Commit 106e4427a3461165c2b4fd60f8f2df48a9433ad3

Authored by 潘钊
2 parents 2dcdf456 087e8052

Merge branch 'jiading' of http://222.66.0.204:8090/panzhaov5/bsth_control into jiading

src/main/java/com/bsth/controller/schedule/TrafficManageController.java
@@ -30,6 +30,15 @@ public class TrafficManageController { @@ -30,6 +30,15 @@ public class TrafficManageController {
30 } 30 }
31 } 31 }
32 32
  33 + @RequestMapping(value = "/setXLByInUse", method = RequestMethod.GET)
  34 + public String setXLByInUse(@RequestParam("inUse") String inUse) throws Exception {
  35 + try {
  36 + return trManageService.setXLByInUse(inUse);
  37 + } catch (Exception exp) {
  38 + throw new Exception(exp.getCause());
  39 + }
  40 + }
  41 +
33 @RequestMapping(value = "/setCL", method = RequestMethod.GET) 42 @RequestMapping(value = "/setCL", method = RequestMethod.GET)
34 public String setCL() throws Exception { 43 public String setCL() throws Exception {
35 try { 44 try {
@@ -57,6 +66,15 @@ public class TrafficManageController { @@ -57,6 +66,15 @@ public class TrafficManageController {
57 } 66 }
58 } 67 }
59 68
  69 + @RequestMapping(value = "/setLDByDate", method = RequestMethod.GET)
  70 + public String setLDByDate(@RequestParam("theDate") String theDate) throws Exception {
  71 + try {
  72 + return trManageService.setLD(theDate);
  73 + } catch (Exception exp) {
  74 + throw new Exception(exp.getCause());
  75 + }
  76 + }
  77 +
60 @RequestMapping(value = "/setLDFile", method = RequestMethod.GET) 78 @RequestMapping(value = "/setLDFile", method = RequestMethod.GET)
61 public String setLDFile() throws Exception { 79 public String setLDFile() throws Exception {
62 try { 80 try {
src/main/java/com/bsth/service/TrafficManageService.java
1 package com.bsth.service; 1 package com.bsth.service;
2 2
3 -import java.util.Map;  
4 -  
5 /** 3 /**
6 * 4 *
7 * @Interface: LineService(线路service业务层实现接口) 5 * @Interface: LineService(线路service业务层实现接口)
@@ -27,6 +25,13 @@ public interface TrafficManageService { @@ -27,6 +25,13 @@ public interface TrafficManageService {
27 String setXL(String ids); 25 String setXL(String ids);
28 26
29 /** 27 /**
  28 + * 上传线路信息
  29 + *
  30 + * @return 调用接口返回信息
  31 + */
  32 + String setXLByInUse(String ids);
  33 +
  34 + /**
30 * 上传车辆信息 35 * 上传车辆信息
31 * 36 *
32 * @return 调用接口返回信息 37 * @return 调用接口返回信息
@@ -65,6 +70,8 @@ public interface TrafficManageService { @@ -65,6 +70,8 @@ public interface TrafficManageService {
65 */ 70 */
66 String setJHBC(); 71 String setJHBC();
67 72
  73 + String setLD(String theDate);
  74 +
68 String setLD(); 75 String setLD();
69 76
70 String setLDFile(); 77 String setLDFile();
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -19,7 +19,6 @@ import com.bsth.service.TrafficManageService; @@ -19,7 +19,6 @@ import com.bsth.service.TrafficManageService;
19 import com.bsth.service.traffic.YgcBasicDataService; 19 import com.bsth.service.traffic.YgcBasicDataService;
20 import com.bsth.util.TimeUtils; 20 import com.bsth.util.TimeUtils;
21 import com.bsth.util.db.DBUtils_MS; 21 import com.bsth.util.db.DBUtils_MS;
22 -import com.bsth.webService.trafficManage.geotool.services.InternalPortType;  
23 import com.bsth.webService.trafficManage.org.tempuri.Results; 22 import com.bsth.webService.trafficManage.org.tempuri.Results;
24 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator; 23 import com.bsth.webService.trafficManage.org.tempuri.WebServiceLocator;
25 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap; 24 import com.bsth.webService.trafficManage.org.tempuri.WebServiceSoap;
@@ -40,6 +39,7 @@ import java.sql.ResultSet; @@ -40,6 +39,7 @@ import java.sql.ResultSet;
40 import java.text.DecimalFormat; 39 import java.text.DecimalFormat;
41 import java.text.SimpleDateFormat; 40 import java.text.SimpleDateFormat;
42 import java.util.*; 41 import java.util.*;
  42 +import java.util.regex.Matcher;
43 import java.util.regex.Pattern; 43 import java.util.regex.Pattern;
44 44
45 /** 45 /**
@@ -67,10 +67,16 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -67,10 +67,16 @@ public class TrafficManageServiceImpl implements TrafficManageService{
67 @Autowired 67 @Autowired
68 private LineRepository lineRepository; 68 private LineRepository lineRepository;
69 69
  70 + @Autowired
  71 + private LineInformationRepository lineInformationRepository;
  72 +
70 // 站点路由repository 73 // 站点路由repository
71 @Autowired 74 @Autowired
72 private StationRouteRepository stationRouteRepository; 75 private StationRouteRepository stationRouteRepository;
73 76
  77 + @Autowired
  78 + private SectionRepository sectionRepository;
  79 +
74 // 车辆repository 80 // 车辆repository
75 @Autowired 81 @Autowired
76 private CarsRepository carsRepository; 82 private CarsRepository carsRepository;
@@ -104,8 +110,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -104,8 +110,8 @@ public class TrafficManageServiceImpl implements TrafficManageService{
104 private YgcBasicDataService ygcBasicDataService; 110 private YgcBasicDataService ygcBasicDataService;
105 111
106 112
107 - // 运管处接口  
108 - private InternalPortType portType = null;//new Internal().getInternalHttpSoap11Endpoint(); 113 + // 运管处上传接口
  114 + private com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap webServiceSoapUp;
109 private WebServiceSoap ssop ; 115 private WebServiceSoap ssop ;
110 { 116 {
111 try { 117 try {
@@ -127,6 +133,23 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -127,6 +133,23 @@ public class TrafficManageServiceImpl implements TrafficManageService{
127 private final String userNameOther = "user"; 133 private final String userNameOther = "user";
128 // 密码 134 // 密码
129 private final String passwordOther = "user"; 135 private final String passwordOther = "user";
  136 +
  137 + // 用户名
  138 + private final String userNameUp = "user";
  139 + // 密码
  140 + private final String passwordUp = "user";
  141 +
  142 + private synchronized com.bsth.webService.trafficManage.up.org.tempuri.WebServiceSoap getWebServiceSoapUp(){
  143 + try {
  144 + if(webServiceSoapUp == null){
  145 + webServiceSoapUp = new com.bsth.webService.trafficManage.up.org.tempuri.WebServiceLocator().getWebServiceSoap();
  146 + }
  147 + }catch (Exception e){
  148 + e.printStackTrace();
  149 + }finally {
  150 + return webServiceSoapUp;
  151 + }
  152 + }
130 /** 153 /**
131 * 上传线路信息 154 * 上传线路信息
132 */ 155 */
@@ -137,26 +160,44 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -137,26 +160,44 @@ public class TrafficManageServiceImpl implements TrafficManageService{
137 String[] idArray = ids.split(","); 160 String[] idArray = ids.split(",");
138 try { 161 try {
139 for (String id : idArray) { 162 for (String id : idArray) {
  163 + if(id == null || id.trim().equals("")){
  164 + continue;
  165 + }
140 Map<String,Object> map = new HashMap<>(); 166 Map<String,Object> map = new HashMap<>();
141 map.put("lineCode_eq", id); 167 map.put("lineCode_eq", id);
142 Line line ; 168 Line line ;
  169 + LineInformation lineInformation;
143 line = lineRepository.findOne(new CustomerSpecs<Line>(map)); 170 line = lineRepository.findOne(new CustomerSpecs<Line>(map));
144 if(line == null){ 171 if(line == null){
145 continue; 172 continue;
146 } 173 }
147 List<StationRoute> upStationsList ;// 上行站点路由集 174 List<StationRoute> upStationsList ;// 上行站点路由集
148 - List<StationRoute> downStationsList = null;// 下行站点路由集  
149 - sBuffer.append("<Data>");  
150 - sBuffer.append("<RequestOrg>上海巴士拓华科技发展有限公司</RequestOrg>");  
151 - sBuffer.append("<DataList>"); 175 + List<StationRoute> downStationsList;// 下行站点路由集
  176 + List<Object[]> downPointList;// 下行站点集
  177 + List<Object[]> upPointList;// 上行站点集
  178 + sBuffer.append("<XLs>");
  179 + sBuffer.append("<XL>");
152 if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){ 180 if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){
153 return result; 181 return result;
154 } 182 }
155 - sBuffer.append("<LINE_ID>").append(line.getId()).append("</LINE_ID>");  
156 - sBuffer.append("<LINE_CODE>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</LINE_CODE>");  
157 - sBuffer.append("<LINE_NAME>").append(line.getName()).append("</LINE_NAME>"); 183 + map = new HashMap<>();
  184 + map.put("line.id_eq",line.getId());
  185 + lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(map));
  186 + if(lineInformation == null){
  187 + continue;
  188 + }
  189 + sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>");
  190 + sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>");
  191 + sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>");
  192 + sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>");
  193 + sBuffer.append("<QZLC>").append(lineInformation.getUpMileage()).append("</QZLC>");
  194 + sBuffer.append("<ZQLC>").append(lineInformation.getDownMileage()).append("</ZQLC>");
  195 + sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>");
  196 + sBuffer.append("<UPDATE_DATE>").append(sdfnyr.format(new Date())).append("</UPDATE_DATE>");
  197 +
158 // 循环添加站点信息 198 // 循环添加站点信息
159 - sBuffer.append("<LineStationList>"); 199 + sBuffer.append("<StationList>");
  200 +
160 // 先查上行 201 // 先查上行
161 upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0); 202 upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0);
162 int startId = 1; 203 int startId = 1;
@@ -167,25 +208,23 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -167,25 +208,23 @@ public class TrafficManageServiceImpl implements TrafficManageService{
167 downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1); 208 downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1);
168 packagStationXml(downStationsList, sBuffer, startId); 209 packagStationXml(downStationsList, sBuffer, startId);
169 } 210 }
170 - sBuffer.append("</LineStationList>"); 211 + sBuffer.append("</StationList>");
171 212
172 // 循环添加站点点位信息 213 // 循环添加站点点位信息
173 sBuffer.append("<LinePointList>"); 214 sBuffer.append("<LinePointList>");
  215 + upPointList = sectionRepository.getSectionDirByLineId(line.getId(),0);
174 startId = 1; 216 startId = 1;
175 - startId = packagStationPointXml(upStationsList, sBuffer, startId); 217 + startId = packagStationPointXml(upPointList, sBuffer, startId);
176 // 环线不查下行 218 // 环线不查下行
177 if(line.getLinePlayType() != 1){ 219 if(line.getLinePlayType() != 1){
178 - packagStationPointXml(downStationsList, sBuffer, startId); 220 + downPointList = sectionRepository.getSectionDirByLineId(line.getId(),1);
  221 + packagStationPointXml(downPointList, sBuffer, startId);
179 } 222 }
180 sBuffer.append("</LinePointList>"); 223 sBuffer.append("</LinePointList>");
181 - sBuffer.append("</DataList>");  
182 - sBuffer.append("</Data>"); 224 + sBuffer.append("</XL>");
  225 + sBuffer.append("</XLs>");
183 // 调用上传方法 226 // 调用上传方法
184 - result = ygcBasicDataService.invokeMethod("UpdateBusLineStation",sBuffer.toString());  
185 - String str = "ReturnCode";  
186 - // 解析返回值  
187 - result = result.substring(result.indexOf(str)+str.length()+1,result.lastIndexOf(str)-2);  
188 - if(result.equals("1")){ 227 + if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){
189 result = "success"; 228 result = "success";
190 }else{ 229 }else{
191 result = "failure"; 230 result = "failure";
@@ -201,6 +240,36 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -201,6 +240,36 @@ public class TrafficManageServiceImpl implements TrafficManageService{
201 } 240 }
202 241
203 /** 242 /**
  243 + * 上传线路信息(按in_use上传)
  244 + */
  245 + @Override
  246 + public String setXLByInUse(String inUse) {
  247 + StringBuffer result = new StringBuffer();
  248 + try {
  249 + Map<String,Object> map = new HashMap<>();
  250 + if(inUse != null && inUse.equals("1")){
  251 + map.put("inUse_eq", inUse);
  252 + }
  253 + List<Line> lines ;
  254 + Line line;
  255 + lines = lineRepository.findAll(new CustomerSpecs<Line>(map));
  256 + if(lines != null && lines.size() > 0){
  257 + for(int i = 0 ; i < lines.size() ; i ++){
  258 + line = lines.get(i);
  259 + if(line != null && line.getId() != null){
  260 + result.append(line.getLineCode()).append(":").append(setXL(line.getLineCode())).append(";");
  261 + }
  262 + }
  263 + }
  264 + } catch (Exception e) {
  265 + result.append("failure");
  266 + logger.error("setXLByInUse:",e);
  267 + e.printStackTrace();
  268 + }
  269 + return result.toString();
  270 + }
  271 +
  272 + /**
204 * 上传车辆信息 273 * 上传车辆信息
205 */ 274 */
206 @Override 275 @Override
@@ -279,14 +348,30 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -279,14 +348,30 @@ public class TrafficManageServiceImpl implements TrafficManageService{
279 } 348 }
280 349
281 /** 350 /**
  351 + * 上传路单 指定日期 yyyy-MM-dd
  352 + * @param theDate
  353 + * @return
  354 + */
  355 + public String setLD(String theDate){
  356 + return uploadLD(theDate);
  357 + }
  358 +
  359 + /**
  360 + * 上传路单 上传前一天的路单
  361 + * @return
  362 + */
  363 + public String setLD(){
  364 + return uploadLD(null);
  365 + }
  366 + /**
282 * 上传路单 367 * 上传路单
283 * @return 上传成功标识 368 * @return 上传成功标识
284 */ 369 */
285 - public String setLD(){ 370 + private String uploadLD(String theDate){
286 String result = "failure"; 371 String result = "failure";
287 Line line; 372 Line line;
288 // 取昨天 的日期 373 // 取昨天 的日期
289 - String date = sdfnyr.format(DateUtils.addDays(new Date(), -1)); 374 + String date = theDate == null ?sdfnyr.format(DateUtils.addDays(new Date(), -1)) : theDate;
290 StringBuffer sf = new StringBuffer(); 375 StringBuffer sf = new StringBuffer();
291 String str; 376 String str;
292 try { 377 try {
@@ -710,7 +795,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -710,7 +795,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
710 // 判断XML是否以</BCList>结尾,如果不是,则加上 795 // 判断XML是否以</BCList>结尾,如果不是,则加上
711 String regex = "^*</JHBC>$"; 796 String regex = "^*</JHBC>$";
712 Pattern p = Pattern.compile(regex); 797 Pattern p = Pattern.compile(regex);
713 - java.util.regex.Matcher m = p.matcher(sBuffer); 798 + Matcher m = p.matcher(sBuffer);
714 boolean isEndWithTrueFlag = false; 799 boolean isEndWithTrueFlag = false;
715 while (m.find()) { 800 while (m.find()) {
716 isEndWithTrueFlag = true; 801 isEndWithTrueFlag = true;
@@ -1146,15 +1231,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1146,15 +1231,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1146 } 1231 }
1147 paraMap = packageYgcStationNumParam(srRoute,null); 1232 paraMap = packageYgcStationNumParam(srRoute,null);
1148 sBuffer.append("<Station>"); 1233 sBuffer.append("<Station>");
1149 - sBuffer.append("<STATION_ID>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap)).append("</STATION_ID>");  
1150 - sBuffer.append("<UPDDOWN>").append(srRoute.getDirections()).append("</UPDDOWN>");  
1151 - sBuffer.append("<STATION_NO>").append(i).append("</STATION_NO>");  
1152 - sBuffer.append("<STATION_CODE>").append(srRoute.getStationCode()).append("</STATION_CODE>");  
1153 - sBuffer.append("<STATION_NAME>").append(srRoute.getStationName()).append("</STATION_NAME>");  
1154 - sBuffer.append("<STATION_LON>").append(srRoute.getStation().getgLonx()).append("</STATION_LON>");  
1155 - sBuffer.append("<STATION_LAT>").append(srRoute.getStation().getgLaty()).append("</STATION_LAT>");  
1156 - sBuffer.append("<STATION_TYPE>").append(zdlx).append("</STATION_TYPE>");  
1157 - sBuffer.append("<STATION_DISTANCE>").append(srRoute.getDistances()).append("</STATION_DISTANCE>"); 1234 + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap)).append("</ZDXH>");
  1235 + sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>");
  1236 + sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>");
  1237 + sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>");
  1238 + sBuffer.append("<ZDJD>").append(srRoute.getStation().getgLonx()).append("</ZDJD>");
  1239 + sBuffer.append("<ZDWD>").append(srRoute.getStation().getgLaty()).append("</ZDWD>");
  1240 + sBuffer.append("<ZZ>").append(srRoute.getStation().getAddr() == null ? "" : srRoute.getStation().getAddr()).append("</ZZ>");
  1241 + sBuffer.append("<ZDLX>").append(zdlx).append("</ZDLX>");
  1242 + sBuffer.append("<ZJLC>").append(srRoute.getDistances()).append("</ZJLC>");
1158 sBuffer.append("</Station>"); 1243 sBuffer.append("</Station>");
1159 startId++; 1244 startId++;
1160 } 1245 }
@@ -1162,35 +1247,37 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1162,35 +1247,37 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1162 } 1247 }
1163 1248
1164 /** 1249 /**
1165 - * @param stationsList 站点路由 1250 + * @param pointList 站点点位
1166 * @param sBuffer sBuffer 1251 * @param sBuffer sBuffer
1167 * @param startId 站点序号起始ID 1252 * @param startId 站点序号起始ID
1168 * 1253 *
1169 * @return 站点序号累加后的ID 1254 * @return 站点序号累加后的ID
1170 */ 1255 */
1171 - private int packagStationPointXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){  
1172 - int size = stationsList.size();  
1173 - StationRoute srRoute;  
1174 - HashMap<String,String> paraMap;  
1175 - String zdlx ;// 站点类型:0:起点站、1:终点站、2:中途站 1256 + private int packagStationPointXml(List<Object[]> pointList,StringBuffer sBuffer,int startId){
  1257 + int size = pointList.size();
  1258 + Object[] objs;
  1259 + String bsection,dir,section;
  1260 + String[] sections ;
1176 for (int i = 0; i < size; i++) { 1261 for (int i = 0; i < size; i++) {
1177 - srRoute = stationsList.get(i);  
1178 - zdlx = srRoute.getStationMark();  
1179 - if(zdlx.equals("B")){  
1180 - zdlx = "0";  
1181 - }else if(zdlx.equals("E")){  
1182 - zdlx = "1";  
1183 - }else{  
1184 - zdlx = "2"; 1262 + objs = pointList.get(i);
  1263 + bsection = objs[0]+"";
  1264 + dir = objs[1]+"";
  1265 + // 取括号内的内容
  1266 + Pattern pattern = Pattern.compile("(?<=\\()(.+?)(?=\\))");
  1267 + Matcher matcher = pattern.matcher(bsection);
  1268 + if(matcher.find()){
  1269 + sections = matcher.group().split(",");
  1270 + for (int j = 0 ; j < sections.length ; j ++){
  1271 + section = sections[j];
  1272 + sBuffer.append("<LinePoint>");
  1273 + sBuffer.append("<ZDXH>").append(startId).append("</ZDXH>");
  1274 + sBuffer.append("<SXX>").append(dir).append("</SXX>");
  1275 + sBuffer.append("<ZDJD>").append(section.split(" ")[0]).append("</ZDJD>");
  1276 + sBuffer.append("<ZDWD>").append(section.split(" ")[1]).append("</ZDWD>");
  1277 + sBuffer.append("</LinePoint>");
  1278 + startId++;
  1279 + }
1185 } 1280 }
1186 - paraMap = packageYgcStationNumParam(srRoute,null);  
1187 - sBuffer.append("<Point>");  
1188 - sBuffer.append("<POINT_ID>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap)).append("</POINT_ID>");  
1189 - sBuffer.append("<UPDDOWN>").append(srRoute.getDirections()).append("</UPDDOWN>");  
1190 - sBuffer.append("<POINTLON>").append(srRoute.getStation().getgLonx()).append("</POINTLON>");  
1191 - sBuffer.append("<POINTLAT>").append(srRoute.getStation().getgLaty()).append("</POINTLAT>");  
1192 - sBuffer.append("</Point>");  
1193 - startId++;  
1194 } 1281 }
1195 return startId; 1282 return startId;
1196 } 1283 }
src/main/resources/application-prod.properties
1 -server.port=9088  
2 -management.port= 9001  
3 -management.address= 127.0.0.1  
4 -  
5 -spring.jpa.hibernate.ddl-auto= update  
6 -spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy  
7 -#DATABASE  
8 -spring.jpa.database= MYSQL  
9 -spring.jpa.show-sql= false  
10 -spring.datasource.driver-class-name= com.mysql.jdbc.Driver  
11 -spring.datasource.url= jdbc:mysql://192.168.160.214:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false  
12 -spring.datasource.username= root  
13 -spring.datasource.password= bsth@pzsgdsg  
14 -#DATASOURCE  
15 -spring.datasource.max-active=100  
16 -spring.datasource.max-idle=8  
17 -spring.datasource.min-idle=8  
18 -spring.datasource.initial-size=5  
19 -  
20 -spring.datasource.test-on-borrow=true  
21 -spring.datasource.test-on-connect=true  
22 -spring.datasource.test-on-return=true  
23 -spring.datasource.test-while-idle=true  
24 -spring.datasource.validation-query=select 1  
25 -  
26 -##  
27 -#222.66.0.204:5555  
28 -##\u5B9E\u65F6gps  
29 -http.gps.real.url= http://192.168.160.214:8080/transport_server/rtgps/  
30 -##\u6D88\u606F\u4E0B\u53D1  
31 -http.send.directive = http://192.168.160.214:8080/transport_server/message/  
32 \ No newline at end of file 1 \ No newline at end of file
  2 +server.port=9088
  3 +management.port= 9001
  4 +management.address= 127.0.0.1
  5 +
  6 +spring.jpa.hibernate.ddl-auto= update
  7 +spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
  8 +#DATABASE
  9 +spring.jpa.database= MYSQL
  10 +spring.jpa.show-sql= false
  11 +spring.datasource.driver-class-name= com.mysql.jdbc.Driver
  12 +spring.datasource.url= jdbc:mysql://192.168.160.222:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
  13 +spring.datasource.username= root
  14 +spring.datasource.password= root2jsp
  15 +#DATASOURCE
  16 +spring.datasource.max-active=100
  17 +spring.datasource.max-idle=8
  18 +spring.datasource.min-idle=8
  19 +spring.datasource.initial-size=5
  20 +
  21 +spring.datasource.test-on-borrow=true
  22 +spring.datasource.test-on-connect=true
  23 +spring.datasource.test-on-return=true
  24 +spring.datasource.test-while-idle=true
  25 +spring.datasource.validation-query=select 1
  26 +
  27 +##
  28 +#222.66.0.204:5555
  29 +##\u5B9E\u65F6gps
  30 +http.gps.real.url= http://192.168.160.151:8080/transport_server/rtgps/
  31 +##\u6D88\u606F\u4E0B\u53D1
  32 +http.send.directive = http://192.168.160.151:8080/transport_server/message/
