Commit 033b3d9365bd68903fbd74a666dbd3acb912440e

Authored by 周勤
1 parent 34d5e365

增加运管处上传日志的保存和查看功能(时刻表上传、线路上传、路单上传)

src/main/java/com/bsth/entity/search/PredicatesBuilder.java
... ... @@ -9,6 +9,7 @@ import java.text.NumberFormat;
9 9 import java.text.ParseException;
10 10 import java.text.SimpleDateFormat;
11 11 import java.util.ArrayList;
  12 +import java.util.Calendar;
12 13 import java.util.Date;
13 14 import java.util.List;
14 15  
... ... @@ -37,7 +38,13 @@ public class PredicatesBuilder {
37 38 if(Date.class.isAssignableFrom(leftType) &&
38 39 String.class.isAssignableFrom(rightType)){
39 40 DateTime dateTime = new DateTime(object);
40   - return cb.equal(expression, dateTime.toDate());
  41 + Date startTime = dateTime.toDate();//设置起始时间
  42 + Calendar c = Calendar.getInstance();
  43 + c.setTime(startTime);
  44 + c.add(Calendar.DAY_OF_MONTH, 1);
  45 + // 设置结束时间,起始时间为结束时间加1天
  46 + Date endTime = c.getTime();
  47 + return cb.between((Path<Date>) expression,startTime,endTime);
41 48 }
42 49 else {
43 50 return cb.equal(expression, object);
... ...
src/main/java/com/bsth/entity/traffic/SKBUploadLogger.java
1 1 package com.bsth.entity.traffic;
2 2  
3   -import com.bsth.entity.schedule.TTInfo;
  3 +import com.bsth.entity.Line;
4 4 import com.bsth.entity.sys.SysUser;
5 5 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6 6  
... ... @@ -33,7 +33,7 @@ public class SKBUploadLogger {
33 33  
34 34 /** 时刻表信息 */
35 35 @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
36   - private TTInfo ttInfo;
  36 + private Line line;
37 37  
38 38 /** 用户 关联 */
39 39 @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
... ... @@ -43,6 +43,23 @@ public class SKBUploadLogger {
43 43 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
44 44 private Date createDate;
45 45  
  46 + // 上传的参数
  47 + @Column( name = "upload_xml" , columnDefinition="TEXT")
  48 + private String uploadXml;
  49 +
  50 + // 上传的参数2
  51 + @Column( name = "upload_xml_sub" , columnDefinition="TEXT")
  52 + private String uploadXmlSub;
  53 +
  54 + // 日志类型 1:时刻表;2:上传线路;3:上传路单
  55 + private String type;
  56 +
  57 + // 模板名称
  58 + private String name;
  59 +
  60 + // 上传状态:是否成功 1:成功;0:失败
  61 + private String state;
  62 +
46 63 public Integer getId() {
47 64 return id;
48 65 }
... ... @@ -51,14 +68,6 @@ public class SKBUploadLogger {
51 68 this.id = id;
52 69 }
53 70  
54   - public TTInfo getTtInfo() {
55   - return ttInfo;
56   - }
57   -
58   - public void setTtInfo(TTInfo ttInfo) {
59   - this.ttInfo = ttInfo;
60   - }
61   -
62 71 public SysUser getUser() {
63 72 return user;
64 73 }
... ... @@ -71,7 +80,29 @@ public class SKBUploadLogger {
71 80 return createDate;
72 81 }
73 82  
74   - public void setCreateDate(Date createDate) {
75   - this.createDate = createDate;
76   - }
  83 + public void setCreateDate(Date createDate) { this.createDate = createDate; }
  84 +
  85 + public String getUploadXml() { return uploadXml; }
  86 +
  87 + public void setUploadXml(String uploadXml) { this.uploadXml = uploadXml; }
  88 +
  89 + public String getState() { return state; }
  90 +
  91 + public void setState(String state) { this.state = state; }
  92 +
  93 + public Line getLine() { return line;}
  94 +
  95 + public void setLine(Line line) { this.line = line; }
  96 +
  97 + public String getType() { return type; }
  98 +
  99 + public void setType(String type) { this.type = type; }
  100 +
  101 + public String getName() { return name; }
  102 +
  103 + public void setName(String name) { this.name = name; }
  104 +
  105 + public String getUploadXmlSub() {return uploadXmlSub;}
  106 +
  107 + public void setUploadXmlSub(String uploadXmlSub) {this.uploadXmlSub = uploadXmlSub; }
77 108 }
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
32 32 import org.springframework.beans.factory.annotation.Autowired;
33 33 import org.springframework.data.domain.Sort;
34 34 import org.springframework.data.domain.Sort.Direction;
  35 +import org.springframework.security.core.context.SecurityContextHolder;
35 36 import org.springframework.stereotype.Service;
36 37  
37 38 import java.io.*;
... ... @@ -65,6 +66,10 @@ import java.util.regex.Pattern;
65 66 public class TrafficManageServiceImpl implements TrafficManageService{
66 67  
67 68 Logger logger = LoggerFactory.getLogger(this.getClass());
  69 + // 运管处上传日志类型
  70 + public static final String UPLOAD_TYPE_SKB = "1";
  71 + public static final String UPLOAD_TYPE_XL = "2";
  72 + public static final String UPLOAD_TYPE_LD = "3";
68 73  
69 74 // 线路repository
70 75 @Autowired
... ... @@ -170,7 +175,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
170 175 @Override
171 176 public String setXL(String ids) {
172 177 String result = "failure";
173   - StringBuffer sBuffer = new StringBuffer();
  178 + String xml ;
174 179 String[] idArray = ids.split(",");
175 180 try {
176 181 for (String id : idArray) {
... ... @@ -185,12 +190,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
185 190 if(line == null){
186 191 continue;
187 192 }
188   - List<StationRoute> upStationsList ;// 上行站点路由集
189   - List<StationRoute> downStationsList;// 下行站点路由集
190   - List<Object[]> downPointList;// 下行站点集
191   - List<Object[]> upPointList;// 上行站点集
192   - sBuffer.append("<XLs>");
193   - sBuffer.append("<XL>");
194 193 if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){
195 194 return result;
196 195 }
... ... @@ -200,56 +199,25 @@ public class TrafficManageServiceImpl implements TrafficManageService{
200 199 if(lineInformation == null){
201 200 continue;
202 201 }
203   - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>");
204   - sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>");
205   - sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>");
206   - sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>");
207   - sBuffer.append("<QZLC>").append(lineInformation.getUpMileage()).append("</QZLC>");
208   - sBuffer.append("<ZQLC>").append(lineInformation.getDownMileage()).append("</ZQLC>");
209   - sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>");
210   - sBuffer.append("<UPDATE_DATE>").append(sdfnyr.format(new Date())).append("</UPDATE_DATE>");
211   -
212   - // 循环添加站点信息
213   - sBuffer.append("<StationList>");
214   -
215   - // 先查上行
216   - upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0);
217   - Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode());
218   - int startId = 1;
219   - startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap);
220   - // 环线不查下行
221   - if(line.getLinePlayType() != 1){
222   - // 再查下行
223   - downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1);
224   - packagStationXml(downStationsList, sBuffer, startId,stationNumMap);
225   - }
226   - sBuffer.append("</StationList>");
227   -
228   - // 循环添加站点点位信息
229   - sBuffer.append("<LinePointList>");
230   - upPointList = sectionRepository.getSectionDirByLineId(line.getId(),0);
231   - startId = 1;
232   - startId = packagStationPointXml(upPointList, sBuffer, startId);
233   - // 环线不查下行
234   - if(line.getLinePlayType() != 1){
235   - downPointList = sectionRepository.getSectionDirByLineId(line.getId(),1);
236   - packagStationPointXml(downPointList, sBuffer, startId);
237   - }
238   - sBuffer.append("</LinePointList>");
239   - sBuffer.append("</XL>");
240   - sBuffer.append("</XLs>");
241   - // 临时添加,后面删除
242   - if(sBuffer.indexOf("<ZDXH>0</ZDXH>") != -1){
  202 + // 取得封装好的xml
  203 + xml = getSetXlXml(line,lineInformation);
  204 + // 站点序号不能为0,如果为0,则返回错误
  205 + if(xml.indexOf("<ZDXH>0</ZDXH>") != -1){
243 206 return "0";
244 207 }
  208 + String state;// 是否上传成功
245 209 // 调用上传方法
246   - if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){
  210 + if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,xml).isSuccess()){
247 211 result = "success";
  212 + state = "1";
248 213 }else{
249 214 result = "failure";
  215 + state = "0";
250 216 }
251   - logger.info("setXL:"+sBuffer.toString());
  217 + logger.info("setXL:"+xml);
252 218 logger.info("setXL:"+result);
  219 + // 保存运管处上传记录
  220 + saveYgcUploadLog(line,xml,TrafficManageServiceImpl.UPLOAD_TYPE_XL,state);
253 221 }
254 222 } catch (Exception e) {
255 223 logger.error("setXL:",e);
... ... @@ -422,10 +390,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
422 390 HashMap logXlbmMap = new HashMap();
423 391 Results results = null;
424 392 String str = "",xlbm;
  393 + // 保存线路(运管处日志用)
  394 + Map<String , Line> logLineMap = null;
425 395 try {
426 396 int counter = 0; // 计数器
427 397 int per = 10; // 每几条线路上传一次路单
428   -
429 398 List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date);
430 399 List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLDGroup(date);
431 400 Map<String,Object> map = new HashMap();
... ... @@ -444,6 +413,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
444 413 if(counter % per == 0){
445 414 sf = new StringBuffer();
446 415 sf.append("<DLDS>");
  416 + logLineMap = new HashMap<>();
447 417 }
448 418 counter ++;
449 419 xlbm = BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm")+"");
... ... @@ -451,6 +421,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
451 421 if(logXlbmMap.get(xlbm) == null){
452 422 logXlbmMap.put(xlbm,xlbm);
453 423 }
  424 + logLineMap.put(line.getLineCode(),line);
454 425 sf.append("<DLD>");
455 426 sf.append("<RQ>"+date+"</RQ>");
456 427 sf.append("<XLBM>"+xlbm+"</XLBM>");
... ... @@ -513,7 +484,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
513 484 str = sf.toString().replace("'","");// 去掉'号
514 485 results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str));
515 486 // 记录日志
516   - result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str);
  487 + result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str,logLineMap);
