Commit 705d475f42c317269c56270acdcae322310b34e3

Authored by 潘钊
1 parent 48d55e8d

update...

src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
... ... @@ -41,7 +41,7 @@ public class GpsRealAnalyse {
41 41 @Autowired
42 42 GpsRealData gpsRealData;
43 43  
44   - final static int POOL_SIZE = 25;
  44 + final static int POOL_SIZE = 30;
45 45 static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1);
46 46  
47 47 public static long st;
... ...
src/main/java/com/bsth/entity/realcontrol/ChildTaskPlan.java
... ... @@ -35,6 +35,7 @@ public class ChildTaskPlan {
35 35  
36 36 /**
37 37 * 任务类型2
  38 + * 1 正常 2 进场 3 出场
38 39 */
39 40 private String type2;
40 41  
... ... @@ -99,6 +100,11 @@ public class ChildTaskPlan {
99 100 private String nbbm;
100 101  
101 102 /**
  103 + * 中途换车营运, 新车关联的主任务ID,子任务删除时,主任务ID将级联
  104 + */
  105 + private Long ccId;
  106 +
  107 + /**
102 108 * 为true 则无售票员, 否则继承主任务
103 109 */
104 110 private boolean noClerk;
... ... @@ -277,4 +283,12 @@ public class ChildTaskPlan {
277 283 public void setNoClerk(boolean noClerk) {
278 284 this.noClerk = noClerk;
279 285 }
  286 +
  287 + public Long getCcId() {
  288 + return ccId;
  289 + }
  290 +
  291 + public void setCcId(Long ccId) {
  292 + this.ccId = ccId;
  293 + }
280 294 }
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -225,6 +225,11 @@ public class ScheduleRealInfo {
225 225 */
226 226 private Integer driftStatus = 0;
227 227  
  228 + /**
  229 + * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成
  230 + */
  231 + private boolean ccService;
  232 +
228 233 public boolean isDfAuto() {
229 234 return dfAuto;
230 235 }
... ... @@ -958,4 +963,12 @@ public class ScheduleRealInfo {
958 963 public void setDriftStatus(Integer driftStatus) {
959 964 this.driftStatus = driftStatus;
960 965 }
  966 +
  967 + public boolean isCcService() {
  968 + return ccService;
  969 + }
  970 +
  971 + public void setCcService(boolean ccService) {
  972 + this.ccService = ccService;
  973 + }
961 974 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
1 1 package com.bsth.service.realcontrol.impl;
2 2  
  3 +import com.alibaba.fastjson.JSON;
3 4 import com.bsth.common.ResponseCode;
4 5 import com.bsth.data.BasicData;
5 6 import com.bsth.data.Station2ParkBuffer;
... ... @@ -46,14 +47,11 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon
46 47 try {
47 48 ScheduleRealInfo sch = dayOfSchedule.get(t.getSchedule().getId());
48 49 //保存起终点名称
49   - //String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_";
50 50 if(StringUtils.isEmpty(t.getStartStationName()))
51 51 t.setStartStationName(getStationName(sch.getXlBm(), t.getStartStation()));
52   - //t.setStartStationName(BasicData.getStationNameByCode(t.getStartStation(), prefix));
53 52  
54 53 if(StringUtils.isEmpty(t.getEndStationName()))
55 54 t.setEndStationName(getStationName(sch.getXlBm(), t.getEndStation()));
56   - //t.setEndStationName(BasicData.getStationNameByCode(t.getEndStation(), prefix));
57 55 if(t.getDestroyReason() == null)
58 56 t.setDestroyReason("");
59 57  
... ... @@ -61,13 +59,44 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon
61 59 if(t.isDestroy() && StringUtils.isEmpty(t.getDestroyReason()))
62 60 t.setDestroyReason(t.getReason());
63 61  
  62 + //中途换车出场子任务,级联生成一个主任务,供报表和对外接口计算用
  63 + if(StringUtils.isNotEmpty(t.getNbbm())){
  64 + ScheduleRealInfo ccServiceSch = JSON.parseObject(JSON.toJSONString(sch), ScheduleRealInfo.class);
  65 + ccServiceSch.setId(null);
  66 + ccServiceSch.setSpId(null);
  67 + ccServiceSch.setClZbh(t.getNbbm());
  68 + ccServiceSch.setCcService(true);
  69 + ccServiceSch.setFcsj(t.getStartDate());
  70 + ccServiceSch.setDfsj(t.getStartDate());
  71 + ccServiceSch.setZdsj(t.getEndDate());
  72 + ccServiceSch.setBcsj(0);
  73 + ccServiceSch.setJhlcOrig(Double.parseDouble(String.valueOf(t.getMileage())));
  74 + ccServiceSch.setJhlc(ccServiceSch.getJhlcOrig());
  75 + ccServiceSch.setQdzCode(t.getStartStation());
  76 + ccServiceSch.setZdzCode(t.getEndStation());
  77 + ccServiceSch.setQdzName(t.getStartStationName());
  78 + ccServiceSch.setZdzName(t.getEndStationName());
  79 + ccServiceSch.setFcsjActual(ccServiceSch.getDfsj());
  80 + ccServiceSch.setZdsjActual(ccServiceSch.getZdsj());
  81 + if("1".equals(t.getType2())){
  82 + ccServiceSch.setBcType("normal");
  83 + }
  84 + else {
  85 + if("2".equals(t.getType2()))
  86 + ccServiceSch.setBcType("in");
  87 + else if("3".equals(t.getType2()))
  88 + ccServiceSch.setBcType("out");
  89 + }
  90 + //实时入库
  91 + ccServiceSch = scheduleRealInfoRepository.save(ccServiceSch);
  92 + t.setCcId(ccServiceSch.getId());
  93 + }
  94 +
64 95 //先持久化子任务
65 96 rs = super.save(t);
66 97 //关联主任务
67 98 sch.getcTasks().add(t);
68 99 dayOfSchedule.save(sch);
69   - //直接持久化
70   - //scheduleRealInfoRepository.save(sch);
71 100 //站到场对照
72 101 t.setSchedule(sch);
73 102 Station2ParkBuffer.put(t);
... ... @@ -101,6 +130,11 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl<ChildTaskPlan, Lon
101 130  
102 131 //删除子任务
103 132 rs = super.delete(id);
  133 +
  134 + //删除级联生成的换车主任务
  135 + if(null != cPlan.getCcId()){
  136 + scheduleRealInfoRepository.delete(cPlan.getCcId());
  137 + }
104 138 //dayOfSchedule.save(sch);
105 139 //解除和主任务关联
106 140 ScheduleRealInfo sch = dayOfSchedule.get(cPlan.getSchedule().getId());
... ...