33 \ No newline at end of file 33 \ No newline at end of file
src/main/resources/ms-jdbc.properties
1 -#ms.mysql.driver= com.mysql.jdbc.Driver  
2 -#ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8&useSSL=false  
3 -#ms.mysql.username= root  
4 -#ms.mysql.password= 123456  
5 -  
6 -ms.mysql.driver= com.mysql.jdbc.Driver  
7 -ms.mysql.url= jdbc:mysql://192.168.160.214:3306/ms?useUnicode=true&characterEncoding=utf-8  
8 -ms.mysql.username= root  
9 -ms.mysql.password= bsth@pzsgdsg  
10 \ No newline at end of file 1 \ No newline at end of file
  2 +#ms.mysql.driver= com.mysql.jdbc.Driver
  3 +#ms.mysql.url= jdbc:mysql://192.168.168.201:3306/ms?useUnicode=true&characterEncoding=utf-8&useSSL=false
  4 +#ms.mysql.username= root
  5 +#ms.mysql.password= 123456
  6 +
  7 +ms.mysql.driver= com.mysql.jdbc.Driver
  8 +ms.mysql.url= jdbc:mysql://192.168.160.222:3306/ms?useUnicode=true&characterEncoding=utf-8
  9 +ms.mysql.username= root
  10 +ms.mysql.password= root2jsp