517 488 }
518 489 }
519 490 // 每per条线路上传后剩下的数据再上传
... ... @@ -521,9 +492,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
521 492 sf.append("</DLDS>");
522 493 str = sf.toString().replace("'","");// 去掉'号
523 494 results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str));
  495 + // 记录日志
  496 + result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str,logLineMap);
524 497 }
525   - // 记录日志
526   - result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str);
527 498 } catch (Exception e) {
528 499 logger.error("setLD:",e);
529 500 logFailure.append(e).append("<br/>");
... ... @@ -558,21 +529,26 @@ public class TrafficManageServiceImpl implements TrafficManageService{
558 529 * @param str
559 530 */
560 531 private String logRecord(Results results,HashMap logXlbmMap,HashMap logXlbmSuccessMap,HashMap logXlbmFailureMap,StringBuffer logSuccess,
561   - StringBuffer logFailure,String str){
  532 + StringBuffer logFailure,String str,Map<String ,Line> logLineMap){
562 533 String result = "failure";
  534 + String state;
563 535 // 记录日志
564 536 if(results != null){
565 537 if(results.isSuccess()){// 上传成功
566 538 // 把上线成功的线路编码放入 logXlbmSuccessMap,并记录logSuccess
567 539 countSuccess += fillMailXlbmMap(logXlbmMap,logXlbmSuccessMap,logSuccess);
568 540 result = "success";
  541 + state = "1";
569 542 }else{// 上传失败
570 543 // 把上线失败的线路编码放入 logXlbmFailureMap,并记录logFailure
571 544 countFailure += fillMailXlbmMap(logXlbmMap,logXlbmFailureMap,logFailure);
572 545 result = "failure";
  546 + state = "0";
573 547 }
574 548 logger.info("setLD:"+str);
575 549 logger.info("setLD:"+result);
  550 + // 保存运管处上传记录
  551 + saveYgcUploadLog(logLineMap,str,TrafficManageServiceImpl.UPLOAD_TYPE_LD,state);
576 552 results = null;
577 553 logXlbmMap = new HashMap();
578 554 }
... ... @@ -946,7 +922,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
946 922 @Override
947 923 public String setSKB(String ids) {
948 924 String result = "上传失败,";
949   - StringBuffer sBuffer = new StringBuffer();
  925 + StringBuffer sBuffer = new StringBuffer("<SKBs>");
950 926 DecimalFormat df = new DecimalFormat("######0.000");
951 927 Map<String,String> lsStationCode2NameMap = null;
952 928 Map<String, Integer> lsStationName2YgcNumber = null;
... ... @@ -962,7 +938,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
962 938 LineInformation lineInformation;
963 939 Iterator<TTInfoDetail> ttInfoDetailIterator;
964 940 HashMap<String,Object> param ;
965   - sBuffer.append("<SKBs>");
966 941 HashMap<String,String> paramMap;
967 942 HashMap<String,String> otherMap = new HashMap<>();
968 943 // 线路编码、周几执行、发车站点名称、发车站点序号、到达站点名称、到达站点序号
... ... @@ -1113,29 +1088,103 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1113 1088 logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber);
1114 1089 }
1115 1090 sBuffer.append("</SKBs>");
1116   - if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
1117   - result = "上传成功";
1118   - SKBUploadLogger skbUploadLogger ;
1119   - SysUser user = SecurityUtils.getCurrentUser();
1120   - // 保存时刻表上传记录
1121   - for(TTInfo ttInfo1 : ttinfoList){
1122   - skbUploadLogger = new SKBUploadLogger();
1123   - skbUploadLogger.setTtInfo(ttInfo1);
1124   - skbUploadLogger.setUser(user);
1125   - skbUploadLoggerRepository.save(skbUploadLogger);
1126   - }
1127   - }
  1091 + String state;// 是否上传成功
  1092 + if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
  1093 + result = "上传成功";
  1094 + state = "1";
  1095 + }else{// 上传失败
  1096 + result = "上传失败";
  1097 + state = "0";
  1098 + }
  1099 + // 保存运管处上传记录
  1100 + saveYgcUploadLog(ttinfoList,sBuffer.toString(),TrafficManageServiceImpl.UPLOAD_TYPE_SKB,state);
