Commit 14eb383d042babc81457ab7d3e3e2cb5d3ba168c
Merge branch 'pudong' of 192.168.168.201:panzhaov5/bsth_control into pudong
Showing
6 changed files
with
115 additions
and
17 deletions
Too many changes to show.
To preserve performance only 6 of 40 files are displayed.
src/main/java/com/bsth/controller/StationController.java
| ... | ... | @@ -2,6 +2,8 @@ package com.bsth.controller; |
| 2 | 2 | |
| 3 | 3 | import java.util.Map; |
| 4 | 4 | |
| 5 | +import org.slf4j.Logger; | |
| 6 | +import org.slf4j.LoggerFactory; | |
| 5 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
| ... | ... | @@ -34,6 +36,9 @@ public class StationController extends BaseController<Station, Integer> { |
| 34 | 36 | |
| 35 | 37 | @Autowired |
| 36 | 38 | private StationService service; |
| 39 | + | |
| 40 | + /** 日志记录器 */ | |
| 41 | + private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class); | |
| 37 | 42 | |
| 38 | 43 | /** |
| 39 | 44 | * @Description :TODO(根据坐标点匹配数据库中的站点) |
| ... | ... | @@ -153,10 +158,13 @@ public class StationController extends BaseController<Station, Integer> { |
| 153 | 158 | */ |
| 154 | 159 | @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) |
| 155 | 160 | public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { |
| 161 | + System.out.println(stationCount+" _ "+ sectionCount ); | |
| 156 | 162 | for(int i = 0; i < stationCount; i++) { |
| 163 | + System.out.println(stationCount); | |
| 157 | 164 | GetUIDAndCode.getStationId(); |
| 158 | 165 | } |
| 159 | 166 | for(int i = 0; i < sectionCount; i++) { |
| 167 | + System.out.println(sectionCount); | |
| 160 | 168 | GetUIDAndCode.getSectionId(); |
| 161 | 169 | } |
| 162 | 170 | return 1; | ... | ... |
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
| ... | ... | @@ -58,4 +58,25 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { |
| 58 | 58 | |
| 59 | 59 | return rtn; |
| 60 | 60 | } |
| 61 | + | |
| 62 | + @RequestMapping(value = "/validate_cars_config", method = RequestMethod.GET) | |
| 63 | + public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) { | |
| 64 | + Map<String, Object> rtn = new HashMap<>(); | |
| 65 | + try { | |
| 66 | + // 车辆重复配置验证 | |
| 67 | + CarConfigInfo carConfigInfo = new CarConfigInfo( | |
| 68 | + null, | |
| 69 | + param.get("xl.id_eq"), | |
| 70 | + param.get("xl.name_eq"), | |
| 71 | + param.get("cl.id_eq") | |
| 72 | + ); | |
| 73 | + carConfigInfoService.validate_cars_config(carConfigInfo); | |
| 74 | + rtn.put("status", ResponseCode.SUCCESS); | |
| 75 | + } catch (ScheduleException exp) { | |
| 76 | + rtn.put("status", ResponseCode.ERROR); | |
| 77 | + rtn.put("msg", exp.getMessage()); | |
| 78 | + } | |
| 79 | + | |
| 80 | + return rtn; | |
| 81 | + } | |
| 61 | 82 | } | ... | ... |
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
| ... | ... | @@ -945,11 +945,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 945 | 945 | */ |
| 946 | 946 | @Override |
| 947 | 947 | public String setSKB(String ids) { |
| 948 | - String result = "failure"; | |
| 948 | + String result = "上传失败,"; | |
| 949 | 949 | StringBuffer sBuffer = new StringBuffer(); |
| 950 | 950 | DecimalFormat df = new DecimalFormat("######0.000"); |
| 951 | - Map<String,String> lsStationCode2NameMap; | |
| 952 | - Map<String, Integer> lsStationName2YgcNumber; | |
| 951 | + Map<String,String> lsStationCode2NameMap = null; | |
| 952 | + Map<String, Integer> lsStationName2YgcNumber = null; | |
| 953 | 953 | try { |
| 954 | 954 | String[] idArray = ids.split(","); |
| 955 | 955 | StringBuffer sBufferA ,sBufferB ,sBufferC ; |
| ... | ... | @@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 965 | 965 | sBuffer.append("<SKBs>"); |
| 966 | 966 | HashMap<String,String> paramMap; |
| 967 | 967 | HashMap<String,String> otherMap = new HashMap<>(); |
| 968 | + // 线路编码、周几执行、发车站点名称、发车站点序号、到达站点名称、到达站点序号 | |
| 969 | + String xlbm,zjzx,fczdmc,zdxh,ddzdmc,ddxh; | |
| 970 | + // 得到时刻表版本号 | |
| 971 | + int lineVersion; | |
| 972 | + long ttinfoId; | |
| 973 | + // 是否输出站点信息 | |
| 974 | + boolean isLogStation; | |
| 968 | 975 | for (int i = 0; i < idArray.length; i++) { |
| 969 | - long ttinfoId = Long.valueOf(idArray[i]); | |
| 976 | + ttinfoId = Long.valueOf(idArray[i]); | |
| 970 | 977 | ttInfo = ttInfoRepository.findOne(ttinfoId); |
| 971 | 978 | if(ttInfo == null) |
| 972 | 979 | continue; |
| 973 | 980 | ttinfoList.add(ttInfo); // 保存时刻表 |
| 974 | 981 | // 得到时刻表版本号 |
| 975 | - int lineVersion = ttInfo.getLineVersion(); | |
| 982 | + lineVersion = ttInfo.getLineVersion(); | |
| 976 | 983 | // 查询历史站点路由 |
| 977 | 984 | lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); |
| 978 | 985 | // 查询历史站点路由 |
| ... | ... | @@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 988 | 995 | param = new HashMap(); |
| 989 | 996 | param.put("line.id_eq", ttInfo.getXl().getId()); |
| 990 | 997 | lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); |
| 998 | + // 初始化 | |
| 999 | + isLogStation = true; | |
| 991 | 1000 | if(ttInfoDetailIterator.hasNext()){ |
| 1001 | + // 得到线路信息 | |
| 1002 | + Line line = lineRepository.findOne(ttInfo.getXl().getId()); | |
| 1003 | + if(line == null){ | |
| 1004 | + result += "未找到相应的线路信息,请设置线路信息后再上传"; | |
| 1005 | + return result; | |
| 1006 | + } | |
| 1007 | + // 得到上海市线路编码 | |
| 1008 | + xlbm = line.getShanghaiLinecode(); | |
| 1009 | + if("".equals(xlbm) || "null".equals(xlbm)){ | |
| 1010 | + result += "线路编码为空,请设置线路编码后再上传"; | |
| 1011 | + return result; | |
| 1012 | + } | |
| 1013 | + // 拿到周几执行 | |
| 1014 | + zjzx = changeRuleDay(ttInfo.getRule_days()); | |
| 1015 | + if("".equals(zjzx) || "null".equals(zjzx)){ | |
| 1016 | + result += "时刻表执行时间为空,请设置执行时间后再上传"; | |
| 1017 | + return result; | |
| 1018 | + } | |
| 992 | 1019 | sBuffer.append("<SKB>"); |
| 993 | - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId())) | |
| 994 | - .append("</XLBM>"); | |
| 1020 | + sBuffer.append("<XLBM>").append(xlbm).append("</XLBM>"); | |
| 995 | 1021 | sBufferB = new StringBuffer(); |
| 996 | 1022 | sBufferC = new StringBuffer(); |
| 997 | 1023 | sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); |
| 998 | 1024 | // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 |
| 999 | 1025 | sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); |
| 1000 | - sBufferB.append("<ZJZX>").append(changeRuleDay(ttInfo.getRule_days())).append("</ZJZX>"); | |
| 1026 | + sBufferB.append("<ZJZX>").append(zjzx).append("</ZJZX>"); | |
| 1001 | 1027 | sBufferB.append("<TBYY>").append("").append("</TBYY>"); |
| 1002 | 1028 | sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); |
| 1003 | 1029 | sBufferB.append("<BCList>"); |
| ... | ... | @@ -1021,22 +1047,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1021 | 1047 | if(changeTimeFormat(ttInfoDetail) == null){ |
| 1022 | 1048 | continue; |
| 1023 | 1049 | } |
| 1050 | + // 发生站点名称 | |
| 1051 | + fczdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getQdzCode()); | |
| 1052 | + if("".equals(fczdmc) || "null".equals(fczdmc)){ | |
| 1053 | + result += "发车站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | |
| 1054 | + return result; | |
| 1055 | + } | |
| 1024 | 1056 | sBufferC.append("<BC>"); |
| 1025 | 1057 | sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); |
| 1026 | 1058 | sBufferC.append("<SXX>").append(sxx).append("</SXX>"); |
| 1027 | - sBufferC.append("<FCZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | |
| 1028 | - +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>"); | |
| 1059 | + sBufferC.append("<FCZDMC>").append(fczdmc).append("</FCZDMC>"); | |
| 1029 | 1060 | // 起点站的参数 |
| 1030 | 1061 | otherMap.put("stationMark","B"); |
| 1031 | 1062 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 1032 | - sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</ZDXH>"); | |
| 1063 | + if(isLogStation){// 输出起点站信息 | |
| 1064 | + logger.info("setSKB:"+"起点站信息:"+paramMap); | |
| 1065 | + } | |
| 1066 | + // 发车站点序号 | |
| 1067 | + zdxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)); | |
| 1068 | + if("".equals(zdxh) || "null".equals(zdxh) || "0".equals(zdxh)){ | |
| 1069 | + result += "发车站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | |
| 1070 | + return result; | |
| 1071 | + } | |
| 1072 | + // 到达站点名称 | |
| 1073 | + ddzdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getZdzCode()); | |
| 1074 | + if("".equals(ddzdmc) || "null".equals(ddzdmc)){ | |
| 1075 | + result += "到达站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | |
| 1076 | + return result; | |
| 1077 | + } | |
| 1078 | + sBufferC.append("<ZDXH>").append(zdxh).append("</ZDXH>"); | |
| 1033 | 1079 | sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); |
| 1034 | - sBufferC.append("<DDZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir() | |
| 1035 | - +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>"); | |
| 1036 | - // 起点站的参数 | |
| 1080 | + sBufferC.append("<DDZDMC>").append(ddzdmc).append("</DDZDMC>"); | |
| 1081 | + // 终点站的参数 | |
| 1037 | 1082 | otherMap.put("stationMark","E"); |
| 1038 | 1083 | paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); |
| 1039 | - sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</DDXH>"); | |
| 1084 | + if(isLogStation){// 输出终点站信息 | |
| 1085 | + logger.info("setSKB:"+"终点站信息:"+paramMap); | |
| 1086 | + } | |
| 1087 | + // 到达站点序号 | |
| 1088 | + ddxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)); | |
| 1089 | + if("".equals(ddxh) || "null".equals(ddxh) || "0".equals(ddxh)){ | |
| 1090 | + result += "到达站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传"; | |
| 1091 | + return result; | |
| 1092 | + } | |
| 1093 | + isLogStation = false; // 一条线路只输出一次,后面的不输出了 | |
| 1094 | + sBufferC.append("<DDXH>").append(ddxh).append("</DDXH>"); | |
| 1040 | 1095 | sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 1041 | 1096 | sBufferC.append("</BC>"); |
| 1042 | 1097 | // 0:上行;1:下行 |
| ... | ... | @@ -1055,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1055 | 1110 | sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); |
| 1056 | 1111 | sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); |
| 1057 | 1112 | } |
| 1113 | + logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber); | |
| 1058 | 1114 | } |
| 1059 | 1115 | sBuffer.append("</SKBs>"); |
| 1060 | 1116 | if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ |
| 1061 | - result = "success"; | |
| 1117 | + result = "上传成功"; | |
| 1062 | 1118 | SKBUploadLogger skbUploadLogger ; |
| 1063 | 1119 | SysUser user = SecurityUtils.getCurrentUser(); |
| 1064 | 1120 | // 保存时刻表上传记录 | ... | ... |
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
| ... | ... | @@ -8,5 +8,6 @@ import com.bsth.service.schedule.exception.ScheduleException; |
| 8 | 8 | */ |
| 9 | 9 | public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { |
| 10 | 10 | void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException; |
| 11 | + void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException; | |
| 11 | 12 | void toggleCancel(Long id) throws ScheduleException; |
| 12 | 13 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
| ... | ... | @@ -73,6 +73,17 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> |
| 73 | 73 | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + @Override | |
| 77 | + public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException { | |
| 78 | + Map<String, Object> param = new HashMap<>(); | |
| 79 | + param.put("xl.id_eq", carConfigInfo.getXl().getId()); | |
| 80 | + param.put("cl.id_eq", carConfigInfo.getCl().getId()); | |
| 81 | + List<CarConfigInfo> carConfigInfos = list(param); | |
| 82 | + if (CollectionUtils.isEmpty(carConfigInfos)) { | |
| 83 | + throw new ScheduleException("当前车辆没有配置在当前线路中,不属于当前线路!"); | |
| 84 | + } | |
| 85 | + } | |
| 86 | + | |
| 76 | 87 | @Transactional |
| 77 | 88 | @Override |
| 78 | 89 | public void delete(Long aLong) throws ScheduleException { | ... | ... |
src/main/resources/static/index.html
| ... | ... | @@ -630,7 +630,8 @@ |
| 630 | 630 | <script |
| 631 | 631 | src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" |
| 632 | 632 | data-exclude=1></script> |
| 633 | - | |
| 633 | +<!-- echarts4 误删 --> | |
| 634 | +<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script> | |
| 634 | 635 | <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> |
| 635 | 636 | |
| 636 | 637 | </body> | ... | ... |