Commit d4ed3f18af412489d1576b17c797364195269201

Authored by 潘钊
1 parent 33f20edb

update...

Too many changes to show.

To preserve performance only 7 of 12 files are displayed.

src/main/java/com/bsth/controller/realcontrol/LineConfigController.java
... ... @@ -44,4 +44,9 @@ public class LineConfigController extends BaseController<LineConfig, Integer>{
44 44 public LineConfig getByLineCode(@RequestParam String lineCode){
45 45 return lineConfigService.getByLineCode(lineCode);
46 46 }
  47 +
  48 + @RequestMapping(value = "/bufferTimeDiff", method = RequestMethod.POST)
  49 + public Map<String, Object> bufferTimeDiff(@RequestParam String lineCode, @RequestParam String field,@RequestParam String value){
  50 + return lineConfigService.bufferTimeDiff(lineCode, field, value);
  51 + }
47 52 }
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -8,10 +8,7 @@ import com.bsth.data.LineConfigData;
8 8 import com.bsth.data.directive.DirectivesPstThread;
9 9 import com.bsth.data.gpsdata.GpsRealData;
10 10 import com.bsth.data.gpsdata.recovery.GpsDataRecovery;
11   -import com.bsth.data.schedule.thread.ScheduleLateThread;
12   -import com.bsth.data.schedule.thread.SchedulePstThread;
13   -import com.bsth.data.schedule.thread.ScheduleRefreshThread;
14   -import com.bsth.data.schedule.thread.SubmitToTrafficManage;
  11 +import com.bsth.data.schedule.thread.*;
15 12 import com.bsth.entity.realcontrol.LineConfig;
16 13 import com.bsth.entity.realcontrol.ScheduleRealInfo;
17 14 import com.bsth.entity.schedule.SchedulePlanInfo;
... ... @@ -129,6 +126,9 @@ public class DayOfSchedule implements CommandLineRunner {
129 126 @Autowired
130 127 DirectivesPstThread directivesPstThread;
131 128  
  129 + @Autowired
  130 + CalcOilThread calcOilThread;
  131 +
132 132 private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"), fmtHHmm = DateTimeFormat.forPattern("HH:mm");
133 133  
134 134 @Override
... ... @@ -140,7 +140,7 @@ public class DayOfSchedule implements CommandLineRunner {
140 140 //翻班线程
141 141 Application.mainServices.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
142 142 //入库
143   -// Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 60, TimeUnit.SECONDS);
  143 +// Application.mainServices.scheduleWithFixedDelay(schedulePstThread, 60, 30, TimeUnit.SECONDS);
144 144 //班次误点扫描
145 145 // Application.mainServices.scheduleWithFixedDelay(scheduleLateThread, 60, 60, TimeUnit.SECONDS);
146 146  
... ... @@ -152,6 +152,9 @@ public class DayOfSchedule implements CommandLineRunner {
152 152 logger.info(diff / 1000 / 60 + "分钟之后提交到运管处");
153 153 //Application.mainServices.scheduleWithFixedDelay(submitToTrafficManage, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
154 154  
  155 + //计算油、公里加注
  156 + Application.mainServices.scheduleWithFixedDelay(calcOilThread, diff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
  157 +
155 158 //指令持久化线程
156 159 Application.mainServices.scheduleWithFixedDelay(directivesPstThread, 180, 180, TimeUnit.SECONDS);
157 160 }
... ...
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java 0 → 100644
  1 +package com.bsth.data.schedule.thread;
  2 +
  3 +import com.bsth.service.oil.YlbService;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +/**
  10 + * 计算油、公里加注量 线程
  11 + * Created by panzhao on 2017/3/7.
  12 + */
  13 +@Component
  14 +public class CalcOilThread extends Thread{
  15 +
  16 + @Autowired
  17 + YlbService ylbService;
  18 +
  19 + Logger logger = LoggerFactory.getLogger(this.getClass());
  20 +
  21 + @Override
  22 + public void run() {
  23 + try{
  24 + logger.info("开始计算路单里程加注量....");
  25 + ylbService.obtainDsq();
  26 + logger.info("计算路单里程加注量结束!");
  27 + } catch(Exception e){
  28 + logger.error("计算路单里程加注量失败",e);
  29 + }
  30 + }
  31 +}
... ...
src/main/java/com/bsth/data/schedule/thread/SubmitToTrafficManage.java
1 1 package com.bsth.data.schedule.thread;
2 2  
3 3 import com.bsth.service.TrafficManageService;
4   -import com.bsth.service.oil.YlbService;
5   -
6 4 import org.slf4j.Logger;
7 5 import org.slf4j.LoggerFactory;
8 6 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -19,18 +17,10 @@ public class SubmitToTrafficManage extends Thread{
19 17  
20 18 @Autowired
21 19 TrafficManageService trafficManageService;
22   -
23   - @Autowired
24   - YlbService YlbService;
25 20  
26 21 @Override
27 22 public void run() {
28 23 logger.info("开始提交数据到运管处...");
29   - try{
30   - YlbService.obtainDsq();
31   - } catch(Exception e){
32   - logger.error("计算路单里程加注量失败",e);
33   - }
34 24  
35 25 try {
36 26 //路单
... ...
src/main/java/com/bsth/service/realcontrol/LineConfigService.java
... ... @@ -18,4 +18,6 @@ public interface LineConfigService extends BaseService&lt;LineConfig, Integer&gt;{
18 18 LineConfig getByLineCode(String lineCode);
19 19  
20 20 Map<String,Object> enableInParkForSource(String lineCode, int enable);
  21 +
  22 + Map<String,Object> bufferTimeDiff(String lineCode, String field, String value);
21 23 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/LineConfigServiceImpl.java
... ... @@ -116,4 +116,25 @@ public class LineConfigServiceImpl extends BaseServiceImpl&lt;LineConfig, Integer&gt;
116 116 }
117 117 return rs;
118 118 }
  119 +
  120 + @Override
  121 + public Map<String, Object> bufferTimeDiff(String lineCode, String field, String value) {
  122 +
  123 + Map<String, Object> rs = new HashMap<>();
  124 + try {
  125 + LineConfig conf = lineConfigData.get(lineCode);
  126 +
  127 + conf.getClass().getField(field).set(conf, value);
  128 + lineConfigData.set(conf);
  129 +
  130 + rs.put("status", ResponseCode.SUCCESS);
  131 + rs.put("field", field);
  132 + rs.put("value", value);
  133 + } catch (Exception e) {
  134 + rs.put("status", ResponseCode.ERROR);
  135 + rs.put("msg", e.getMessage());
  136 + logger.error("", e);
  137 + }
  138 + return rs;
  139 + }
119 140 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -2339,6 +2339,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2339 2339 set.addAll(dayOfSchedule.changeCar(sch, cpc.getClZbh()));
2340 2340 }
2341 2341  
  2342 + dayOfSchedule.save(sch);
  2343 +
2342 2344 }
2343 2345 rs.put("ts", set);
2344 2346 rs.put("status", ResponseCode.SUCCESS);
... ... @@ -2354,7 +2356,12 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2354 2356 return;
2355 2357 String jName = BasicData.allPerson.get(jGh);
2356 2358 if (StringUtils.isNotEmpty(jName)) {
2357   - sch.setjGh(jGh);
  2359 +
  2360 + if(jGh.indexOf("-") != -1)
  2361 + sch.setjGh(jGh.substring(jGh.indexOf("-") + 1));
  2362 + else
  2363 + sch.setjGh(jGh);
  2364 +
2358 2365 sch.setjName(jName);
2359 2366 }
2360 2367 }
... ...