1128 1101 } catch (Exception e) {
1129 1102 logger.error("setSKB:", e);
1130 1103 e.printStackTrace();
1131 1104 }finally{
1132   - logger.info("setSKB:"+sBuffer.toString());
1133   - logger.info("setSKB:"+result);
  1105 + logger.info("setSKB:"+sBuffer.toString());
  1106 + logger.info("setSKB:"+result);
1134 1107 }
1135 1108 return result;
1136 1109 }
1137 1110  
1138 1111 /**
  1112 + * 保存上传运管处的日志
  1113 + * @param obj 参数
  1114 + * @param type 日志类型
  1115 + * @param xml 上传参数
  1116 + */
  1117 + private void saveYgcUploadLog(Object obj,String xml,String type,String state){
  1118 + SKBUploadLogger skbUploadLogger = new SKBUploadLogger();
  1119 + SysUser user;
  1120 + // 如果不是人为上传,SysUser则为空,设置上传人员为管理员
  1121 + if(SecurityContextHolder.getContext() == null || SecurityContextHolder.getContext().getAuthentication() == null){
  1122 + user = new SysUser();
  1123 + user.setId(1);
  1124 + }else{// 获取上传人员
  1125 + user = SecurityUtils.getCurrentUser();
  1126 + }
  1127 + // 最大的字符长度
  1128 + int maxLength = 60000;
  1129 + int cutLength = 50000;// 需要截取的字符长度
  1130 + String xml_sub = null;
  1131 + skbUploadLogger.setType(type);// 设置类型
  1132 + // 判断xml是否超长,如果超长,则截取
  1133 + if(xml != null && xml.length() > maxLength){
  1134 + int xmlLength = xml.length();
  1135 + int cutCount = xmlLength / cutLength + (xmlLength % cutLength > 0 ? 1 : 0);
  1136 + if(cutCount > 2){
  1137 + xml = "由于上传参数内容超长,请查看服务器的系统日志";
  1138 + }else if(cutCount == 2){
  1139 + xml_sub =xml.substring(cutLength);
  1140 + xml = xml.substring(0,cutLength);
  1141 + }else{
  1142 + // 不做处理
  1143 + }
  1144 + }
  1145 + skbUploadLogger.setUploadXml(xml);// 上传的参数
  1146 + skbUploadLogger.setUploadXmlSub(xml_sub);
  1147 + skbUploadLogger.setState(state);// 状态:是否成功
  1148 + skbUploadLogger.setUser(user);
  1149 + // 时刻表
  1150 + if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_SKB)){
  1151 + List<TTInfo> ttInfoList = (List<TTInfo>)obj;
  1152 + String name = "";
  1153 + Line line = null;
  1154 + for(TTInfo ttInfo : ttInfoList){
  1155 + name += ttInfo.getName() + " ";
  1156 + line = ttInfo.getXl();
  1157 + }
  1158 + skbUploadLogger.setLine(line);
  1159 + skbUploadLogger.setUser(user);
  1160 + skbUploadLogger.setName(name);
  1161 + skbUploadLoggerRepository.save(skbUploadLogger);
  1162 + }else{
  1163 + if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_XL)){
  1164 + Line line = (Line) obj;
  1165 + String name = line.getName() + "线路停靠站上传";
  1166 + skbUploadLogger.setLine(line);
  1167 + skbUploadLogger.setName(name);
  1168 + skbUploadLoggerRepository.save(skbUploadLogger);
  1169 + }else if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_LD)){
  1170 + Map<String ,Line> logLineMap = (Map<String ,Line> )obj;
  1171 + for (String key : logLineMap.keySet()) {
  1172 + Line line = logLineMap.get(key);
  1173 + String name = line.getName() + "路单上传";
  1174 + skbUploadLogger = new SKBUploadLogger();
  1175 + skbUploadLogger.setType(type);// 设置类型
  1176 + skbUploadLogger.setUploadXml(xml);// 上传的参数
  1177 + skbUploadLogger.setUploadXmlSub(xml_sub);
  1178 + skbUploadLogger.setState(state);// 状态:是否成功
  1179 + skbUploadLogger.setUser(user);
  1180 + skbUploadLogger.setLine(line);
  1181 + skbUploadLogger.setName(name);
  1182 + skbUploadLoggerRepository.save(skbUploadLogger);
  1183 + }
  1184 + }
  1185 + }
  1186 + }
  1187 + /**
1139 1188 * 上传线路人员车辆配置信息
1140 1189 */
1141 1190 @Override
... ... @@ -1640,4 +1689,50 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1640 1689 }
1641 1690 return tempStationName2YgcNumber;
1642 1691 }
  1692 +
  1693 + private String getSetXlXml(Line line,LineInformation lineInformation){
  1694 + StringBuffer sBuffer = new StringBuffer();
  1695 + List<StationRoute> upStationsList ;// 上行站点路由集
  1696 + List<StationRoute> downStationsList;// 下行站点路由集
  1697 + List<Object[]> downPointList;// 下行站点集
  1698 + List<Object[]> upPointList;// 上行站点集
  1699 + sBuffer.append("<XLs>");
  1700 + sBuffer.append("<XL>");
  1701 + sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>");
  1702 + sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>");
  1703 + sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>");
  1704 + sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>");
  1705 + sBuffer.append("<QZLC>").append(lineInformation.getUpMileage()).append("</QZLC>");
  1706 + sBuffer.append("<ZQLC>").append(lineInformation.getDownMileage()).append("</ZQLC>");
  1707 + sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>");
  1708 + sBuffer.append("<UPDATE_DATE>").append(sdfnyr.format(new Date())).append("</UPDATE_DATE>");
  1709 + // 循环添加站点信息
  1710 + sBuffer.append("<StationList>");
  1711 + // 先查上行
  1712 + upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0);
  1713 + Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode());
  1714 + int startId = 1;
  1715 + startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap);
  1716 + // 环线不查下行
  1717 + if(line.getLinePlayType() != 1){
  1718 + // 再查下行
  1719 + downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1);
  1720 + packagStationXml(downStationsList, sBuffer, startId,stationNumMap);
  1721 + }
  1722 + sBuffer.append("</StationList>");
  1723 + // 循环添加站点点位信息
  1724 + sBuffer.append("<LinePointList>");
  1725 + upPointList = sectionRepository.getSectionDirByLineId(line.getId(),0);
  1726 + startId = 1;
  1727 + startId = packagStationPointXml(upPointList, sBuffer, startId);
  1728 + // 环线不查下行
  1729 + if(line.getLinePlayType() != 1){
  1730 + downPointList = sectionRepository.getSectionDirByLineId(line.getId(),1);
  1731 + packagStationPointXml(downPointList, sBuffer, startId);
  1732 + }
  1733 + sBuffer.append("</LinePointList>");
  1734 + sBuffer.append("</XL>");
  1735 + sBuffer.append("</XLs>");
  1736 + return sBuffer.toString();
  1737 + }
