Commit a2705c5614e61b0ed84987ee65d08eaa7685bb61

Authored by yiming
1 parent e237b179

临港路单上送新增字段

src/main/java/com/example/demo/SaticScheduleTask.java
... ... @@ -6,6 +6,7 @@ package com.example.demo;
6 6 import cn.hutool.http.HttpUtil;
7 7 import com.alibaba.fastjson.JSON;
8 8 import com.alibaba.fastjson.JSONArray;
  9 +import com.alibaba.fastjson.JSONObject;
9 10 import com.example.demo.model.Waybill;
10 11 import com.example.demo.service.Contrast;
11 12 import com.example.demo.service.DriverCardService;
... ... @@ -47,7 +48,14 @@ public class SaticScheduleTask {
47 48 LocalDateTime now=LocalDate.now().atStartOfDay();
48 49 List<Waybill> dataList=contrast.getSchedulingS(now,1);
49 50 JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(dataList));
50   - HttpUtil.post("https://160.10.6.50:12602/api/waybillUpload",jsonArray.toString());
  51 + for (int i = 0; i < jsonArray.size(); i++) {
  52 + JSONObject waybill=jsonArray.getJSONObject(i);
  53 + String result=HttpUtil.post("http://10.10.150.54:12602/api/waybillUpload",waybill.toJSONString());
  54 + JSONObject jsonObject=JSONObject.parseObject(result);
  55 + if(!"00".equals(jsonObject.getString("respCode"))){
  56 + logger.info(">>>>>>>>>>>>>>路单信息发送失败"+waybill.toJSONString());
  57 + }
  58 + }
51 59 logger.info(">>>>>>>>>>>>>>"+now.minusDays(1)+"路单信息发送完毕");
52 60 } catch (Exception e) {
53 61 e.printStackTrace();
... ...
src/main/java/com/example/demo/model/Waybill.java
... ... @@ -8,6 +8,7 @@ public class Waybill {
8 8 private String tripID;//上海市线路编码
9 9 private String companyNO;//公司号
10 10 private String driver;//司售卡卡内号
  11 + private String cardFace;//司售卡面号
11 12 private String routeCode;//票务线路编码
12 13 private String carPlate;//车牌
13 14 private String upDownTrip;//上下行
... ... @@ -18,13 +19,14 @@ public class Waybill {
18 19 private String departureTime;//发车时间
19 20 private String arrivalTime;//到达时间
20 21  
21   - private List<StopInfo> stopInfosList;//进出站信息
  22 +
  23 + private List<StopInfo> stopInfos;//进出站信息
22 24  
23 25 public static Waybill getInstance(Scheduling scheduling){
24 26 Waybill waybill=new Waybill();
25 27 waybill.setRouteDate(scheduling.getSchedule_date_str()!=null?scheduling.getSchedule_date_str().replace("-",""):null);
26 28 waybill.setTripID(scheduling.getShanghai_linecode());
27   - waybill.setCompanyNO("");
  29 + waybill.setCompanyNO("198");
28 30 waybill.setCarPlate(scheduling.getCar_plate()!=null?scheduling.getCar_plate().replace("沪",""):null);
29 31 waybill.setUpDownTrip(scheduling.getXl_dir());
30 32 waybill.setStartStation(scheduling.getQdz_name());
... ... @@ -53,7 +55,7 @@ public class Waybill {
53 55 stopInfos.add(stopInfoOut);
54 56 });
55 57 }
56   - waybill.setStopInfosList(stopInfos);
  58 + waybill.setStopInfos(stopInfos);
57 59 return waybill;
58 60 }
59 61  
... ... @@ -161,11 +163,40 @@ public class Waybill {
161 163 this.arrivalTime = arrivalTime;
162 164 }
163 165  
164   - public List<StopInfo> getStopInfosList() {
165   - return stopInfosList;
  166 + public List<StopInfo> getStopInfos() {
  167 + return stopInfos;
  168 + }
  169 +
  170 + public void setStopInfos(List<StopInfo> stopInfos) {
  171 + this.stopInfos = stopInfos;
  172 + }
  173 +
  174 + public String getCardFace() {
  175 + return cardFace;
  176 + }
  177 +
  178 + public void setCardFace(String cardFace) {
  179 + this.cardFace = cardFace;
166 180 }
167 181  
168   - public void setStopInfosList(List<StopInfo> stopInfosList) {
169   - this.stopInfosList = stopInfosList;
  182 + @Override
  183 + public String toString() {
  184 + return "Waybill{" +
  185 + "routeDate='" + routeDate + '\'' +
  186 + ", tripID='" + tripID + '\'' +
  187 + ", companyNO='" + companyNO + '\'' +
  188 + ", driver='" + driver + '\'' +
  189 + ", cardFace='" + cardFace + '\'' +
  190 + ", routeCode='" + routeCode + '\'' +
  191 + ", carPlate='" + carPlate + '\'' +
  192 + ", upDownTrip='" + upDownTrip + '\'' +
  193 + ", startStation='" + startStation + '\'' +
  194 + ", startStationCode='" + startStationCode + '\'' +
  195 + ", endStation='" + endStation + '\'' +
  196 + ", endStationCode='" + endStationCode + '\'' +
  197 + ", departureTime='" + departureTime + '\'' +
  198 + ", arrivalTime='" + arrivalTime + '\'' +
  199 + ", stopInfos=" + stopInfos +
  200 + '}';
170 201 }
171 202 }
... ...
src/main/java/com/example/demo/service/Contrast.java
... ... @@ -47,9 +47,11 @@ public class Contrast {
47 47 });
48 48 List<CardDriver> cardDrivers = siteMapper1.getCardDriver();
49 49 Map<String,String> cardDriverMap=new HashMap<>();
  50 + Map<String,String> faceNoMap=new HashMap<>();
50 51 cardDrivers.forEach(cardDriver -> {
51 52 if(cardDriver.getDriver_no()!=null && cardDriver.getDriver_no().split("-").length==2){
52   - cardDriverMap.put(cardDriver.getDriver_no().split("-")[1], cardDriver.getCard_no());
  53 + cardDriverMap.put(cardDriver.getDriver_no().split("-")[1], cardDriver.getInside_no()==null?"00000000":cardDriver.getInside_no());
  54 + faceNoMap.put(cardDriver.getDriver_no().split("-")[1], cardDriver.getCard_no());
53 55 }
54 56 });
55 57 //计算开始结束时间
... ... @@ -177,8 +179,10 @@ public class Contrast {
177 179 Waybill waybill= Waybill.getInstance(scheduling);
178 180 if(cardDriverMap.get(scheduling.getJ_gh())!=null){
179 181 waybill.setDriver(cardDriverMap.get(scheduling.getJ_gh()));
  182 + waybill.setCardFace(faceNoMap.get(scheduling.getJ_gh()));
180 183 }else{
181 184 waybill.setDriver(cardDriverMap.get(scheduling.getS_gh()));
  185 + waybill.setCardFace(faceNoMap.get(scheduling.getS_gh()));
182 186 }
183 187 if(waybill.getDriver()==null){
184 188 drivers.add(scheduling.getJ_gh());
... ...