Commit 6f34477558e0c0da3ae8ac451c2e1d61ab114973

Authored by 潘钊
2 parents 68e2fecf 31a1bea8

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

Showing 24 changed files with 2052 additions and 851 deletions

Too many changes to show.

To preserve performance only 24 of 44 files are displayed.

src/main/java/com/bsth/controller/realcontrol/SchEditInfoController.java
1   -package com.bsth.controller.realcontrol;
2   -
3   -import com.bsth.controller.BaseController;
4   -import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
5   -import com.bsth.data.schedule.edit_logs.service.SchEditInfoService;
6   -import org.springframework.beans.factory.annotation.Autowired;
7   -import org.springframework.web.bind.annotation.RequestMapping;
8   -import org.springframework.web.bind.annotation.RequestMethod;
9   -import org.springframework.web.bind.annotation.RequestParam;
10   -import org.springframework.web.bind.annotation.RestController;
11   -
12   -import java.util.Map;
13   -
14   -/**
15   - * 班次修正记录
16   - * Created by panzhao on 2017/5/22.
17   - */
18   -@RestController
19   -@RequestMapping("schEditInfo")
20   -public class SchEditInfoController extends BaseController<SchEditInfo, Long>{
21   -
22   - @Autowired
23   - SchEditInfoService editInfoService;
24   -
25   - @RequestMapping(value = "/_list", method = RequestMethod.GET)
26   - public Map<String, Object> _list(@RequestParam String rq, @RequestParam String lineCode,@RequestParam Map<String, String> map) {
27   - return editInfoService._list(rq, lineCode, map);
28   - }
29   -}
  1 +package com.bsth.controller.realcontrol;
  2 +
  3 +import com.bsth.controller.BaseController;
  4 +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
  5 +import com.bsth.data.schedule.edit_logs.service.SchEditInfoService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import java.util.Map;
  13 +
  14 +/**
  15 + * 班次修正记录
  16 + * Created by panzhao on 2017/5/22.
  17 + */
  18 +@RestController
  19 +@RequestMapping("schEditInfo")
  20 +public class SchEditInfoController extends BaseController<SchEditInfo, Long>{
  21 +
  22 + @Autowired
  23 + SchEditInfoService editInfoService;
  24 +
  25 + @RequestMapping(value = "/_list", method = RequestMethod.GET)
  26 + public Map<String, Object> _list(@RequestParam String rq, @RequestParam String lineCode,@RequestParam Map<String, String> map) {
  27 + return editInfoService._list(rq, lineCode, map);
  28 + }
  29 +}
... ...
src/main/java/com/bsth/controller/report/SheetController.java 0 → 100644
  1 +package com.bsth.controller.report;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.controller.BaseController;
  13 +import com.bsth.entity.sheet.Sheet;
  14 +import com.bsth.service.report.SheetService;
  15 +
  16 +@RestController
  17 +@RequestMapping("sheet")
  18 +public class SheetController extends BaseController<Sheet, Integer>{
  19 + @Autowired
  20 + SheetService sheetService;
  21 + @RequestMapping(value = "/saveListSheet",method = RequestMethod.POST)
  22 + public String saveListSheet(){
  23 + String result="";
  24 + try {
  25 + result = sheetService.saveSheetList();
  26 + } catch (Exception e) {
  27 + // TODO Auto-generated catch block
  28 + e.printStackTrace();
  29 + }
  30 + return result;
  31 + }
  32 +
  33 +
  34 + @RequestMapping(value = "/sheetList",method = RequestMethod.GET)
  35 + public List<Sheet> sheetList(@RequestParam Integer id){
  36 + List<Sheet> list=sheetService.sheetList(id);
  37 + return list;
  38 + }
  39 + @RequestMapping(value = "/countList",method = RequestMethod.GET)
  40 + public List<Map<String, Object>> countList(@RequestParam Map<String, Object> map){
  41 + List<Map<String, Object>> list=sheetService.countList(map);
  42 + return list;
  43 + }
  44 +}
... ...
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
... ... @@ -7,10 +7,7 @@ import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
7 7 import com.bsth.service.schedule.EmployeeConfigInfoService;
8 8 import com.bsth.service.schedule.exception.ScheduleException;
9 9 import org.springframework.beans.factory.annotation.Autowired;
10   -import org.springframework.web.bind.annotation.RequestMapping;
11   -import org.springframework.web.bind.annotation.RequestMethod;
12   -import org.springframework.web.bind.annotation.RequestParam;
13   -import org.springframework.web.bind.annotation.RestController;
  10 +import org.springframework.web.bind.annotation.*;
14 11  
15 12 import java.util.HashMap;
16 13 import java.util.List;
... ... @@ -38,6 +35,19 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
38 35 }
39 36  
40 37  
  38 + @RequestMapping(value = "/dbbm/{xlid}", method = RequestMethod.GET)
  39 + public Map<String, Object> getDbbm(@PathVariable("xlid") Integer xl) {
  40 + Map<String, Object> rtn = new HashMap<>();
  41 + try {
  42 + rtn.put("data", employeeConfigInfoService.getMaxDbbm(xl));
  43 + rtn.put("status", ResponseCode.SUCCESS);
  44 + } catch (Exception exp) {
  45 + exp.printStackTrace();
  46 + rtn.put("status", ResponseCode.ERROR);
  47 + rtn.put("msg", exp.getMessage());
  48 + }
  49 + return rtn;
  50 + }
41 51  
42 52 @RequestMapping(value = "/validate_jsy", method = RequestMethod.GET)
43 53 public Map<String, Object> validate_jsy(@RequestParam Map<String, Object> param) {
... ...
src/main/java/com/bsth/controller/schedule/core/GuideboardInfoController.java
... ... @@ -7,10 +7,7 @@ import com.bsth.repository.schedule.GuideboardInfoRepository;
7 7 import com.bsth.service.schedule.GuideboardInfoService;
8 8 import com.bsth.service.schedule.exception.ScheduleException;
9 9 import org.springframework.beans.factory.annotation.Autowired;
10   -import org.springframework.web.bind.annotation.RequestMapping;
11   -import org.springframework.web.bind.annotation.RequestMethod;
12   -import org.springframework.web.bind.annotation.RequestParam;
13   -import org.springframework.web.bind.annotation.RestController;
  10 +import org.springframework.web.bind.annotation.*;
14 11  
15 12 import java.util.HashMap;
16 13 import java.util.List;
... ... @@ -33,6 +30,21 @@ public class GuideboardInfoController extends BController&lt;GuideboardInfo, Long&gt;
33 30 return guideboardInfoRepository.findLpName(ttid);
34 31 }
35 32  
  33 + @RequestMapping(value = "lpno/{xlid}", method = RequestMethod.GET)
  34 + public Map<String, Object> getLpNo(@PathVariable("xlid") Integer xl) {
  35 + Map<String, Object> rtn = new HashMap<>();
  36 + try {
  37 + rtn.put("data", guideboardInfoService.getMaxLpno(xl));
  38 + rtn.put("status", ResponseCode.SUCCESS);
  39 + } catch (Exception exp) {
  40 + exp.printStackTrace();
  41 + rtn.put("status", ResponseCode.ERROR);
  42 + rtn.put("msg", exp.getMessage());
  43 + }
  44 +
  45 + return rtn;
  46 + }
  47 +