1643 1738 }
... ...
src/main/resources/static/pages/trafficManage/js/timeTempletUploadRecord.js
... ... @@ -34,7 +34,7 @@
34 34 $('#companySelect').html(options).on('change', setbrancheCompanySelectOptions);
35 35  
36 36 });
37   -
  37 +
38 38 // 填充分公司下拉框选择值
39 39 function setbrancheCompanySelectOptions(){
40 40  
... ... @@ -197,6 +197,12 @@
197 197 $(".autocompleter").css("width",
198 198 $("#line_name").css("width"));
199 199  
  200 + // 设置上传类型
  201 + var uploadStateOptions = '<option value="1">时刻表上传</option>'
  202 + +'<option value="2">线路停靠站上传</option>'
  203 + +'<option value="3">路单上传</option>';
  204 + $('#uploadType').html(uploadStateOptions).on('change', searchM);
  205 +
200 206 searchM(null, true);
201 207 // 绑定查询事件
202 208 $("#search").click(searchM);
... ... @@ -268,4 +274,12 @@
268 274 }
269 275 });
270 276 }
271   -})();
272 277 \ No newline at end of file
  278 +
  279 + template.helper("cutXml", function(xml) {
  280 + return xml ? xml.substring(0,20) + "..." : "";
  281 + });
  282 +})();
  283 +function showXml(el){
  284 + window.sessionStorage.setItem('upload_ygc_xml',JSON.stringify($(el).val()));
  285 + $.get('show_xml.html', function(m){$(pjaxContainer).append(m);});
  286 +}