11 \ No newline at end of file 11 \ No newline at end of file
src/main/resources/static/pages/trafficManage/js/lineStationUploadRecord.js
@@ -13,16 +13,59 @@ @@ -13,16 +13,59 @@
13 */ 13 */
14 14
15 (function(){ 15 (function(){
  16 + var page = 0, initPag, storage = window.localStorage;
16 // 关闭左侧栏 17 // 关闭左侧栏
17 if (!$('body').hasClass('page-sidebar-closed')) 18 if (!$('body').hasClass('page-sidebar-closed'))
18 $('.menu-toggler.sidebar-toggler').click(); 19 $('.menu-toggler.sidebar-toggler').click();
19 - // 日期控件  
20 - $('#dateInput').datetimepicker({  
21 - // 日期控件时间格式  
22 - format : 'YYYY-MM-DD',  
23 - // 语言  
24 - locale: 'zh-cn'  
25 - }); 20 +
  21 + $("#dateInput").datetimepicker({
  22 + format : 'YYYY-MM-DD',
  23 + locale : 'zh-cn'
  24 + });
  25 +
  26 + function getComp(cb) {
  27 + $.get('/user/companyData',null,function(rs) {
  28 + return cb && cb(rs);
  29 + });
  30 + }
  31 +
  32 + initLineSelect2();
  33 +
  34 + function initLineSelect2(compD) {debugger;
  35 + getComp(function(rs) {
  36 + var params = {};
  37 + if(rs.length>0) {
  38 + var compA = new Array();
  39 + for(var c = 0 ; c<rs.length;c++) {
  40 + var comC = rs[c].companyCode;
  41 + var child = rs[c].children;
  42 + if(child.length>0) {
  43 + for(var d = 0 ;d< child.length;d++) {
  44 + compA.push(comC + '_' + child[d].code);
  45 + }
  46 + }else {
  47 + compA.push(comC);
  48 + }
  49 + }
  50 + params.cgsbm_in = compA.toString();
  51 + }
  52 + // 填充线路拉框选择值
  53 + $get('/line/all', params, function(array){
  54 + var len_ = array.length,paramsD = new Array();
  55 + if(len_>0) {
  56 + $.each(array, function(i, g){
  57 + if(g.name!='' || g.name != null) {
  58 + paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name});
  59 + }
  60 + });
  61 + initPinYinSelect2($('#line'),paramsD,function(selector) {
  62 + selector.select2("val", storage.xlName_AgursData);
  63 + });
  64 + }
  65 + });
  66 + });
  67 + }
  68 +
26 // 日期范围输入框限制,绑定按键和粘贴事件 69 // 日期范围输入框限制,绑定按键和粘贴事件
27 $(".dateRange").keyup(function(){ 70 $(".dateRange").keyup(function(){
28 var tmptxt=$(this).val(); 71 var tmptxt=$(this).val();
@@ -48,81 +91,91 @@ @@ -48,81 +91,91 @@
48 if(tmptxt < 0){ 91 if(tmptxt < 0){
49 $(this).val(00); 92 $(this).val(00);
50 } 93 }
51 - }).css("ime-mode", "disabled");  
52 - /**  
53 - * 取得编码-公司map  
54 - * gsmap["5"] = 南汇公司  
55 - * gsmap["5_3"] = 芦潮港分公司  
56 - */  
57 - function getBusMap(){  
58 - // 取得公司信息,替换公司编码  
59 - var gsmap = {};  
60 - $get('/business/all', null, function(array){  
61 - $.each(array, function(i, gs){  
62 - var k = gs.upCode + '_' + gs.businessCode;  
63 - if(gs.upCode === '88'){  
64 - k = gs.businessCode;  
65 - }  
66 - gsmap[k] = gs.businessName;  
67 - });  
68 - });  
69 - return gsmap;  
70 - }  
71 - /**  
72 - * 设置公司自动完成  
73 - */  
74 - var lines = new Array();  
75 - var gsmap = getBusMap();  
76 - // 取得所有线路  
77 - $get('/line/all', null, function(allLine) {  
78 - // 遍历数组  
79 - $.each(allLine, function(i, e) {  
80 - var companyCode = e.company;  
81 - e.company = gsmap[e.company];  
82 - e.brancheCompany = gsmap[companyCode+"_"+e.brancheCompany];  
83 - var line = '{"hex":"' + e.company + '","label":"' + e.name  
84 - + '"}';  
85 - var obj = jQuery.parseJSON(line);  
86 - lines[i] = obj;  
87 - });  
88 - });  
89 - // 给输入框绑定autocomplete事件  
90 - $("input[name='xl.name_eq']").autocompleter({  
91 - highlightMatches : true,  
92 - source : lines,  
93 - template : '{{ label }} <span>({{ hex }})</span>',  
94 - hint : true,  
95 - empty : false,  
96 - limit : 5,  
97 - });  
98 - // 设置autocompleter的宽度和输入框一样  
99 - $(".autocompleter").css("width",  
100 - $("input[name='xl.name_eq']").css("width"));  
101 -  
102 - /**  
103 - * 设置内部编码自动完成  
104 - */  
105 - var cars = new Array();  
106 - // 取得所有车辆  
107 - $get('/cars/all', null, function(allCars) {  
108 - // 遍历数组  
109 - $.each(allCars, function(i, e) {  
110 - var car = '{"hex":"' + e.insideCode + '","label":"' + e.insideCode  
111 - + '"}';  
112 - var obj = jQuery.parseJSON(car);  
113 - cars[i] = obj;  
114 - });  
115 - });  
116 - // 给输入框绑定autocomplete事件  
117 - $("input[name='xl.insideCode_eq']").autocompleter({  
118 - highlightMatches : true,  
119 - source : cars,  
120 - template : '{{ label }}',  
121 - hint : true,  
122 - empty : false,  
123 - limit : 5,  
124 - });  
125 - // 设置autocompleter的宽度和输入框一样  
126 - $(".autocompleter").css("width",  
127 - $("input[name='xl.insideCode_eq']").css("width")); 94 + }).css("ime-mode", "disabled");
  95 +
  96 + // 绑定查询事件
  97 + $("#search").click(searchM);
  98 + // 查询方法
  99 + function searchM(pagination) {
  100 + if($("#dateInput").val() == ""){
  101 + alert("请选择时间");
  102 + return ;
  103 + }
  104 + if(pagination){
  105 + page = 0;
  106 + }
  107 + var params = {};
  108 + // 排序(按方向与序号)
  109 + params['order'] = 'reportDate';
  110 + // 排序方向.
  111 + params['direction'] = 'ASC';
  112 + // 记录当前页数
  113 + params['page'] = page;
  114 + // 弹出正在加载层
  115 + var i = layer.load(2);
  116 + // 取得输入框的值
  117 + var inputs = $(".form-inline input,select");
  118 + // 遍历数组
  119 + $.each(inputs, function(i, element) {
  120 + params[$(element).attr("name")] = $(element).val();
  121 + });
  122 + var startDate = params['startDate'] == "" ? "0" : params['startDate'];
  123 + var endDate = params['endDate'] == "" ? "23" : params['endDate'];
  124 + var reportDate = params['reportDate'];
  125 + params['reportDate_start'] = reportDate.replace(/-/g,'') + (startDate > 9 ? startDate : "0"+startDate);
  126 + params['reportDate_end'] = reportDate.replace(/-/g,'') + (endDate > 9 ? endDate : "0"+endDate);
  127 + $get('/vehicle_stop/getVehicleInoutStopByParam', params, function(data) {
  128 + var content = data.content;
  129 + _dateFormat(content);
  130 + var bodyHtm = template('lineStationUploadRecord_list_temp', {
  131 + list : content
  132 + });
  133 + $('#vehicle_stop tbody').html(bodyHtm);
  134 + if(pagination && data.content.length > 0){
  135 + //重新分页
  136 + initPag = true;
  137 + showPagination(data);
  138 + }
  139 + layer.close(i);
  140 + });
  141 + }
  142 +
  143 + /** 分页栏组件 */
  144 + function showPagination(data){
  145 + // 分页组件
  146 + $('#pagination').jqPaginator({
  147 + // 总页数
  148 + totalPages: data.totalPages,
  149 + // 中间显示页数
  150 + visiblePages: 6,
  151 + // 当前页
  152 + currentPage: page + 1,
  153 + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  154 + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  155 + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  156 + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  157 + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  158 + onPageChange: function (num, type) {
  159 + if(initPag){
  160 + initPag = false;
  161 + return;
  162 + }
  163 + page = num - 1;
  164 + searchM(false);
  165 + }
  166 + });
  167 + }
  168 +
  169 + //转换时间格式
  170 + function _dateFormat(list) {
  171 + var fs = 'YYYY-MM-DD HH:mm:ss';
  172 + $.each(list, function(i, obj) {
  173 + obj['report_date'] = moment(obj['report_date']).format(fs);
  174 + });
  175 + }
  176 +
  177 + // 时间字符串转成时间戳
  178 + function str2datetime(stringTime){
  179 + return Date.parse(new Date(stringTime));
  180 + }
128 })(); 181 })();
129 \ No newline at end of file 182 \ No newline at end of file