36 48 @RequestMapping(value = "/validate_lpno", method = RequestMethod.GET)
37 49 public Map<String, Object> validate_lpno(@RequestParam Map<String, Object> param) {
38 50 Map<String, Object> rtn = new HashMap<>();
... ...
src/main/java/com/bsth/data/schedule/edit_logs/ScheduleModifyLogger.java
1   -package com.bsth.data.schedule.edit_logs;
2   -
3   -import com.alibaba.fastjson.JSONArray;
4   -import com.alibaba.fastjson.JSONObject;
5   -import com.bsth.controller.realcontrol.dto.ChangePersonCar;
6   -import com.bsth.data.schedule.edit_logs.entity.EditType;
7   -import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
8   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
9   -import org.apache.commons.lang3.StringUtils;
10   -import org.slf4j.Logger;
11   -import org.slf4j.LoggerFactory;
12   -
13   -import java.util.LinkedList;
14   -
15   -/**
16   - * 班次修正记录
17   - * Created by panzhao on 2017/5/16.
18   - */
19   -public class ScheduleModifyLogger {
20   -
21   - public static LinkedList<SchEditInfo> list;
22   -
23   - static {
24   - list = new LinkedList<>();
25   - }
26   -
27   - static Logger log = LoggerFactory.getLogger(ScheduleModifyLogger.class);
28   -
29   - /**
30   - * 待发调整
31   - * opType 0: 双击调整、 1:待发调整、2:批量待发调整、3:间隔调整
32   - */
33   - public static void dftz(ScheduleRealInfo sch, String opType, String oldDfsj, String nowDfsj, String remarks) {
34   - try {
35   - if (oldDfsj.equals(nowDfsj))
36   - return;
37   -
38   - SchEditInfo sei = SchEditInfo.getInstance(sch);
39   - sei.setType(EditType.DFTZ);
40   - sei.setType2(opType);
41   - sei.setRemarks(remarks == null ? "" : remarks);
42   -
43   - //detail
44   - JSONObject jobj = new JSONObject();
45   - jobj.put("old", oldDfsj);
46   - jobj.put("now", nowDfsj);
47   -
48   - sei.setJsonArray(jobj.toJSONString());
49   -
50   - put(sei);
51   - } catch (Exception e) {
52   - log.error("", e);
53   - }
54   - }
55   -
56   - /**
57   - * 发车信息微调记录器
58   - */
59   - public static void fcxxwt(ScheduleRealInfo sch, String remarks, JSONArray jsonArray) {
60   -
61   - try {
62   - if (jsonArray == null || jsonArray.size() == 0)
63   - return;
64   -
65   - SchEditInfo sei = SchEditInfo.getInstance(sch);
66   - sei.setRemarks(remarks);
67   - sei.setJsonArray(jsonArray.toJSONString());
68   - sei.setType(EditType.FCXXWT);
69   -
70   - put(sei);
71   - } catch (Exception e) {
72   - log.error("", e);
73   - }
74   - }
75   -
76   - /**
77   - * 计划烂班
78   - *
79   - * @param remarks
80   - */
81   - public static void jhlb(ScheduleRealInfo sch, String remarks) {
82   - try {
83   - SchEditInfo sei = SchEditInfo.getInstance(sch);
84   - sei.setRemarks(remarks);
85   - sei.setType(EditType.JHLB);
86   -
87   - put(sei);
88   - } catch (Exception e) {
89   - log.error("", e);
90   - }
91   - }
92   -
93   - /**
94   - * 实发调整
95   - *
96   - * @param sch
97   - * @param nowSfsj
98   - * @param remarks
99   - */
100   - public static void sftz(ScheduleRealInfo sch, String nowSfsj, String remarks) {
101   - try {
102   - SchEditInfo sei = SchEditInfo.getInstance(sch);
103   - sei.setRemarks(remarks);
104   - sei.setType(EditType.SFTZ);
105   - //detail
106   - JSONObject jobj = new JSONObject();
107   - jobj.put("old", sch.getFcsjActual());
108   - jobj.put("now", nowSfsj);
109   -
110   - sei.setJsonArray(jobj.toJSONString());
111   - put(sei);
112   - } catch (Exception e) {
113   - log.error("", e);
114   - }
115   - }
116   -
117   - /**
118   - * 撤销烂班
119   - *
120   - * @param sch
121   - */
122   - public static void cxlb(ScheduleRealInfo sch) {
123   - try {
124   - SchEditInfo sei = SchEditInfo.getInstance(sch);
125   - sei.setType(EditType.CXLB);
126   -
127   - put(sei);
128   - } catch (Exception e) {
129   - log.error("", e);
130   - }
131   - }
132   -
133   - /**
134   - * 撤销执行
135   - *
136   - * @param sch
137   - */
138   - public static void cxzx(ScheduleRealInfo sch) {
139   - try {
140   - SchEditInfo sei = SchEditInfo.getInstance(sch);
141   - sei.setType(EditType.CXZX);
142   -
143   - //detail
144   - JSONObject obj = new JSONObject();
145   - if (StringUtils.isNotEmpty(sch.getFcsjActual()))
146   - obj.put("old_sfsj", sch.getFcsjActual());
147   -
148   - if (StringUtils.isNotEmpty(sch.getZdsjActual()))
149   - obj.put("old_sdsj", sch.getZdsjActual());
150   -
151   - sei.setJsonArray(obj.toJSONString());
152   - put(sei);
153   - } catch (Exception e) {
154   - log.error("", e);
155   - }
156   - }
157   -
158   - /**
159   - * 撤销实发
160   - *
161   - * @param sch
162   - */
163   - public static void cxsf(ScheduleRealInfo sch) {
164   - try {
165   - SchEditInfo sei = SchEditInfo.getInstance(sch);
166   - sei.setType(EditType.CXSF);
167   -
168   - //detail
169   - JSONObject obj = new JSONObject();
170   - obj.put("old_sfsj", sch.getFcsjActual());
171   -
172   - sei.setJsonArray(obj.toJSONString());
173   - put(sei);
174   - } catch (Exception e) {
175   - log.error("", e);
176   - }
177   - }
178   -
179   - /**
180   - * 调整人车
181   - *
182   - * @param sch
183   - * @param cpc
184   - */
185   - public static void tzrc(ScheduleRealInfo sch, ChangePersonCar cpc) {
186   - try {
187   - String newNbbm = cpc.getClZbh();
188   - String newJsy = cpc.getJsy();
189   - String newSpy = cpc.getSpy();
190   - //String oldJsy = sch.getjGh() + "/" + sch.getjName();
191   -
192   - if (newNbbm == null && newJsy == null && newSpy==null)
193   - return;
194   - /*if (newNbbm != null && newJsy != null
195   - && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy))
196   - return;*/
197   -
198   -
199   - SchEditInfo sei = SchEditInfo.getInstance(sch);
200   - sei.setType(EditType.TZRC);
201   -
202   - //detail
203   - JSONObject jobj = new JSONObject();
204   - if (StringUtils.isNotEmpty(newNbbm) && !newNbbm.equals(sch.getClZbh())) {
205   - jobj.put("old_nbbm", sch.getClZbh());
206   - jobj.put("now_nbbm", newNbbm);
207   - }
208   -
209   - String oldJsy = sch.getjGh() + "/" + sch.getjName();
210   - if (StringUtils.isNotEmpty(newJsy) && !newJsy.equals(oldJsy)) {
211   - jobj.put("old_jsy", oldJsy);
212   - jobj.put("now_jsy", newJsy);
213   - }
214   -
215   - String oldSpy = sch.getsGh() + "/" + sch.getsName();
216   - if (StringUtils.isNotEmpty(newSpy) && !newSpy.equals(oldSpy)) {
217   - jobj.put("old_spy", oldSpy);
218   - jobj.put("now_spy", cpc.getSpy());
219   - }
220   -
221   - sei.setJsonArray(jobj.toJSONString());
222   - put(sei);
223   - } catch (Exception e) {
224   - log.error("", e);
225   - }
226   - }
227   -
228   - public static void put(SchEditInfo sei) {
229   - list.add(sei);
230   - }
231   -}
  1 +package com.bsth.data.schedule.edit_logs;
  2 +
  3 +import com.alibaba.fastjson.JSONArray;
  4 +import com.alibaba.fastjson.JSONObject;
  5 +import com.bsth.controller.realcontrol.dto.ChangePersonCar;
  6 +import com.bsth.data.schedule.edit_logs.entity.EditType;
  7 +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
  8 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  9 +import org.apache.commons.lang3.StringUtils;
  10 +import org.slf4j.Logger;
  11 +import org.slf4j.LoggerFactory;
  12 +
  13 +import java.util.LinkedList;
  14 +
  15 +/**
  16 + * 班次修正记录
  17 + * Created by panzhao on 2017/5/16.
  18 + */
  19 +public class ScheduleModifyLogger {
  20 +
  21 + public static LinkedList<SchEditInfo> list;
  22 +
  23 + static {
  24 + list = new LinkedList<>();
  25 + }
  26 +
  27 + static Logger log = LoggerFactory.getLogger(ScheduleModifyLogger.class);
  28 +
  29 + /**
  30 + * 待发调整
  31 + * opType 0: 双击调整、 1:待发调整、2:批量待发调整、3:间隔调整
  32 + */
  33 + public static void dftz(ScheduleRealInfo sch, String opType, String oldDfsj, String nowDfsj, String remarks) {
  34 + try {
  35 + if (oldDfsj.equals(nowDfsj))
  36 + return;
  37 +
  38 + SchEditInfo sei = SchEditInfo.getInstance(sch);
  39 + sei.setType(EditType.DFTZ);
  40 + sei.setType2(opType);
  41 + sei.setRemarks(remarks == null ? "" : remarks);
  42 +
  43 + //detail
  44 + JSONObject jobj = new JSONObject();
  45 + jobj.put("old", oldDfsj);
  46 + jobj.put("now", nowDfsj);
  47 +
  48 + sei.setJsonArray(jobj.toJSONString());
  49 +
  50 + put(sei);
  51 + } catch (Exception e) {
  52 + log.error("", e);
  53 + }
  54 + }
  55 +
  56 + /**
  57 + * 发车信息微调记录器
  58 + */
  59 + public static void fcxxwt(ScheduleRealInfo sch, String remarks, JSONArray jsonArray) {
  60 +
  61 + try {
  62 + if (jsonArray == null || jsonArray.size() == 0)
  63 + return;
  64 +
  65 + SchEditInfo sei = SchEditInfo.getInstance(sch);
  66 + sei.setRemarks(remarks);
  67 + sei.setJsonArray(jsonArray.toJSONString());
  68 + sei.setType(EditType.FCXXWT);
  69 +
  70 + put(sei);
  71 + } catch (Exception e) {
  72 + log.error("", e);
  73 + }
  74 + }
  75 +
  76 + /**
  77 + * 计划烂班
  78 + *
  79 + * @param remarks
  80 + */
  81 + public static void jhlb(ScheduleRealInfo sch, String remarks) {
  82 + try {
  83 + SchEditInfo sei = SchEditInfo.getInstance(sch);
  84 + sei.setRemarks(remarks);
  85 + sei.setType(EditType.JHLB);
  86 +
  87 + put(sei);
  88 + } catch (Exception e) {
  89 + log.error("", e);
  90 + }
  91 + }
  92 +
  93 + /**
  94 + * 实发调整
  95 + *
  96 + * @param sch
  97 + * @param nowSfsj
  98 + * @param remarks
  99 + */
  100 + public static void sftz(ScheduleRealInfo sch, String nowSfsj, String remarks) {
  101 + try {
  102 + SchEditInfo sei = SchEditInfo.getInstance(sch);
  103 + sei.setRemarks(remarks);
  104 + sei.setType(EditType.SFTZ);
  105 + //detail
  106 + JSONObject jobj = new JSONObject();
  107 + jobj.put("old", sch.getFcsjActual());
  108 + jobj.put("now", nowSfsj);
  109 +
  110 + sei.setJsonArray(jobj.toJSONString());
  111 + put(sei);
  112 + } catch (Exception e) {
  113 + log.error("", e);
  114 + }
  115 + }
  116 +
  117 + /**
  118 + * 撤销烂班
  119 + *
  120 + * @param sch
  121 + */
  122 + public static void cxlb(ScheduleRealInfo sch) {
  123 + try {
  124 + SchEditInfo sei = SchEditInfo.getInstance(sch);
  125 + sei.setType(EditType.CXLB);
  126 +
  127 + put(sei);
  128 + } catch (Exception e) {
  129 + log.error("", e);
  130 + }
  131 + }
  132 +
  133 + /**
  134 + * 撤销执行
  135 + *
  136 + * @param sch
  137 + */
  138 + public static void cxzx(ScheduleRealInfo sch) {
  139 + try {
  140 + SchEditInfo sei = SchEditInfo.getInstance(sch);
  141 + sei.setType(EditType.CXZX);
  142 +
  143 + //detail
  144 + JSONObject obj = new JSONObject();
  145 + if (StringUtils.isNotEmpty(sch.getFcsjActual()))
  146 + obj.put("old_sfsj", sch.getFcsjActual());
  147 +
  148 + if (StringUtils.isNotEmpty(sch.getZdsjActual()))
  149 + obj.put("old_sdsj", sch.getZdsjActual());
  150 +
  151 + sei.setJsonArray(obj.toJSONString());
  152 + put(sei);
  153 + } catch (Exception e) {
  154 + log.error("", e);
  155 + }
  156 + }
  157 +
  158 + /**
  159 + * 撤销实发
  160 + *
  161 + * @param sch
  162 + */
  163 + public static void cxsf(ScheduleRealInfo sch) {
  164 + try {
  165 + SchEditInfo sei = SchEditInfo.getInstance(sch);
  166 + sei.setType(EditType.CXSF);
  167 +
  168 + //detail
  169 + JSONObject obj = new JSONObject();
  170 + obj.put("old_sfsj", sch.getFcsjActual());
  171 +
  172 + sei.setJsonArray(obj.toJSONString());
  173 + put(sei);
  174 + } catch (Exception e) {
  175 + log.error("", e);
  176 + }
  177 + }
  178 +
  179 + /**
  180 + * 调整人车
  181 + *
  182 + * @param sch
  183 + * @param cpc
  184 + */
  185 + public static void tzrc(ScheduleRealInfo sch, ChangePersonCar cpc) {
  186 + try {
  187 + String newNbbm = cpc.getClZbh();
  188 + String newJsy = cpc.getJsy();
  189 + String newSpy = cpc.getSpy();
  190 + //String oldJsy = sch.getjGh() + "/" + sch.getjName();
  191 +
  192 + if (newNbbm == null && newJsy == null && newSpy==null)
  193 + return;
  194 + /*if (newNbbm != null && newJsy != null
  195 + && newNbbm.equals(sch.getClZbh()) && newJsy.equals(oldJsy))
  196 + return;*/
  197 +
  198 +
  199 + SchEditInfo sei = SchEditInfo.getInstance(sch);
  200 + sei.setType(EditType.TZRC);
  201 +
  202 + //detail
  203 + JSONObject jobj = new JSONObject();
  204 + if (StringUtils.isNotEmpty(newNbbm) && !newNbbm.equals(sch.getClZbh())) {
  205 + jobj.put("old_nbbm", sch.getClZbh());
  206 + jobj.put("now_nbbm", newNbbm);
  207 + }
  208 +
  209 + String oldJsy = sch.getjGh() + "/" + sch.getjName();
  210 + if (StringUtils.isNotEmpty(newJsy) && !newJsy.equals(oldJsy)) {
  211 + jobj.put("old_jsy", oldJsy);
  212 + jobj.put("now_jsy", newJsy);
  213 + }
  214 +
  215 + String oldSpy = sch.getsGh() + "/" + sch.getsName();
  216 + if (StringUtils.isNotEmpty(newSpy) && !newSpy.equals(oldSpy)) {
  217 + jobj.put("old_spy", oldSpy);
  218 + jobj.put("now_spy", cpc.getSpy());
  219 + }
  220 +
  221 + sei.setJsonArray(jobj.toJSONString());
  222 + put(sei);
  223 + } catch (Exception e) {
  224 + log.error("", e);
  225 + }
  226 + }
  227 +
  228 + public static void put(SchEditInfo sei) {
  229 + list.add(sei);
  230 + }
  231 +}
... ...
src/main/java/com/bsth/data/schedule/edit_logs/SeiPstThread.java
1   -package com.bsth.data.schedule.edit_logs;
2   -
3   -import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
4   -import com.bsth.data.schedule.edit_logs.repository.EditInfoRepository;
5   -import org.slf4j.Logger;
6   -import org.slf4j.LoggerFactory;
7   -import org.springframework.beans.factory.annotation.Autowired;
8   -import org.springframework.stereotype.Component;
9   -
10   -import java.util.ArrayList;
11   -import java.util.LinkedList;
12   -import java.util.List;
13   -
14   -/**
15   - * 班次修正日志入库
16   - * Created by panzhao on 2017/5/19.
17   - */
18   -@Component
19   -public class SeiPstThread extends Thread{
20   -
21   - @Autowired
22   - EditInfoRepository repository;
23   -
24   - Logger log = LoggerFactory.getLogger(this.getClass());
25   -
26   - @Override
27   - public void run() {
28   - try{
29   - List<SchEditInfo> pstList = new ArrayList<>();
30   - LinkedList<SchEditInfo> list = ScheduleModifyLogger.list;
31   - SchEditInfo sei;
32   - for(int i = 0; i < 1000; i ++){
33   - sei = list.poll();
34   - if(sei == null)
35   - break;
36   - else{
37   - //repository.save(sei);
38   - pstList.add(sei);
39   - }
40   - }
41   -
42   - repository.save(pstList);
43   - }catch (Exception e){
44   - log.error("", e);
45   - }
46   - }
  1 +package com.bsth.data.schedule.edit_logs;
  2 +
  3 +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
  4 +import com.bsth.data.schedule.edit_logs.repository.EditInfoRepository;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import java.util.ArrayList;
  11 +import java.util.LinkedList;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * 班次修正日志入库
  16 + * Created by panzhao on 2017/5/19.
  17 + */
  18 +@Component
  19 +public class SeiPstThread extends Thread{
  20 +
  21 + @Autowired
  22 + EditInfoRepository repository;
  23 +
  24 + Logger log = LoggerFactory.getLogger(this.getClass());
  25 +
  26 + @Override
  27 + public void run() {
  28 + try{
  29 + List<SchEditInfo> pstList = new ArrayList<>();
  30 + LinkedList<SchEditInfo> list = ScheduleModifyLogger.list;
  31 + SchEditInfo sei;
  32 + for(int i = 0; i < 1000; i ++){
  33 + sei = list.poll();
  34 + if(sei == null)
  35 + break;
  36 + else{
  37 + //repository.save(sei);
  38 + pstList.add(sei);
  39 + }
  40 + }
  41 +
  42 + repository.save(pstList);
  43 + }catch (Exception e){
  44 + log.error("", e);
  45 + }
  46 + }
47 47 }
48 48 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/edit_logs/entity/EditType.java
1   -package com.bsth.data.schedule.edit_logs.entity;
2   -
3   -/**
4   - * Created by panzhao on 2017/5/18.
5   - */
6   -public enum EditType {
7   -
8   - DFTZ,SFTZ,FCXXWT,TZRC,LPDD,ZRW,JHLB,CXLB, CXSF, CXZX
  1 +package com.bsth.data.schedule.edit_logs.entity;
  2 +
  3 +/**
  4 + * Created by panzhao on 2017/5/18.
  5 + */
  6 +public enum EditType {
  7 +
  8 + DFTZ,SFTZ,FCXXWT,TZRC,LPDD,ZRW,JHLB,CXLB, CXSF, CXZX
9 9 }
10 10 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/edit_logs/entity/SchEditInfo.java
1   -package com.bsth.data.schedule.edit_logs.entity;
2   -
3   -import com.bsth.entity.realcontrol.ScheduleRealInfo;
4   -import com.bsth.entity.sys.SysUser;
5   -import com.bsth.security.util.SecurityUtils;
6   -import org.joda.time.format.DateTimeFormat;
7   -import org.joda.time.format.DateTimeFormatter;
8   -
9   -import javax.persistence.*;
10   -
11   -/**
12   - * Created by panzhao on 2017/5/18.
13   - */
14   -@Entity
15   -@Table(name = "logger_sch_modify")
16   -public class SchEditInfo {
17   -
18   - @Id
19   - @GeneratedValue
20   - private long id;
21   - /**
22   - * 日期 yyyy-MM-dd
23   - */
24   - private String rq;
25   -
26   - /**
27   - * 时间 HH:mm
28   - */
29   - private String timeStr;
30   -
31   - /** 时间戳 */
32   - private long ts;
33   -
34   - private String lineCode;
35   -
36   - private String gsbm;
37   -
38   - private String fgsbm;
39   -
40   - /**
41   - * 班次ID
42   - */
43   - private long schId;
44   -
45   - /**
46   - * 类型
47   - */
48   - @Enumerated(EnumType.STRING)
49   - private EditType type;
50   -
51   - private String type2;
52   - /**
53   - * 操作人 @system 系统/用户名
54   - */
55   - private String user;
56   -
57   - /**
58   - * 操作明细
59   - */
60   - @Column(length = 2000)
61   - private String jsonArray;
62   -
63   - private String remarks;
64   -
65   - public String getRq() {
66   - return rq;
67   - }
68   -
69   - public void setRq(String rq) {
70   - this.rq = rq;
71   - }
72   -
73   - public String getTimeStr() {
74   - return timeStr;
75   - }
76   -
77   - public void setTimeStr(String timeStr) {
78   - this.timeStr = timeStr;
79   - }
80   -
81   - public long getSchId() {
82   - return schId;
83   - }
84   -
85   - public void setSchId(long schId) {
86   - this.schId = schId;
87   - }
88   -
89   - public EditType getType() {
90   - return type;
91   - }
92   -
93   - public void setType(EditType type) {
94   - this.type = type;
95   - }
96   -
97   - public String getUser() {
98   - return user;
99   - }
100   -
101   - public void setUser(String user) {
102   - this.user = user;
103   - }
104   -
105   - public long getId() {
106   - return id;
107   - }
108   -
109   - public void setId(long id) {
110   - this.id = id;
111   - }
112   -
113   - public String getJsonArray() {
114   - return jsonArray;
115   - }
116   -
117   - public void setJsonArray(String jsonArray) {
118   - this.jsonArray = jsonArray;
119   - }
120   -
121   - public String getType2() {
122   - return type2;
123   - }
124   -
125   - public void setType2(String type2) {
126   - this.type2 = type2;
127   - }
128   -
129   - public String getRemarks() {
130   - return remarks;
131   - }
132   -
133   - public void setRemarks(String remarks) {
134   - this.remarks = remarks;
135   - }
136   -
137   -
138   - @Transient
139   - private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
140   - /* @Transient
141   - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");*/
142   - public static SchEditInfo getInstance(ScheduleRealInfo sch){
143   - SchEditInfo sei = new SchEditInfo();
144   - long t = System.currentTimeMillis();
145   -
146   - sei.setTs(t);
147   - sei.setTimeStr(fmtHHmm.print(t));
148   -
149   - SysUser user = SecurityUtils.getCurrentUser();
150   - if(user != null)
151   - sei.setUser(user.getUserName());
152   -
153   - if(sch != null){
154   - sei.setRq(sch.getScheduleDateStr());
155   - sei.setSchId(sch.getId());
156   - sei.setLineCode(sch.getXlBm());
157   - sei.setGsbm(sch.getGsBm());
158   - sei.setFgsbm(sch.getFgsBm());
159   - }
160   - return sei;
161   - }
162   -
163   - public String getLineCode() {
164   - return lineCode;
165   - }
166   -
167   - public void setLineCode(String lineCode) {
168   - this.lineCode = lineCode;
169   - }
170   -
171   - public String getGsbm() {
172   - return gsbm;
173   - }
174   -
175   - public void setGsbm(String gsbm) {
176   - this.gsbm = gsbm;
177   - }
178   -
179   - public String getFgsbm() {
180   - return fgsbm;
181   - }
182   -
183   - public void setFgsbm(String fgsbm) {
184   - this.fgsbm = fgsbm;
185   - }
186   -
187   - public long getTs() {
188   - return ts;
189   - }
190   -
191   - public void setTs(long ts) {
192   - this.ts = ts;
193   - }
  1 +package com.bsth.data.schedule.edit_logs.entity;
  2 +
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import com.bsth.entity.sys.SysUser;
  5 +import com.bsth.security.util.SecurityUtils;
  6 +import org.joda.time.format.DateTimeFormat;
  7 +import org.joda.time.format.DateTimeFormatter;
  8 +
  9 +import javax.persistence.*;
  10 +
  11 +/**
  12 + * Created by panzhao on 2017/5/18.
  13 + */
  14 +@Entity
  15 +@Table(name = "logger_sch_modify")
  16 +public class SchEditInfo {
  17 +
  18 + @Id
  19 + @GeneratedValue
  20 + private long id;
  21 + /**
  22 + * 日期 yyyy-MM-dd
  23 + */
  24 + private String rq;
  25 +
  26 + /**
  27 + * 时间 HH:mm
  28 + */
  29 + private String timeStr;
  30 +
  31 + /** 时间戳 */
  32 + private long ts;
  33 +
  34 + private String lineCode;
  35 +
  36 + private String gsbm;
  37 +
  38 + private String fgsbm;
  39 +
  40 + /**
  41 + * 班次ID
  42 + */
  43 + private long schId;
  44 +
  45 + /**
  46 + * 类型
  47 + */
  48 + @Enumerated(EnumType.STRING)
  49 + private EditType type;
  50 +
  51 + private String type2;
  52 + /**
  53 + * 操作人 @system 系统/用户名
  54 + */
  55 + private String user;
  56 +
  57 + /**
  58 + * 操作明细
  59 + */
  60 + @Column(length = 2000)
  61 + private String jsonArray;
  62 +
  63 + private String remarks;
  64 +
  65 + public String getRq() {
  66 + return rq;
  67 + }
  68 +
  69 + public void setRq(String rq) {
  70 + this.rq = rq;
  71 + }
  72 +
  73 + public String getTimeStr() {
  74 + return timeStr;
  75 + }
  76 +
  77 + public void setTimeStr(String timeStr) {
  78 + this.timeStr = timeStr;
  79 + }
  80 +
  81 + public long getSchId() {
  82 + return schId;
  83 + }
  84 +
  85 + public void setSchId(long schId) {
  86 + this.schId = schId;
  87 + }
  88 +
  89 + public EditType getType() {
  90 + return type;
  91 + }
  92 +
  93 + public void setType(EditType type) {
  94 + this.type = type;
  95 + }
  96 +
  97 + public String getUser() {
  98 + return user;
  99 + }
  100 +
  101 + public void setUser(String user) {
  102 + this.user = user;
  103 + }
  104 +
  105 + public long getId() {
  106 + return id;
  107 + }
  108 +
  109 + public void setId(long id) {
  110 + this.id = id;
  111 + }
  112 +
  113 + public String getJsonArray() {
  114 + return jsonArray;
  115 + }
  116 +
  117 + public void setJsonArray(String jsonArray) {
  118 + this.jsonArray = jsonArray;
  119 + }
  120 +
  121 + public String getType2() {
  122 + return type2;
  123 + }
  124 +
  125 + public void setType2(String type2) {
  126 + this.type2 = type2;
  127 + }
  128 +
  129 + public String getRemarks() {
  130 + return remarks;
  131 + }
  132 +
  133 + public void setRemarks(String remarks) {
  134 + this.remarks = remarks;
  135 + }
  136 +
  137 +
  138 + @Transient
  139 + private static DateTimeFormatter fmtHHmm = DateTimeFormat.forPattern("HH:mm");
  140 + /* @Transient
  141 + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd");*/
  142 + public static SchEditInfo getInstance(ScheduleRealInfo sch){
  143 + SchEditInfo sei = new SchEditInfo();
  144 + long t = System.currentTimeMillis();
  145 +
  146 + sei.setTs(t);
  147 + sei.setTimeStr(fmtHHmm.print(t));
  148 +
  149 + SysUser user = SecurityUtils.getCurrentUser();
  150 + if(user != null)
  151 + sei.setUser(user.getUserName());
  152 +
  153 + if(sch != null){
  154 + sei.setRq(sch.getScheduleDateStr());
  155 + sei.setSchId(sch.getId());
  156 + sei.setLineCode(sch.getXlBm());
  157 + sei.setGsbm(sch.getGsBm());
  158 + sei.setFgsbm(sch.getFgsBm());
  159 + }
  160 + return sei;
  161 + }
  162 +
  163 + public String getLineCode() {
  164 + return lineCode;
  165 + }
  166 +
  167 + public void setLineCode(String lineCode) {
  168 + this.lineCode = lineCode;
  169 + }
  170 +
  171 + public String getGsbm() {
  172 + return gsbm;
  173 + }
  174 +
  175 + public void setGsbm(String gsbm) {
  176 + this.gsbm = gsbm;
  177 + }
  178 +
  179 + public String getFgsbm() {
  180 + return fgsbm;
  181 + }
  182 +
  183 + public void setFgsbm(String fgsbm) {
  184 + this.fgsbm = fgsbm;
  185 + }
  186 +
  187 + public long getTs() {
  188 + return ts;
  189 + }
  190 +
  191 + public void setTs(long ts) {
  192 + this.ts = ts;
  193 + }
194 194 }
195 195 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/edit_logs/service/SchEditInfoService.java
1   -package com.bsth.data.schedule.edit_logs.service;
2   -
3   -import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
4   -import com.bsth.service.BaseService;
5   -
6   -import java.util.Map;
7   -
8   -/**
9   - * Created by panzhao on 2017/5/22.
10   - */
11   -public interface SchEditInfoService extends BaseService<SchEditInfo, Long> {
12   -
13   - Map<String, Object> _list(String rq, String lineCode, Map<String, String> map);
14   -}
  1 +package com.bsth.data.schedule.edit_logs.service;
  2 +
  3 +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
  4 +import com.bsth.service.BaseService;
  5 +
  6 +import java.util.Map;
  7 +
  8 +/**
  9 + * Created by panzhao on 2017/5/22.
  10 + */
  11 +public interface SchEditInfoService extends BaseService<SchEditInfo, Long> {
  12 +
  13 + Map<String, Object> _list(String rq, String lineCode, Map<String, String> map);
  14 +}
... ...
src/main/java/com/bsth/data/schedule/edit_logs/service/SchEditInfoServiceImpl.java
1   -package com.bsth.data.schedule.edit_logs.service;
2   -
3   -import com.bsth.common.ResponseCode;
4   -import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
5   -import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
6   -import com.bsth.service.impl.BaseServiceImpl;
7   -import com.bsth.util.BatchSaveUtils;
8   -import org.apache.commons.lang3.StringUtils;
9   -import org.slf4j.Logger;
10   -import org.slf4j.LoggerFactory;
11   -import org.springframework.beans.factory.annotation.Autowired;
12   -import org.springframework.jdbc.core.BeanPropertyRowMapper;
13   -import org.springframework.jdbc.core.JdbcTemplate;
14   -import org.springframework.stereotype.Service;
15   -
16   -import java.util.HashMap;
17   -import java.util.List;
18   -import java.util.Map;
19   -import java.util.Set;
20   -
21   -/**
22   - * Created by panzhao on 2017/5/22.
23   - */
24   -@Service
25   -public class SchEditInfoServiceImpl extends BaseServiceImpl<SchEditInfo, Long> implements SchEditInfoService{
26   -
27   - Logger log = LoggerFactory.getLogger(this.getClass());
28   -
29   - @Autowired
30   - JdbcTemplate jdbcTemplate;
31   -
32   - public Map<String, Object> _list(String rq, String lineCode, Map<String, String> map) {
33   -
34   - Map<String, Object> rs = new HashMap();
35   - try {
36   - //拼接除rq、lineCode 外的其他where 条件
37   - map.remove("rq");
38   - map.remove("lineCode");
39   - String cont = "", v;
40   - Set<String> ks = map.keySet();
41   - for(String k : ks){
42   - v =map.get(k);
43   - if(StringUtils.isNotEmpty(v))
44   - cont += " and t2." + BatchSaveUtils.propertyToField(k) + "='" + v + "'";
45   - }
46   - String sql = "select t1.*, t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name,t2.xl_dir,t2.real_exec_date from (select * from logger_sch_modify where rq=? and line_code=? ) t1 INNER JOIN bsth_c_s_sp_info_real t2 on t1.sch_id=t2.id where 1=1 " + cont;
47   -
48   - List<SchEditInfoDto> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SchEditInfoDto.class), rq, lineCode);
49   -
50   - rs.put("status", ResponseCode.SUCCESS);
51   - rs.put("list", list);
52   - }catch (Exception e){
53   - log.error("", e);
54   - rs.put("status", ResponseCode.ERROR);
55   - rs.put("msg", e.getMessage());
56   - }
57   - return rs;
58   - }
59   -}
  1 +package com.bsth.data.schedule.edit_logs.service;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.data.schedule.edit_logs.entity.SchEditInfo;
  5 +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto;
  6 +import com.bsth.service.impl.BaseServiceImpl;
  7 +import com.bsth.util.BatchSaveUtils;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  13 +import org.springframework.jdbc.core.JdbcTemplate;
  14 +import org.springframework.stereotype.Service;
  15 +
  16 +import java.util.HashMap;
  17 +import java.util.List;
  18 +import java.util.Map;
  19 +import java.util.Set;
  20 +
  21 +/**
  22 + * Created by panzhao on 2017/5/22.
  23 + */
  24 +@Service
  25 +public class SchEditInfoServiceImpl extends BaseServiceImpl<SchEditInfo, Long> implements SchEditInfoService{
  26 +
  27 + Logger log = LoggerFactory.getLogger(this.getClass());
  28 +
  29 + @Autowired
  30 + JdbcTemplate jdbcTemplate;
  31 +
  32 + public Map<String, Object> _list(String rq, String lineCode, Map<String, String> map) {
  33 +
  34 + Map<String, Object> rs = new HashMap();
  35 + try {
  36 + //拼接除rq、lineCode 外的其他where 条件
  37 + map.remove("rq");
  38 + map.remove("lineCode");
  39 + String cont = "", v;
  40 + Set<String> ks = map.keySet();
  41 + for(String k : ks){
  42 + v =map.get(k);
  43 + if(StringUtils.isNotEmpty(v))
  44 + cont += " and t2." + BatchSaveUtils.propertyToField(k) + "='" + v + "'";
  45 + }
  46 + String sql = "select t1.*, t2.fcsj,t2.lp_name,t2.cl_zbh,t2.j_gh,t2.j_name,t2.xl_dir,t2.real_exec_date from (select * from logger_sch_modify where rq=? and line_code=? ) t1 INNER JOIN bsth_c_s_sp_info_real t2 on t1.sch_id=t2.id where 1=1 " + cont;
  47 +
  48 + List<SchEditInfoDto> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SchEditInfoDto.class), rq, lineCode);
  49 +
  50 + rs.put("status", ResponseCode.SUCCESS);
  51 + rs.put("list", list);
  52 + }catch (Exception e){
  53 + log.error("", e);
  54 + rs.put("status", ResponseCode.ERROR);
  55 + rs.put("msg", e.getMessage());
  56 + }
  57 + return rs;
  58 + }
  59 +}