273 287 \ No newline at end of file
... ...
src/main/resources/static/pages/trafficManage/timeTempletUploadRecord.html
... ... @@ -10,16 +10,19 @@
10 10 <div class="col-md-12">
11 11 <ul class="breadcrumb">
12 12 <li>筛选数据:</li>
13   - <li><select name="ttInfo.xl.company_eq" class="form-control" id="companySelect"></select></li>
14   - <li><select name="ttInfo.xl.brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select></li>
  13 + <li><select name="line.company_eq" class="form-control" id="companySelect"></select></li>
  14 + <li><select name="line.brancheCompany_eq" class="form-control" id="brancheCompanySelect"></select></li>
15 15 <li>日期:</li>
16   - <li><input type="text" class="inputCommon dateTime" name="createDate_date_eq" id="dateInput" placeholder="日期"></li>
  16 + <li><input type="text" class="inputCommon dateTime" name="createDate_eq" id="dateInput" placeholder="日期">
  17 + </li>
17 18 <li>线路名称:</li>
18 19 <li><input type="text" class="form-control form-filter input-sm"
19   - name="ttInfo.xl.name_eq" id="line_name" maxlength="40" /></li>
  20 + name="line.name_eq" id="line_name" maxlength="40" /></li>
20 21 <li>上传用户:</li>
21 22 <li><input type="text" class="inputCommon inputCarPlate"
22 23 name="user.name_like" maxlength="40" /></li>
  24 + <li>上传类型:</li>
  25 + <li><select name="type_eq" class="form-control" id="uploadType"></select></li>
