Commit 14eb383d042babc81457ab7d3e3e2cb5d3ba168c

Authored by 娄高锋
2 parents 8b0a04de 29e2a138

Merge branch 'pudong' of 192.168.168.201:panzhaov5/bsth_control into pudong

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,6 +2,8 @@ package com.bsth.controller;
2 2
3 import java.util.Map; 3 import java.util.Map;
4 4
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
5 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.web.bind.annotation.RequestMapping; 8 import org.springframework.web.bind.annotation.RequestMapping;
7 import org.springframework.web.bind.annotation.RequestMethod; 9 import org.springframework.web.bind.annotation.RequestMethod;
@@ -34,6 +36,9 @@ public class StationController extends BaseController<Station, Integer> { @@ -34,6 +36,9 @@ public class StationController extends BaseController<Station, Integer> {
34 36
35 @Autowired 37 @Autowired
36 private StationService service; 38 private StationService service;
  39 +
  40 + /** 日志记录器 */
  41 + private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class);
37 42
38 /** 43 /**
39 * @Description :TODO(根据坐标点匹配数据库中的站点) 44 * @Description :TODO(根据坐标点匹配数据库中的站点)
@@ -153,10 +158,13 @@ public class StationController extends BaseController<Station, Integer> { @@ -153,10 +158,13 @@ public class StationController extends BaseController<Station, Integer> {
153 */ 158 */
154 @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) 159 @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET)
155 public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { 160 public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) {
  161 + System.out.println(stationCount+" _ "+ sectionCount );
156 for(int i = 0; i < stationCount; i++) { 162 for(int i = 0; i < stationCount; i++) {
  163 + System.out.println(stationCount);
157 GetUIDAndCode.getStationId(); 164 GetUIDAndCode.getStationId();
158 } 165 }
159 for(int i = 0; i < sectionCount; i++) { 166 for(int i = 0; i < sectionCount; i++) {
  167 + System.out.println(sectionCount);
160 GetUIDAndCode.getSectionId(); 168 GetUIDAndCode.getSectionId();
161 } 169 }
162 return 1; 170 return 1;
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
@@ -58,4 +58,25 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; { @@ -58,4 +58,25 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
58 58
59 return rtn; 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,11 +945,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
945 */ 945 */
946 @Override 946 @Override
947 public String setSKB(String ids) { 947 public String setSKB(String ids) {
948 - String result = "failure"; 948 + String result = "上传失败,";
949 StringBuffer sBuffer = new StringBuffer(); 949 StringBuffer sBuffer = new StringBuffer();
950 DecimalFormat df = new DecimalFormat("######0.000"); 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 try { 953 try {
954 String[] idArray = ids.split(","); 954 String[] idArray = ids.split(",");
955 StringBuffer sBufferA ,sBufferB ,sBufferC ; 955 StringBuffer sBufferA ,sBufferB ,sBufferC ;
@@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{
965 sBuffer.append("<SKBs>"); 965 sBuffer.append("<SKBs>");
966 HashMap<String,String> paramMap; 966 HashMap<String,String> paramMap;
967 HashMap<String,String> otherMap = new HashMap<>(); 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 for (int i = 0; i < idArray.length; i++) { 975 for (int i = 0; i < idArray.length; i++) {
969 - long ttinfoId = Long.valueOf(idArray[i]); 976 + ttinfoId = Long.valueOf(idArray[i]);
970 ttInfo = ttInfoRepository.findOne(ttinfoId); 977 ttInfo = ttInfoRepository.findOne(ttinfoId);
971 if(ttInfo == null) 978 if(ttInfo == null)
972 continue; 979 continue;
973 ttinfoList.add(ttInfo); // 保存时刻表 980 ttinfoList.add(ttInfo); // 保存时刻表
974 // 得到时刻表版本号 981 // 得到时刻表版本号
975 - int lineVersion = ttInfo.getLineVersion(); 982 + lineVersion = ttInfo.getLineVersion();
976 // 查询历史站点路由 983 // 查询历史站点路由
977 lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); 984 lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion);
978 // 查询历史站点路由 985 // 查询历史站点路由
@@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{
988 param = new HashMap(); 995 param = new HashMap();
989 param.put("line.id_eq", ttInfo.getXl().getId()); 996 param.put("line.id_eq", ttInfo.getXl().getId());
990 lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); 997 lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param));
  998 + // 初始化
  999 + isLogStation = true;
991 if(ttInfoDetailIterator.hasNext()){ 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 sBuffer.append("<SKB>"); 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 sBufferB = new StringBuffer(); 1021 sBufferB = new StringBuffer();
996 sBufferC = new StringBuffer(); 1022 sBufferC = new StringBuffer();
997 sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); 1023 sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>");
998 // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 1024 // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表
999 sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); 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 sBufferB.append("<TBYY>").append("").append("</TBYY>"); 1027 sBufferB.append("<TBYY>").append("").append("</TBYY>");
1002 sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); 1028 sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
1003 sBufferB.append("<BCList>"); 1029 sBufferB.append("<BCList>");
@@ -1021,22 +1047,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1021,22 +1047,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1021 if(changeTimeFormat(ttInfoDetail) == null){ 1047 if(changeTimeFormat(ttInfoDetail) == null){
1022 continue; 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 sBufferC.append("<BC>"); 1056 sBufferC.append("<BC>");
1025 sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); 1057 sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>");
1026 sBufferC.append("<SXX>").append(sxx).append("</SXX>"); 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 otherMap.put("stationMark","B"); 1061 otherMap.put("stationMark","B");
1031 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 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 sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); 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 otherMap.put("stationMark","E"); 1082 otherMap.put("stationMark","E");
1038 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 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 sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); 1095 sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
1041 sBufferC.append("</BC>"); 1096 sBufferC.append("</BC>");
1042 // 0:上行;1:下行 1097 // 0:上行;1:下行
@@ -1055,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1055,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1055 sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); 1110 sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>");
1056 sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); 1111 sBuffer.append(sBufferA).append(sBufferB).append(sBufferC);
1057 } 1112 }
  1113 + logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber);
1058 } 1114 }
1059 sBuffer.append("</SKBs>"); 1115 sBuffer.append("</SKBs>");
1060 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 1116 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
1061 - result = "success"; 1117 + result = "上传成功";
1062 SKBUploadLogger skbUploadLogger ; 1118 SKBUploadLogger skbUploadLogger ;
1063 SysUser user = SecurityUtils.getCurrentUser(); 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,5 +8,6 @@ import com.bsth.service.schedule.exception.ScheduleException;
8 */ 8 */
9 public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { 9 public interface CarConfigInfoService extends BService<CarConfigInfo, Long> {
10 void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException; 10 void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException;
  11 + void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException;
11 void toggleCancel(Long id) throws ScheduleException; 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&lt;CarConfigInfo, Long&gt; @@ -73,6 +73,17 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
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 @Transactional 87 @Transactional
77 @Override 88 @Override
78 public void delete(Long aLong) throws ScheduleException { 89 public void delete(Long aLong) throws ScheduleException {
src/main/resources/static/index.html
@@ -630,7 +630,8 @@ @@ -630,7 +630,8 @@
630 <script 630 <script
631 src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda" 631 src="http://webapi.amap.com/maps?v=1.3&key=16cb1c5043847e09ef9edafdd77befda"
632 data-exclude=1></script> 632 data-exclude=1></script>
633 - 633 +<!-- echarts4 误删 -->
  634 +<script src="/metronic_v4.5.4/plugins/echarts4/echarts.min.js"></script>
634 <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script> 635 <script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" merge="plugins"></script>
635 636
636 </body> 637 </body>