... ...
src/main/java/com/bsth/data/schedule/edit_logs/service/dto/SchEditInfoDto.java
1   -package com.bsth.data.schedule.edit_logs.service.dto;
2   -
3   -/**
4   - * Created by panzhao on 2017/5/22.
5   - */
6   -public class SchEditInfoDto {
7   -
8   - private long id;
9   - /*** 日期 yyyy-MM-dd*/
10   - private String rq;
11   -
12   - /*** 时间 HH:mm*/
13   - private String timeStr;
14   -
15   - private String lineCode;
16   -
17   - private String gsbm;
18   -
19   - private String fgsbm;
20   -
21   - /*** 班次ID*/
22   - private long schId;
23   -
24   - /*** 类型*/
25   - private String type;
26   -
27   - private String type2;
28   - /*** 操作人 @system 系统/用户名*/
29   - private String user;
30   -
31   - /*** 操作明细*/
32   - private String jsonArray;
33   -
34   - private String remarks;
35   -
36   - /** 路牌 */
37   - private String lpName;
38   -
39   - /** 驾驶员工号 */
40   - private String jGh;
41   -
42   - /** 驾驶员姓名 */
43   - private String jName;
44   -
45   - /** 车辆自编号 */
46   - private String clZbh;
47   -
48   - /** 计发时间 */
49   - private String fcsj;
50   -
51   - /** 上下行 */
52   - private int xlDir;
53   -
54   - /** 实际执行日期 */
55   - private String realExecDate;
56   -
57   - public long getId() {
58   - return id;
59   - }
60   -
61   - public void setId(long id) {
62   - this.id = id;
63   - }
64   -
65   - public String getRq() {
66   - return rq;
67   - }
68   -
69   - public void setRq(String rq) {
70   - this.rq = rq;
71   - }
72   -
73   - public String getTimeStr() {
74   - return timeStr;
75   - }
76   -
77   - public void setTimeStr(String timeStr) {
78   - this.timeStr = timeStr;
79   - }
80   -
81   - public String getLineCode() {
82   - return lineCode;
83   - }
84   -
85   - public void setLineCode(String lineCode) {
86   - this.lineCode = lineCode;
87   - }
88   -
89   - public String getGsbm() {
90   - return gsbm;
91   - }
92   -
93   - public void setGsbm(String gsbm) {
94   - this.gsbm = gsbm;
95   - }
96   -
97   - public String getFgsbm() {
98   - return fgsbm;
99   - }
100   -
101   - public void setFgsbm(String fgsbm) {
102   - this.fgsbm = fgsbm;
103   - }
104   -
105   - public long getSchId() {
106   - return schId;
107   - }
108   -
109   - public void setSchId(long schId) {
110   - this.schId = schId;
111   - }
112   -
113   - public String getType2() {
114   - return type2;
115   - }
116   -
117   - public void setType2(String type2) {
118   - this.type2 = type2;
119   - }
120   -
121   - public String getUser() {
122   - return user;
123   - }
124   -
125   - public void setUser(String user) {
126   - this.user = user;
127   - }
128   -
129   - public String getJsonArray() {
130   - return jsonArray;
131   - }
132   -
133   - public void setJsonArray(String jsonArray) {
134   - this.jsonArray = jsonArray;
135   - }
136   -
137   - public String getRemarks() {
138   - return remarks;
139   - }
140   -
141   - public void setRemarks(String remarks) {
142   - this.remarks = remarks;
143   - }
144   -
145   - public String getLpName() {
146   - return lpName;
147   - }
148   -
149   - public void setLpName(String lpName) {
150   - this.lpName = lpName;
151   - }
152   -
153   - public String getjGh() {
154   - return jGh;
155   - }
156   -
157   - public void setjGh(String jGh) {
158   - this.jGh = jGh;
159   - }
160   -
161   - public String getjName() {
162   - return jName;
163   - }
164   -
165   - public void setjName(String jName) {
166   - this.jName = jName;
167   - }
168   -
169   -
170   - public String getRealExecDate() {
171   - return realExecDate;
172   - }
173   -
174   - public void setRealExecDate(String realExecDate) {
175   - this.realExecDate = realExecDate;
176   - }
177   -
178   - public String getType() {
179   - return type;
180   - }
181   -
182   - public void setType(String type) {
183   - this.type = type;
184   - }
185   -
186   - public String getClZbh() {
187   - return clZbh;
188   - }
189   -
190   - public void setClZbh(String clZbh) {
191   - this.clZbh = clZbh;
192   - }
193   -
194   - public String getFcsj() {
195   - return fcsj;
196   - }
197   -
198   - public void setFcsj(String fcsj) {
199   - this.fcsj = fcsj;
200   - }
201   -
202   - public int getXlDir() {
203   - return xlDir;
204   - }
205   -
206   - public void setXlDir(int xlDir) {
207   - this.xlDir = xlDir;
208   - }
209   -}
  1 +package com.bsth.data.schedule.edit_logs.service.dto;
  2 +
  3 +/**
  4 + * Created by panzhao on 2017/5/22.
  5 + */
  6 +public class SchEditInfoDto {
  7 +
  8 + private long id;
  9 + /*** 日期 yyyy-MM-dd*/
  10 + private String rq;
  11 +
  12 + /*** 时间 HH:mm*/
  13 + private String timeStr;
  14 +
  15 + private String lineCode;
  16 +
  17 + private String gsbm;
  18 +
  19 + private String fgsbm;
  20 +
  21 + /*** 班次ID*/
  22 + private long schId;
  23 +
  24 + /*** 类型*/
  25 + private String type;
  26 +
  27 + private String type2;
  28 + /*** 操作人 @system 系统/用户名*/
  29 + private String user;
  30 +
  31 + /*** 操作明细*/
  32 + private String jsonArray;
  33 +
  34 + private String remarks;
  35 +
  36 + /** 路牌 */
  37 + private String lpName;
  38 +
  39 + /** 驾驶员工号 */
  40 + private String jGh;
  41 +
  42 + /** 驾驶员姓名 */
  43 + private String jName;
  44 +
  45 + /** 车辆自编号 */
  46 + private String clZbh;
  47 +
  48 + /** 计发时间 */
  49 + private String fcsj;
  50 +
  51 + /** 上下行 */
  52 + private int xlDir;
  53 +
  54 + /** 实际执行日期 */
  55 + private String realExecDate;
  56 +
  57 + public long getId() {
  58 + return id;
  59 + }
  60 +
  61 + public void setId(long id) {
  62 + this.id = id;
  63 + }
  64 +
  65 + public String getRq() {
  66 + return rq;
  67 + }
  68 +
  69 + public void setRq(String rq) {
  70 + this.rq = rq;
  71 + }
  72 +
  73 + public String getTimeStr() {
  74 + return timeStr;
  75 + }
  76 +
  77 + public void setTimeStr(String timeStr) {
  78 + this.timeStr = timeStr;
  79 + }
  80 +
  81 + public String getLineCode() {
  82 + return lineCode;
  83 + }
  84 +
  85 + public void setLineCode(String lineCode) {
  86 + this.lineCode = lineCode;
  87 + }
  88 +
  89 + public String getGsbm() {
  90 + return gsbm;
  91 + }
  92 +
  93 + public void setGsbm(String gsbm) {
  94 + this.gsbm = gsbm;
  95 + }
  96 +
  97 + public String getFgsbm() {
  98 + return fgsbm;
  99 + }
  100 +
  101 + public void setFgsbm(String fgsbm) {
  102 + this.fgsbm = fgsbm;
  103 + }
  104 +
  105 + public long getSchId() {
  106 + return schId;
  107 + }
  108 +
  109 + public void setSchId(long schId) {
  110 + this.schId = schId;
  111 + }
  112 +
  113 + public String getType2() {
  114 + return type2;
  115 + }
  116 +
  117 + public void setType2(String type2) {
  118 + this.type2 = type2;
  119 + }
  120 +
  121 + public String getUser() {
  122 + return user;
  123 + }
  124 +
  125 + public void setUser(String user) {
  126 + this.user = user;
  127 + }
  128 +
  129 + public String getJsonArray() {
  130 + return jsonArray;
  131 + }
  132 +
  133 + public void setJsonArray(String jsonArray) {
  134 + this.jsonArray = jsonArray;
  135 + }
  136 +
  137 + public String getRemarks() {
  138 + return remarks;
  139 + }
  140 +
  141 + public void setRemarks(String remarks) {
  142 + this.remarks = remarks;
  143 + }
  144 +
  145 + public String getLpName() {
  146 + return lpName;
  147 + }
  148 +
  149 + public void setLpName(String lpName) {
  150 + this.lpName = lpName;
  151 + }
  152 +
  153 + public String getjGh() {
  154 + return jGh;
  155 + }
  156 +
  157 + public void setjGh(String jGh) {
  158 + this.jGh = jGh;
  159 + }
  160 +
  161 + public String getjName() {
  162 + return jName;
  163 + }
  164 +
  165 + public void setjName(String jName) {
  166 + this.jName = jName;
  167 + }
  168 +
  169 +
  170 + public String getRealExecDate() {
  171 + return realExecDate;
  172 + }
  173 +
  174 + public void setRealExecDate(String realExecDate) {
  175 + this.realExecDate = realExecDate;
  176 + }
  177 +
  178 + public String getType() {
  179 + return type;
  180 + }
  181 +
  182 + public void setType(String type) {
  183 + this.type = type;
  184 + }
  185 +
  186 + public String getClZbh() {
  187 + return clZbh;
  188 + }
  189 +
  190 + public void setClZbh(String clZbh) {
  191 + this.clZbh = clZbh;
  192 + }
  193 +
  194 + public String getFcsj() {
  195 + return fcsj;
  196 + }
  197 +
  198 + public void setFcsj(String fcsj) {
  199 + this.fcsj = fcsj;
  200 + }
  201 +
  202 + public int getXlDir() {
  203 + return xlDir;
  204 + }
  205 +
  206 + public void setXlDir(int xlDir) {
  207 + this.xlDir = xlDir;
  208 + }
  209 +}