23 26 <li><a class="btn btn-circle blue" id="search">筛选</a></li>
24 27 </ul>
25 28 </div>
... ... @@ -37,6 +40,9 @@
37 40 <th>线路</th>
38 41 <th>模板名称</th>
39 42 <th>上传人员</th>
  43 + <th>上传参数</th>
  44 + <th>上传类型</th>
  45 + <th>是否成功</th>
40 46 <th>上传时间</th>
41 47 </tr>
42 48 </thead>
... ... @@ -57,90 +63,121 @@
57 63 {{i+1}}
58 64 </td>
59 65 <td>
60   - {{if obj.ttInfo.xl.company == '55'}}
  66 + {{if obj.line.company == '55'}}
61 67 上南公司
62   - {{else if obj.ttInfo.xl.company == '22'}}
  68 + {{else if obj.line.company == '22'}}
63 69 金高公司
64   - {{else if obj.ttInfo.xl.company == '05'}}
  70 + {{else if obj.line.company == '05'}}
65 71 杨高公司
66   - {{else if obj.ttInfo.xl.company == '26'}}
  72 + {{else if obj.line.company == '26'}}
67 73 南汇公司
68   - {{else if obj.ttInfo.xl.company == '77'}}
  74 + {{else if obj.line.company == '77'}}
69 75 闵行公司
70 76 {{/if}}
71 77 </td>
72 78 <td>
73   - {{if obj.ttInfo.xl.company == '55'}}
  79 + {{if obj.line.company == '55'}}
74 80  
75   - {{if obj.ttInfo.xl.brancheCompany == '1'}}
  81 + {{if obj.line.brancheCompany == '1'}}
76 82 上南二分公司
77   - {{else if obj.ttInfo.xl.brancheCompany == '2'}}
  83 + {{else if obj.line.brancheCompany == '2'}}
78 84 上南三分公司
79   - {{else if obj.ttInfo.xl.brancheCompany == '3'}}
  85 + {{else if obj.line.brancheCompany == '3'}}
80 86 上南六分公司
81   - {{else if obj.ttInfo.xl.brancheCompany == '4'}}
  87 + {{else if obj.line.brancheCompany == '4'}}
82 88 上南一分公司
83 89 {{/if}}
84 90  
85   - {{else if obj.ttInfo.xl.company == '22'}}
  91 + {{else if obj.line.company == '22'}}
86 92  
87   - {{if obj.ttInfo.xl.brancheCompany == '1'}}
  93 + {{if obj.line.brancheCompany == '1'}}
88 94 四分公司
89   - {{else if obj.ttInfo.xl.brancheCompany == '2'}}
  95 + {{else if obj.line.brancheCompany == '2'}}
90 96 二分公司
91   - {{else if obj.ttInfo.xl.brancheCompany == '3'}}
  97 + {{else if obj.line.brancheCompany == '3'}}
92 98 三分公司
93   - {{else if obj.ttInfo.xl.brancheCompany == '5'}}
  99 + {{else if obj.line.brancheCompany == '5'}}
94 100 一分公司
95 101 {{/if}}
96 102  
97   - {{else if obj.ttInfo.xl.company == '05'}}
  103 + {{else if obj.line.company == '05'}}