... ...
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
... ... @@ -3,6 +3,8 @@ package com.bsth.data.schedule.thread;
3 3 import com.bsth.service.oil.DlbService;
4 4 import com.bsth.data.safe_driv.SafeDrivCenter;
5 5 import com.bsth.service.oil.YlbService;
  6 +import com.bsth.service.report.SheetService;
  7 +
6 8 import org.slf4j.Logger;
7 9 import org.slf4j.LoggerFactory;
8 10 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -19,6 +21,9 @@ public class CalcOilThread extends Thread{
19 21 YlbService ylbService;
20 22 @Autowired
21 23 DlbService dlbService;
  24 +
  25 + @Autowired
  26 + SheetService sheetService;
22 27 Logger logger = LoggerFactory.getLogger(this.getClass());
23 28  
24 29 @Override
... ... @@ -28,7 +33,9 @@ public class CalcOilThread extends Thread{
28 33 ylbService.obtainDsq();
29 34 dlbService.obtainDsq();
30 35 logger.info("计算路单里程加注量结束!");
31   -
  36 + logger.info("开始计算班次准点率....");
  37 + sheetService.saveSheetList();
  38 + logger.info("计算班次准点率结束!");
32 39 //清除安全驾驶数据 先临时蹭这个线程
33 40 SafeDrivCenter.clear();
34 41 } catch(Exception e){
... ...
src/main/java/com/bsth/entity/sheet/Sheet.java 0 → 100644
  1 +package com.bsth.entity.sheet;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +import javax.persistence.Transient;
  10 +@Entity
  11 +@Table(name = "bsth_c_sheet")
  12 +public class Sheet {
  13 + @Id
  14 + @GeneratedValue
  15 + private Integer id;
  16 + private String gs;
  17 + private String fgs;
  18 + private String line;
  19 + private String date;
  20 + private String realDate;
  21 + private String jhsj;
  22 + private Long jhsjt;
  23 + private String sjsj;
  24 + private Long sjsjt;
  25 + private String xlDir;
  26 + private Date createDate;
  27 + private String zdname;
  28 +
  29 + @Transient
  30 + private String sfzd;
  31 +
  32 + public Integer getId() {
  33 + return id;
  34 + }
  35 + public void setId(Integer id) {
  36 + this.id = id;
  37 + }
  38 + public String getGs() {
  39 + return gs;
  40 + }
  41 + public void setGs(String gs) {
  42 + this.gs = gs;
  43 + }
  44 + public String getFgs() {
  45 + return fgs;
  46 + }
  47 + public void setFgs(String fgs) {
  48 + this.fgs = fgs;
  49 + }
  50 + public String getLine() {
  51 + return line;
  52 + }
  53 + public void setLine(String line) {
  54 + this.line = line;
  55 + }
  56 + public String getDate() {
  57 + return date;
  58 + }
  59 + public void setDate(String date) {
  60 + this.date = date;
  61 + }
  62 + public String getRealDate() {
  63 + return realDate;
  64 + }
  65 + public void setRealDate(String realDate) {
  66 + this.realDate = realDate;
  67 + }
  68 + public String getJhsj() {
  69 + return jhsj;
  70 + }
  71 + public void setJhsj(String jhsj) {
  72 + this.jhsj = jhsj;
  73 + }
  74 + public String getSjsj() {
  75 + return sjsj;
  76 + }
  77 + public void setSjsj(String sjsj) {
  78 + this.sjsj = sjsj;
  79 + }
  80 +
  81 + public Long getJhsjt() {
  82 + return jhsjt;
  83 + }
  84 + public void setJhsjt(Long jhsjt) {
  85 + this.jhsjt = jhsjt;
  86 + }
  87 + public Long getSjsjt() {
  88 + return sjsjt;
  89 + }
  90 + public void setSjsjt(Long sjsjt) {
  91 + this.sjsjt = sjsjt;
  92 + }
  93 + public String getXlDir() {
  94 + return xlDir;
  95 + }
  96 + public void setXlDir(String xlDir) {
  97 + this.xlDir = xlDir;
  98 + }
  99 + public Date getCreateDate() {
  100 + return createDate;
  101 + }
  102 + public void setCreateDate(Date createDate) {
  103 + this.createDate = createDate;
  104 + }
  105 +
  106 + public String getZdname() {
  107 + return zdname;
  108 + }
  109 + public void setZdname(String zdname) {
  110 + this.zdname = zdname;
  111 + }
  112 + public String getSfzd() {
  113 + return sfzd;
  114 + }
  115 + public void setSfzd(String sfzd) {
  116 + this.sfzd = sfzd;
  117 + }
  118 +
  119 +
  120 +
  121 +}
... ...
src/main/java/com/bsth/repository/sheet/SheetRepository.java 0 → 100644
  1 +package com.bsth.repository.sheet;
  2 +
  3 +import com.bsth.entity.sheet.Sheet;
  4 +import com.bsth.repository.BaseRepository;
  5 +import org.springframework.stereotype.Repository;
  6 +
  7 +/**
  8 + *
  9 + */
  10 +@Repository
  11 +public interface SheetRepository extends BaseRepository<Sheet, Integer>{
  12 +}
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -28,10 +28,12 @@ import com.bsth.entity.mcy_forms.Singledata;
28 28 import com.bsth.entity.mcy_forms.Turnoutrate;
29 29 import com.bsth.entity.mcy_forms.Vehicleloading;
30 30 import com.bsth.entity.mcy_forms.Waybillday;
  31 +import com.bsth.entity.oil.Dlb;
31 32 import com.bsth.entity.oil.Ylb;
32 33 import com.bsth.entity.realcontrol.ScheduleRealInfo;
33 34 import com.bsth.entity.schedule.SchedulePlanInfo;
34 35 import com.bsth.repository.LineRepository;
  36 +import com.bsth.repository.oil.DlbRepository;
35 37 import com.bsth.repository.oil.YlbRepository;
36 38 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
37 39 import com.bsth.data.BasicData;
... ... @@ -67,6 +69,9 @@ public class FormsServiceImpl implements FormsService {
67 69 YlbRepository ylbRepository;
68 70  
69 71 @Autowired
  72 + DlbRepository dlbRepository;
  73 +
  74 + @Autowired
70 75 LineRepository lineRepository;
71 76  
72 77  
... ... @@ -98,6 +103,7 @@ public class FormsServiceImpl implements FormsService {
98 103 });
99 104 List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
100 105 List<Ylb> listYlb= ylbRepository.obtainYl(date, "", "", line, "", "xlbm");
  106 + List<Dlb> listDlb= dlbRepository.obtainDl(date, "", "", line, "", "xlbm");
101 107 double jzl=0.0,sh=0.0,yh=0.0;
102 108 for (int i = 0; i < list.size(); i++) {
103 109 Waybillday w=list.get(i);
... ... @@ -132,6 +138,14 @@ public class FormsServiceImpl implements FormsService {
132 138 }
133 139 }
134 140  
  141 + for (int j = 0; j < listDlb.size(); j++) {
  142 + Dlb d=listDlb.get(j);
  143 + if(w.getNbbm().equals(d.getNbbm()) && w.getJgh().equals(d.getJsy())){
  144 + jzl=Arith.add(jzl, d.getCdl());
  145 + sh=Arith.add(sh, d.getSh());
  146 + yh=Arith.add(yh, d.getHd());
  147 + }
  148 + }
135 149 w.setJzl(String.valueOf(jzl));
136 150 w.setYh(String.valueOf(yh));
137 151 w.setSh(String.valueOf(sh));
... ... @@ -1087,7 +1101,10 @@ public class FormsServiceImpl implements FormsService {
1087 1101  
1088 1102 @Override
1089 1103 public List<Daily> daily(Map<String, Object> map) {
1090   -
  1104 + String xlbm="";;
  1105 + if(map.get("line")!=null){
  1106 + xlbm=map.get("line").toString().trim();
  1107 + }
1091 1108 String gsbm="";
1092 1109 if(map.get("gsdmDaily")!=null){
1093 1110 gsbm=map.get("gsdmDaily").toString();
... ... @@ -1098,7 +1115,7 @@ public class FormsServiceImpl implements FormsService {
1098 1115 fgsbm=map.get("fgsdmDaily").toString();
1099 1116 }
1100 1117  
1101   - String sql="select t.schedule_date_str,"
  1118 + /*String sql="select t.schedule_date_str,"
1102 1119 + " t.cl_zbh,t.j_gh,t.j_name,x.yh from (select r.schedule_date_str,r.xl_bm,"
1103 1120 + " r.cl_zbh,r.j_gh,r.j_name from bsth_c_s_sp_info_real r WHERE "
1104 1121 + " r.xl_bm='" + map.get("line").toString() + "' "
... ... @@ -1112,7 +1129,20 @@ public class FormsServiceImpl implements FormsService {
1112 1129 + " and y.ssgsdm like '%"+gsbm+"%' "
1113 1130 + " and y.fgsdm like '%"+fgsbm+"%'"
1114 1131 + " ) x"
1115   - + " on t.cl_zbh = x.nbbm and t.j_gh=x.jsy";
  1132 + + " on t.cl_zbh = x.nbbm and t.j_gh=x.jsy";*/
  1133 +
  1134 + String sql="select r.schedule_date_str, "
  1135 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm"
  1136 + + " from bsth_c_s_sp_info_real r where "
  1137 + + "r.schedule_date_str = '"+map.get("date").toString()+"'";
  1138 + if(xlbm.equals("")){
  1139 + sql +="and r.gs_bm='"+gsbm+"' "
  1140 + + " and r.fgs_bm='"+fgsbm+"'";
  1141 + }else{
  1142 + sql += " and r.xl_bm = '"+xlbm+"'";
  1143 + }
  1144 + sql += " group by r.schedule_date_str,"
  1145 + + " r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
1116 1146  
1117 1147 List<Daily> list = jdbcTemplate.query(sql, new RowMapper<Daily>() {
1118 1148 @Override
... ... @@ -1122,21 +1152,31 @@ public class FormsServiceImpl implements FormsService {
1122 1152 daily.setZbh(arg0.getString("cl_zbh"));
1123 1153 daily.setJgh(arg0.getString("j_gh"));
1124 1154 daily.setjName(arg0.getString("j_name"));
1125   - daily.setYh(arg0.getString("yh"));
1126 1155 return daily;
1127 1156 }
1128 1157 });
  1158 + List<Ylb> listYlb= ylbRepository.obtainYl(map.get("date").toString(), "", "", xlbm, "", "xlbm");
  1159 + List<Dlb> listDlb= dlbRepository.obtainDl(map.get("date").toString(), "", "", xlbm, "", "xlbm");
1129 1160 List<ScheduleRealInfo> sList;
1130 1161 List<ScheduleRealInfo> lists=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(map.get("line").toString(), map.get("date").toString());
1131 1162 for(int i=0;i<list.size();i++){
1132 1163 sList =new ArrayList<ScheduleRealInfo>();
1133 1164 Daily d=list.get(i);
1134   - if(d.getYh()==null){
1135   - d.setYh("0");
1136   - }else{
1137   - if(d.getYh().equals(""))
1138   - d.setYh("0");
  1165 + Double yh=0.0;
  1166 + for (int j = 0; j < listYlb.size(); j++) {
  1167 + Ylb y=listYlb.get(j);
  1168 + if(y.getNbbm().equals(d.getZbh())&& y.getJsy().equals(d.getJgh())){
  1169 + yh=Arith.add(yh, y.getYh());
  1170 + }
  1171 + }
  1172 +
  1173 + for (int j = 0; j < listDlb.size(); j++) {
  1174 + Dlb b=listDlb.get(j);
  1175 + if(b.getNbbm().equals(d.getZbh())&& b.getJsy().equals(d.getJgh())){
  1176 + yh=Arith.add(yh, b.getHd());
  1177 + }
1139 1178 }
  1179 + d.setYh(String.valueOf(yh));
1140 1180 for (int j = 0; j < lists.size(); j++) {
1141 1181 ScheduleRealInfo s=lists.get(j);
1142 1182 if(d.getJgh().equals(s.getjGh()) && d.getZbh().equals(s.getClZbh())){
... ...
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
... ... @@ -11,6 +11,7 @@ import java.util.Collections;
11 11 import java.util.Comparator;
12 12 import java.util.Date;
13 13 import java.util.HashMap;
  14 +import java.util.HashSet;
14 15 import java.util.Iterator;
15 16 import java.util.List;
16 17 import java.util.Map;
... ... @@ -585,7 +586,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
585 586  
586 587 @Override
587 588 public Map<String, Object> timeAndSpeed(Map<String, Object> map) {
588   - List<Long> ttList = new ArrayList<Long>();
  589 + List<Map<String, Object>> ttList = new ArrayList<Map<String, Object>>();
589 590 List<ChildTaskPlan> cList = new ArrayList<ChildTaskPlan>();
590 591 List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
591 592 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
... ... @@ -593,6 +594,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
593 594 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
594 595 Map<String, List<ChildTaskPlan>> cMap = new HashMap<String, List<ChildTaskPlan>>();
595 596 Map<String, Object> modelMap = new HashMap<String, Object>();
  597 + Set<Long> tsSet = new HashSet<Long>();
596 598  
597 599 String company = map.get("company").toString();
598 600 String subCompany = map.get("subCompany").toString();
... ... @@ -616,20 +618,23 @@ public class BusIntervalServiceImpl implements BusIntervalService {
616 618  
617 619 try {
618 620  
619   - String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'";
  621 + String where = "";
620 622 if(line.length() != 0 && statu.equals("1")){
621   - sql += " and xl_bm = '"+line+"'";
  623 + where += " and xl_bm = '"+line+"'";
622 624 }
623 625 if(lp.length() != 0 && statu.equals("1")){
624   - sql += " and lp_name = '"+lp+"'";
  626 + where += " and lp_name = '"+lp+"'";
625 627 }
626 628 if(company.length() != 0){
627   - sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
  629 + where += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
628 630 }
629 631 if(sfqr == 1){
630   - sql += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'";
  632 + where += " and zdsj >= '"+times1+"' and fcsj <= '"+times2+"'";
631 633 }
632   - sql += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks' order by fcsj";
  634 + where += " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
  635 +
  636 + String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"'"
  637 + + " and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"+where+"";
633 638  
634 639 list = jdbcTemplate.query(sql,
635 640 new RowMapper<ScheduleRealInfo>(){
... ... @@ -704,6 +709,65 @@ public class BusIntervalServiceImpl implements BusIntervalService {
704 709 return schedule;
705 710 }
706 711 });
  712 +
  713 + {
  714 + List<Map<String, String>> temp1 = new ArrayList<Map<String, String>>();
  715 + List<Map<String, String>> temp2 = new ArrayList<Map<String, String>>();
  716 + sql = "select * from bsth_c_s_sp_info where bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
  717 +
  718 + if(startDate.equals(endDate)){
  719 + sql += " and schedule_date = '"+startDate+"'";
  720 + } else {
  721 + sql += " and schedule_date >= '"+startDate+"' and schedule_date <= '"+endDate+"'";
  722 + }
  723 + if(line.length() != 0 && statu.equals("1")){
  724 + sql += " and xl_bm = '"+line+"'";
  725 + }
  726 + if(company.length() != 0){
  727 + sql += " and gs_bm = '"+company+"' and fgs_bm = '"+subCompany+"'";
  728 + }
  729 + temp1 = jdbcTemplate.query(sql,
  730 + new RowMapper<Map<String, String>>(){
  731 + @Override
  732 + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {
  733 + Map<String, String> m = new HashMap<String, String>();
  734 + m.put("id", rs.getString("id"));
  735 + m.put("lp", rs.getString("lp"));
  736 + m.put("fcsj", rs.getString("fcsj"));
  737 + m.put("xl_bm", rs.getString("xl_bm"));
  738 + m.put("tt_info", rs.getString("tt_info"));
  739 + return m;
  740 + }
  741 + });
  742 + sql = "select * from bsth_c_s_ttinfo_detail where ists = 1"
  743 + + " and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
  744 +
  745 + if(line.length() != 0 && statu.equals("1")){
  746 + sql += " and xl = '"+line+"'";
  747 + }
  748 + temp2 = jdbcTemplate.query(sql,
  749 + new RowMapper<Map<String, String>>(){
  750 + @Override
  751 + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {
  752 + Map<String, String> m = new HashMap<String, String>();
  753 + m.put("id", rs.getString("id"));
  754 + m.put("lp", rs.getString("lp"));
  755 + m.put("xl", rs.getString("xl"));
  756 + m.put("fcsj", rs.getString("fcsj"));
  757 + m.put("ttinfo", rs.getString("ttinfo"));
  758 + return m;
  759 + }
  760 + });
  761 +
  762 + for(Map<String, String> m2 : temp2){
  763 + for(Map<String, String> m1 : temp1){
  764 + if(m2.get("ttinfo").equals(m1.get("tt_info")) && m2.get("xl").equals(m1.get("xl_bm"))
  765 + && m2.get("lp").equals(m1.get("lp")) && m2.get("fcsj").equals(m1.get("fcsj"))){
  766 + tsSet.add(Long.valueOf(m1.get("id")));
  767 + }
  768 + }
  769 + }
  770 + }
707 771  
708 772 sql = "select * from bsth_c_s_child_task order by start_date";
709 773  
... ... @@ -723,13 +787,17 @@ public class BusIntervalServiceImpl implements BusIntervalService {
723 787 });
724 788  
725 789 if(model.length() != 0){
726   - sql = "select id from bsth_c_s_sp_info where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
  790 + sql = "select sp.id from bsth_c_s_sp_info sp left join bsth_c_s_ttinfo_detail tt on sp.tt_info = tt.ttinfo and sp.xl_bm = tt.xl and sp.lp = tt.lp and sp.fcsj = tt.fcsj "
  791 + + "where tt_info = '" + model + "' and bc_type != 'in' and bc_type != 'out' and bc_type != 'ldks'";
727 792  
728 793 ttList = jdbcTemplate.query(sql,
729   - new RowMapper<Long>(){
  794 + new RowMapper<Map<String, Object>>(){
730 795 @Override
731   - public Long mapRow(ResultSet rs, int rowNum) throws SQLException {
732   - return rs.getLong("id");
  796 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  797 + Map<String, Object> m = new HashMap<String, Object>();
  798 + m.put("id", rs.getString("id"));
  799 + m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):"0");
  800 + return m;
733 801 }
734 802 });
735 803 }
... ... @@ -771,13 +839,15 @@ public class BusIntervalServiceImpl implements BusIntervalService {
771 839 if(schedule.getXlName()==null || schedule.getXlName().trim().length()==0)
772 840 continue;
773 841 if(model.length() != 0){
774   - for(Long tt : ttList)
775   - if((long) tt == (long)schedule.getSpId()){
  842 + for(Map<String, Object> tt : ttList){
  843 + long id = Long.valueOf(tt.get("id").toString());
  844 + if(id == (long)schedule.getSpId()){
776 845 String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();
777 846 if(!keyMap.containsKey(key))
778 847 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
779 848 keyMap.get(key).add(schedule);
780 849 }
  850 + }
781 851 }else{
782 852 String key = schedule.getScheduleDateStr() + "/" + schedule.getXlName() + "/" + schedule.getLpName();
783 853 if(!keyMap.containsKey(key))
... ... @@ -821,14 +891,16 @@ public class BusIntervalServiceImpl implements BusIntervalService {
821 891 for(int i = 1; i < keyList.size(); i++){
822 892 ScheduleRealInfo schedule1 = sortMap.get(keyList.get(i - 1));
823 893 ScheduleRealInfo schedule2 = sortMap.get(keyList.get(i));
824   - if(sfqr == 1 && time1 > schedule1.getFcsjT()){
825   - jhyysj += schedule2.getFcsjT() - time1;
826   - }else if(sfqr == 1 && time2 < schedule2.getFcsjT()){
827   - jhyysj += time2 - schedule1.getFcsjT();
828   - }else{
829   - jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT();
  894 + if(!tsSet.contains(schedule1.getId())){
  895 + if(sfqr == 1 && time1 > schedule1.getFcsjT()){
  896 + jhyysj += schedule2.getFcsjT() - time1;
  897 + }else if(sfqr == 1 && time2 < schedule2.getFcsjT()){
  898 + jhyysj += time2 - schedule1.getFcsjT();
  899 + }else{
  900 + jhyysj += schedule2.getFcsjT() - schedule1.getFcsjT();
  901 + }
  902 + jhyysj1 += schedule2.getFcsjT() - schedule1.getFcsjT();
830 903 }
831   - jhyysj1 += schedule2.getFcsjT() - schedule1.getFcsjT();
832 904 long zdsj2 = schedule2.getZdsjT();
833 905 long fcsj2 = schedule2.getFcsjT();
834 906 if(fcsj2 > zdsj2)
... ...
src/main/java/com/bsth/service/report/SheetService.java 0 → 100644
  1 +package com.bsth.service.report;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import com.bsth.entity.sheet.Sheet;
  7 +import com.bsth.service.BaseService;
  8 +
  9 +public interface SheetService extends BaseService<Sheet, Integer>{
  10 + public List<Map<String, Object>> bcPunctual(Map<String, Object> map);
  11 + public String saveSheetList() throws Exception;
  12 + public List<Map<String, Object>> countList(Map<String, Object> map);
  13 +
  14 + public List<Sheet> sheetList(Integer id);
  15 +}
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -375,11 +375,11 @@ public class ReportServiceImpl implements ReportService{
375 375 String[] minSjs = minfcsj.split(":");
376 376 int minSj=Integer.parseInt(minSjs[0])*60+Integer.parseInt(minSjs[1]);
377 377 //查询时间里程
378   - String sqlPc=" (SELECT jhlc,fcsj,bc_type,lp,2 as xh FROM bsth_c_s_ttinfo_detail "
  378 + String sqlPc=" (SELECT jhlc,fcsj,bc_type,lp,2 as xh, ists FROM bsth_c_s_ttinfo_detail "
379 379 + " where ttinfo ='"+ttinfo+"' and fcsj <='"+minfcsj+"' ) "
380 380 + " union "
381   - + " (SELECT jhlc,fcsj,bc_type,lp,1 as xh FROM bsth_c_s_ttinfo_detail "
382   - + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"') order by lp,xh,fcsj";
  381 + + " (SELECT jhlc,fcsj,bc_type,lp,1 as xh, ists FROM bsth_c_s_ttinfo_detail "
  382 + + " where ttinfo ='"+ttinfo+"' and fcsj > '"+minfcsj+"') order by lp,xh,fcsj";
383 383  
384 384 Map<String, Object> map=new HashMap<String,Object>();
385 385 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
... ... @@ -391,6 +391,7 @@ public class ReportServiceImpl implements ReportService{
391 391 m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
392 392 m.put("bcType", rs.getString("bc_type"));
393 393 m.put("lp", rs.getString("lp"));
  394 + m.put("ists", rs.getObject("ists")==null?"0":rs.getString("ists"));
394 395 return m;
395 396 }
396 397 });
... ... @@ -451,6 +452,9 @@ public class ReportServiceImpl implements ReportService{
451 452 lp=m.get("lp").toString();
452 453  
453 454 }
  455 + if(m.containsKey("ists") && m.get("ists").equals("1")){
  456 + sj = 0;
  457 + }
454 458 }
455 459 if(yysj>0){
456 460 yycs =yygl/(yysj*1.0/60);
... ... @@ -662,22 +666,28 @@ public class ReportServiceImpl implements ReportService{
662 666 + " (SELECT jhlc,fcsj,bcsj,bc_type,lp,xl_dir,ists,1 as xh FROM "
663 667 + " bsth_c_s_ttinfo_detail where ttinfo ='"+ttinfo+"' and "
664 668 + " fcsj > '"+minfcsj+"' and bc_type!='in' and bc_type!='out' and bc_type!='ldks') "
665   - + " order by xl_dir, xh,fcsj";
  669 + + " order by xl_dir, xh, fcsj";
666 670 Map<String, Object> map=new HashMap<String,Object>();
667 671 List<Map<String, Object>> list= jdbcTemplate.query(sqlPc,
668   - new RowMapper<Map<String, Object>>(){
669   - @Override
670   - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
671   - Map<String, Object> m=new HashMap<String,Object>();
672   - m.put("fcsj", rs.getString("fcsj"));
673   - m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
674   - m.put("bcsj", rs.getString("bcsj"));
675   - m.put("bcType", rs.getString("bc_type"));
676   - m.put("lp", rs.getString("lp"));
677   - m.put("dir", rs.getString("xl_dir"));
678   - m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):"");
679   - return m;
680   - }
  672 + new RowMapper<Map<String, Object>>(){
  673 + @Override
  674 + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {
  675 + Map<String, Object> m=new HashMap<String,Object>();
  676 + m.put("fcsj", rs.getString("fcsj"));
  677 + m.put("yygl", rs.getString("jhlc")==null?"0":rs.getString("jhlc"));
  678 + m.put("bcsj", rs.getString("bcsj"));
  679 + m.put("bcType", rs.getString("bc_type"));
  680 + m.put("lp", rs.getString("lp"));
  681 + m.put("dir", rs.getString("xl_dir"));
  682 + m.put("ists", rs.getString("ists")!=null?rs.getString("ists"):"");
  683 +
  684 + if(rs.getString("xh").equals("2")){
  685 + String[] split = m.get("fcsj").toString().split(":");
  686 + m.put("fcsj", Integer.valueOf(split[0]) + 24 + ":"+split[1]);
  687 + }
  688 +
  689 + return m;
  690 + }
681 691 });
682 692  
683 693 List<Map<String, Object>> newList=new ArrayList<Map<String,Object>>();
... ... @@ -711,6 +721,7 @@ public class ReportServiceImpl implements ReportService{
711 721 List<Map<String, Object>> list2 = keyMap.get(key);
712 722 List<Integer> cjs = new ArrayList<Integer>();
713 723 int sxsj = 0, xxsj = 0, zcj = 0, tssj = 0;
  724 + int sxbc = 0, xxbc = 0;
714 725 int temp = 24*60+1;
715 726 boolean ists = false;
716 727 for(Map<String, Object> m : list2){
... ... @@ -720,8 +731,10 @@ public class ReportServiceImpl implements ReportService{
720 731 int bcsj = Integer.valueOf(m.get("bcsj").toString());
721 732 if(xlDir == 0){
722 733 sxsj += bcsj;
  734 + sxbc ++;
723 735 } else {
724 736 xxsj += bcsj;
  737 + xxbc ++;
725 738 }
726 739 if(temp >= fcsj){
727 740 temp = fcsj;
... ... @@ -744,9 +757,9 @@ public class ReportServiceImpl implements ReportService{
744 757 zcj += i;
745 758 }
746 759 tempMap.put("sjd", key);
747   - tempMap.put("sxsj", sxsj);
748   - tempMap.put("xxsj", xxsj);
749   - tempMap.put("fqsj", sxsj + xxsj);
  760 + tempMap.put("sxsj", sxsj / sxbc);
  761 + tempMap.put("xxsj", xxsj / xxbc);
  762 + tempMap.put("fqsj", (sxsj + xxsj) / list2.size());
750 763 tempMap.put("cjqj", cjs.size()>0?cjs.get(0)+"——"+cjs.get(cjs.size()-1):"——");
751 764 tempMap.put("pjcj", cjs.size()>0?zcj/cjs.size():"/");
752 765 tempMap.put("tssj", tssj);
... ...
src/main/java/com/bsth/service/report/impl/SheetServiceImpl.java 0 → 100644
  1 +package com.bsth.service.report.impl;
  2 +
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
  6 +import java.text.ParseException;
  7 +import java.text.SimpleDateFormat;
  8 +import java.util.ArrayList;
  9 +import java.util.Calendar;
  10 +import java.util.Collections;
  11 +import java.util.Comparator;
  12 +import java.util.Date;
  13 +import java.util.GregorianCalendar;
  14 +import java.util.HashMap;
  15 +import java.util.Iterator;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +import java.util.Set;
  19 +
  20 +import javax.transaction.Transactional;
  21 +
  22 +import org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener;
  23 +import org.slf4j.Logger;
  24 +import org.slf4j.LoggerFactory;
  25 +import org.springframework.beans.factory.annotation.Autowired;
  26 +import org.springframework.jdbc.core.JdbcTemplate;
  27 +import org.springframework.jdbc.core.RowMapper;
  28 +import org.springframework.scheduling.commonj.ScheduledTimerListener;
  29 +import org.springframework.stereotype.Service;
  30 +
  31 +import com.bsth.data.BasicData;
  32 +import com.bsth.entity.Line;
  33 +import com.bsth.entity.oil.Ylb;
  34 +import com.bsth.entity.realcontrol.ChildTaskPlan;
  35 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  36 +import com.bsth.entity.sheet.Sheet;
  37 +import com.bsth.repository.LineRepository;
  38 +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
  39 +import com.bsth.repository.sheet.SheetRepository;
  40 +import com.bsth.service.impl.BaseServiceImpl;
  41 +import com.bsth.service.report.SheetService;
  42 +import com.bsth.util.BatchSaveUtils;
  43 +import com.bsth.util.ComparableChild;
  44 +import com.bsth.util.ComparableReal;
  45 +import com.google.common.util.concurrent.AbstractScheduledService.Scheduler;
  46 +
  47 +@Service
  48 +public class SheetServiceImpl extends BaseServiceImpl<Sheet, Integer> implements SheetService {
  49 + Logger logger = LoggerFactory.getLogger(this.getClass());
  50 + @Autowired
  51 + ScheduleRealInfoRepository scheduleRealInfoRepository;
  52 + @Autowired
  53 + LineRepository lineRepository;
  54 + @Autowired
  55 + JdbcTemplate jdbcTemplate;
  56 + @Autowired
  57 + SheetRepository sheetRepository;
  58 + /**
  59 + * 班次准点率
  60 + */
  61 + @Override
  62 + public List<Map<String, Object>> bcPunctual(Map<String, Object> map) {
  63 + // TODO Auto-generated method stub
  64 + String line =map.get("line").toString();
  65 + String date =map.get("date").toString();
  66 + List<ScheduleRealInfo> realList=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
  67 +
  68 + return null;
  69 + }
  70 + public static boolean isInOut(ScheduleRealInfo s){
  71 + boolean fage=false;
  72 + if(s.getBcType().equals("in")){
  73 + fage=true;
  74 + }
  75 + if(s.getBcType().equals("out")){
  76 + fage=true;
  77 + }
  78 + if(s.getBcType().equals("ldks")){
  79 + fage=true;
  80 + }
  81 +
  82 + return fage;
  83 + }
  84 + @Override
  85 + public String saveSheetList() throws Exception{
  86 + Map<String, Object> map=new HashMap<String,Object>();
  87 + String result = "failure";
  88 + try {
  89 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  90 + Date dNow = new Date(); //当前时间
  91 + Calendar calendar = Calendar.getInstance(); //得到日历
  92 + calendar.setTime(dNow);//把当前时间赋给日历
  93 + calendar.add(Calendar.DAY_OF_MONTH, -3); //设置为前三天
  94 +
  95 + String rq=sdf.format(calendar.getTime());
  96 +// String rq="2017-05-16";
  97 +
  98 + List<Line> lineList = (List<Line>) lineRepository.findAll();
  99 +
  100 + List<ScheduleRealInfo> lists= scheduleRealInfoRepository.findByDate(rq);
  101 + List<Sheet> listAdds=new ArrayList<Sheet>();
  102 + for (int i = 0; i < lineList.size(); i++) {
  103 + List<ScheduleRealInfo> list=new ArrayList<ScheduleRealInfo>();
  104 + String line=lineList.get(i).getLineCode();
  105 + for (int j = 0; j < lists.size(); j++) {
  106 + ScheduleRealInfo s=lists.get(j);
  107 + if(!isInOut(s)){
  108 + if(s.getXlBm().equals(line)){
  109 + list.add(s);
  110 + }
  111 + }
  112 +
  113 + }
  114 + if(list.size()>0){
  115 + List<Sheet> listAdd=punctualByLine(line,list);
  116 + if(listAdd.size()>0){
  117 + listAdds.addAll(listAdd);
  118 + }
  119 + }
  120 +
  121 + }
  122 +
  123 + if(listAdds.size()>0){
  124 + new BatchSaveUtils<Sheet>().saveList(listAdds, Sheet.class);
  125 + }
  126 + result = "success";
  127 + }catch (Exception e) {
  128 + // TODO Auto-generated catch block
  129 + throw e;
  130 + }finally{
  131 + logger.info("setDDRB:"+result);
  132 + }
  133 +
  134 + return result;
  135 + }
  136 +
  137 + public List<Sheet> punctualByLine(String line,List<ScheduleRealInfo> list){
  138 + List<Sheet> listAdd=new ArrayList<Sheet>();
  139 +// String line =map.get("line").toString();
  140 +// String date =map.get("date").toString();
  141 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm");
  142 + String sqlMinYysj="select start_opt from bsth_c_line_config where "
  143 + + " id = ("
  144 + + "select max(id) from bsth_c_line_config where line ='"+BasicData.lineId2CodeMap.inverse().get(line) +"'"
  145 + + ")";
  146 + List<String> listMin=jdbcTemplate.query(sqlMinYysj,
  147 + new RowMapper<String>(){
  148 + @Override
  149 + public String mapRow(ResultSet rs, int rowNum) throws SQLException {
  150 + String s=rs.getString("start_opt");
  151 + return s;
  152 + }
  153 + });
  154 + if(listMin.size()>0){
  155 + String minfcsj=listMin.get(0);
  156 + String[] minSjs = minfcsj.split(":");
  157 + //车辆最早发车时间 用了过滤超第二天0点的数据
  158 + Long minSj=Long.parseLong(minSjs[0])*60+Long.parseLong(minSjs[1]);
  159 + //0 上行 1下行
  160 + List<ScheduleRealInfo> listJhsj0=new ArrayList<ScheduleRealInfo>();
  161 +
  162 + List<ScheduleRealInfo> listJhsj1=new ArrayList<ScheduleRealInfo>();
  163 +
  164 + List<ScheduleRealInfo> listReal0=new ArrayList<ScheduleRealInfo>();
  165 +
  166 + List<ScheduleRealInfo> listReal1=new ArrayList<ScheduleRealInfo>();
  167 + //排除所有进出场班次
  168 +// List<ScheduleRealInfo> list=scheduleRealInfoRepository.scheduleByDateAndLine2(line, date);
  169 + /* for (int i = 0; i < list.size(); i++) {
  170 + //排除所有烂班的班次
  171 + ScheduleRealInfo s=list.get(i);
  172 + Set<ChildTaskPlan> cts=s.getcTasks();
  173 + if(cts!=null && cts.size() > 0){
  174 +
  175 + }
  176 + ScheduleRealInfo r=checkBc(s);
  177 + String[] fcsj= r.getFcsj().split(":");
  178 + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]);
  179 + Long fscjT=0L;
  180 + if(fcsjL<minSj){
  181 + Calendar calendar = new GregorianCalendar();
  182 + calendar.setTime(r.getScheduleDate());
  183 + calendar.add(calendar.DATE,1);
  184 + r.setScheduleDate(calendar.getTime());
  185 + try {
  186 + fscjT = sdf.parse(sdf.format(r.getScheduleDate())+" "+r.getFcsj()).getTime();
  187 + } catch (ParseException e) {
  188 + // TODO Auto-generated catch block
  189 + e.printStackTrace();
  190 + }
  191 +
  192 + }else{
  193 + try {
  194 + fscjT =sdf.parse(r.getScheduleDateStr()+" "+r.getFcsj()).getTime();
  195 + } catch (ParseException e) {
  196 + // TODO Auto-generated catch block
  197 + e.printStackTrace();
  198 + };
  199 + }
  200 +
  201 + Sheet sheet=new Sheet();
  202 + Long fcsjAcual=0L;
  203 + if (r.getFcsjActual()!=null) {
  204 + if(!r.getFcsjActual().equals("")){
  205 + try {
  206 + fcsjAcual =sdf.parse(r.getRealExecDate()+" "+r.getFcsjActual()).getTime();
  207 + } catch (ParseException e) {
  208 + // TODO Auto-generated catch block
  209 + e.printStackTrace();
  210 + }
  211 +
  212 +
  213 + Long sjc=fscjT-fcsjAcual;
  214 + //在快慢五分钟内直接添加
  215 + if(sjc>= 3*60*1000*-1 && sjc <=3*60*1000){
  216 +
  217 + sheet.setDate(r.getScheduleDateStr());
  218 + sheet.setRealDate(r.getRealExecDate());
  219 + sheet.setJhsjt(fscjT);
  220 + sheet.setJhsj(r.getFcsj());
  221 + sheet.setSjsjt(fcsjAcual);
  222 + sheet.setSjsj(r.getFcsjActual());
  223 + sheet.setGs(r.getGsBm());
  224 + sheet.setFgs(r.getFgsBm());
  225 + sheet.setLine(r.getXlBm());
  226 + sheet.setXlDir(r.getXlDir());
  227 + sheet.setZdname(r.getQdzName());
  228 + sheet.setCreateDate(new Date());
  229 + listAdd.add(sheet);
  230 + }else{
  231 + r.setFcsjActualTime(fcsjAcual);
  232 + r.setFcsjT(fscjT);
  233 + if(r.getXlDir().equals("0")){
  234 + listJhsj0.add(r);
  235 + listReal0.add(r);
  236 + }else{
  237 + listJhsj1.add(r);
  238 + listReal1.add(r);
  239 + }
  240 + }
  241 + }else{
  242 + sheet.setDate(r.getScheduleDateStr());
  243 + sheet.setRealDate(r.getRealExecDate());
  244 + sheet.setJhsjt(fscjT);
  245 + sheet.setJhsj(r.getFcsj());
  246 + sheet.setSjsjt(0L);
  247 + sheet.setSjsj("烂班");
  248 + sheet.setGs(r.getGsBm());
  249 + sheet.setFgs(r.getFgsBm());
  250 + sheet.setLine(r.getXlBm());
  251 + sheet.setXlDir(r.getXlDir());
  252 + sheet.setZdname(r.getQdzName());
  253 + sheet.setCreateDate(new Date());
  254 + listAdd.add(sheet);
  255 + }
  256 + }else{
  257 + sheet.setDate(r.getScheduleDateStr());
  258 + sheet.setRealDate(r.getRealExecDate());
  259 + sheet.setJhsjt(fscjT);
  260 + sheet.setJhsj(r.getFcsj());
  261 + sheet.setSjsjt(0L);
  262 + sheet.setSjsj("烂班");
  263 + sheet.setGs(r.getGsBm());
  264 + sheet.setFgs(r.getFgsBm());
  265 + sheet.setLine(r.getXlBm());
  266 + sheet.setXlDir(r.getXlDir());
  267 + sheet.setZdname(r.getQdzName());
  268 + sheet.setCreateDate(new Date());
  269 + listAdd.add(sheet);
  270 + }
  271 + }*/
  272 + for (int i = 0; i < list.size(); i++) {
  273 + ScheduleRealInfo s=list.get(i);
  274 + ScheduleRealInfo r=checkBc(s);
  275 + String[] fcsj= r.getFcsj().split(":");
  276 + Long fcsjL=Long.parseLong(fcsj[0])*60+Long.parseLong(fcsj[1]);
  277 + Long fscjT=0L;
  278 + if(fcsjL<minSj){
  279 + Calendar calendar = new GregorianCalendar();
  280 + calendar.setTime(r.getScheduleDate());
  281 + calendar.add(calendar.DATE,1);
  282 + r.setScheduleDate(calendar.getTime());
  283 + try {
  284 + fscjT = sdf.parse(sdf.format(r.getScheduleDate())+" "+r.getFcsj()).getTime();
  285 + } catch (ParseException e) {
  286 + // TODO Auto-generated catch block
  287 + e.printStackTrace();
  288 + }
  289 +
  290 + }else{
  291 + try {
  292 + fscjT =sdf.parse(r.getScheduleDateStr()+" "+r.getFcsj()).getTime();
  293 + } catch (ParseException e) {
  294 + // TODO Auto-generated catch block
  295 + e.printStackTrace();
  296 + };
  297 + }
  298 + r.setFcsjT(fscjT);
  299 + Sheet sheet=new Sheet();
  300 + if (s.getFcsjActual() != null) {
  301 + Long fcsjAcual = 0L;
  302 + try {
  303 + fcsjAcual = sdf.parse(r.getRealExecDate() + " " + r.getFcsjActual()).getTime();
  304 + r.setFcsjActualTime(fcsjAcual);
  305 + r.setFcsjT(fscjT);
  306 + } catch (ParseException e) {
  307 + // TODO Auto-generated catch block
  308 + e.printStackTrace();
  309 + }
  310 + if (r.isSflj()) {
  311 + if (s.getXlDir().equals("0")) {
  312 + listReal0.add(r);
  313 + } else {
  314 + listReal1.add(r);
  315 + }
  316 +
  317 + } else {
  318 + if (s.getFcsjActual() != null) {
  319 + Long sjc = fcsjAcual - fscjT;
  320 + // 在快慢五分钟内直接添加
  321 + if (sjc >= 1 * 60 * 1000 * -1 && sjc <= 3 * 60 * 1000) {
  322 + sheet.setDate(r.getScheduleDateStr());
  323 + sheet.setRealDate(r.getRealExecDate());
  324 + sheet.setJhsjt(fscjT);
  325 + sheet.setJhsj(r.getFcsj());
  326 + sheet.setSjsjt(fcsjAcual);
  327 + sheet.setSjsj(r.getFcsjActual());
  328 + sheet.setGs(r.getGsBm());
  329 + sheet.setFgs(r.getFgsBm());
  330 + sheet.setLine(r.getXlBm());
  331 + sheet.setXlDir(r.getXlDir());
  332 + sheet.setZdname(r.getQdzName());
  333 + sheet.setCreateDate(new Date());
  334 + listAdd.add(sheet);
  335 + } else {
  336 + if (r.getXlDir().equals("0")) {
  337 + listJhsj0.add(r);
  338 + listReal0.add(r);
  339 + } else {
  340 + listJhsj1.add(r);
  341 + listReal1.add(r);
  342 + }
  343 + }
  344 + }
  345 + }
  346 + } else {
  347 + /*sheet.setDate(r.getScheduleDateStr());
  348 + sheet.setRealDate(r.getRealExecDate());
  349 + sheet.setJhsjt(fscjT);
  350 + sheet.setJhsj(r.getFcsj());
  351 + sheet.setSjsjt(0L);
  352 + sheet.setSjsj("烂班");
  353 + sheet.setGs(r.getGsBm());
  354 + sheet.setFgs(r.getFgsBm());
  355 + sheet.setLine(r.getXlBm());
  356 + sheet.setXlDir(r.getXlDir());
  357 + sheet.setZdname(r.getQdzName());
  358 + sheet.setCreateDate(new Date());
  359 + listAdd.add(sheet);*/
  360 + r.setFcsjActualTime(0L);
  361 + r.setFcsjT(fscjT);
  362 + r.setFcsjActual("烂班");
  363 + if (r.getXlDir().equals("0")) {
  364 + listJhsj0.add(r);
  365 + listReal0.add(r);
  366 + } else {
  367 + listJhsj1.add(r);
  368 + listReal1.add(r);
  369 + }
  370 +
  371 + }
  372 +
  373 + }
  374 + //计发排序
  375 + Collections.sort(listJhsj0, new ComparableReal());
  376 + Collections.sort(listJhsj1, new ComparableReal());
  377 + //实发排序
  378 + Collections.sort(listReal0,new ComparableAcual());
  379 + Collections.sort(listReal1,new ComparableAcual());
  380 +
  381 + //计划发车时间和实际发车时间比较计算准点率
  382 +
  383 +
  384 +
  385 + int no=listJhsj0.size()*2;
  386 + boolean fage=true;
  387 +// for (int p = no; p > 0; p--) {
  388 + while(fage){
  389 + //查询所有的实发 对应最接近的 计发
  390 + List<Map<String, Object>> list_map=new ArrayList<Map<String,Object>>();
  391 + for (int i = 0; i < listReal0.size(); i++) {
  392 + Map<String, Object> m_=new HashMap<String,Object>();
  393 + ScheduleRealInfo s1=listReal0.get(i);
  394 + Long sjsj=s1.getFcsjActualTime();
  395 + ScheduleRealInfo absInfo=new ScheduleRealInfo();
  396 + int next_j=listJhsj0.size();
  397 + for (int j = 0; j < listJhsj0.size(); j++) {
  398 + ScheduleRealInfo s2=listJhsj0.get(j);
  399 + if(j==0){
  400 + absInfo=s2;
  401 + }else{
  402 + //计发实发时间绝对值比较 取到最接近的值
  403 + Long abs1 = Math.abs(sjsj - s2.getFcsjT());
  404 + Long abs2 = Math.abs(sjsj -absInfo.getFcsjT());
  405 + if(abs2-abs1>0){
  406 + absInfo=s2;
  407 + next_j=j;
  408 + }
  409 + }
  410 + }
  411 + if(next_j<=0){
  412 + break;
  413 + }else{
  414 + m_.put("s", s1.getId());
  415 + m_.put("j", absInfo.getId());
  416 + m_.put("s_list", s1);
  417 + m_.put("j_list", absInfo);
  418 + m_.put("abs", Math.abs(sjsj-absInfo.getFcsjT()));
  419 + list_map.add(m_);
  420 + }
  421 + }
  422 + Collections.sort(list_map,new ComparableMap());
  423 + Map<String, Object> m_s=new HashMap<String,Object>();
  424 + List<Map<String, Object>> list_m_s=new ArrayList<Map<String,Object>>();
  425 +
  426 + for (int i = 0; i < list_map.size(); i++) {
  427 + Map<String, Object> m_=list_map.get(i);
  428 + Map<String, Object> m_l=new HashMap<String,Object>();
  429 + if(m_s.get(m_.get("j").toString())==null){
  430 + m_s.put(m_.get("s").toString(), m_.get("s"));
  431 + m_s.put(m_.get("j").toString(), m_.get("j"));
  432 + m_l.put("s", m_.get("s"));
  433 + m_l.put("j", m_.get("j"));
  434 + m_l.put("s_l",m_.get("s_list"));
  435 + m_l.put("j_l",m_.get("j_list"));
  436 + list_m_s.add(m_l);
  437 + }
  438 + }
  439 + for (int i = 0; i < list_m_s.size(); i++) {
  440 + Map<String, Object> m_l=list_m_s.get(i);
  441 + Long s=Long.parseLong(m_l.get("s").toString());
  442 + boolean s_bool=false;
  443 + for (int k = 0; k < listReal0.size(); k++) {
  444 + ScheduleRealInfo s0=listReal0.get(k);
  445 + if(s0.getId()-s==0){
  446 + listReal0.remove(s0);
  447 + s_bool=true;
  448 + }
  449 + }
  450 +
  451 + Long j=Long.parseLong(m_l.get("j").toString());
  452 + boolean j_bool=false;
  453 + for (int j2 = 0; j2 < listJhsj0.size(); j2++) {
  454 + ScheduleRealInfo j0=listJhsj0.get(j2);
  455 + if(j0.getId()-j==0){
  456 + listJhsj0.remove(j0);
  457 + j_bool=true;
  458 + }
  459 + }
  460 +
  461 + if(s_bool&&j_bool){
  462 + ScheduleRealInfo sf=(ScheduleRealInfo)m_l.get("s_l");
  463 + ScheduleRealInfo jf=(ScheduleRealInfo)m_l.get("j_l");
  464 + Sheet sheet=new Sheet();
  465 + sheet.setDate(sf.getScheduleDateStr());
  466 + sheet.setRealDate(sf.getRealExecDate());
  467 + sheet.setJhsjt(jf.getFcsjT());
  468 + sheet.setJhsj(jf.getFcsj());
  469 + sheet.setSjsjt(sf.getFcsjActualTime());
  470 + sheet.setSjsj(sf.getFcsjActual());
  471 + sheet.setGs(sf.getGsBm());
  472 + sheet.setFgs(sf.getFgsBm());
  473 + sheet.setLine(sf.getXlBm());
  474 + sheet.setXlDir(sf.getXlDir());
  475 + sheet.setZdname(sf.getQdzName());
  476 + sheet.setCreateDate(new Date());
  477 + listAdd.add(sheet);
  478 + }
  479 + }
  480 +
  481 + if(listJhsj0.size()<=0){
  482 + fage=false;
  483 + }
  484 + no--;
  485 + if(no<0){
  486 + fage=false;
  487 + }
  488 + }
  489 +
  490 +
  491 + int nos=listJhsj1.size()*2;
  492 + fage=true;
  493 + while(fage){
  494 + //查询所有的实发 对应最接近的 计发
  495 + List<Map<String, Object>> list_map=new ArrayList<Map<String,Object>>();
  496 + for (int i = 0; i < listReal1.size(); i++) {
  497 + Map<String, Object> m_=new HashMap<String,Object>();
  498 + ScheduleRealInfo s1=listReal1.get(i);
  499 + Long sjsj=s1.getFcsjActualTime();
  500 + ScheduleRealInfo absInfo=new ScheduleRealInfo();
  501 + int next_j=listJhsj1.size();
  502 + for (int j = 0; j < listJhsj1.size(); j++) {
  503 + ScheduleRealInfo s2=listJhsj1.get(j);
  504 + if(j==0){
  505 + absInfo=s2;
  506 + }else{
  507 + //计发实发时间绝对值比较 取到最接近的值
  508 + Long abs1 = Math.abs(sjsj - s2.getFcsjT());
  509 + Long abs2 = Math.abs(sjsj -absInfo.getFcsjT());
  510 + if(abs2-abs1>0){
  511 + absInfo=s2;
  512 + next_j=j;
  513 + }
  514 + }
  515 + }
  516 + if(next_j<=0){
  517 + break;
  518 + }else{
  519 + m_.put("s", s1.getId());
  520 + m_.put("j", absInfo.getId());
  521 + m_.put("s_list", s1);
  522 + m_.put("j_list", absInfo);
  523 + m_.put("abs", Math.abs(sjsj-absInfo.getFcsjT()));
  524 + list_map.add(m_);
  525 + }
  526 +
  527 + }
  528 + Collections.sort(list_map,new ComparableMap());
  529 + Map<String, Object> m_s=new HashMap<String,Object>();
  530 + List<Map<String, Object>> list_m_s=new ArrayList<Map<String,Object>>();
  531 +
  532 + for (int i = 0; i < list_map.size(); i++) {
  533 + Map<String, Object> m_=list_map.get(i);
  534 + Map<String, Object> m_l=new HashMap<String,Object>();
  535 + if(m_s.get(m_.get("j").toString())==null){
  536 + m_s.put(m_.get("s").toString(), m_.get("s"));
  537 + m_s.put(m_.get("j").toString(), m_.get("j"));
  538 + m_l.put("s", m_.get("s"));
  539 + m_l.put("j", m_.get("j"));
  540 + m_l.put("s_l",m_.get("s_list"));
  541 + m_l.put("j_l",m_.get("j_list"));
  542 + list_m_s.add(m_l);
  543 + }
  544 + }
  545 + for (int i = 0; i < list_m_s.size(); i++) {
  546 + Map<String, Object> m_l=list_m_s.get(i);
  547 + Long s=Long.parseLong(m_l.get("s").toString());
  548 + boolean s_bool=false;
  549 + for (int k = 0; k < listReal1.size(); k++) {
  550 + ScheduleRealInfo s0=listReal1.get(k);
  551 + if(s0.getId()-s==0){
  552 + listReal1.remove(s0);
  553 + s_bool=true;
  554 + }
  555 + }
  556 +
  557 + Long j=Long.parseLong(m_l.get("j").toString());
  558 + boolean j_bool=false;
  559 + for (int j2 = 0; j2 < listJhsj1.size(); j2++) {
  560 + ScheduleRealInfo j0=listJhsj1.get(j2);
  561 + if(j0.getId()-j==0){
  562 + listJhsj1.remove(j0);
  563 + j_bool=true;
  564 + }
  565 + }
  566 +
  567 + if(s_bool&&j_bool){
  568 + ScheduleRealInfo sf=(ScheduleRealInfo)m_l.get("s_l");
  569 + ScheduleRealInfo jf=(ScheduleRealInfo)m_l.get("j_l");
  570 + Sheet sheet=new Sheet();
  571 + sheet.setDate(sf.getScheduleDateStr());
  572 + sheet.setRealDate(sf.getRealExecDate());
  573 + sheet.setJhsjt(jf.getFcsjT());
  574 + sheet.setJhsj(jf.getFcsj());
  575 + sheet.setSjsjt(sf.getFcsjActualTime());
  576 + sheet.setSjsj(sf.getFcsjActual());
  577 + sheet.setGs(sf.getGsBm());
  578 + sheet.setFgs(sf.getFgsBm());
  579 + sheet.setLine(sf.getXlBm());
  580 + sheet.setXlDir(sf.getXlDir());
  581 + sheet.setZdname(sf.getQdzName());
  582 + sheet.setCreateDate(new Date());
  583 + listAdd.add(sheet);
  584 + }
  585 + }
  586 +
  587 + if(listJhsj1.size()<=0){
  588 + fage=false;
  589 + }
  590 + nos--;
  591 + if(nos<0){
  592 + fage=false;
  593 + }
  594 + }
  595 + }
  596 + return listAdd;
  597 + }
  598 +
  599 + public ScheduleRealInfo checkBc(ScheduleRealInfo s){
  600 + //如果班次有子任务 且 子任务中有属于营运的。把该子任务的发车时间设置成班次的发车时间
  601 + Set<ChildTaskPlan> childTaskPlans = s.getcTasks();
  602 + if(!childTaskPlans.isEmpty()){
  603 + List<ChildTaskPlan> listit=new ArrayList<ChildTaskPlan>(childTaskPlans);
  604 + Collections.sort(listit, new ComparableChild());
  605 + for (int i = 0; i < listit.size(); i++) {
  606 + ChildTaskPlan c=listit.get(i);
  607 + if(!c.isDestroy()){
  608 + if(c.getMileageType().equals("service")){
  609 + s.setFcsjActual(c.getStartDate());
  610 + break;
  611 + }
  612 +
  613 + }
  614 + }
  615 + }
  616 + return s;
  617 + }
  618 +
  619 + public Long abs_js(List<ScheduleRealInfo> list,ScheduleRealInfo t){
  620 + Long jhsj=t.getFcsjT();
  621 + ScheduleRealInfo absInfo=new ScheduleRealInfo();
  622 + for (int j = 0; j < list.size(); j++) {
  623 + ScheduleRealInfo s =list.get(j);
  624 + if(j==0){
  625 + absInfo=s;
  626 + }else{
  627 + //计发实发时间绝对值比较 取到最接近的值
  628 + Long abs1 = Math.abs(jhsj - s.getFcsjActualTime());
  629 + Long abs2 = Math.abs(absInfo.getFcsjActualTime());
  630 + if(abs2-abs1>0){
  631 + absInfo=s;
  632 + }
  633 + }
  634 + }
  635 + return absInfo.getId();
  636 +
  637 + }
  638 +
  639 + @Override
  640 + public List<Map<String, Object>> countList(Map<String, Object> map) {
  641 + // TODO Auto-generated method stub
  642 + List<Map<String, Object>> listmap=new ArrayList<Map<String,Object>>();
  643 + String line="";
  644 + if(map.get("line")!=null){
  645 + line =map.get("line").toString();
  646 + }
  647 + String gs="";
  648 + if(map.get("gs")!=null){
  649 + gs=map.get("gs").toString();
  650 + }
  651 + String fgs="";
  652 + if(map.get("fgs")!=null){
  653 + fgs=map.get("fgs").toString();
  654 + }
  655 + String date=map.get("date").toString();
  656 + String sql="select * from bsth_c_sheet where date='"+date+"'";
  657 + if(line.trim().equals("")){
  658 + sql +=" and gs like '%"+gs+"%' and fgs like '%"+fgs+"%'";
  659 + }else{
  660 + sql +=" and line ='"+line+"'";
  661 + }
  662 + sql +=" order by line ";
  663 + List<Sheet> list=jdbcTemplate.query(sql,
  664 + new RowMapper<Sheet>(){
  665 + @Override
  666 + public Sheet mapRow(ResultSet rs, int rowNum) throws SQLException {
  667 + Sheet s=new Sheet();
  668 + s.setGs(rs.getString("gs"));
  669 + s.setFgs(rs.getString("fgs"));
  670 + s.setLine(rs.getString("line"));
  671 + s.setDate(rs.getString("date"));
  672 + s.setJhsj(rs.getString("jhsj"));
  673 + s.setJhsjt(rs.getLong("jhsjt"));
  674 + s.setSjsj(rs.getString("sjsj"));
  675 + s.setSjsjt(rs.getLong("sjsjt"));
  676 + s.setId(rs.getInt("id"));
  677 + return s;
  678 + }
  679 + });
  680 +
  681 + String sqlByLine="select line from bsth_c_sheet where date='"+date+"'";
  682 + if(line.trim().equals("")){
  683 + sqlByLine +=" and gs like '%"+gs+"%' and fgs like '%"+fgs+"%'";
  684 + }else{
  685 + sqlByLine +=" and line ='"+line+"'";
  686 + }
  687 + sqlByLine +=" group by line ";
  688 + List<String> listLine=jdbcTemplate.query(sqlByLine,
  689 + new RowMapper<String>(){
  690 + @Override
  691 + public String mapRow(ResultSet rs, int rowNum) throws SQLException {
  692 + String line=rs.getString("line");
  693 + return line;
  694 + }
  695 + });
  696 + for (int i = 0; i < listLine.size(); i++) {
  697 + String xlbm=listLine.get(i);
  698 + List<Sheet> newList=new ArrayList<Sheet>();
  699 + for (int j = 0; j < list.size(); j++) {
  700 + if(xlbm.equals(list.get(j).getLine())){
  701 + newList.add(list.get(j));
  702 + }
  703 + }
  704 +
  705 + if(newList.size()>0){
  706 + Map<String, Object> newmap=culateByLine(newList);
  707 + listmap.add(newmap);
  708 + }
  709 +
  710 + }
  711 + return listmap;
  712 + }
  713 +
  714 + public Map<String, Object> culateByLine(List<Sheet> list){
  715 + Map<String, Object> map=new HashMap<String,Object>();
  716 + String gs=BasicData.businessCodeNameMap.get(list.get(0).getGs());
  717 + String fgs=BasicData.businessFgsCodeNameMap.get(list.get(0).getFgs()+"_"+list.get(0).getGs());
  718 + String line=BasicData.lineCode2NameMap.get(list.get(0).getLine());
  719 + Integer id=list.get(0).getId();
  720 + int bcs=list.size();
  721 + int zdbcs=0;
  722 + for (int i = 0; i < list.size(); i++) {
  723 + Sheet s=list.get(i);
  724 + Long sjc=s.getJhsjt()-s.getSjsjt();
  725 + if(sjc>= 3*60*1000*-1 && sjc <=1*60*1000){
  726 + zdbcs++;
  727 + }
  728 + }
  729 + double zdlv =(zdbcs*1.0/bcs)*100;
  730 + DecimalFormat df = new DecimalFormat("0.00");
  731 + map.put("gs", gs);
  732 + map.put("fgs", fgs);
  733 + map.put("line", line);
  734 + map.put("bcs", bcs);
  735 + map.put("zdbcs", zdbcs);
  736 + map.put("zdlv", df.format(zdlv)+"%");
  737 + map.put("id", id);
  738 + return map;
  739 + }
  740 + @Override
  741 + public List<Sheet> sheetList(Integer id) {
  742 + // TODO Auto-generated method stub
  743 + Sheet sheet=sheetRepository.findOne(id);
  744 + String sql="select * from bsth_c_sheet where date='"+sheet.getDate()+"' and line = '"+sheet.getLine()+"'"
  745 + + " order by xl_dir,jhsj";
  746 +
  747 + List<Sheet> list=jdbcTemplate.query(sql,
  748 + new RowMapper<Sheet>(){
  749 + @Override
  750 + public Sheet mapRow(ResultSet rs, int rowNum) throws SQLException {
  751 + Sheet s=new Sheet();
  752 + s.setId(rs.getInt("id"));
  753 + s.setGs(rs.getString("gs"));
  754 + s.setFgs(rs.getString("fgs"));
  755 + s.setLine(rs.getString("line"));
  756 + s.setDate(rs.getString("date"));
  757 + s.setJhsj(rs.getString("jhsj"));
  758 + s.setJhsjt(rs.getLong("jhsjt"));
  759 + s.setSjsj(rs.getString("sjsj"));
  760 + s.setSjsjt(rs.getLong("sjsjt"));
  761 + s.setZdname(rs.getString("zdname"));
  762 + return s;
  763 + }
  764 + });
  765 + for (int i = 0; i < list.size(); i++) {
  766 + Sheet t=list.get(i);
  767 + t.setLine(BasicData.lineCode2NameMap.get(t.getLine()));
  768 + Long sjc=t.getJhsjt()-t.getSjsjt();
  769 + if(sjc>= 3*60*1000*-1 && sjc <=1*60*1000){
  770 + t.setSfzd("Y");
  771 + }else{
  772 + t.setSfzd("N");
  773 + }
  774 + }
  775 +
  776 + return list;
  777 + }
  778 +
  779 +
  780 +}
  781 + class ComparableAcual implements Comparator<ScheduleRealInfo>{
  782 +
  783 + @Override
  784 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  785 + // TODO Auto-generated method stub
  786 + return o1.getFcsjActualTime().compareTo(o2.getFcsjActualTime());
  787 + }
  788 +
  789 +}
  790 +
  791 + class ComparableMap implements Comparator<Map<String, Object>>{
  792 + @Override
  793 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  794 + // TODO Auto-generated method stub
  795 + return (int) (Long.parseLong(o1.get("abs").toString())-Long.parseLong((o2.get("abs").toString())));
  796 + }
  797 + }
... ...
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
... ... @@ -9,5 +9,6 @@ import com.bsth.service.schedule.exception.ScheduleException;
9 9 public interface EmployeeConfigInfoService extends BService<EmployeeConfigInfo, Long> {
10 10 void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
11 11 void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
12   - public void toggleCancel(Long id) throws ScheduleException;
  12 + void toggleCancel(Long id) throws ScheduleException;
  13 + Long getMaxDbbm(Integer xlId);
13 14 }
... ...
src/main/java/com/bsth/service/schedule/GuideboardInfoService.java
... ... @@ -7,8 +7,10 @@ import com.bsth.service.schedule.exception.ScheduleException;
7 7 * Created by xu on 16/5/11.
8 8 */
9 9 public interface GuideboardInfoService extends BService<GuideboardInfo, Long> {
10   - public void validate_lpno(GuideboardInfo guideboardInfo) throws ScheduleException;
11   - public void validate_lpname(GuideboardInfo guideboardInfo) throws ScheduleException;
12   - public void toggleCancel(Long id) throws ScheduleException;
  10 + void validate_lpno(GuideboardInfo guideboardInfo) throws ScheduleException;
  11 + void validate_lpname(GuideboardInfo guideboardInfo) throws ScheduleException;
  12 + void toggleCancel(Long id) throws ScheduleException;
  13 +
  14 + Long getMaxLpno(Integer xlid);
13 15  
14 16 }
... ...
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
... ... @@ -8,11 +8,16 @@ import com.bsth.service.schedule.exception.ScheduleException;
8 8 import com.bsth.service.schedule.utils.DataToolsService;
9 9 import org.springframework.beans.factory.annotation.Autowired;
10 10 import org.springframework.beans.factory.annotation.Qualifier;
  11 +import org.springframework.dao.DataAccessException;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.jdbc.core.ResultSetExtractor;
11 14 import org.springframework.stereotype.Service;
12 15 import org.springframework.transaction.annotation.Transactional;
13 16 import org.springframework.util.CollectionUtils;
14 17  
15 18 import java.io.File;
  19 +import java.sql.ResultSet;
  20 +import java.sql.SQLException;
16 21 import java.util.*;
17 22  
18 23 /**
... ... @@ -27,6 +32,9 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
27 32 @Qualifier(value = "employeeConfig_dataTool")
28 33 private DataToolsService dataToolsService;
29 34  
  35 + @Autowired
  36 + private JdbcTemplate jdbcTemplate;
  37 +
30 38 @Override
31 39 public File uploadFile(String filename, byte[] filedata) throws ScheduleException {
32 40 return dataToolsService.uploadFile(filename, filedata);
... ... @@ -42,6 +50,25 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
42 50 return dataToolsService.exportData(params);
43 51 }
44 52  
  53 + @Override
  54 + public Long getMaxDbbm(Integer xlId) {
  55 + String sql = "select max(dbbm + 0) as maxdbbm from bsth_c_s_ecinfo where xl = ?";
  56 +
  57 + Long maxBM = jdbcTemplate.query(sql, new ResultSetExtractor<Long>() {
  58 + @Override
  59 + public Long extractData(ResultSet rs) throws SQLException, DataAccessException {
  60 + if (rs.next()) {
  61 + return rs.getLong("maxdbbm");
  62 + } else {
  63 + return 0L;
  64 + }
  65 +
  66 + }
  67 + }, xlId);
  68 +
  69 + return maxBM + 1;
  70 + }
  71 +
45 72 @Transactional
46 73 @Override
47 74 public void validate_jsy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
... ...
src/main/java/com/bsth/service/schedule/impl/GuideboardInfoServiceImpl.java
... ... @@ -8,11 +8,16 @@ import com.bsth.service.schedule.exception.ScheduleException;
8 8 import com.bsth.service.schedule.utils.DataToolsService;
9 9 import org.springframework.beans.factory.annotation.Autowired;
10 10 import org.springframework.beans.factory.annotation.Qualifier;
  11 +import org.springframework.dao.DataAccessException;
  12 +import org.springframework.jdbc.core.JdbcTemplate;
  13 +import org.springframework.jdbc.core.ResultSetExtractor;
11 14 import org.springframework.stereotype.Service;
12 15 import org.springframework.util.CollectionUtils;
13 16  
14 17 import javax.transaction.Transactional;
15 18 import java.io.File;
  19 +import java.sql.ResultSet;
  20 +import java.sql.SQLException;
16 21 import java.util.HashMap;
17 22 import java.util.List;
18 23 import java.util.Map;
... ... @@ -29,6 +34,27 @@ public class GuideboardInfoServiceImpl extends BServiceImpl&lt;GuideboardInfo, Long
29 34 @Autowired
30 35 private TTInfoDetailService ttInfoDetailService;
31 36  
  37 + @Autowired
  38 + private JdbcTemplate jdbcTemplate;
  39 +
  40 + @Override
  41 + public Long getMaxLpno(Integer xlid) {
  42 + String sql = "select max(lp_no) as maxno from bsth_c_s_gbi where xl = ?";
  43 +
  44 + Long maxNo = jdbcTemplate.query(sql, new ResultSetExtractor<Long>() {
  45 + @Override
  46 + public Long extractData(ResultSet rs) throws SQLException, DataAccessException {
  47 + if (rs.next()) {
  48 + return rs.getLong("maxno");
  49 + } else {
  50 + return 0L;
  51 + }
  52 + }
  53 + }, xlid);
  54 +
  55 + return maxNo + 1;
  56 + }
  57 +
32 58 @Override
33 59 public void validate_lpno(GuideboardInfo guideboardInfo) throws ScheduleException {
34 60 // 查询条件
... ...
src/main/java/com/bsth/service/schedule/impl/SchedulePlanServiceImpl.java
... ... @@ -249,6 +249,8 @@ public class SchedulePlanServiceImpl extends BServiceImpl&lt;SchedulePlan, Long&gt; im
249 249 end2.getTime() - start2.getTime(),
250 250 end3.getTime() - start3.getTime());
251 251  
  252 + // TODO:将lpInfoResults_output 也要返回
  253 +
252 254 return planResult;
253 255 }
254 256  
... ...