98 104  
99   - {{if obj.ttInfo.xl.brancheCompany == '1'}}
  105 + {{if obj.line.brancheCompany == '1'}}
100 106 川沙分公司
101   - {{else if obj.ttInfo.xl.brancheCompany == '2'}}
  107 + {{else if obj.line.brancheCompany == '2'}}
102 108 金桥分公司
103   - {{else if obj.ttInfo.xl.brancheCompany == '3'}}
  109 + {{else if obj.line.brancheCompany == '3'}}
104 110 芦潮港分公司
105   - {{else if obj.ttInfo.xl.brancheCompany == '5'}}
  111 + {{else if obj.line.brancheCompany == '5'}}
106 112 杨高分公司
107   - {{else if obj.ttInfo.xl.brancheCompany == '6'}}
  113 + {{else if obj.line.brancheCompany == '6'}}
108 114 周浦分公司
109 115 {{/if}}
110 116  
111   - {{else if obj.ttInfo.xl.company == '26'}}
  117 + {{else if obj.line.company == '26'}}
112 118  
113   - {{if obj.ttInfo.xl.brancheCompany == '1'}}
  119 + {{if obj.line.brancheCompany == '1'}}
114 120 南汇一分
115   - {{else if obj.ttInfo.xl.brancheCompany == '2'}}
  121 + {{else if obj.line.brancheCompany == '2'}}
116 122 南汇二分
117   - {{else if obj.ttInfo.xl.brancheCompany == '3'}}
  123 + {{else if obj.line.brancheCompany == '3'}}
118 124 南汇三分
119   - {{else if obj.ttInfo.xl.brancheCompany == '4'}}
  125 + {{else if obj.line.brancheCompany == '4'}}
120 126 南汇维修公司
121   - {{else if obj.ttInfo.xl.brancheCompany == '5'}}
  127 + {{else if obj.line.brancheCompany == '5'}}
122 128 南汇公司
123 129 {{/if}}
124 130  
125 131 {{/if}}
126 132 </td>
127 133 <td>
128   - {{obj.ttInfo.xl.name}}
  134 + {{obj.line.name}}
129 135 </td>
130 136 <td>
131   - {{obj.ttInfo.name}}
  137 + {{obj.name}}
132 138 </td>
133 139 <td>
134 140 {{obj.user.name}}
135 141 </td>
136 142 <td>
  143 + {{cutXml(obj.uploadXml)}}
  144 + {{if obj.uploadXml != null && obj.uploadXml != ''}}
  145 + {{if obj.state == '1'}}
  146 + <button type="button" class="btn btn-primary" value="{{obj.uploadXml}}{{obj.uploadXmlSub}}" onclick="showXml(this)">
  147 + 查看
  148 + </button>
  149 + {{else if obj.state == '0'}}
  150 + <button type="button" class="btn btn-danger" value="{{obj.uploadXml}}{{obj.uploadXmlSub}}" onclick="showXml(this)">
  151 + 查看
  152 + </button>
  153 + {{/if}}
  154 + {{/if}}
  155 +
  156 + </td>
  157 + <td>
  158 + {{if obj.type == '1'}}
  159 + 时刻表上传
  160 + {{else if obj.type == '2'}}
  161 + 线路停靠站上传
  162 + {{else if obj.type == '3'}}
  163 + 路单上传
  164 + {{/if}}
  165 + </td>
  166 + <td>
  167 + {{if obj.state == '1'}}
  168 + 成功
  169 + {{else if obj.state == '0'}}
  170 + 失败
  171 + {{/if}}
  172 + </td>
  173 + <td>
137 174 {{obj.createDate}}
138 175 </td>
139 176 </tr>
140 177 {{/each}}
141 178 {{if list.length == 0}}
142 179 <tr class="muted">
143   - <td colspan=7 style="text-align: center;"><h6>没有找到相关数据</h6></td>
  180 + <td colspan=10 style="text-align: center;"><h6>没有找到相关数据</h6></td>
144 181 </tr>
145 182 {{/if}}
146 183 </script>
... ...