Commit 65c24b453b2bba4fa9769bf8fa4f7cb9d2da7684

Authored by youxiw2000
2 parents b362ddfb 9d003d17

Merge branch 'pudong_jdk8' of http://192.168.168.245:8888/panzhaov5/bsth_control into pudong_jdk8

Too many changes to show.

To preserve performance only 15 of 26 files are displayed.

src/main/java/com/bsth/common/Constants.java
... ... @@ -61,4 +61,6 @@ public class Constants {
61 61 public static final String MULTI_REMOVE_CHILDTASK_SCH_FK = "update bsth_c_s_child_task set schedule=NULL where schedule in ";
62 62  
63 63 public static final String WEAK_CIPHER = "weakCipher";
  64 +
  65 + public static final String FILE_AUTH = "/.well-known/pki-validation/fileauth.txt";
64 66 }
... ...
src/main/java/com/bsth/controller/realcontrol/calc/ReCalcDataController.java
... ... @@ -20,7 +20,8 @@ import java.util.Map;
20 20 @RequestMapping("/sch/reCalc")
21 21 public class ReCalcDataController {
22 22  
23   - private static String reCalcUrl = "http://10.10.150.24:30571/reCalc/scheduleDetail";
  23 +// private static String reCalcUrl = "http://10.10.150.24:30571/reCalc/scheduleDetail";
  24 + private static String reCalcUrl = "http://127.0.0.1:30571/reCalc/scheduleDetail";
24 25  
25 26 Logger logger = LoggerFactory.getLogger(this.getClass());
26 27  
... ...
src/main/java/com/bsth/controller/schedule/datasync/VehicleDataSyncController.java
... ... @@ -6,7 +6,12 @@ import com.bsth.controller.schedule.datasync.request.VehicleDataSyncTaskRequest;
6 6 import com.bsth.entity.schedule.datasync.VehicleDataSyncTask;
7 7 import com.bsth.entity.schedule.datasync.VehicleDataSyncTaskTypeEnum;
8 8 import com.bsth.service.schedule.datasync.VehicleDataSyncTaskService;
  9 +import com.bsth.service.schedule.utils.DataToolsProperties;
9 10 import com.bsth.service.schedule.utils.MyHttpUtils;
  11 +import org.apache.commons.vfs2.FileObject;
  12 +import org.apache.commons.vfs2.FileSystem;
  13 +import org.apache.commons.vfs2.FilesCache;
  14 +import org.pentaho.di.core.vfs.KettleVFS;
10 15 import org.springframework.beans.factory.annotation.Autowired;
11 16 import org.springframework.web.bind.annotation.*;
12 17  
... ... @@ -48,6 +53,37 @@ public class VehicleDataSyncController extends BController<VehicleDataSyncTask,
48 53 }
49 54 //------------------ 外部系统调用的api(如上)-----------------------//
50 55  
  56 + @Autowired
  57 + private DataToolsProperties dataToolsProperties;
  58 + /**
  59 + * 刷新缓存。
  60 + * @return
  61 + */
  62 + @GetMapping(value = "/refreshBuffer")
  63 + public ApiResult refreshBuffer() {
  64 + try {
  65 + // 1、刷新车辆同步ETL文件
  66 + // 注意:使用Kettle内部的相关类清除指定ktr的缓存
  67 + File ktrFile = new File(this.getClass().getResource(
  68 + dataToolsProperties.getVehicleDatasyncktr()).toURI());
  69 + FileObject fileObject = KettleVFS.getFileObject(ktrFile.getAbsolutePath());
  70 + FileSystem fileSystem = fileObject.getFileSystem();
  71 + FilesCache filesCache = KettleVFS.getInstance().getFileSystemManager().getFilesCache();
  72 +// System.out.println(filesCache.getFile(fileSystem, fileObject.getName()));
  73 + filesCache.removeFile(fileSystem, fileObject.getName());
  74 +
  75 + return ApiResult.success(
  76 + "200",
  77 + "刷新成功",
  78 + "刷新成功");
  79 + } catch (Exception exp) {
  80 + exp.printStackTrace();
  81 + return ApiResult.failure(
  82 + "500",
  83 + "刷新失败,内部错误:" + exp.getMessage());
  84 + }
  85 + }
  86 +
51 87 /**
52 88 * 手动添加同步任务。
53 89 * @param vehicleDataSyncTaskRequest
... ...
src/main/java/com/bsth/data/report_register/entity/ReportRegister.java
1   -package com.bsth.data.report_register.entity;
2   -
3   -import javax.persistence.*;
4   -import java.text.DateFormat;
5   -import java.text.SimpleDateFormat;
6   -import java.util.Date;
7   -
8   -
9   -@Entity
10   -@Table(name = "bsth_t_report")
11   -public class ReportRegister {
12   -
13   - @Id
14   - @GeneratedValue(strategy = GenerationType.IDENTITY)
15   - private long ID;
16   -
17   - /** 类型*/
18   - private String REPORT_TYPE;
19   - /** 公司 */
20   - private String REPORT_GS;
21   - /** 分公司 */
22   - private String REPORT_FGS;
23   - /** 公司名 */
24   - private String REPORT_GSNAME;
25   - /** 分公司名 */
26   - private String REPORT_FGSNAME;
27   - /** 时间*/
28   - private Date REPORT_DATE;
29   - /** 报备人*/
30   - private String REPORT_BBR;
31   - /** 线路编码 */
32   - private String REPORT_XL;
33   - /** 线路名*/
34   - private String REPORT_XLNAME;
35   - /** 站点*/
36   - private String REPORT_STATION;
37   - /** 对外上报部门*/
38   - private String REPORT_DWSBBM;
39   - /** 对外上报时间*/
40   - private String REPORT_DWSBSJ;
41   - /** 延误时间*/
42   - private String REPORT_YWSJ;
43   - /** 首末班误点原因*/
44   - private String REPORT_SMBWD;
45   - /** 大间隔时间*/
46   - private String REPORT_DJGSJ;
47   - /** 大间隔原因*/
48   - private String REPORT_DJGYY;
49   - /** 突发事件*/
50   - private String REPORT_TFSJ;
51   - /** 影响时间*/
52   - private String REPORT_YXSJ;
53   - /** 影响班次数*/
54   - private String REPORT_YXBC;
55   - /** 调整措施*/
56   - private String REPORT_TZCS;
57   - /** 报案事故编号*/
58   - private String REPORT_SGBH;
59   - /** 车辆自编号*/
60   - private String REPORT_ZBH;
61   - /** 车辆牌照号*/
62   - private String REPORT_PZH;
63   - /** 驾驶员*/
64   - private String REPORT_JSY;
65   - /** 事故发生时间*/
66   - private String REPORT_SGSJ;
67   - /** 事故发生地点*/
68   - private String REPORT_SGDD;
69   - /** 行驶方向*/
70   - private String REPORT_XSFX;
71   - /** 事故对象*/
72   - private String REPORT_SGDX;
73   - /** 对象车牌照号*/
74   - private String REPORT_DXPZH;
75   - /** 事故概况*/
76   - private String REPORT_SGGK;
77   - /** 受伤人数*/
78   - private String REPORT_SSRS;
79   - /** 死亡人数*/
80   - private String REPORT_SWRS;
81   - /** 报告人 */
82   - private String REPORT_BGR;
83   - /** 报告人电话 */
84   - private String REPORT_BGRDH;
85   - /** 备注 */
86   - private String REPORT_BZ;
87   - /** 路段*/
88   - private String REPORT_ROAD;
89   - /** 访问接口时使用的状态码 操作类型,0:新增;1:修改;2:删除 */
90   - private String STATUS;
91   - /** 创建人*/
92   - private String CREATE_BY;
93   - /** 创建时间 */
94   - @Column(updatable = false, name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
95   - private Date CREATE_DATE;
96   - /** 修改人*/
97   - private String UPDATE_BY;
98   - /** 修改时间*/
99   - @Column(name = "UPDATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
100   - private Date UPDATE_DATE;
101   -
102   - public long getID() {
103   - return ID;
104   - }
105   -
106   - public void setID(long ID) {
107   - this.ID = ID;
108   - }
109   -
110   - public String getREPORT_TYPE() {
111   - return REPORT_TYPE;
112   - }
113   -
114   - public void setREPORT_TYPE(String REPORT_TYPE) {
115   - this.REPORT_TYPE = REPORT_TYPE;
116   - }
117   -
118   - public String getREPORT_GS() {
119   - return REPORT_GS;
120   - }
121   -
122   - public void setREPORT_GS(String REPORT_GS) {
123   - this.REPORT_GS = REPORT_GS;
124   - }
125   -
126   - public String getREPORT_FGS() {
127   - return REPORT_FGS;
128   - }
129   -
130   - public void setREPORT_FGS(String REPORT_FGS) {
131   - this.REPORT_FGS = REPORT_FGS;
132   - }
133   -
134   - public String getREPORT_GSNAME() {
135   - return REPORT_GSNAME;
136   - }
137   -
138   - public void setREPORT_GSNAME(String REPORT_GSNAME) {
139   - this.REPORT_GSNAME = REPORT_GSNAME;
140   - }
141   -
142   - public String getREPORT_FGSNAME() {
143   - return REPORT_FGSNAME;
144   - }
145   -
146   - public void setREPORT_FGSNAME(String REPORT_FGSNAME) {
147   - this.REPORT_FGSNAME = REPORT_FGSNAME;
148   - }
149   -
150   - public Date getREPORT_DATE() {
151   - return REPORT_DATE;
152   - }
153   -
154   - public void setREPORT_DATE(Date REPORT_DATE) {
155   - this.REPORT_DATE = REPORT_DATE;
156   - }
157   -
158   - public String getREPORT_BBR() {
159   - return REPORT_BBR;
160   - }
161   -
162   - public void setREPORT_BBR(String REPORT_BBR) {
163   - this.REPORT_BBR = REPORT_BBR;
164   - }
165   -
166   - public String getREPORT_XL() {
167   - return REPORT_XL;
168   - }
169   -
170   - public void setREPORT_XL(String REPORT_XL) {
171   - this.REPORT_XL = REPORT_XL;
172   - }
173   -
174   - public String getREPORT_XLNAME() {
175   - return REPORT_XLNAME;
176   - }
177   -
178   - public void setREPORT_XLNAME(String REPORT_XLNAME) {
179   - this.REPORT_XLNAME = REPORT_XLNAME;
180   - }
181   -
182   - public String getREPORT_STATION() {
183   - return REPORT_STATION;
184   - }
185   -
186   - public void setREPORT_STATION(String REPORT_STATION) {
187   - this.REPORT_STATION = REPORT_STATION;
188   - }
189   -
190   - public String getREPORT_DWSBBM() {
191   - return REPORT_DWSBBM;
192   - }
193   -
194   - public void setREPORT_DWSBBM(String REPORT_DWSBBM) {
195   - this.REPORT_DWSBBM = REPORT_DWSBBM;
196   - }
197   -
198   - public String getREPORT_DWSBSJ() {
199   - return REPORT_DWSBSJ;
200   - }
201   -
202   - public void setREPORT_DWSBSJ(String REPORT_DWSBSJ) {
203   - this.REPORT_DWSBSJ = REPORT_DWSBSJ;
204   - }
205   -
206   - public String getREPORT_YWSJ() {
207   - return REPORT_YWSJ;
208   - }
209   -
210   - public void setREPORT_YWSJ(String REPORT_YWSJ) {
211   - this.REPORT_YWSJ = REPORT_YWSJ;
212   - }
213   -
214   - public String getREPORT_SMBWD() {
215   - return REPORT_SMBWD;
216   - }
217   -
218   - public void setREPORT_SMBWD(String REPORT_SMBWD) {
219   - this.REPORT_SMBWD = REPORT_SMBWD;
220   - }
221   -
222   - public String getREPORT_DJGSJ() {
223   - return REPORT_DJGSJ;
224   - }
225   -
226   - public void setREPORT_DJGSJ(String REPORT_DJGSJ) {
227   - this.REPORT_DJGSJ = REPORT_DJGSJ;
228   - }
229   -
230   - public String getREPORT_DJGYY() {
231   - return REPORT_DJGYY;
232   - }
233   -
234   - public void setREPORT_DJGYY(String REPORT_DJGYY) {
235   - this.REPORT_DJGYY = REPORT_DJGYY;
236   - }
237   -
238   - public String getREPORT_TFSJ() {
239   - return REPORT_TFSJ;
240   - }
241   -
242   - public void setREPORT_TFSJ(String REPORT_TFSJ) {
243   - this.REPORT_TFSJ = REPORT_TFSJ;
244   - }
245   -
246   - public String getREPORT_YXSJ() {
247   - return REPORT_YXSJ;
248   - }
249   -
250   - public void setREPORT_YXSJ(String REPORT_YXSJ) {
251   - this.REPORT_YXSJ = REPORT_YXSJ;
252   - }
253   -
254   - public String getREPORT_YXBC() {
255   - return REPORT_YXBC;
256   - }
257   -
258   - public void setREPORT_YXBC(String REPORT_YXBC) {
259   - this.REPORT_YXBC = REPORT_YXBC;
260   - }
261   -
262   - public String getREPORT_TZCS() {
263   - return REPORT_TZCS;
264   - }
265   -
266   - public void setREPORT_TZCS(String REPORT_TZCS) {
267   - this.REPORT_TZCS = REPORT_TZCS;
268   - }
269   -
270   - public String getREPORT_SGBH() {
271   - return REPORT_SGBH;
272   - }
273   -
274   - public void setREPORT_SGBH(String REPORT_SGBH) {
275   - this.REPORT_SGBH = REPORT_SGBH;
276   - }
277   -
278   - public String getREPORT_ZBH() {
279   - return REPORT_ZBH;
280   - }
281   -
282   - public void setREPORT_ZBH(String REPORT_ZBH) {
283   - this.REPORT_ZBH = REPORT_ZBH;
284   - }
285   -
286   - public String getREPORT_PZH() {
287   - return REPORT_PZH;
288   - }
289   -
290   - public void setREPORT_PZH(String REPORT_PZH) {
291   - this.REPORT_PZH = REPORT_PZH;
292   - }
293   -
294   - public String getREPORT_JSY() {
295   - return REPORT_JSY;
296   - }
297   -
298   - public void setREPORT_JSY(String REPORT_JSY) {
299   - this.REPORT_JSY = REPORT_JSY;
300   - }
301   -
302   - public String getREPORT_SGSJ() {
303   - return REPORT_SGSJ;
304   - }
305   -
306   - public void setREPORT_SGSJ(String REPORT_SGSJ) {
307   - this.REPORT_SGSJ = REPORT_SGSJ;
308   - }
309   -
310   - public String getREPORT_SGDD() {
311   - return REPORT_SGDD;
312   - }
313   -
314   - public void setREPORT_SGDD(String REPORT_SGDD) {
315   - this.REPORT_SGDD = REPORT_SGDD;
316   - }
317   -
318   - public String getREPORT_XSFX() {
319   - return REPORT_XSFX;
320   - }
321   -
322   - public void setREPORT_XSFX(String REPORT_XSFX) {
323   - this.REPORT_XSFX = REPORT_XSFX;
324   - }
325   -
326   - public String getREPORT_SGDX() {
327   - return REPORT_SGDX;
328   - }
329   -
330   - public void setREPORT_SGDX(String REPORT_SGDX) {
331   - this.REPORT_SGDX = REPORT_SGDX;
332   - }
333   -
334   - public String getREPORT_DXPZH() {
335   - return REPORT_DXPZH;
336   - }
337   -
338   - public void setREPORT_DXPZH(String REPORT_DXPZH) {
339   - this.REPORT_DXPZH = REPORT_DXPZH;
340   - }
341   -
342   - public String getREPORT_SGGK() {
343   - return REPORT_SGGK;
344   - }
345   -
346   - public void setREPORT_SGGK(String REPORT_SGGK) {
347   - this.REPORT_SGGK = REPORT_SGGK;
348   - }
349   -
350   - public String getREPORT_SSRS() {
351   - return REPORT_SSRS;
352   - }
353   -
354   - public void setREPORT_SSRS(String REPORT_SSRS) {
355   - this.REPORT_SSRS = REPORT_SSRS;
356   - }
357   -
358   - public String getREPORT_SWRS() {
359   - return REPORT_SWRS;
360   - }
361   -
362   - public void setREPORT_SWRS(String REPORT_SWRS) {
363   - this.REPORT_SWRS = REPORT_SWRS;
364   - }
365   -
366   - public String getREPORT_BGR() {
367   - return REPORT_BGR;
368   - }
369   -
370   - public void setREPORT_BGR(String REPORT_BGR) {
371   - this.REPORT_BGR = REPORT_BGR;
372   - }
373   -
374   - public String getREPORT_BGRDH() {
375   - return REPORT_BGRDH;
376   - }
377   -
378   - public void setREPORT_BGRDH(String REPORT_BGRDH) {
379   - this.REPORT_BGRDH = REPORT_BGRDH;
380   - }
381   -
382   - public String getREPORT_BZ() {
383   - return REPORT_BZ;
384   - }
385   -
386   - public void setREPORT_BZ(String REPORT_BZ) {
387   - this.REPORT_BZ = REPORT_BZ;
388   - }
389   -
390   - public String getCREATE_BY() {
391   - return CREATE_BY;
392   - }
393   -
394   - public void setCREATE_BY(String CREATE_BY) {
395   - this.CREATE_BY = CREATE_BY;
396   - }
397   -
398   - public Date getCREATE_DATE() {
399   - return CREATE_DATE;
400   - }
401   -
402   - public void setCREATE_DATE(Date CREATE_DATE) {
403   - this.CREATE_DATE = CREATE_DATE;
404   - }
405   -
406   - public String getUPDATE_BY() {
407   - return UPDATE_BY;
408   - }
409   -
410   - public void setUPDATE_BY(String UPDATE_BY) {
411   - this.UPDATE_BY = UPDATE_BY;
412   - }
413   -
414   - public Date getUPDATE_DATE() {
415   - return UPDATE_DATE;
416   - }
417   -
418   - public void setUPDATE_DATE(Date UPDATE_DATE) {
419   - this.UPDATE_DATE = UPDATE_DATE;
420   - }
421   -
422   - public String getREPORT_ROAD() {
423   - return REPORT_ROAD;
424   - }
425   -
426   - public void setREPORT_ROAD(String REPORT_ROAD) {
427   - this.REPORT_ROAD = REPORT_ROAD;
428   - }
429   -
430   - public String getSTATUS() {
431   - return STATUS;
432   - }
433   -
434   - public void setSTATUS(String STATUS) {
435   - this.STATUS = STATUS;
436   - }
437   -
438   - @Override
439   - public String toString() {
440   - DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
441   - return "{" +
442   - "ID:'" + ID + '\'' +
443   - ", REPORT_TYPE:'" + REPORT_TYPE + '\'' +
444   - ", REPORT_GS:'" + REPORT_GS + '\'' +
445   - ", REPORT_FGS:'" + REPORT_FGS + '\'' +
446   - ", REPORT_DATE:'" + dateFormat.format(REPORT_DATE) + '\'' +
447   - ", REPORT_BBR:'" + REPORT_BBR + '\'' +
448   - ", REPORT_XL:'" + REPORT_XL + '\'' +
449   - ", REPORT_XLNAME:'" + REPORT_XLNAME + '\'' +
450   - ", REPORT_STATION:'" + REPORT_STATION + '\'' +
451   - ", REPORT_DWSBBM:'" + REPORT_DWSBBM + '\'' +
452   - ", REPORT_DWSBSJ:'" + REPORT_DWSBSJ + '\'' +
453   - ", REPORT_YWSJ:'" + REPORT_YWSJ + '\'' +
454   - ", REPORT_SMBWD:'" + REPORT_SMBWD + '\'' +
455   - ", REPORT_DJGSJ:'" + REPORT_DJGSJ + '\'' +
456   - ", REPORT_DJGYY:'" + REPORT_DJGYY + '\'' +
457   - ", REPORT_TFSJ:'" + REPORT_TFSJ + '\'' +
458   - ", REPORT_YXSJ:'" + REPORT_YXSJ + '\'' +
459   - ", REPORT_YXBC:'" + REPORT_YXBC + '\'' +
460   - ", REPORT_TZCS:'" + REPORT_TZCS + '\'' +
461   - ", REPORT_SGBH:'" + REPORT_SGBH + '\'' +
462   - ", REPORT_ZBH:'" + REPORT_ZBH + '\'' +
463   - ", REPORT_PZH:'" + REPORT_PZH + '\'' +
464   - ", REPORT_JSY:'" + REPORT_JSY + '\'' +
465   - ", REPORT_SGSJ:'" + REPORT_SGSJ + '\'' +
466   - ", REPORT_SGDD:'" + REPORT_SGDD + '\'' +
467   - ", REPORT_XSFX:'" + REPORT_XSFX + '\'' +
468   - ", REPORT_SGDX:'" + REPORT_SGDX + '\'' +
469   - ", REPORT_DXPZH:'" + REPORT_DXPZH + '\'' +
470   - ", REPORT_SGGK:'" + REPORT_SGGK + '\'' +
471   - ", REPORT_SSRS:'" + REPORT_SSRS + '\'' +
472   - ", REPORT_SWRS:'" + REPORT_SWRS + '\'' +
473   - ", REPORT_BGR:'" + REPORT_BGR + '\'' +
474   - ", REPORT_BGRDH:'" + REPORT_BGRDH + '\'' +
475   - ", REPORT_BZ:'" + REPORT_BZ + '\'' +
476   - ", CREATE_BY:'" + CREATE_BY + '\'' +
477   - ", CREATE_DATE:" + CREATE_DATE +
478   - ", UPDATE_BY:'" + UPDATE_BY + '\'' +
479   - ", UPDATE_DATE:" + UPDATE_DATE +
480   - ", REPORT_ROAD:'" + REPORT_ROAD + '\'' +
481   - ", STATUS:'" + STATUS + '\'' +
482   - '}';
483   - }
484   -}
  1 +package com.bsth.data.report_register.entity;
  2 +
  3 +import javax.persistence.*;
  4 +import java.text.DateFormat;
  5 +import java.text.SimpleDateFormat;
  6 +import java.util.Date;
  7 +
  8 +
  9 +@Entity
  10 +@Table(name = "bsth_t_report")
  11 +public class ReportRegister {
  12 +
  13 + @Id
  14 + @GeneratedValue(strategy = GenerationType.IDENTITY)
  15 + private long ID;
  16 +
  17 + /** 类型,1:首末班误点,2:大间隔,3:突发事件,4:事故,5:其他,6:咨询,7:绕改道 */
  18 + private String REPORT_TYPE;
  19 + /** 公司 */
  20 + private String REPORT_GS;
  21 + /** 分公司 */
  22 + private String REPORT_FGS;
  23 + /** 公司名 */
  24 + private String REPORT_GSNAME;
  25 + /** 分公司名 */
  26 + private String REPORT_FGSNAME;
  27 + /** 时间*/
  28 + private Date REPORT_DATE;
  29 + /** 报备人*/
  30 + private String REPORT_BBR;
  31 + /** 线路编码 */
  32 + private String REPORT_XL;
  33 + /** 线路名*/
  34 + private String REPORT_XLNAME;
  35 + /** 站点*/
  36 + private String REPORT_STATION;
  37 + /** 对外上报部门*/
  38 + private String REPORT_DWSBBM;
  39 + /** 对外上报时间*/
  40 + private String REPORT_DWSBSJ;
  41 + /** 延误时间*/
  42 + private String REPORT_YWSJ;
  43 + /** 首末班误点原因*/
  44 + private String REPORT_SMBWD;
  45 + /** 大间隔时间*/
  46 + private String REPORT_DJGSJ;
  47 + /** 大间隔原因*/
  48 + private String REPORT_DJGYY;
  49 + /** 突发事件*/
  50 + private String REPORT_TFSJ;
  51 + /** 影响时间*/
  52 + private String REPORT_YXSJ;
  53 + /** 影响班次数*/
  54 + private String REPORT_YXBC;
  55 + /** 调整措施*/
  56 + private String REPORT_TZCS;
  57 + /** 报案事故编号*/
  58 + private String REPORT_SGBH;
  59 + /** 车辆自编号*/
  60 + private String REPORT_ZBH;
  61 + /** 车辆牌照号*/
  62 + private String REPORT_PZH;
  63 + /** 驾驶员*/
  64 + private String REPORT_JSY;
  65 + /** 事故发生时间*/
  66 + private String REPORT_SGSJ;
  67 + /** 事故发生地点*/
  68 + private String REPORT_SGDD;
  69 + /** 行驶方向*/
  70 + private String REPORT_XSFX;
  71 + /** 事故对象*/
  72 + private String REPORT_SGDX;
  73 + /** 对象车牌照号*/
  74 + private String REPORT_DXPZH;
  75 + /** 事故概况*/
  76 + private String REPORT_SGGK;
  77 + /** 受伤人数*/
  78 + private String REPORT_SSRS;
  79 + /** 死亡人数*/
  80 + private String REPORT_SWRS;
  81 + /** 报告人 */
  82 + private String REPORT_BGR;
  83 + /** 报告人电话 */
  84 + private String REPORT_BGRDH;
  85 + /** 备注 */
  86 + private String REPORT_BZ;
  87 + /** 路段*/
  88 + private String REPORT_ROAD;
  89 + /** 访问接口时使用的状态码 操作类型,0:新增;1:修改;2:删除 */
  90 + private String STATUS;
  91 + /** 创建人*/
  92 + private String CREATE_BY;
  93 + /** 创建时间 */
  94 + @Column(updatable = false, name = "CREATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
  95 + private Date CREATE_DATE;
  96 + /** 修改人*/
  97 + private String UPDATE_BY;
  98 + /** 修改时间*/
  99 + @Column(name = "UPDATE_DATE", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
  100 + private Date UPDATE_DATE;
  101 +
  102 + public long getID() {
  103 + return ID;
  104 + }
  105 +
  106 + public void setID(long ID) {
  107 + this.ID = ID;
  108 + }
  109 +
  110 + public String getREPORT_TYPE() {
  111 + return REPORT_TYPE;
  112 + }
  113 +
  114 + public void setREPORT_TYPE(String REPORT_TYPE) {
  115 + this.REPORT_TYPE = REPORT_TYPE;
  116 + }
  117 +
  118 + public String getREPORT_GS() {
  119 + return REPORT_GS;
  120 + }
  121 +
  122 + public void setREPORT_GS(String REPORT_GS) {
  123 + this.REPORT_GS = REPORT_GS;
  124 + }
  125 +
  126 + public String getREPORT_FGS() {
  127 + return REPORT_FGS;
  128 + }
  129 +
  130 + public void setREPORT_FGS(String REPORT_FGS) {
  131 + this.REPORT_FGS = REPORT_FGS;
  132 + }
  133 +
  134 + public String getREPORT_GSNAME() {
  135 + return REPORT_GSNAME;
  136 + }
  137 +
  138 + public void setREPORT_GSNAME(String REPORT_GSNAME) {
  139 + this.REPORT_GSNAME = REPORT_GSNAME;
  140 + }
  141 +
  142 + public String getREPORT_FGSNAME() {
  143 + return REPORT_FGSNAME;
  144 + }
  145 +
  146 + public void setREPORT_FGSNAME(String REPORT_FGSNAME) {
  147 + this.REPORT_FGSNAME = REPORT_FGSNAME;
  148 + }
  149 +
  150 + public Date getREPORT_DATE() {
  151 + return REPORT_DATE;
  152 + }
  153 +
  154 + public void setREPORT_DATE(Date REPORT_DATE) {
  155 + this.REPORT_DATE = REPORT_DATE;
  156 + }
  157 +
  158 + public String getREPORT_BBR() {
  159 + return REPORT_BBR;
  160 + }
  161 +
  162 + public void setREPORT_BBR(String REPORT_BBR) {
  163 + this.REPORT_BBR = REPORT_BBR;
  164 + }
  165 +
  166 + public String getREPORT_XL() {
  167 + return REPORT_XL;
  168 + }
  169 +
  170 + public void setREPORT_XL(String REPORT_XL) {
  171 + this.REPORT_XL = REPORT_XL;
  172 + }
  173 +
  174 + public String getREPORT_XLNAME() {
  175 + return REPORT_XLNAME;
  176 + }
  177 +
  178 + public void setREPORT_XLNAME(String REPORT_XLNAME) {
  179 + this.REPORT_XLNAME = REPORT_XLNAME;
  180 + }
  181 +
  182 + public String getREPORT_STATION() {
  183 + return REPORT_STATION;
  184 + }
  185 +
  186 + public void setREPORT_STATION(String REPORT_STATION) {
  187 + this.REPORT_STATION = REPORT_STATION;
  188 + }
  189 +
  190 + public String getREPORT_DWSBBM() {
  191 + return REPORT_DWSBBM;
  192 + }
  193 +
  194 + public void setREPORT_DWSBBM(String REPORT_DWSBBM) {
  195 + this.REPORT_DWSBBM = REPORT_DWSBBM;
  196 + }
  197 +
  198 + public String getREPORT_DWSBSJ() {
  199 + return REPORT_DWSBSJ;
  200 + }
  201 +
  202 + public void setREPORT_DWSBSJ(String REPORT_DWSBSJ) {
  203 + this.REPORT_DWSBSJ = REPORT_DWSBSJ;
  204 + }
  205 +
  206 + public String getREPORT_YWSJ() {
  207 + return REPORT_YWSJ;
  208 + }
  209 +
  210 + public void setREPORT_YWSJ(String REPORT_YWSJ) {
  211 + this.REPORT_YWSJ = REPORT_YWSJ;
  212 + }
  213 +
  214 + public String getREPORT_SMBWD() {
  215 + return REPORT_SMBWD;
  216 + }
  217 +
  218 + public void setREPORT_SMBWD(String REPORT_SMBWD) {
  219 + this.REPORT_SMBWD = REPORT_SMBWD;
  220 + }
  221 +
  222 + public String getREPORT_DJGSJ() {
  223 + return REPORT_DJGSJ;
  224 + }
  225 +
  226 + public void setREPORT_DJGSJ(String REPORT_DJGSJ) {
  227 + this.REPORT_DJGSJ = REPORT_DJGSJ;
  228 + }
  229 +
  230 + public String getREPORT_DJGYY() {
  231 + return REPORT_DJGYY;
  232 + }
  233 +
  234 + public void setREPORT_DJGYY(String REPORT_DJGYY) {
  235 + this.REPORT_DJGYY = REPORT_DJGYY;
  236 + }
  237 +
  238 + public String getREPORT_TFSJ() {
  239 + return REPORT_TFSJ;
  240 + }
  241 +
  242 + public void setREPORT_TFSJ(String REPORT_TFSJ) {
  243 + this.REPORT_TFSJ = REPORT_TFSJ;
  244 + }
  245 +
  246 + public String getREPORT_YXSJ() {
  247 + return REPORT_YXSJ;
  248 + }
  249 +
  250 + public void setREPORT_YXSJ(String REPORT_YXSJ) {
  251 + this.REPORT_YXSJ = REPORT_YXSJ;
  252 + }
  253 +
  254 + public String getREPORT_YXBC() {
  255 + return REPORT_YXBC;
  256 + }
  257 +
  258 + public void setREPORT_YXBC(String REPORT_YXBC) {
  259 + this.REPORT_YXBC = REPORT_YXBC;
  260 + }
  261 +
  262 + public String getREPORT_TZCS() {
  263 + return REPORT_TZCS;
  264 + }
  265 +
  266 + public void setREPORT_TZCS(String REPORT_TZCS) {
  267 + this.REPORT_TZCS = REPORT_TZCS;
  268 + }
  269 +
  270 + public String getREPORT_SGBH() {
  271 + return REPORT_SGBH;
  272 + }
  273 +
  274 + public void setREPORT_SGBH(String REPORT_SGBH) {
  275 + this.REPORT_SGBH = REPORT_SGBH;
  276 + }
  277 +
  278 + public String getREPORT_ZBH() {
  279 + return REPORT_ZBH;
  280 + }
  281 +
  282 + public void setREPORT_ZBH(String REPORT_ZBH) {
  283 + this.REPORT_ZBH = REPORT_ZBH;
  284 + }
  285 +
  286 + public String getREPORT_PZH() {
  287 + return REPORT_PZH;
  288 + }
  289 +
  290 + public void setREPORT_PZH(String REPORT_PZH) {
  291 + this.REPORT_PZH = REPORT_PZH;
  292 + }
  293 +
  294 + public String getREPORT_JSY() {
  295 + return REPORT_JSY;
  296 + }
  297 +
  298 + public void setREPORT_JSY(String REPORT_JSY) {
  299 + this.REPORT_JSY = REPORT_JSY;
  300 + }
  301 +
  302 + public String getREPORT_SGSJ() {
  303 + return REPORT_SGSJ;
  304 + }
  305 +
  306 + public void setREPORT_SGSJ(String REPORT_SGSJ) {
  307 + this.REPORT_SGSJ = REPORT_SGSJ;
  308 + }
  309 +
  310 + public String getREPORT_SGDD() {
  311 + return REPORT_SGDD;
  312 + }
  313 +
  314 + public void setREPORT_SGDD(String REPORT_SGDD) {
  315 + this.REPORT_SGDD = REPORT_SGDD;
  316 + }
  317 +
  318 + public String getREPORT_XSFX() {
  319 + return REPORT_XSFX;
  320 + }
  321 +
  322 + public void setREPORT_XSFX(String REPORT_XSFX) {
  323 + this.REPORT_XSFX = REPORT_XSFX;
  324 + }
  325 +
  326 + public String getREPORT_SGDX() {
  327 + return REPORT_SGDX;
  328 + }
  329 +
  330 + public void setREPORT_SGDX(String REPORT_SGDX) {
  331 + this.REPORT_SGDX = REPORT_SGDX;
  332 + }
  333 +
  334 + public String getREPORT_DXPZH() {
  335 + return REPORT_DXPZH;
  336 + }
  337 +
  338 + public void setREPORT_DXPZH(String REPORT_DXPZH) {
  339 + this.REPORT_DXPZH = REPORT_DXPZH;
  340 + }
  341 +
  342 + public String getREPORT_SGGK() {
  343 + return REPORT_SGGK;
  344 + }
  345 +
  346 + public void setREPORT_SGGK(String REPORT_SGGK) {
  347 + this.REPORT_SGGK = REPORT_SGGK;
  348 + }
  349 +
  350 + public String getREPORT_SSRS() {
  351 + return REPORT_SSRS;
  352 + }
  353 +
  354 + public void setREPORT_SSRS(String REPORT_SSRS) {
  355 + this.REPORT_SSRS = REPORT_SSRS;
  356 + }
  357 +
  358 + public String getREPORT_SWRS() {
  359 + return REPORT_SWRS;
  360 + }
  361 +
  362 + public void setREPORT_SWRS(String REPORT_SWRS) {
  363 + this.REPORT_SWRS = REPORT_SWRS;
  364 + }
  365 +
  366 + public String getREPORT_BGR() {
  367 + return REPORT_BGR;
  368 + }
  369 +
  370 + public void setREPORT_BGR(String REPORT_BGR) {
  371 + this.REPORT_BGR = REPORT_BGR;
  372 + }
  373 +
  374 + public String getREPORT_BGRDH() {
  375 + return REPORT_BGRDH;
  376 + }
  377 +
  378 + public void setREPORT_BGRDH(String REPORT_BGRDH) {
  379 + this.REPORT_BGRDH = REPORT_BGRDH;
  380 + }
  381 +
  382 + public String getREPORT_BZ() {
  383 + return REPORT_BZ;
  384 + }
  385 +
  386 + public void setREPORT_BZ(String REPORT_BZ) {
  387 + this.REPORT_BZ = REPORT_BZ;
  388 + }
  389 +
  390 + public String getCREATE_BY() {
  391 + return CREATE_BY;
  392 + }
  393 +
  394 + public void setCREATE_BY(String CREATE_BY) {
  395 + this.CREATE_BY = CREATE_BY;
  396 + }
  397 +
  398 + public Date getCREATE_DATE() {
  399 + return CREATE_DATE;
  400 + }
  401 +
  402 + public void setCREATE_DATE(Date CREATE_DATE) {
  403 + this.CREATE_DATE = CREATE_DATE;
  404 + }
  405 +
  406 + public String getUPDATE_BY() {
  407 + return UPDATE_BY;
  408 + }
  409 +
  410 + public void setUPDATE_BY(String UPDATE_BY) {
  411 + this.UPDATE_BY = UPDATE_BY;
  412 + }
  413 +
  414 + public Date getUPDATE_DATE() {
  415 + return UPDATE_DATE;
  416 + }
  417 +
  418 + public void setUPDATE_DATE(Date UPDATE_DATE) {
  419 + this.UPDATE_DATE = UPDATE_DATE;
  420 + }
  421 +
  422 + public String getREPORT_ROAD() {
  423 + return REPORT_ROAD;
  424 + }
  425 +
  426 + public void setREPORT_ROAD(String REPORT_ROAD) {
  427 + this.REPORT_ROAD = REPORT_ROAD;
  428 + }
  429 +
  430 + public String getSTATUS() {
  431 + return STATUS;
  432 + }
  433 +
  434 + public void setSTATUS(String STATUS) {
  435 + this.STATUS = STATUS;
  436 + }
  437 +
  438 + @Override
  439 + public String toString() {
  440 + DateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  441 + return "{" +
  442 + "ID:'" + ID + '\'' +
  443 + ", REPORT_TYPE:'" + REPORT_TYPE + '\'' +
  444 + ", REPORT_GS:'" + REPORT_GS + '\'' +
  445 + ", REPORT_FGS:'" + REPORT_FGS + '\'' +
  446 + ", REPORT_DATE:'" + dateFormat.format(REPORT_DATE) + '\'' +
  447 + ", REPORT_BBR:'" + REPORT_BBR + '\'' +
  448 + ", REPORT_XL:'" + REPORT_XL + '\'' +
  449 + ", REPORT_XLNAME:'" + REPORT_XLNAME + '\'' +
  450 + ", REPORT_STATION:'" + REPORT_STATION + '\'' +
  451 + ", REPORT_DWSBBM:'" + REPORT_DWSBBM + '\'' +
  452 + ", REPORT_DWSBSJ:'" + REPORT_DWSBSJ + '\'' +
  453 + ", REPORT_YWSJ:'" + REPORT_YWSJ + '\'' +
  454 + ", REPORT_SMBWD:'" + REPORT_SMBWD + '\'' +
  455 + ", REPORT_DJGSJ:'" + REPORT_DJGSJ + '\'' +
  456 + ", REPORT_DJGYY:'" + REPORT_DJGYY + '\'' +
  457 + ", REPORT_TFSJ:'" + REPORT_TFSJ + '\'' +
  458 + ", REPORT_YXSJ:'" + REPORT_YXSJ + '\'' +
  459 + ", REPORT_YXBC:'" + REPORT_YXBC + '\'' +
  460 + ", REPORT_TZCS:'" + REPORT_TZCS + '\'' +
  461 + ", REPORT_SGBH:'" + REPORT_SGBH + '\'' +
  462 + ", REPORT_ZBH:'" + REPORT_ZBH + '\'' +
  463 + ", REPORT_PZH:'" + REPORT_PZH + '\'' +
  464 + ", REPORT_JSY:'" + REPORT_JSY + '\'' +
  465 + ", REPORT_SGSJ:'" + REPORT_SGSJ + '\'' +
  466 + ", REPORT_SGDD:'" + REPORT_SGDD + '\'' +
  467 + ", REPORT_XSFX:'" + REPORT_XSFX + '\'' +
  468 + ", REPORT_SGDX:'" + REPORT_SGDX + '\'' +
  469 + ", REPORT_DXPZH:'" + REPORT_DXPZH + '\'' +
  470 + ", REPORT_SGGK:'" + REPORT_SGGK + '\'' +
  471 + ", REPORT_SSRS:'" + REPORT_SSRS + '\'' +
  472 + ", REPORT_SWRS:'" + REPORT_SWRS + '\'' +
  473 + ", REPORT_BGR:'" + REPORT_BGR + '\'' +
  474 + ", REPORT_BGRDH:'" + REPORT_BGRDH + '\'' +
  475 + ", REPORT_BZ:'" + REPORT_BZ + '\'' +
  476 + ", CREATE_BY:'" + CREATE_BY + '\'' +
  477 + ", CREATE_DATE:" + CREATE_DATE +
  478 + ", UPDATE_BY:'" + UPDATE_BY + '\'' +
  479 + ", UPDATE_DATE:" + UPDATE_DATE +
  480 + ", REPORT_ROAD:'" + REPORT_ROAD + '\'' +
  481 + ", STATUS:'" + STATUS + '\'' +
  482 + '}';
  483 + }
  484 +}
... ...
src/main/java/com/bsth/filter/BaseFilter.java
1   -package com.bsth.filter;
2   -
3   -import com.bsth.common.Constants;
4   -import org.springframework.util.AntPathMatcher;
5   -import org.springframework.util.PathMatcher;
6   -
7   -import javax.servlet.*;
8   -import javax.servlet.http.HttpServletRequest;
9   -import javax.servlet.http.HttpServletResponse;
10   -import java.io.IOException;
11   -
12   -public abstract class BaseFilter implements Filter {
13   -
14   - private final PathMatcher pathMatcher = new AntPathMatcher();
15   -
16   - /**
17   - * 白名单
18   - */
19   - private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
20   - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH,
21   - Constants.VEHICLE_DATA_SYNC_URL };
22   -
23   - @Override
24   - public void destroy() {
25   -
26   - }
27   -
28   - @Override
29   - public void doFilter(ServletRequest request, ServletResponse response,
30   - FilterChain chain) throws IOException, ServletException {
31   -
32   - HttpServletRequest httpRequest = (HttpServletRequest) request;
33   - HttpServletResponse httpResponse = (HttpServletResponse) response;
34   -
35   - String currentURL = httpRequest.getServletPath();
36   -
37   - if (isWhiteURL(currentURL)) {
38   - chain.doFilter(request, response);
39   - return;
40   - }
41   -
42   - doFilter(httpRequest, httpResponse, chain);
43   - return;
44   - }
45   -
46   - public void doFilter(HttpServletRequest request,
47   - HttpServletResponse response, FilterChain chain)
48   - throws IOException, ServletException {
49   - chain.doFilter(request, response);
50   - }
51   -
52   - @Override
53   - public void init(FilterConfig arg0) throws ServletException {
54   -
55   - }
56   -
57   - private boolean isWhiteURL(String currentURL) {
58   - for (String whiteURL : whiteListURLs) {
59   - if (pathMatcher.match(whiteURL, currentURL)) {
60   - return true;
61   - }
62   - }
63   - return false;
64   - }
65   -}
  1 +package com.bsth.filter;
  2 +
  3 +import com.bsth.common.Constants;
  4 +import org.springframework.util.AntPathMatcher;
  5 +import org.springframework.util.PathMatcher;
  6 +
  7 +import javax.servlet.*;
  8 +import javax.servlet.http.HttpServletRequest;
  9 +import javax.servlet.http.HttpServletResponse;
  10 +import java.io.IOException;
  11 +
  12 +public abstract class BaseFilter implements Filter {
  13 +
  14 + private final PathMatcher pathMatcher = new AntPathMatcher();
  15 +
  16 + /**
  17 + * 白名单
  18 + */
  19 + private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
  20 + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE,
  21 + Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL,
  22 + Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL,
  23 + Constants.FILE_AUTH};
  24 +
  25 + @Override
  26 + public void destroy() {
  27 +
  28 + }
  29 +
  30 + @Override
  31 + public void doFilter(ServletRequest request, ServletResponse response,
  32 + FilterChain chain) throws IOException, ServletException {
  33 +
  34 + HttpServletRequest httpRequest = (HttpServletRequest) request;
  35 + HttpServletResponse httpResponse = (HttpServletResponse) response;
  36 +
  37 + String currentURL = httpRequest.getServletPath();
  38 +
  39 + if (isWhiteURL(currentURL)) {
  40 + chain.doFilter(request, response);
  41 + return;
  42 + }
  43 +
  44 + doFilter(httpRequest, httpResponse, chain);
  45 + return;
  46 + }
  47 +
  48 + public void doFilter(HttpServletRequest request,
  49 + HttpServletResponse response, FilterChain chain)
  50 + throws IOException, ServletException {
  51 + chain.doFilter(request, response);
  52 + }
  53 +
  54 + @Override
  55 + public void init(FilterConfig arg0) throws ServletException {
  56 +
  57 + }
  58 +
  59 + private boolean isWhiteURL(String currentURL) {
  60 + for (String whiteURL : whiteListURLs) {
  61 + if (pathMatcher.match(whiteURL, currentURL)) {
  62 + return true;
  63 + }
  64 + }
  65 + return false;
  66 + }
  67 +}
... ...
src/main/java/com/bsth/security/WebSecurityConfig.java
... ... @@ -42,7 +42,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
42 42 public void configure(WebSecurity web) throws Exception {
43 43 // 白名单
44 44 web.ignoring().antMatchers(Constants.LOGIN, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA,
45   - Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT);
  45 + Constants.SERVICE_INTERFACE, Constants.METRONIC_URL, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL,
  46 + Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.FILE_AUTH);
46 47 }
47 48  
48 49 @Override
... ...
src/main/java/com/bsth/security/filter/LoginInterceptor.java
... ... @@ -33,8 +33,9 @@ public class LoginInterceptor implements Filter {
33 33 * 相比于 BaseFilter,此处对线调GPS请求进行了拦截验证
34 34 */
35 35 private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.SERVICE_INTERFACE,
36   - Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,Constants.STATION_AND_SECTION_COUNT,
37   - Constants.VEHICLE_DATA_SYNC_URL };
  36 + Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.METRONIC_URL, Constants.LOGIN,
  37 + Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL,
  38 + Constants.STATION_AND_SECTION_COUNT, Constants.VEHICLE_DATA_SYNC_URL, Constants.FILE_AUTH };
38 39  
39 40  
40 41 @Override
... ...
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
... ... @@ -664,7 +664,7 @@ public class GpsServiceImpl implements GpsService {
664 664 Collections.sort(rs, new Comparator<GpsEntity>() {
665 665 @Override
666 666 public int compare(GpsEntity o1, GpsEntity o2) {
667   - return o2.getTimestamp().intValue() - o1.getTimestamp().intValue();
  667 + return (int)(o2.getTimestamp().longValue() - o1.getTimestamp().longValue());
668 668 }
669 669 });
670 670  
... ... @@ -1185,7 +1185,7 @@ public class GpsServiceImpl implements GpsService {
1185 1185 Collections.sort(rs, new Comparator<SafeDriv>() {
1186 1186 @Override
1187 1187 public int compare(SafeDriv o1, SafeDriv o2) {
1188   - return o2.getTs().intValue() - o1.getTs().intValue();
  1188 + return (int)(o2.getTs().longValue() - o1.getTs().longValue());
1189 1189 }
1190 1190 });
1191 1191  
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
1   -package com.bsth.service.oil.impl;
2   -
3   -
4   -
5   -import java.sql.ResultSet;
6   -import java.sql.SQLException;
7   -import java.text.DecimalFormat;
8   -import java.text.ParseException;
9   -import java.text.SimpleDateFormat;
10   -import java.util.ArrayList;
11   -import java.util.Calendar;
12   -import java.util.Collections;
13   -import java.util.Comparator;
14   -import java.util.Date;
15   -import java.util.HashMap;
16   -import java.util.Iterator;
17   -import java.util.List;
18   -import java.util.Map;
19   -
20   -import javax.transaction.Transactional;
21   -
22   -import org.apache.commons.lang3.StringEscapeUtils;
23   -import org.apache.commons.lang3.StringUtils;
24   -import org.slf4j.Logger;
25   -import org.slf4j.LoggerFactory;
26   -import org.springframework.beans.factory.annotation.Autowired;
27   -import org.springframework.data.domain.Sort;
28   -import org.springframework.data.domain.Sort.Direction;
29   -import org.springframework.jdbc.core.JdbcTemplate;
30   -import org.springframework.jdbc.core.RowMapper;
31   -import org.springframework.stereotype.Service;
32   -
33   -import com.alibaba.fastjson.JSONArray;
34   -import com.alibaba.fastjson.JSONObject;
35   -import com.bsth.common.ResponseCode;
36   -import com.bsth.data.BasicData;
37   -import com.bsth.entity.Cars;
38   -import com.bsth.entity.Line;
39   -import com.bsth.entity.oil.Cdl;
40   -import com.bsth.entity.oil.Cyl;
41   -import com.bsth.entity.oil.Dlb;
42   -import com.bsth.entity.oil.Jdl;
43   -import com.bsth.entity.oil.Nylog;
44   -import com.bsth.entity.oil.Ylxxb;
45   -import com.bsth.entity.search.CustomerSpecs;
46   -import com.bsth.entity.sys.SysUser;
47   -import com.bsth.repository.CarsRepository;
48   -import com.bsth.repository.oil.CdlRepository;
49   -import com.bsth.repository.oil.CylRepository;
50   -import com.bsth.repository.oil.DlbRepository;
51   -import com.bsth.repository.oil.JdlRepository;
52   -import com.bsth.repository.oil.NylogRepository;
53   -import com.bsth.repository.oil.YlbRepository;
54   -import com.bsth.repository.oil.YlxxbRepository;
55   -import com.bsth.security.util.SecurityUtils;
56   -import com.bsth.service.impl.BaseServiceImpl;
57   -import com.bsth.service.oil.DlbService;
58   -import com.bsth.service.realcontrol.ScheduleRealInfoService;
59   -import com.bsth.util.Arith;
60   -import com.bsth.util.BatchSaveUtils;
61   -
62   -@Service
63   -public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{
64   - @Autowired
65   - DlbRepository repository;
66   - @Autowired
67   - NylogRepository nylogRepository;
68   - @Autowired
69   - YlxxbRepository ylxxbRepository;
70   -
71   - @Autowired
72   - CdlRepository cdlRepository;
73   - @Autowired
74   - JdlRepository jdlRepository;
75   - @Autowired
76   - CarsRepository carsRepository;
77   -
78   - @Autowired
79   - ScheduleRealInfoService scheduleRealInfoService;
80   -
81   - @Autowired
82   - JdbcTemplate jdbcTemplate;
83   -
84   - Logger logger = LoggerFactory.getLogger(this.getClass());
85   -
86   - @Transactional
87   - @Override
88   - public String obtainDsq() throws Exception{
89   - String result = "failure";
90   - List<Cars> carsList=carsRepository.findCars();
91   - Map<String, Boolean> carsMap=new HashMap<String, Boolean>();
92   - for (int i = 0; i < carsList.size(); i++) {
93   - Cars c=carsList.get(i);
94   - carsMap.put(c.getInsideCode(), c.getSfdc());
95   - }
96   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
97   - Date dNow = new Date(); //当前时间
98   - Date dBefore = new Date();
99   - Calendar calendar = Calendar.getInstance(); //得到日历
100   - calendar.setTime(dNow);//把当前时间赋给日历
101   - calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
102   - dBefore = calendar.getTime(); //得到前一天的时间
103   - String rq=sdf.format(dBefore);
104   -// String rq="2017-11-02";
105   - String line="";
106   - //保留两位小数
107   - DecimalFormat df = new DecimalFormat("#.00");
108   - // TODO Auto-generated method stub
109   - Map<String, Object> newMap=new HashMap<String,Object>();
110   - //当天DLB信息
111   - List<Dlb> dlList=repository.obtainDl(rq, "", "", line, "", "nbbm");
112   - //当天YLXXB信息
113   - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,"");
114   - //当天加电信息表
115   - List<Jdl> jdlList=jdlRepository.JdlList(rq);
116   - //前一天所有车辆最后进场班次信息
117   -// List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", "");
118   - List<Cdl> cdyList=cdlRepository.obtainCdl();
119   - //从排班表中计算出行驶的总里程
120   - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","","");
121   - for(int x=0;x<listpb.size();x++){
122   - String type="add";
123   - boolean sfdc=false;
124   - Map<String, Object> map=listpb.get(x);
125   - if (carsMap.get(map.get("clZbh").toString())!=null) {
126   - sfdc= carsMap.get(map.get("clZbh").toString());
127   - }else{
128   - sfdc=false;
129   - }
130   - if(sfdc){
131   - //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
132   - Dlb t=new Dlb();
133   - for(int k=0;k<dlList.size();k++){
134   - Dlb t1=dlList.get(k);
135   - if(t1.getNbbm().equals(map.get("clZbh").toString())
136   - &&t1.getJsy().equals(map.get("jGh").toString())
137   - &&t1.getXlbm().equals(map.get("xlBm").toString())
138   - &&t1.getLp().equals(map.get("lpName").toString()))
139   - {
140   - t=t1;
141   - type="update";
142   - }
143   - }
144   - try {
145   - //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
146   - Double jzl=0.0;
147   - if(map.get("seqNumber").toString().equals("1")){
148   - boolean fage=true;
149   -// for (int i = 0; i < dlListBe.size(); i++) {
150   -// Dlb dlb=dlListBe.get(i);
151   -// if(map.get("clZbh").toString().equals(dlb.getNbbm())){
152   -// t.setCzcd(dlb.getJzcd());
153   -// fage=false;
154   -// break;
155   -// }
156   -// }
157   - if(fage){
158   - for (int y = 0; y < cdyList.size(); y++) {
159   - Cdl cdl=cdyList.get(y);
160   - if(map.get("clZbh").toString().equals(cdl.getNbbm())){
161   - t.setCzcd(cdl.getClcd()==null?0:cdl.getClcd());
162   - fage=false;
163   - break;
164   - }
165   - }
166   - }
167   - if(fage){
168   - t.setCzcd(0.0);
169   - }
170   -
171   - //手动导入没有驾驶员工号
172   - for (int i = 0; i < jdlList.size(); i++) {
173   - Jdl jdl=jdlList.get(i);
174   - if(map.get("clZbh").toString().equals(jdl.getNbbm())
175   - &&map.get("jGh").toString().equals(jdl.getJsy())){
176   - jzl+=jdl.getJdl();
177   - }
178   - }
179   - }
180   -
181   -
182   - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断)
183   - for(int j=0;j<ylxxList.size();j++){
184   - Ylxxb ylxxb= ylxxList.get(j);
185   - if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){
186   - jzl+=ylxxb.getJzl();
187   - }
188   - }
189   -
190   - t.setCdl(jzl);
191   - if(type.equals("add")){
192   - t.setHd(jzl);
193   - t.setJzcd(t.getCzcd());
194   - }
195   -
196   - t.setNbbm(map.get("clZbh").toString());
197   - t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
198   - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
199   - t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
200   - t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
201   - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
202   - t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
203   - t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
204   - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
205   - t.setLp(map.get("lpName").toString());
206   - t.setRq(sdf.parse(rq));
207   - t.setCreatetime(new Date());
208   - t.setJname(map.get("jName").toString());
209   - /*if(type.equals("add")){
210   - addList.add(t);
211   - }else{
212   - updateList.add(t);
213   - }*/
214   - repository.save(t);
215   - newMap.put("status", ResponseCode.SUCCESS);
216   - } catch (ParseException e) {
217   - // TODO Auto-generated catch block
218   - newMap.put("status", ResponseCode.ERROR);
219   - e.printStackTrace();
220   - }
221   - }
222   - }
223   - return result;
224   - }
225   -
226   - /**
227   - * 获取进存油信息
228   - * @Transactional 回滚事物
229   - */
230   - @Transactional
231   - @Override
232   - public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{
233   - Map<String, Object> newMap = new HashMap<String, Object>();
234   - try {
235   - Date date=new Date();
236   - List<Cars> carsList = carsRepository.findCars();
237   - Map<String, Boolean> carsMap = new HashMap<String, Boolean>();
238   - for (int i = 0; i < carsList.size(); i++) {
239   - Cars c = carsList.get(i);
240   - carsMap.put(c.getInsideCode(), c.getSfdc());
241   - }
242   - String rq = map2.get("rq").toString();
243   - String line = "";
244   - if (map2.get("xlbm_like") != null) {
245   - line = map2.get("xlbm_like").toString().trim();
246   - }
247   - String gsbm="";
248   - if(map2.get("ssgsdm_like")!=null){
249   - gsbm=map2.get("ssgsdm_like").toString();
250   - }
251   - String fgsbm="";
252   - if(map2.get("fgsdm_like")!=null){
253   - fgsbm=map2.get("fgsdm_like").toString();
254   - }
255   - String nbbm="";
256   - if(map2.get("nbbm_eq")!=null){
257   - nbbm=map2.get("nbbm_eq").toString();
258   - }
259   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
260   - // 保留两位小数
261   - DecimalFormat df = new DecimalFormat("#.00");
262   - // TODO Auto-generated method stub
263   - // 当天DLB信息
264   - List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm");
265   - // 当天YLXXB信息
266   - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm);
267   - // 从排班表中计算出行驶的总里程
268   - List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>();
269   - List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm);
270   - Map<String, Double> lcMap=new HashMap<String,Double>();
271   - for (int i = 0; i < listpbs.size(); i++) {
272   - String cl=listpbs.get(i).get("clZbh").toString();
273   - Double lc= listpbs.get(i).get("totalKilometers") == null ? 0.0
274   - : Double.parseDouble(listpbs.get(i).get("totalKilometers").toString());
275   - if(lcMap.get(cl)==null){
276   - lcMap.put(cl, lc);
277   - }else{
278   - double lc_=lcMap.get(cl);
279   - lcMap.remove(cl);
280   - lcMap.put(cl, Arith.add(lc, lc_));
281   - }
282   - }
283   -
284   -// Map<String, Double> shMap=new HashMap<String,Double>();
285   -// for (int i = 0; i < dlList.size(); i++) {
286   -// Dlb dlb=dlList.get(i);
287   -// String cl=dlb.getNbbm();
288   -// if(shMap.get(cl)==null){
289   -// shMap.put(cl, dlb.getSh());
290   -// }else{
291   -// double sh=shMap.get(cl);
292   -// shMap.remove(cl);
293   -// shMap.put(cl, Arith.add(sh, dlb.getSh()));
294   -// }
295   -// }
296   - List<Jdl> jdlList=jdlRepository.JdlList(rq);
297   - String sxtj=map2.get("sxtj").toString();
298   - if(sxtj.equals("0")){
299   - listpb=listpbs;
300   - }else{
301   - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm);
302   - List<String> stringList=new ArrayList<String>();
303   - for (int i = 0; i < objectLists.size(); i++) {
304   - String clbm=objectLists.get(i)[0].toString();
305   - int cs=Integer.parseInt(objectLists.get(i)[1].toString());
306   - //一车一单
307   - if(sxtj.equals("1")){
308   - if(cs==1){
309   - stringList.add(clbm);
310   - }
311   - }
312   - //一车多单
313   - if(sxtj.equals("2")){
314   - if(cs>1){
315   - stringList.add(clbm);
316   - }
317   - }
318   - }
319   -
320   - for (int i = 0; i < stringList.size(); i++) {
321   - String strNbbm=stringList.get(i);
322   - for (int j = 0; j < listpbs.size(); j++) {
323   - Map<String, Object> map = listpbs.get(j);
324   - String mapNbbm=map.get("clZbh").toString();
325   - if(strNbbm.equals(mapNbbm)){
326   - listpb.add(map);
327   - }
328   - }
329   - }
330   - }
331   - Map<String, Object> newMap_=new HashMap<String,Object>();
332   - List<Dlb> addList = new ArrayList<Dlb>();
333   - List<Dlb> updateList = new ArrayList<Dlb>();
334   - Map<String, Object> cMap=new HashMap<String, Object>();
335   - List<Map<String, Object>> listpb_=listpb;
336   - Collections.sort(listpb,new NbbmJcsxMap());
337   - for (int x = 0; x < listpb_.size(); x++) {
338   - String type = "add";
339   - boolean sfdc = false;
340   - Map<String, Object> map_ = listpb_.get(x);
341   - if (carsMap.get(map_.get("clZbh").toString()) != null) {
342   - sfdc = carsMap.get(map_.get("clZbh").toString());
343   - } else {
344   - sfdc = false;
345   - }
346   - if (sfdc) {
347   - if(newMap_.get(map_.get("clZbh").toString())==null){
348   - newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString());
349   - //车辆总里程
350   - double zlc =lcMap.get(map_.get("clZbh").toString());
351   - //车辆总加电量
352   - double zjzl = 0.0;
353   - for (int j = 0; j < ylxxList.size(); j++) {
354   - Ylxxb ylxxb = ylxxList.get(j);
355   - if (map_.get("clZbh").toString().equals(ylxxb.getNbbm())
356   - && map_.get("company").toString().equals(ylxxb.getGsdm())) {
357   - zjzl = Arith.add(zjzl, ylxxb.getJzl());
358   - }
359   - }
360   - for (int i = 0; i < jdlList.size(); i++) {
361   - Jdl jdl=jdlList.get(i);
362   - if(map_.get("clZbh").toString().equals(jdl.getNbbm())
363   - &&map_.get("company").toString().equals(jdl.getGsBm())
364   - &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){
365   - zjzl = Arith.add(zjzl,jdl.getJdl());
366   - }
367   - }
368   -// double clsh=0.0;
369   -// if(shMap.get(map_.get("clZbh").toString())==null){
370   -// clsh=0.0;
371   -// }else{
372   -// clsh=shMap.get(map_.get("clZbh").toString());
373   -// }
374   -// zjzl =Arith.sub(zjzl, clsh);
375   - Double nextJzyl = 0.0;
376   - for (int i = 0; i < listpb.size(); i++) {
377   - Map<String, Object> map = listpb.get(i);
378   - if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){
379   - // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
380   - Dlb t = new Dlb();
381   - for (int k = 0; k < dlList.size(); k++) {
382   - Dlb t1 = dlList.get(k);
383   - if (t1.getNbbm().equals(map.get("clZbh").toString())
384   - && t1.getJsy().equals(map.get("jGh").toString())
385   - && t1.getXlbm().equals(map.get("xlBm").toString())) {
386   - if(t1.getLp()==null){
387   - //同人同车同线路不同路牌的过滤 (考虑到历史数据)
388   - if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) {
389   - t = t1;
390   - type = "update";
391   - cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(),
392   - map.get("clZbh").toString());
393   - }
394   - }else{
395   - if(t1.getLp().equals(map.get("lpName").toString())){
396   - t = t1;
397   - type = "update";
398   - }
399   -
400   - }
401   - }
402   - }
403   - Double lc= Double.parseDouble(map.get("totalKilometers").toString());
404   - if(map.get("seqNumber").toString().equals("1")){
405   - // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
406   - Double dh=0.0;
407   - if(zlc>0){
408   - dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
409   - }
410   - nextJzyl =Arith.sub(zjzl,dh);
411   - if(zlc>0){
412   -// long l=Math.round(nextJzyl);
413   - double ylxs=nextJzyl;
414   - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
415   - if(dh<0){
416   - t.setHd(0.0);
417   - t.setCdl(0.0);
418   - nextJzyl=Arith.add(ylxs, dh);
419   - }else{
420   - t.setHd(dh);
421   - t.setCdl(dh);
422   - nextJzyl=ylxs;
423   - }
424   - }else{
425   - t.setHd(0.0);
426   - t.setCdl(0.0);
427   - }
428   - }else{
429   - Double dh=0.0;
430   - if(zlc>0){
431   - dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
432   - }
433   - nextJzyl =Arith.sub( nextJzyl,dh);
434   - if(zlc>0){
435   -// long l=0l;
436   - double ylxs=0.0;
437   - if(i==listpb.size()-1){
438   -// ylxs=czyl;
439   - }else{
440   - if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){
441   -// l=Math.round(nextJzyl);
442   - ylxs=nextJzyl;
443   - }
444   -
445   - }
446   - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
447   - if(dh<0){
448   - t.setHd(0.0);
449   - t.setCdl(0.0);
450   - nextJzyl=Arith.add(ylxs, dh);
451   - }else{
452   - t.setHd(dh);
453   - t.setCdl(dh);
454   - nextJzyl=ylxs;
455   - }
456   - }else{
457   - t.setHd(0.0);
458   - t.setCdl(0.0);
459   - }
460   - }
461   - t.setCzcd(100.0);
462   - t.setJzcd(100.0);
463   - t.setNbbm(map.get("clZbh").toString());
464   - t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
465   - t.setZlc(map.get("totalKilometers") == null ? 0.0
466   - : Double.parseDouble(map.get("totalKilometers").toString()));
467   - t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
468   - t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
469   - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
470   - t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
471   - t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
472   - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
473   - t.setRq(sdf.parse(rq));
474   - t.setLp(map.get("lpName").toString());
475   - t.setJname(map.get("jName").toString());
476   - if (!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))) {
477   - if (t.getHd() < 0) {
478   - t.setHd(0.0);
479   - }
480   - if (t.getCdl() < 0) {
481   - t.setCdl(0.0);
482   - }
483   - if (type.equals("add")) {
484   - t.setCreatetime(date);
485   - addList.add(t);
486   - } else {
487   - t.setUpdatetime(date);
488   - updateList.add(t);
489   - }
490   - }
491   - newMap.put("status", ResponseCode.SUCCESS);
492   - }
493   - }
494   - }
495   - }
496   - }
497   - if(addList.size()>0){
498   - try {
499   - new BatchSaveUtils<Dlb>().saveList2(addList, Dlb.class);
500   - } catch (Exception e) {
501   - // TODO: handle exception
502   - if(e.getMessage().indexOf("PK_DLB_UK")>0){
503   - newMap.put("fage", "存在相同数据,数据已经过滤");
504   - logger.info("获取:存在相同数据,数据已经过滤");
505   - }
506   - }
507   -
508   - }
509   -
510   - if(updateList.size()>0){
511   - for (int i = 0; i < updateList.size(); i++) {
512   - repository.save(updateList.get(i));
513   - }
514   - }
515   - SysUser user = SecurityUtils.getCurrentUser();
516   - Nylog nylog=new Nylog();
517   - nylog.setCreatedate(new Date());
518   - nylog.setCzmc("获取");
519   - nylog.setNylx("电");
520   - nylog.setUserid(user.getUserName());
521   - nylog.setUsername(user.getName());
522   - nylog.setCxtj(line+"-"+ date+"-"+gsbm+"-"+fgsbm);
523   - nylogRepository.save(nylog);
524   - newMap.put("status", ResponseCode.SUCCESS);
525   - } catch (Exception e) {
526   - // TODO Auto-generated catch block
527   - newMap.put("status", ResponseCode.ERROR);
528   - throw e;
529   - }
530   -
531   - return newMap;
532   - }
533   -
534   - /**
535   - * 拆分
536   - */
537   - @Transactional
538   - @Override
539   - public Map<String, Object> sort(Map<String, Object> map) {
540   - // TODO Auto-generated method stub
541   - Map<String, Object> newMap = new HashMap<String, Object>();
542   - try{
543   - int id=Integer.parseInt(map.get("id").toString());
544   - //最后存油量
545   - Double jzdl=Double.parseDouble(map.get("jzdl").toString());
546   - Double hdl=Double.parseDouble(map.get("hdl").toString());
547   - Dlb dlb=repository.findById(id).get();
548   - dlb.setJzcd(jzdl);
549   - dlb.setHd(hdl);
550   - repository.save(dlb);
551   - newMap.put("status", ResponseCode.SUCCESS);
552   - }catch(Exception e){
553   - newMap.put("status", ResponseCode.ERROR);
554   - logger.error("save erro.", e);
555   - }
556   - return newMap;
557   - }
558   -
559   -
560   - /**
561   - * 核对,有加注没里程
562   - * @param map
563   - * @return
564   - */
565   - @Transactional
566   - @Override
567   - public Map<String, Object> checkDl(Map<String, Object> map) {
568   - Map<String, Object> newMap=new HashMap<String,Object>();
569   -// String xlbm="";
570   -// if(map.get("xlbm_like")!=null){
571   -// xlbm=map.get("xlbm_like").toString();
572   -// }
573   - // TODO Auto-generated method stub
574   -
575   - List<Cars> carsList = carsRepository.findCars();
576   - Map<String, String> carsMap = new HashMap<String, String>();
577   - for (int i = 0; i < carsList.size(); i++) {
578   - Cars c = carsList.get(i);
579   - carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode());
580   - }
581   -
582   - try{
583   - //获取车辆存油信息
584   -
585   - String rq=map.get("rq").toString();
586   - String xlbm="";
587   - if(map.get("xlbm_like")!=null){
588   - xlbm= map.get("xlbm_like").toString().trim();
589   - }
590   - String gsbm="";
591   - if(map.get("ssgsdm_like")!=null){
592   - gsbm=map.get("ssgsdm_like").toString();
593   - }
594   - String fgsbm="";
595   - if(map.get("fgsdm_like")!=null){
596   - fgsbm=map.get("fgsdm_like").toString();
597   - }
598   - String nbbm="";
599   - if(map.get("nbbm_eq")!=null){
600   - nbbm=map.get("nbbm_eq").toString();
601   - }
602   -
603   - String sql="select * from bsth_c_jdl j where j.gs_bm ='"+gsbm+"' "
604   - + " and j.fgs_bm ='"+fgsbm+"' and rq ='"+rq+"' "
605   - + "and nbbm not in (select nbbm from bsth_c_dlb d"
606   - + " where ssgsdm ='"+gsbm+"' and fgsdm ='"+fgsbm+"'"
607   - + " and rq='"+rq+"')";
608   - List<Jdl> listJdl=jdbcTemplate.query(sql,
609   - new RowMapper<Jdl>(){
610   - @Override
611   - public Jdl mapRow(ResultSet rs, int rowNum) throws SQLException {
612   - Jdl s = new Jdl();
613   - s.setNbbm(rs.getString("nbbm"));
614   - s.setGsBm(rs.getString("gs_bm"));
615   - s.setFgsBm(rs.getString("fgs_bm"));
616   - s.setJdl(rs.getDouble("jdl"));
617   - s.setRq(rs.getDate("rq"));
618   - return s;
619   - }
620   - });
621   - for (int i = 0; i < listJdl.size(); i++) {
622   - Jdl j=listJdl.get(i);
623   - Dlb t=new Dlb();
624   - Line line= BasicData.nbbm2LineMap.get(j.getNbbm());
625   - if(null !=line){
626   - t.setCdl(j.getJdl());
627   - t.setNbbm(j.getNbbm());
628   - t.setRq(j.getRq());
629   - t.setJsy("");
630   - t.setCdl(j.getJdl());
631   - t.setSsgsdm(j.getGsBm());
632   - t.setFgsdm(j.getFgsBm());
633   - t.setJzcd(100.0);
634   - t.setCzcd(100.0);
635   - t.setHd(0.0);
636   - t.setJcsx(1);
637   - t.setXlbm(line.getLineCode());
638   - t.setLp("");
639   - repository.save(t);
640   - }
641   - }
642   -
643   - SysUser user = SecurityUtils.getCurrentUser();
644   - Nylog nylog=new Nylog();
645   - nylog.setCreatedate(new Date());
646   - nylog.setCzmc("核对");
647   - nylog.setNylx("电");
648   - nylog.setUserid(user.getUserName());
649   - nylog.setUsername(user.getName());
650   - nylog.setCxtj(xlbm+"-"+ rq+"-"+gsbm+"-"+fgsbm);
651   - nylogRepository.save(nylog);
652   - newMap.put("status", ResponseCode.SUCCESS);
653   - }catch(Exception e){
654   - newMap.put("status", ResponseCode.ERROR);
655   - logger.error("save erro.", e);
656   - throw e;
657   - }
658   -
659   - return newMap;
660   - }
661   -
662   - @Override
663   - public List<Dlb> listDlb(Map<String, Object> map) {
664   - // TODO Auto-generated method stub
665   - List<Dlb> listDlb = new ArrayList<Dlb>();
666   - List<String> stringList = new ArrayList<String>();
667   - String rq = map.get("rq").toString();
668   - String gsbm = map.get("ssgsdm_like").toString();
669   - String fgsbm = map.get("fgsdm_like").toString();
670   - String xlbm = map.get("xlbm_like").toString().trim();
671   - String nbbm = map.get("nbbm_eq").toString();
672   - String sxtj = map.get("sxtj").toString();
673   - String type = map.get("type").toString();
674   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
675   - try {
676   - if (nbbm.trim() != "") {
677   - stringList.add(nbbm);
678   - if (type.equals("1"))
679   - listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
680   - else
681   - listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
682   -
683   - } else {
684   - // 全部
685   - if (sxtj.equals("0")) {
686   - List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
687   - for (int i = 0; i < objectLists.size(); i++) {
688   - String clbm = objectLists.get(i)[0].toString();
689   - stringList.add(clbm);
690   - }
691   - if (stringList.size() > 0) {
692   - if (type.equals("1"))
693   - listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
694   - else
695   - listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
696   - }
697   - } else {
698   - List<Object[]> objectLists;
699   - if (sxtj.equals("3")) {
700   - // 有加油没里程
701   - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
702   - for (int i = 0; i < objectLists.size(); i++) {
703   - String clbm = objectLists.get(i)[0].toString();
704   - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
705   - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
706   - if (jzl > 0 && zlc <= 0) {
707   - stringList.add(clbm);
708   - }
709   -
710   - }
711   -
712   - } else if (sxtj.equals("4")) {
713   - // 有里程没加油
714   - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
715   - for (int i = 0; i < objectLists.size(); i++) {
716   - String clbm = objectLists.get(i)[0].toString();
717   - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
718   - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
719   - if (zlc > 0 && jzl <= 0) {
720   - stringList.add(clbm);
721   - }
722   -
723   - }
724   - } else {
725   - objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
726   - for (int i = 0; i < objectLists.size(); i++) {
727   - String clbm = objectLists.get(i)[0].toString();
728   - int cs = Integer.parseInt(objectLists.get(i)[1].toString());
729   - // 一车一单
730   - if (sxtj.equals("1")) {
731   - if (cs == 1) {
732   - stringList.add(clbm);
733   - }
734   - }
735   - // 一车多单
736   - if (sxtj.equals("2")) {
737   - if (cs > 1) {
738   - stringList.add(clbm);
739   - }
740   - }
741   - }
742   - }
743   -
744   - if (stringList.size() > 0) {
745   - if (type.equals("1"))
746   - listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
747   - else
748   - listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
749   - }
750   - }
751   - }
752   - } catch (ParseException e) {
753   - // TODO Auto-generated catch block
754   - e.printStackTrace();
755   - }
756   - return listDlb;
757   - }
758   -
759   - @Override
760   - public Map<String, Object> sumYlb(Map<String, Object> map) {
761   - // TODO Auto-generated method stub
762   - List<String> stringList = new ArrayList<String>();
763   - String rq = map.get("rq").toString();
764   - String gsbm = map.get("ssgsdm_like").toString();
765   - String fgsbm = map.get("fgsdm_like").toString();
766   - String xlbm = map.get("xlbm_like").toString().trim();
767   - String nbbm = map.get("nbbm_eq").toString();
768   - String sxtj = map.get("sxtj").toString();
769   - String type = map.get("type").toString();
770   - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
771   - List<Object[]> sumYlbList = new ArrayList<Object[]>();
772   - try {
773   - if (nbbm.trim() != "") {
774   - stringList.add(nbbm);
775   - } else {
776   - if (!sxtj.equals("0")) {
777   - List<Object[]> objectLists;
778   - if (sxtj.equals("3")) {
779   - // 有加油没里程
780   - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
781   - for (int i = 0; i < objectLists.size(); i++) {
782   - String clbm = objectLists.get(i)[0].toString();
783   - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
784   - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
785   - if (jzl > 0 && zlc <= 0) {
786   - stringList.add(clbm);
787   - }
788   -
789   - }
790   -
791   - } else if (sxtj.equals("4")) {
792   - // 有里程没加油
793   - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
794   - for (int i = 0; i < objectLists.size(); i++) {
795   - String clbm = objectLists.get(i)[0].toString();
796   - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
797   - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
798   - if (zlc > 0 && jzl <= 0) {
799   - stringList.add(clbm);
800   - }
801   -
802   - }
803   - } else {
804   - objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
805   - for (int i = 0; i < objectLists.size(); i++) {
806   - String clbm = objectLists.get(i)[0].toString();
807   - int cs = Integer.parseInt(objectLists.get(i)[1].toString());
808   - // 一车一单
809   -
810   - if (sxtj.equals("1")) {
811   - if (cs == 1) {
812   - stringList.add(clbm);
813   - }
814   - }
815   - // 一车多单
816   - if (sxtj.equals("2")) {
817   - if (cs > 1) {
818   - stringList.add(clbm);
819   - }
820   - }
821   - }
822   - }
823   - }
824   - }
825   - if (sxtj.equals("0")) {
826   - sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
827   - } else {
828   - if (stringList.size() > 0) {
829   -
830   - // String strings[]=new String[stringList.size()];
831   - // for(int i=0;i<stringList.size();i++){
832   - // strings[i]=stringList.get(i);
833   - // }
834   - if (type.equals("1"))
835   - sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList);
836   - else
837   - sumYlbList = repository.sumDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
838   -
839   - }
840   - // else {
841   - // sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
842   - // }
843   - }
844   - } catch (ParseException e) {
845   - // TODO Auto-generated catch block
846   - e.printStackTrace();
847   - }
848   - Double jzl = 0.0, yh = 0.0, sh = 0.0;
849   - for (int i = 0; i < sumYlbList.size(); i++) {
850   - jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
851   - yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));
852   - sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString()));
853   - }
854   -
855   - Map<String, Object> sumMap = new HashMap<String, Object>();
856   - sumMap.put("jzl", jzl);
857   - sumMap.put("yh", yh);
858   - sumMap.put("sh", sh);
859   - return sumMap;
860   - }
861   -
862   -
863   - @Transactional
864   - @Override
865   - public Map<String, Object> saveDlbList(Map<String, Object> map) throws Exception {
866   - // TODO Auto-generated method stub
867   - Map<String, Object> newMap=new HashMap<String,Object>();
868   - try{
869   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
870   - String json =StringEscapeUtils.unescapeHtml4(map.get("dlbList").toString());
871   - JSONArray jsonArray=JSONArray.parseArray(json);
872   - JSONObject jsonObject;
873   - // 获取车辆存油信息
874   -// List<Cyl> cylList = cylRepository.obtainCyl("","");
875   - for (int i = 0; i < jsonArray.size(); i++) {
876   -// Ylb t=new Ylb();
877   - jsonObject=jsonArray.getJSONObject(i);
878   - double czcd = jsonObject.getDoubleValue("czcd");
879   - double cdl =jsonObject.getDoubleValue("cdl");
880   - double jzcd =jsonObject.getDoubleValue("jzcd");
881   - double sh =jsonObject.getDoubleValue("sh");
882   - String shyy =jsonObject.getString("shyy");
883   - double hd = jsonObject.getDoubleValue("hd");
884   - int yhlx =jsonObject.getIntValue("yhlx");
885   - Integer id =jsonObject.getInteger("id");
886   -// String nbbm =jsonObject.getString("nbbm");
887   -// String rq=jsonObject.getString("rq");
888   - repository.dlbUpdate(id, czcd, jzcd, hd, sh, shyy, yhlx);
889   -
890   - }
891   -
892   - SysUser user = SecurityUtils.getCurrentUser();
893   - Nylog nylog=new Nylog();
894   - nylog.setCreatedate(new Date());
895   - nylog.setCzmc("保存全部");
896   - nylog.setNylx("电");
897   - nylog.setUserid(user.getUserName());
898   - nylog.setUsername(user.getName());
899   - nylog.setCxtj("");
900   - nylogRepository.save(nylog);
901   - newMap.put("status", ResponseCode.SUCCESS);
902   - }catch(Exception e){
903   - newMap.put("status", ResponseCode.ERROR);
904   - logger.error("save erro.", e);
905   - throw e;
906   - }
907   - return newMap;
908   - }
909   -
910   - public List<Dlb> listOrderBy(String rq,String gsdm,
911   - String fgsdm,String xlbm,String nbbm,
912   - String px) {
913   - // TODO Auto-generated method stub
914   - String sql="SELECT * FROM bsth_c_dlb "
915   - + " where rq='"+rq+"' and ssgsdm like '%"+gsdm+"%' "
916   - + " and fgsdm like '%"+fgsdm+"%'";
917   - if(xlbm.equals("")){
918   - sql+= " and xlbm like '%"+xlbm+"%' ";
919   - }else{
920   - sql+= " and xlbm = '"+xlbm+"' ";
921   - }
922   -
923   - sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc ";
924   -
925   - List<Dlb> list = jdbcTemplate.query(sql, new RowMapper<Dlb>() {
926   - @Override
927   - public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
928   - Dlb y = new Dlb();
929   - y.setId(arg0.getInt("id"));
930   - return y;
931   - }
932   - });
933   - List<Dlb> lists=new ArrayList<Dlb>();
934   - List<Dlb> dlbLists=repository.obtainDl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx");
935   - for (int i = 0; i < list.size(); i++) {
936   - Dlb t=list.get(i);
937   - for (int j = 0; j < dlbLists.size(); j++) {
938   - Dlb t2=dlbLists.get(j);
939   - if(t.getId().intValue()==t2.getId().intValue()){
940   - lists.add(t2);
941   - break;
942   - }
943   - }
944   - }
945   -
946   - return lists;
947   - }
948   -
949   -
950   - @Override
951   - public String checkJsy(Map<String, Object> map) {
952   - // TODO Auto-generated method stub
953   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
954   - String rq=map.get("date").toString();
955   - String nbbm=map.get("nbbm").toString();
956   - String jsy =map.get("jsy").toString();
957   - String xlbm=map.get("xlbm").toString();
958   - List<Dlb> list= repository.queryListDlb(rq, nbbm, jsy, xlbm);
959   - String type="1";
960   - if(list.size()>0){
961   - type="0";
962   - }
963   - return type;
964   - }
965   -
966   - @Override
967   - public Map<String, Object> saveDlb(Dlb t) {
968   - // TODO Auto-generated method stub
969   - Map<String, Object> map = new HashMap<>();
970   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
971   - String rq=sdf.format(t.getRq());
972   - String gsdm=t.getSsgsdm();
973   - String fgsdm=t.getFgsdm();
974   - String xlbm=t.getXlbm();
975   - String jhsj=t.getJhsj();
976   - String jsy=t.getJsy();
977   - String nbbm=t.getNbbm();
978   - int sfkt=t.getSfkt();
979   - t.setCreatetime(new Date());
980   - String[] jhsjStr = jhsj.split(":");
981   - long fcsjL= Long.parseLong(jhsjStr[0])*60+Long.parseLong(jhsjStr[1]);
982   - List<Dlb> list=this.listOrderBy(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj");
983   -// repository.obtainYl(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj");
984   - int jcsx=1;
985   - if(list.size()>0){
986   - for (int i = 0; i < list.size(); i++) {
987   - Dlb y=list.get(i);
988   - String[] fcsjStr = y.getJhsj().split(":");
989   - long fcsj=Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
990   - if(fcsjL>fcsj){
991   - jcsx=jcsx+y.getJcsx();
992   - }else{
993   - y.setJcsx(y.getJcsx()+1);
994   - repository.save(y);
995   - }
996   - }
997   -
998   - }
999   - t.setJcsx(jcsx);
1000   - repository.save(t);
1001   -
1002   - SysUser user = SecurityUtils.getCurrentUser();
1003   - Nylog nylog=new Nylog();
1004   - nylog.setCreatedate(new Date());
1005   - nylog.setCzmc("手动添加");
1006   - nylog.setNylx("电");
1007   - nylog.setUserid(user.getUserName());
1008   - nylog.setUsername(user.getName());
1009   - nylog.setCxtj("");
1010   - nylogRepository.save(nylog);
1011   - map.put("status", ResponseCode.SUCCESS);
1012   - map.put("t", t);
1013   - return map;
1014   - }
1015   -
1016   - @Transactional
1017   - @Override
1018   - public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{
1019   - // TODO Auto-generated method stub
1020   - Map<String, Object> maps = new HashMap<>();
1021   - try{
1022   - String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString());
1023   - JSONArray jsonArray=JSONArray.parseArray(json);
1024   - JSONObject jsonObject;
1025   - for (int x = 0; x < jsonArray.size(); x++) {
1026   - jsonObject=jsonArray.getJSONObject(x);
1027   - Integer id =jsonObject.getInteger("id");
1028   - repository.deleteById(id);
1029   - }
1030   -
1031   - SysUser user = SecurityUtils.getCurrentUser();
1032   - Nylog nylog=new Nylog();
1033   - nylog.setCreatedate(new Date());
1034   - nylog.setCzmc("删除");
1035   - nylog.setNylx("电");
1036   - nylog.setUserid(user.getUserName());
1037   - nylog.setUsername(user.getName());
1038   - nylog.setCxtj("");
1039   - nylogRepository.save(nylog);
1040   - maps.put("status", ResponseCode.SUCCESS);
1041   - } catch (Exception e) {
1042   - maps.put("status", ResponseCode.ERROR);
1043   - logger.error("save erro.", e);
1044   - throw e;
1045   - }
1046   - return maps;
1047   - }
1048   -
1049   - @Override
1050   - public Map<String, List<Dlb>> updeteHistory(List<Map<String, Object>> listpbDc,String date,
1051   - String gsdm,String fgsdm,String line) {
1052   - // TODO Auto-generated method stub
1053   - Map<String, List<Dlb>> mapList=new HashMap<String,List<Dlb>>();
1054   - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
1055   - // 保留两位小数
1056   - DecimalFormat df = new DecimalFormat("#.00");
1057   - List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm");
1058   - List<Dlb> dlbList_upd=new ArrayList<Dlb>();
1059   - List<Dlb> dlbList_del=new ArrayList<Dlb>();
1060   - try{
1061   - for (int j = 0; j < dlbList.size(); j++) {
1062   - Dlb t=dlbList.get(j);
1063   - boolean fage=true;
1064   - if(StringUtils.isEmpty(t.getLp())){
1065   - fage=false;
1066   - }else{
1067   - for (int i = 0; i < listpbDc.size(); i++) {
1068   - Map<String, Object> m = listpbDc.get(i);
1069   - if(t.getNbbm().equals(m.get("clZbh").toString())
1070   - &&t.getJsy().equals(m.get("jGh").toString())
1071   - &&t.getXlbm().equals(m.get("xlBm").toString())
1072   - &&t.getLp().equals(m.get("lpName").toString())){
1073   - //该条记录不用删除
1074   - fage =false;
1075   - dlbList_upd.add(t);
1076   - }
1077   - }
1078   - }
1079   -
1080   - if(fage){
1081   - if(t.getXlbm().equals(line)){
1082   - dlbList_del.add(t);
1083   - }
1084   - }
1085   - }
1086   - mapList.put("delList", dlbList_del);
1087   - Map<String, Double> lcMap=new HashMap<String,Double>();
1088   - for (int i = 0; i < listpbDc.size(); i++) {
1089   - String cl=listpbDc.get(i).get("clZbh").toString();
1090   - Double lc= listpbDc.get(i).get("totalKilometers") == null ? 0.0
1091   - : Double.parseDouble(listpbDc.get(i).get("totalKilometers").toString());
1092   - if(lcMap.get(cl)==null){
1093   - lcMap.put(cl, lc);
1094   - }else{
1095   - double lc_=lcMap.get(cl);
1096   - lcMap.remove(cl);
1097   - lcMap.put(cl, Arith.add(lc, lc_));
1098   - }
1099   - }
1100   - Map<String, Double> shMap=new HashMap<String,Double>();
1101   - for (int i = 0; i < dlbList_upd.size(); i++) {
1102   - Dlb dlb=dlbList_upd.get(i);
1103   - String cl=dlb.getNbbm();
1104   - if(shMap.get(cl)==null){
1105   - shMap.put(cl, dlb.getSh());
1106   - }else{
1107   - double sh=shMap.get(cl);
1108   - shMap.remove(cl);
1109   - shMap.put(cl, Arith.add(sh, dlb.getSh()));
1110   - }
1111   - }
1112   - List<Jdl> jdlList=jdlRepository.JdlList(date);
1113   - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm);
1114   - Map<String, Object> newMap_=new HashMap<String,Object>();
1115   - Map<String, Object> cMap=new HashMap<String, Object>();
1116   - List<Map<String, Object>> listpb_=listpbDc;
1117   - Collections.sort(listpbDc,new NbbmJcsxMap());
1118   - List<Dlb> updateDlb=new ArrayList<Dlb>();
1119   - for (int x = 0; x < listpb_.size(); x++) {
1120   - String type = "add";
1121   - Map<String, Object> map_ = listpb_.get(x);
1122   - if(newMap_.get(map_.get("clZbh").toString())==null){
1123   - newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString());
1124   - //车辆总里程
1125   - double zlc =lcMap.get(map_.get("clZbh").toString());
1126   - //车辆总加电量
1127   - double zjzl = 0.0;
1128   - for (int j = 0; j < ylxxList.size(); j++) {
1129   - Ylxxb ylxxb = ylxxList.get(j);
1130   - if (map_.get("clZbh").toString().equals(ylxxb.getNbbm())
1131   - && map_.get("company").toString().equals(ylxxb.getGsdm())) {
1132   - zjzl = Arith.add(zjzl, ylxxb.getJzl());
1133   - }
1134   - }
1135   - for (int i = 0; i < jdlList.size(); i++) {
1136   - Jdl jdl=jdlList.get(i);
1137   - if(map_.get("clZbh").toString().equals(jdl.getNbbm())
1138   - &&map_.get("company").toString().equals(jdl.getGsBm())
1139   - &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){
1140   - zjzl = Arith.add(zjzl,jdl.getJdl());
1141   - }
1142   - }
1143   - double clsh=0.0;
1144   - if(shMap.get(map_.get("clZbh").toString())==null){
1145   - clsh=0.0;
1146   - }else{
1147   - clsh=shMap.get(map_.get("clZbh").toString());
1148   - }
1149   - zjzl =Arith.sub(zjzl, clsh);
1150   - Double nextJzyl = 0.0;
1151   - for (int i = 0; i < listpbDc.size(); i++) {
1152   - Map<String, Object> map = listpbDc.get(i);
1153   - if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){
1154   - // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
1155   - Dlb t = new Dlb();
1156   - for (int k = 0; k < dlbList_upd.size(); k++) {
1157   - Dlb t1 = dlbList_upd.get(k);
1158   - if (t1.getNbbm().equals(map.get("clZbh").toString())
1159   - && t1.getJsy().equals(map.get("jGh").toString())
1160   - && t1.getXlbm().equals(map.get("xlBm").toString())
1161   - && t1.getLp().equals(map.get("lpName").toString())) {
1162   - t = t1;
1163   - type = "update";
1164   - }
1165   -
1166   - }
1167   - Double lc= Double.parseDouble(map.get("totalKilometers").toString());
1168   - if(map.get("seqNumber").toString().equals("1")){
1169   - // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
1170   - Double dh=0.0;
1171   - if(zlc>0){
1172   - dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
1173   - }
1174   - nextJzyl =Arith.sub(zjzl,dh);
1175   - if(zlc>0){
1176   -// long l=Math.round(nextJzyl);
1177   - double ylxs=nextJzyl;
1178   - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
1179   - if(dh<0){
1180   - t.setHd(0.0);
1181   - t.setCdl(0.0);
1182   - nextJzyl=Arith.add(ylxs, dh);
1183   - }else{
1184   - t.setHd(dh);
1185   - t.setCdl(dh);
1186   - nextJzyl=ylxs;
1187   - }
1188   - }else{
1189   - t.setHd(0.0);
1190   - t.setCdl(0.0);
1191   - }
1192   - }else{
1193   - Double dh=0.0;
1194   - if(zlc>0){
1195   - dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
1196   - }
1197   - nextJzyl =Arith.sub( nextJzyl,dh);
1198   - if(zlc>0){
1199   -// long l=0l;
1200   - double ylxs=0.0;
1201   - if(i==listpbDc.size()-1){
1202   -// ylxs=czyl;
1203   - }else{
1204   - if(listpbDc.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){
1205   -// l=Math.round(nextJzyl);
1206   - ylxs=nextJzyl;
1207   - }
1208   -
1209   - }
1210   - dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
1211   - if(dh<0){
1212   - t.setHd(0.0);
1213   - t.setCdl(0.0);
1214   - nextJzyl=Arith.add(ylxs, dh);
1215   - }else{
1216   - t.setHd(dh);
1217   - t.setCdl(dh);
1218   - nextJzyl=ylxs;
1219   - }
1220   - }else{
1221   - t.setHd(0.0);
1222   - t.setCdl(0.0);
1223   - }
1224   - }
1225   - t.setCzcd(100.0);
1226   - t.setJzcd(100.0);
1227   - t.setNbbm(map.get("clZbh").toString());
1228   - t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
1229   - t.setZlc(map.get("totalKilometers") == null ? 0.0
1230   - : Double.parseDouble(map.get("totalKilometers").toString()));
1231   - t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
1232   - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
1233   - t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
1234   - t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
1235   - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
1236   - t.setRq(sdf.parse(date));
1237   - t.setLp(map.get("lpName").toString());
1238   - t.setCdl(Arith.add(t.getCdl(), t.getSh()));
1239   - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
1240   - if(type.equals("add")){
1241   - t.setCreatetime(new Date());
1242   - }else{
1243   - t.setUpdatetime(new Date());
1244   - }
1245   - }
1246   -
1247   - if(t.getHd()<0){
1248   - t.setHd(0.0);
1249   - }
1250   - if(t.getCdl()<0){
1251   - t.setCdl(0.0);
1252   - }
1253   - updateDlb.add(t);
1254   - }
1255   - }
1256   - }
1257   - }
1258   - mapList.put("updList", updateDlb);
1259   - }catch(Exception e){
1260   - logger.error("save erro.", e);
1261   - }
1262   - return mapList;
1263   - }
1264   -
1265   - @Override
1266   - public Map<String, Object> update(Map<String, Object> map) {
1267   - if(map.get("id")!=null){
1268   - if(map.get("id").toString().length()>0){
1269   - Integer id=Integer.parseInt(map.get("id").toString());
1270   - String jsy=map.get("jsy").toString();
1271   - Dlb t=repository.findById(id).get();
1272   - t.setJsy(jsy);
1273   - repository.save(t);
1274   - map.put("status", ResponseCode.SUCCESS);
1275   - }
1276   - }
1277   - return map;
1278   - }
1279   -
1280   -}
1281   -
1282   -class NbbmJcsxMap implements Comparator<Map<String, Object>>{
1283   - @Override
1284   - public int compare(Map<String, Object> o1, Map<String, Object> o2) {
1285   - // TODO Auto-generated method stub
1286   - return (o1.get("clZbh").toString()+o1.get("seqNumber").toString()).compareTo((o2.get("clZbh").toString()+o1.get("seqNumber").toString()));
1287   - }
1288   -}
  1 +package com.bsth.service.oil.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.HashMap;
  14 +import java.util.List;
  15 +import java.util.Map;
  16 +
  17 +import javax.transaction.Transactional;
  18 +
  19 +import org.apache.commons.lang3.StringEscapeUtils;
  20 +import org.apache.commons.lang3.StringUtils;
  21 +import org.slf4j.Logger;
  22 +import org.slf4j.LoggerFactory;
  23 +import org.springframework.beans.factory.annotation.Autowired;
  24 +import org.springframework.jdbc.core.JdbcTemplate;
  25 +import org.springframework.jdbc.core.RowMapper;
  26 +import org.springframework.stereotype.Service;
  27 +
  28 +import com.alibaba.fastjson.JSONArray;
  29 +import com.alibaba.fastjson.JSONObject;
  30 +import com.bsth.common.ResponseCode;
  31 +import com.bsth.data.BasicData;
  32 +import com.bsth.entity.Cars;
  33 +import com.bsth.entity.Line;
  34 +import com.bsth.entity.oil.Cdl;
  35 +import com.bsth.entity.oil.Dlb;
  36 +import com.bsth.entity.oil.Jdl;
  37 +import com.bsth.entity.oil.Nylog;
  38 +import com.bsth.entity.sys.SysUser;
  39 +import com.bsth.repository.CarsRepository;
  40 +import com.bsth.repository.oil.CdlRepository;
  41 +import com.bsth.repository.oil.DlbRepository;
  42 +import com.bsth.repository.oil.JdlRepository;
  43 +import com.bsth.repository.oil.NylogRepository;
  44 +import com.bsth.repository.oil.YlxxbRepository;
  45 +import com.bsth.security.util.SecurityUtils;
  46 +import com.bsth.service.impl.BaseServiceImpl;
  47 +import com.bsth.service.oil.DlbService;
  48 +import com.bsth.service.realcontrol.ScheduleRealInfoService;
  49 +import com.bsth.util.Arith;
  50 +import com.bsth.util.BatchSaveUtils;
  51 +
  52 +@Service
  53 +public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{
  54 + @Autowired
  55 + DlbRepository repository;
  56 + @Autowired
  57 + NylogRepository nylogRepository;
  58 + @Autowired
  59 + YlxxbRepository ylxxbRepository;
  60 +
  61 + @Autowired
  62 + CdlRepository cdlRepository;
  63 + @Autowired
  64 + JdlRepository jdlRepository;
  65 + @Autowired
  66 + CarsRepository carsRepository;
  67 +
  68 + @Autowired
  69 + ScheduleRealInfoService scheduleRealInfoService;
  70 +
  71 + @Autowired
  72 + JdbcTemplate jdbcTemplate;
  73 +
  74 + Logger logger = LoggerFactory.getLogger(this.getClass());
  75 +
  76 + @Transactional
  77 + @Override
  78 + public String obtainDsq() throws Exception{
  79 + String result = "failure";
  80 + List<Cars> carsList=carsRepository.findCars();
  81 + Map<String, Boolean> carsMap=new HashMap<String, Boolean>();
  82 + for (int i = 0; i < carsList.size(); i++) {
  83 + Cars c=carsList.get(i);
  84 + carsMap.put(c.getInsideCode(), (c.getSfdc()!=null?c.getSfdc():false)
  85 + || (c.getSfmix()!=null?c.getSfmix():false));//电车或油电混合,都可以充电
  86 + }
  87 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  88 + Date dNow = new Date(); //当前时间
  89 + Date dBefore = new Date();
  90 + Calendar calendar = Calendar.getInstance(); //得到日历
  91 + calendar.setTime(dNow);//把当前时间赋给日历
  92 + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
  93 + dBefore = calendar.getTime(); //得到前一天的时间
  94 + String rq=sdf.format(dBefore);
  95 +// String rq="2017-11-02";
  96 + String line="";
  97 + //保留两位小数
  98 + DecimalFormat df = new DecimalFormat("#.00");
  99 + // TODO Auto-generated method stub
  100 + Map<String, Object> newMap=new HashMap<String,Object>();
  101 + //当天DLB信息
  102 + List<Dlb> dlList=repository.obtainDl(rq, "", "", line, "", "nbbm");
  103 + //当天加电信息表
  104 + List<Jdl> jdlList=jdlRepository.JdlList(rq);
  105 + //前一天所有车辆最后进场班次信息
  106 +// List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", "");
  107 + List<Cdl> cdyList=cdlRepository.obtainCdl();
  108 + //从排班表中计算出行驶的总里程
  109 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","","");
  110 + for(int x=0;x<listpb.size();x++){
  111 + String type="add";
  112 + boolean sfdc=false;
  113 + Map<String, Object> map=listpb.get(x);
  114 + if (carsMap.get(map.get("clZbh").toString())!=null) {
  115 + sfdc = carsMap.get(map.get("clZbh").toString());
  116 + }else{
  117 + sfdc=false;
  118 + }
  119 + if(sfdc){
  120 + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  121 + Dlb t=new Dlb();
  122 + for(int k=0;k<dlList.size();k++){
  123 + Dlb t1=dlList.get(k);
  124 + if(t1.getNbbm().equals(map.get("clZbh").toString())
  125 + &&t1.getJsy().equals(map.get("jGh").toString())
  126 + &&t1.getXlbm().equals(map.get("xlBm").toString())
  127 + &&t1.getLp().equals(map.get("lpName").toString()))
  128 + {
  129 + t=t1;
  130 + type="update";
  131 + }
  132 + }
  133 + try {
  134 + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  135 + Double jzl=0.0;
  136 + if(map.get("seqNumber").toString().equals("1")){
  137 + boolean fage=true;
  138 +// for (int i = 0; i < dlListBe.size(); i++) {
  139 +// Dlb dlb=dlListBe.get(i);
  140 +// if(map.get("clZbh").toString().equals(dlb.getNbbm())){
  141 +// t.setCzcd(dlb.getJzcd());
  142 +// fage=false;
  143 +// break;
  144 +// }
  145 +// }
  146 + if(fage){
  147 + for (int y = 0; y < cdyList.size(); y++) {
  148 + Cdl cdl=cdyList.get(y);
  149 + if(map.get("clZbh").toString().equals(cdl.getNbbm())){
  150 + t.setCzcd(cdl.getClcd()==null?0:cdl.getClcd());
  151 + fage=false;
  152 + break;
  153 + }
  154 + }
  155 + }
  156 + if(fage){
  157 + t.setCzcd(0.0);
  158 + }
  159 +
  160 + //手动导入没有驾驶员工号
  161 + for (int i = 0; i < jdlList.size(); i++) {
  162 + Jdl jdl=jdlList.get(i);
  163 + if(map.get("clZbh").toString().equals(jdl.getNbbm())
  164 + &&map.get("jGh").toString().equals(jdl.getJsy())){
  165 + jzl+=jdl.getJdl();
  166 + }
  167 + }
  168 + }
  169 +
  170 +
  171 + t.setCdl(jzl);
  172 + if(type.equals("add")){
  173 + t.setHd(jzl);
  174 + t.setJzcd(t.getCzcd());
  175 + }
  176 +
  177 + t.setNbbm(map.get("clZbh").toString());
  178 + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString());
  179 + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString()))));
  180 + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString());
  181 + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
  182 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  183 + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString());
  184 + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString());
  185 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  186 + t.setLp(map.get("lpName").toString());
  187 + t.setRq(sdf.parse(rq));
  188 + t.setCreatetime(new Date());
  189 + t.setJname(map.get("jName").toString());
  190 + /*if(type.equals("add")){
  191 + addList.add(t);
  192 + }else{
  193 + updateList.add(t);
  194 + }*/
  195 + repository.save(t);
  196 + newMap.put("status", ResponseCode.SUCCESS);
  197 + } catch (ParseException e) {
  198 + // TODO Auto-generated catch block
  199 + newMap.put("status", ResponseCode.ERROR);
  200 + e.printStackTrace();
  201 + }
  202 + }
  203 + }
  204 + return result;
  205 + }
  206 +
  207 + /**
  208 + * 获取进存油信息
  209 + * @Transactional 回滚事物
  210 + */
  211 + @Transactional
  212 + @Override
  213 + public Map<String, Object> obtain(Map<String, Object> map2) throws Exception{
  214 + Map<String, Object> newMap = new HashMap<String, Object>();
  215 + try {
  216 + Date date=new Date();
  217 + List<Cars> carsList = carsRepository.findCars();
  218 + Map<String, Boolean> carsMap = new HashMap<String, Boolean>();
  219 + for (int i = 0; i < carsList.size(); i++) {
  220 + Cars c = carsList.get(i);
  221 + carsMap.put(c.getInsideCode(), (c.getSfdc()!=null?c.getSfdc():false)
  222 + || (c.getSfmix()!=null?c.getSfmix():false));//电车或油电混合,都可以充电
  223 + }
  224 + String rq = map2.get("rq").toString();
  225 + String line = "";
  226 + if (map2.get("xlbm_like") != null) {
  227 + line = map2.get("xlbm_like").toString().trim();
  228 + }
  229 + String gsbm="";
  230 + if(map2.get("ssgsdm_like")!=null){
  231 + gsbm=map2.get("ssgsdm_like").toString();
  232 + }
  233 + String fgsbm="";
  234 + if(map2.get("fgsdm_like")!=null){
  235 + fgsbm=map2.get("fgsdm_like").toString();
  236 + }
  237 + String nbbm="";
  238 + if(map2.get("nbbm_eq")!=null){
  239 + nbbm=map2.get("nbbm_eq").toString();
  240 + }
  241 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  242 + // 保留两位小数
  243 + DecimalFormat df = new DecimalFormat("#.00");
  244 + // TODO Auto-generated method stub
  245 + // 当天DLB信息
  246 + List<Dlb> dlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm");
  247 + // 从排班表中计算出行驶的总里程
  248 + List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>();
  249 + List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm);
  250 + Map<String, Double> lcMap=new HashMap<String,Double>();
  251 + for (int i = 0; i < listpbs.size(); i++) {
  252 + String cl=listpbs.get(i).get("clZbh").toString();
  253 + Double lc= listpbs.get(i).get("totalKilometers") == null ? 0.0
  254 + : Double.parseDouble(listpbs.get(i).get("totalKilometers").toString());
  255 + if(lcMap.get(cl)==null){
  256 + lcMap.put(cl, lc);
  257 + }else{
  258 + double lc_=lcMap.get(cl);
  259 + lcMap.remove(cl);
  260 + lcMap.put(cl, Arith.add(lc, lc_));
  261 + }
  262 + }
  263 +
  264 +// Map<String, Double> shMap=new HashMap<String,Double>();
  265 +// for (int i = 0; i < dlList.size(); i++) {
  266 +// Dlb dlb=dlList.get(i);
  267 +// String cl=dlb.getNbbm();
  268 +// if(shMap.get(cl)==null){
  269 +// shMap.put(cl, dlb.getSh());
  270 +// }else{
  271 +// double sh=shMap.get(cl);
  272 +// shMap.remove(cl);
  273 +// shMap.put(cl, Arith.add(sh, dlb.getSh()));
  274 +// }
  275 +// }
  276 + List<Jdl> jdlList=jdlRepository.JdlList(rq);
  277 + String sxtj=map2.get("sxtj").toString();
  278 + if(sxtj.equals("0")){
  279 + listpb=listpbs;
  280 + }else{
  281 + List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, "",nbbm);
  282 + List<String> stringList=new ArrayList<String>();
  283 + for (int i = 0; i < objectLists.size(); i++) {
  284 + String clbm=objectLists.get(i)[0].toString();
  285 + int cs=Integer.parseInt(objectLists.get(i)[1].toString());
  286 + //一车一单
  287 + if(sxtj.equals("1")){
  288 + if(cs==1){
  289 + stringList.add(clbm);
  290 + }
  291 + }
  292 + //一车多单
  293 + if(sxtj.equals("2")){
  294 + if(cs>1){
  295 + stringList.add(clbm);
  296 + }
  297 + }
  298 + }
  299 +
  300 + for (int i = 0; i < stringList.size(); i++) {
  301 + String strNbbm=stringList.get(i);
  302 + for (int j = 0; j < listpbs.size(); j++) {
  303 + Map<String, Object> map = listpbs.get(j);
  304 + String mapNbbm=map.get("clZbh").toString();
  305 + if(strNbbm.equals(mapNbbm)){
  306 + listpb.add(map);
  307 + }
  308 + }
  309 + }
  310 + }
  311 + Map<String, Object> newMap_=new HashMap<String,Object>();
  312 + List<Dlb> addList = new ArrayList<Dlb>();
  313 + List<Dlb> updateList = new ArrayList<Dlb>();
  314 + Map<String, Object> cMap=new HashMap<String, Object>();
  315 + List<Map<String, Object>> listpb_=listpb;
  316 + Collections.sort(listpb,new NbbmJcsxMap());
  317 + for (int x = 0; x < listpb_.size(); x++) {
  318 + String type = "add";
  319 + boolean sfdc = false;
  320 + Map<String, Object> map_ = listpb_.get(x);
  321 + if (carsMap.get(map_.get("clZbh").toString()) != null) {
  322 + sfdc = carsMap.get(map_.get("clZbh").toString());
  323 + } else {
  324 + sfdc = false;
  325 + }
  326 + if (sfdc) {
  327 + if(newMap_.get(map_.get("clZbh").toString())==null){
  328 + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString());
  329 + //车辆总里程
  330 + double zlc =lcMap.get(map_.get("clZbh").toString());
  331 + //车辆总加电量
  332 + double zjzl = 0.0;
  333 + for (int i = 0; i < jdlList.size(); i++) {
  334 + Jdl jdl=jdlList.get(i);
  335 + if(map_.get("clZbh").toString().equals(jdl.getNbbm())
  336 + &&map_.get("company").toString().equals(jdl.getGsBm())
  337 + &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){
  338 + zjzl = Arith.add(zjzl,jdl.getJdl());
  339 + }
  340 + }
  341 +// double clsh=0.0;
  342 +// if(shMap.get(map_.get("clZbh").toString())==null){
  343 +// clsh=0.0;
  344 +// }else{
  345 +// clsh=shMap.get(map_.get("clZbh").toString());
  346 +// }
  347 +// zjzl =Arith.sub(zjzl, clsh);
  348 + Double nextJzyl = 0.0;
  349 + for (int i = 0; i < listpb.size(); i++) {
  350 + Map<String, Object> map = listpb.get(i);
  351 + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){
  352 + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  353 + Dlb t = new Dlb();
  354 + for (int k = 0; k < dlList.size(); k++) {
  355 + Dlb t1 = dlList.get(k);
  356 + if (t1.getNbbm().equals(map.get("clZbh").toString())
  357 + && t1.getJsy().equals(map.get("jGh").toString())
  358 + && t1.getXlbm().equals(map.get("xlBm").toString())) {
  359 + if(t1.getLp()==null){
  360 + //同人同车同线路不同路牌的过滤 (考虑到历史数据)
  361 + if (cMap.get(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString())==null) {
  362 + t = t1;
  363 + type = "update";
  364 + cMap.put(map.get("clZbh").toString()+map.get("jGh").toString()+map.get("xlBm").toString(),
  365 + map.get("clZbh").toString());
  366 + }
  367 + }else{
  368 + if(t1.getLp().equals(map.get("lpName").toString())){
  369 + t = t1;
  370 + type = "update";
  371 + }
  372 +
  373 + }
  374 + }
  375 + }
  376 + Double lc= Double.parseDouble(map.get("totalKilometers").toString());
  377 + if(map.get("seqNumber").toString().equals("1")){
  378 + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  379 + Double dh=0.0;
  380 + if(zlc>0){
  381 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  382 + }
  383 + nextJzyl =Arith.sub(zjzl,dh);
  384 + if(zlc>0){
  385 +// long l=Math.round(nextJzyl);
  386 + double ylxs=nextJzyl;
  387 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  388 + if(dh<0){
  389 + t.setHd(0.0);
  390 + t.setCdl(0.0);
  391 + nextJzyl=Arith.add(ylxs, dh);
  392 + }else{
  393 + t.setHd(dh);
  394 + t.setCdl(dh);
  395 + nextJzyl=ylxs;
  396 + }
  397 + }else{
  398 + t.setHd(0.0);
  399 + t.setCdl(0.0);
  400 + }
  401 + }else{
  402 + Double dh=0.0;
  403 + if(zlc>0){
  404 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  405 + }
  406 + nextJzyl =Arith.sub( nextJzyl,dh);
  407 + if(zlc>0){
  408 +// long l=0l;
  409 + double ylxs=0.0;
  410 + if(i==listpb.size()-1){
  411 +// ylxs=czyl;
  412 + }else{
  413 + if(listpb.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){
  414 +// l=Math.round(nextJzyl);
  415 + ylxs=nextJzyl;
  416 + }
  417 +
  418 + }
  419 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  420 + if(dh<0){
  421 + t.setHd(0.0);
  422 + t.setCdl(0.0);
  423 + nextJzyl=Arith.add(ylxs, dh);
  424 + }else{
  425 + t.setHd(dh);
  426 + t.setCdl(dh);
  427 + nextJzyl=ylxs;
  428 + }
  429 + }else{
  430 + t.setHd(0.0);
  431 + t.setCdl(0.0);
  432 + }
  433 + }
  434 + t.setCzcd(100.0);
  435 + t.setJzcd(100.0);
  436 + t.setNbbm(map.get("clZbh").toString());
  437 + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
  438 + t.setZlc(map.get("totalKilometers") == null ? 0.0
  439 + : Double.parseDouble(map.get("totalKilometers").toString()));
  440 + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  441 + t.setLinename(map.get("lineName")==null?"":map.get("lineName").toString());
  442 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  443 + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
  444 + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
  445 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  446 + t.setRq(sdf.parse(rq));
  447 + t.setLp(map.get("lpName").toString());
  448 + t.setJname(map.get("jName").toString());
  449 + if (!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))) {
  450 + if (t.getHd() < 0) {
  451 + t.setHd(0.0);
  452 + }
  453 + if (t.getCdl() < 0) {
  454 + t.setCdl(0.0);
  455 + }
  456 + if (type.equals("add")) {
  457 + t.setCreatetime(date);
  458 + addList.add(t);
  459 + } else {
  460 + t.setUpdatetime(date);
  461 + updateList.add(t);
  462 + }
  463 + }
  464 + newMap.put("status", ResponseCode.SUCCESS);
  465 + }
  466 + }
  467 + }
  468 + }
  469 + }
  470 + if(addList.size()>0){
  471 + try {
  472 + new BatchSaveUtils<Dlb>().saveList2(addList, Dlb.class);
  473 + } catch (Exception e) {
  474 + // TODO: handle exception
  475 + if(e.getMessage().indexOf("PK_DLB_UK")>0){
  476 + newMap.put("fage", "存在相同数据,数据已经过滤");
  477 + logger.info("获取:存在相同数据,数据已经过滤");
  478 + }
  479 + }
  480 +
  481 + }
  482 +
  483 + if(updateList.size()>0){
  484 + for (int i = 0; i < updateList.size(); i++) {
  485 + repository.save(updateList.get(i));
  486 + }
  487 + }
  488 + SysUser user = SecurityUtils.getCurrentUser();
  489 + Nylog nylog=new Nylog();
  490 + nylog.setCreatedate(new Date());
  491 + nylog.setCzmc("获取");
  492 + nylog.setNylx("电");
  493 + nylog.setUserid(user.getUserName());
  494 + nylog.setUsername(user.getName());
  495 + nylog.setCxtj(line+"-"+ date+"-"+gsbm+"-"+fgsbm);
  496 + nylogRepository.save(nylog);
  497 + newMap.put("status", ResponseCode.SUCCESS);
  498 + } catch (Exception e) {
  499 + // TODO Auto-generated catch block
  500 + newMap.put("status", ResponseCode.ERROR);
  501 + throw e;
  502 + }
  503 +
  504 + return newMap;
  505 + }
  506 +
  507 + /**
  508 + * 拆分
  509 + */
  510 + @Transactional
  511 + @Override
  512 + public Map<String, Object> sort(Map<String, Object> map) {
  513 + // TODO Auto-generated method stub
  514 + Map<String, Object> newMap = new HashMap<String, Object>();
  515 + try{
  516 + int id=Integer.parseInt(map.get("id").toString());
  517 + //最后存油量
  518 + Double jzdl=Double.parseDouble(map.get("jzdl").toString());
  519 + Double hdl=Double.parseDouble(map.get("hdl").toString());
  520 + Dlb dlb=repository.findById(id).get();
  521 + dlb.setJzcd(jzdl);
  522 + dlb.setHd(hdl);
  523 + repository.save(dlb);
  524 + newMap.put("status", ResponseCode.SUCCESS);
  525 + }catch(Exception e){
  526 + newMap.put("status", ResponseCode.ERROR);
  527 + logger.error("save erro.", e);
  528 + }
  529 + return newMap;
  530 + }
  531 +
  532 +
  533 + /**
  534 + * 核对,有加注没里程
  535 + * @param map
  536 + * @return
  537 + */
  538 + @Transactional
  539 + @Override
  540 + public Map<String, Object> checkDl(Map<String, Object> map) {
  541 + Map<String, Object> newMap=new HashMap<String,Object>();
  542 +// String xlbm="";
  543 +// if(map.get("xlbm_like")!=null){
  544 +// xlbm=map.get("xlbm_like").toString();
  545 +// }
  546 + // TODO Auto-generated method stub
  547 +
  548 + List<Cars> carsList = carsRepository.findCars();
  549 + Map<String, String> carsMap = new HashMap<String, String>();
  550 + for (int i = 0; i < carsList.size(); i++) {
  551 + Cars c = carsList.get(i);
  552 + carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode());
  553 + }
  554 +
  555 + try{
  556 + //获取车辆存油信息
  557 +
  558 + String rq=map.get("rq").toString();
  559 + String xlbm="";
  560 + if(map.get("xlbm_like")!=null){
  561 + xlbm= map.get("xlbm_like").toString().trim();
  562 + }
  563 + String gsbm="";
  564 + if(map.get("ssgsdm_like")!=null){
  565 + gsbm=map.get("ssgsdm_like").toString();
  566 + }
  567 + String fgsbm="";
  568 + if(map.get("fgsdm_like")!=null){
  569 + fgsbm=map.get("fgsdm_like").toString();
  570 + }
  571 + String nbbm="";
  572 + if(map.get("nbbm_eq")!=null){
  573 + nbbm=map.get("nbbm_eq").toString();
  574 + }
  575 +
  576 + String sql="select * from bsth_c_jdl j where j.gs_bm ='"+gsbm+"' "
  577 + + " and j.fgs_bm ='"+fgsbm+"' and rq ='"+rq+"' "
  578 + + "and nbbm not in (select nbbm from bsth_c_dlb d"
  579 + + " where ssgsdm ='"+gsbm+"' and fgsdm ='"+fgsbm+"'"
  580 + + " and rq='"+rq+"')";
  581 + List<Jdl> listJdl=jdbcTemplate.query(sql,
  582 + new RowMapper<Jdl>(){
  583 + @Override
  584 + public Jdl mapRow(ResultSet rs, int rowNum) throws SQLException {
  585 + Jdl s = new Jdl();
  586 + s.setNbbm(rs.getString("nbbm"));
  587 + s.setGsBm(rs.getString("gs_bm"));
  588 + s.setFgsBm(rs.getString("fgs_bm"));
  589 + s.setJdl(rs.getDouble("jdl"));
  590 + s.setRq(rs.getDate("rq"));
  591 + return s;
  592 + }
  593 + });
  594 + for (int i = 0; i < listJdl.size(); i++) {
  595 + Jdl j=listJdl.get(i);
  596 + Dlb t=new Dlb();
  597 + Line line= BasicData.nbbm2LineMap.get(j.getNbbm());
  598 + if(null !=line){
  599 + t.setCdl(j.getJdl());
  600 + t.setNbbm(j.getNbbm());
  601 + t.setRq(j.getRq());
  602 + t.setJsy("");
  603 + t.setCdl(j.getJdl());
  604 + t.setSsgsdm(j.getGsBm());
  605 + t.setFgsdm(j.getFgsBm());
  606 + t.setJzcd(100.0);
  607 + t.setCzcd(100.0);
  608 + t.setHd(0.0);
  609 + t.setJcsx(1);
  610 + t.setXlbm(line.getLineCode());
  611 + t.setLp("");
  612 + repository.save(t);
  613 + }
  614 + }
  615 +
  616 + SysUser user = SecurityUtils.getCurrentUser();
  617 + Nylog nylog=new Nylog();
  618 + nylog.setCreatedate(new Date());
  619 + nylog.setCzmc("核对");
  620 + nylog.setNylx("电");
  621 + nylog.setUserid(user.getUserName());
  622 + nylog.setUsername(user.getName());
  623 + nylog.setCxtj(xlbm+"-"+ rq+"-"+gsbm+"-"+fgsbm);
  624 + nylogRepository.save(nylog);
  625 + newMap.put("status", ResponseCode.SUCCESS);
  626 + }catch(Exception e){
  627 + newMap.put("status", ResponseCode.ERROR);
  628 + logger.error("save erro.", e);
  629 + throw e;
  630 + }
  631 +
  632 + return newMap;
  633 + }
  634 +
  635 + @Override
  636 + public List<Dlb> listDlb(Map<String, Object> map) {
  637 + // TODO Auto-generated method stub
  638 + List<Dlb> listDlb = new ArrayList<Dlb>();
  639 + List<String> stringList = new ArrayList<String>();
  640 + String rq = map.get("rq").toString();
  641 + String gsbm = map.get("ssgsdm_like").toString();
  642 + String fgsbm = map.get("fgsdm_like").toString();
  643 + String xlbm = map.get("xlbm_like").toString().trim();
  644 + String nbbm = map.get("nbbm_eq").toString();
  645 + String sxtj = map.get("sxtj").toString();
  646 + String type = map.get("type").toString();
  647 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  648 + try {
  649 + if (nbbm.trim() != "") {
  650 + stringList.add(nbbm);
  651 + if (type.equals("1"))
  652 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  653 + else
  654 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  655 +
  656 + } else {
  657 + // 全部
  658 + if (sxtj.equals("0")) {
  659 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  660 + for (int i = 0; i < objectLists.size(); i++) {
  661 + String clbm = objectLists.get(i)[0].toString();
  662 + stringList.add(clbm);
  663 + }
  664 + if (stringList.size() > 0) {
  665 + if (type.equals("1"))
  666 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  667 + else
  668 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  669 + }
  670 + } else {
  671 + List<Object[]> objectLists;
  672 + if (sxtj.equals("3")) {
  673 + // 有加油没里程
  674 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  675 + for (int i = 0; i < objectLists.size(); i++) {
  676 + String clbm = objectLists.get(i)[0].toString();
  677 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  678 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  679 + if (jzl > 0 && zlc <= 0) {
  680 + stringList.add(clbm);
  681 + }
  682 +
  683 + }
  684 +
  685 + } else if (sxtj.equals("4")) {
  686 + // 有里程没加油
  687 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  688 + for (int i = 0; i < objectLists.size(); i++) {
  689 + String clbm = objectLists.get(i)[0].toString();
  690 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  691 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  692 + if (zlc > 0 && jzl <= 0) {
  693 + stringList.add(clbm);
  694 + }
  695 +
  696 + }
  697 + } else {
  698 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  699 + for (int i = 0; i < objectLists.size(); i++) {
  700 + String clbm = objectLists.get(i)[0].toString();
  701 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  702 + // 一车一单
  703 + if (sxtj.equals("1")) {
  704 + if (cs == 1) {
  705 + stringList.add(clbm);
  706 + }
  707 + }
  708 + // 一车多单
  709 + if (sxtj.equals("2")) {
  710 + if (cs > 1) {
  711 + stringList.add(clbm);
  712 + }
  713 + }
  714 + }
  715 + }
  716 +
  717 + if (stringList.size() > 0) {
  718 + if (type.equals("1"))
  719 + listDlb = repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);
  720 + else
  721 + listDlb = repository.listDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  722 + }
  723 + }
  724 + }
  725 + } catch (ParseException e) {
  726 + // TODO Auto-generated catch block
  727 + e.printStackTrace();
  728 + }
  729 + return listDlb;
  730 + }
  731 +
  732 + @Override
  733 + public Map<String, Object> sumYlb(Map<String, Object> map) {
  734 + // TODO Auto-generated method stub
  735 + List<String> stringList = new ArrayList<String>();
  736 + String rq = map.get("rq").toString();
  737 + String gsbm = map.get("ssgsdm_like").toString();
  738 + String fgsbm = map.get("fgsdm_like").toString();
  739 + String xlbm = map.get("xlbm_like").toString().trim();
  740 + String nbbm = map.get("nbbm_eq").toString();
  741 + String sxtj = map.get("sxtj").toString();
  742 + String type = map.get("type").toString();
  743 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  744 + List<Object[]> sumYlbList = new ArrayList<Object[]>();
  745 + try {
  746 + if (nbbm.trim() != "") {
  747 + stringList.add(nbbm);
  748 + } else {
  749 + if (!sxtj.equals("0")) {
  750 + List<Object[]> objectLists;
  751 + if (sxtj.equals("3")) {
  752 + // 有加油没里程
  753 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  754 + for (int i = 0; i < objectLists.size(); i++) {
  755 + String clbm = objectLists.get(i)[0].toString();
  756 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  757 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  758 + if (jzl > 0 && zlc <= 0) {
  759 + stringList.add(clbm);
  760 + }
  761 +
  762 + }
  763 +
  764 + } else if (sxtj.equals("4")) {
  765 + // 有里程没加油
  766 + objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);
  767 + for (int i = 0; i < objectLists.size(); i++) {
  768 + String clbm = objectLists.get(i)[0].toString();
  769 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  770 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  771 + if (zlc > 0 && jzl <= 0) {
  772 + stringList.add(clbm);
  773 + }
  774 +
  775 + }
  776 + } else {
  777 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  778 + for (int i = 0; i < objectLists.size(); i++) {
  779 + String clbm = objectLists.get(i)[0].toString();
  780 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  781 + // 一车一单
  782 +
  783 + if (sxtj.equals("1")) {
  784 + if (cs == 1) {
  785 + stringList.add(clbm);
  786 + }
  787 + }
  788 + // 一车多单
  789 + if (sxtj.equals("2")) {
  790 + if (cs > 1) {
  791 + stringList.add(clbm);
  792 + }
  793 + }
  794 + }
  795 + }
  796 + }
  797 + }
  798 + if (sxtj.equals("0")) {
  799 + sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
  800 + } else {
  801 + if (stringList.size() > 0) {
  802 +
  803 + // String strings[]=new String[stringList.size()];
  804 + // for(int i=0;i<stringList.size();i++){
  805 + // strings[i]=stringList.get(i);
  806 + // }
  807 + if (type.equals("1"))
  808 + sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList);
  809 + else
  810 + sumYlbList = repository.sumDlb_s(sdf.parse(rq + " 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  811 +
  812 + }
  813 + // else {
  814 + // sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
  815 + // }
  816 + }
  817 + } catch (ParseException e) {
  818 + // TODO Auto-generated catch block
  819 + e.printStackTrace();
  820 + }
  821 + Double jzl = 0.0, yh = 0.0, sh = 0.0;
  822 + for (int i = 0; i < sumYlbList.size(); i++) {
  823 + jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
  824 + yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));
  825 + sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString()));
  826 + }
  827 +
  828 + Map<String, Object> sumMap = new HashMap<String, Object>();
  829 + sumMap.put("jzl", jzl);
  830 + sumMap.put("yh", yh);
  831 + sumMap.put("sh", sh);
  832 + return sumMap;
  833 + }
  834 +
  835 +
  836 + @Transactional
  837 + @Override
  838 + public Map<String, Object> saveDlbList(Map<String, Object> map) throws Exception {
  839 + // TODO Auto-generated method stub
  840 + Map<String, Object> newMap=new HashMap<String,Object>();
  841 + try{
  842 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  843 + String json =StringEscapeUtils.unescapeHtml4(map.get("dlbList").toString());
  844 + JSONArray jsonArray=JSONArray.parseArray(json);
  845 + JSONObject jsonObject;
  846 + // 获取车辆存油信息
  847 +// List<Cyl> cylList = cylRepository.obtainCyl("","");
  848 + for (int i = 0; i < jsonArray.size(); i++) {
  849 +// Ylb t=new Ylb();
  850 + jsonObject=jsonArray.getJSONObject(i);
  851 + double czcd = jsonObject.getDoubleValue("czcd");
  852 + double cdl =jsonObject.getDoubleValue("cdl");
  853 + double jzcd =jsonObject.getDoubleValue("jzcd");
  854 + double sh =jsonObject.getDoubleValue("sh");
  855 + String shyy =jsonObject.getString("shyy");
  856 + double hd = jsonObject.getDoubleValue("hd");
  857 + int yhlx =jsonObject.getIntValue("yhlx");
  858 + Integer id =jsonObject.getInteger("id");
  859 +// String nbbm =jsonObject.getString("nbbm");
  860 +// String rq=jsonObject.getString("rq");
  861 + repository.dlbUpdate(id, czcd, jzcd, hd, sh, shyy, yhlx);
  862 +
  863 + }
  864 +
  865 + SysUser user = SecurityUtils.getCurrentUser();
  866 + Nylog nylog=new Nylog();
  867 + nylog.setCreatedate(new Date());
  868 + nylog.setCzmc("保存全部");
  869 + nylog.setNylx("电");
  870 + nylog.setUserid(user.getUserName());
  871 + nylog.setUsername(user.getName());
  872 + nylog.setCxtj("");
  873 + nylogRepository.save(nylog);
  874 + newMap.put("status", ResponseCode.SUCCESS);
  875 + }catch(Exception e){
  876 + newMap.put("status", ResponseCode.ERROR);
  877 + logger.error("save erro.", e);
  878 + throw e;
  879 + }
  880 + return newMap;
  881 + }
  882 +
  883 + public List<Dlb> listOrderBy(String rq,String gsdm,
  884 + String fgsdm,String xlbm,String nbbm,
  885 + String px) {
  886 + // TODO Auto-generated method stub
  887 + String sql="SELECT * FROM bsth_c_dlb "
  888 + + " where rq='"+rq+"' and ssgsdm like '%"+gsdm+"%' "
  889 + + " and fgsdm like '%"+fgsdm+"%'";
  890 + if(xlbm.equals("")){
  891 + sql+= " and xlbm like '%"+xlbm+"%' ";
  892 + }else{
  893 + sql+= " and xlbm = '"+xlbm+"' ";
  894 + }
  895 +
  896 + sql += "and nbbm like '%"+nbbm+"%' order by "+px+" asc ";
  897 +
  898 + List<Dlb> list = jdbcTemplate.query(sql, new RowMapper<Dlb>() {
  899 + @Override
  900 + public Dlb mapRow(ResultSet arg0, int arg1) throws SQLException {
  901 + Dlb y = new Dlb();
  902 + y.setId(arg0.getInt("id"));
  903 + return y;
  904 + }
  905 + });
  906 + List<Dlb> lists=new ArrayList<Dlb>();
  907 + List<Dlb> dlbLists=repository.obtainDl(rq,gsdm,fgsdm,xlbm,nbbm,"jcsx");
  908 + for (int i = 0; i < list.size(); i++) {
  909 + Dlb t=list.get(i);
  910 + for (int j = 0; j < dlbLists.size(); j++) {
  911 + Dlb t2=dlbLists.get(j);
  912 + if(t.getId().intValue()==t2.getId().intValue()){
  913 + lists.add(t2);
  914 + break;
  915 + }
  916 + }
  917 + }
  918 +
  919 + return lists;
  920 + }
  921 +
  922 +
  923 + @Override
  924 + public String checkJsy(Map<String, Object> map) {
  925 + // TODO Auto-generated method stub
  926 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  927 + String rq=map.get("date").toString();
  928 + String nbbm=map.get("nbbm").toString();
  929 + String jsy =map.get("jsy").toString();
  930 + String xlbm=map.get("xlbm").toString();
  931 + List<Dlb> list= repository.queryListDlb(rq, nbbm, jsy, xlbm);
  932 + String type="1";
  933 + if(list.size()>0){
  934 + type="0";
  935 + }
  936 + return type;
  937 + }
  938 +
  939 + @Override
  940 + public Map<String, Object> saveDlb(Dlb t) {
  941 + // TODO Auto-generated method stub
  942 + Map<String, Object> map = new HashMap<>();
  943 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  944 + String rq=sdf.format(t.getRq());
  945 + String gsdm=t.getSsgsdm();
  946 + String fgsdm=t.getFgsdm();
  947 + String xlbm=t.getXlbm();
  948 + String jhsj=t.getJhsj();
  949 + String jsy=t.getJsy();
  950 + String nbbm=t.getNbbm();
  951 + int sfkt=t.getSfkt();
  952 + t.setCreatetime(new Date());
  953 + String[] jhsjStr = jhsj.split(":");
  954 + long fcsjL= Long.parseLong(jhsjStr[0])*60+Long.parseLong(jhsjStr[1]);
  955 + List<Dlb> list=this.listOrderBy(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj");
  956 +// repository.obtainYl(rq, gsdm, fgsdm, xlbm, nbbm, "jhsj");
  957 + int jcsx=1;
  958 + if(list.size()>0){
  959 + for (int i = 0; i < list.size(); i++) {
  960 + Dlb y=list.get(i);
  961 + String[] fcsjStr = y.getJhsj().split(":");
  962 + long fcsj=Long.parseLong(fcsjStr[0])*60+Long.parseLong(fcsjStr[1]);
  963 + if(fcsjL>fcsj){
  964 + jcsx=jcsx+y.getJcsx();
  965 + }else{
  966 + y.setJcsx(y.getJcsx()+1);
  967 + repository.save(y);
  968 + }
  969 + }
  970 +
  971 + }
  972 + t.setJcsx(jcsx);
  973 + repository.save(t);
  974 +
  975 + SysUser user = SecurityUtils.getCurrentUser();
  976 + Nylog nylog=new Nylog();
  977 + nylog.setCreatedate(new Date());
  978 + nylog.setCzmc("手动添加");
  979 + nylog.setNylx("电");
  980 + nylog.setUserid(user.getUserName());
  981 + nylog.setUsername(user.getName());
  982 + nylog.setCxtj("");
  983 + nylogRepository.save(nylog);
  984 + map.put("status", ResponseCode.SUCCESS);
  985 + map.put("t", t);
  986 + return map;
  987 + }
  988 +
  989 + @Transactional
  990 + @Override
  991 + public Map<String, Object> deleteIds(Map<String, Object> map) throws Exception{
  992 + // TODO Auto-generated method stub
  993 + Map<String, Object> maps = new HashMap<>();
  994 + try{
  995 + String json =StringEscapeUtils.unescapeHtml4(map.get("ids").toString());
  996 + JSONArray jsonArray=JSONArray.parseArray(json);
  997 + JSONObject jsonObject;
  998 + for (int x = 0; x < jsonArray.size(); x++) {
  999 + jsonObject=jsonArray.getJSONObject(x);
  1000 + Integer id =jsonObject.getInteger("id");
  1001 + repository.deleteById(id);
  1002 + }
  1003 +
  1004 + SysUser user = SecurityUtils.getCurrentUser();
  1005 + Nylog nylog=new Nylog();
  1006 + nylog.setCreatedate(new Date());
  1007 + nylog.setCzmc("删除");
  1008 + nylog.setNylx("电");
  1009 + nylog.setUserid(user.getUserName());
  1010 + nylog.setUsername(user.getName());
  1011 + nylog.setCxtj("");
  1012 + nylogRepository.save(nylog);
  1013 + maps.put("status", ResponseCode.SUCCESS);
  1014 + } catch (Exception e) {
  1015 + maps.put("status", ResponseCode.ERROR);
  1016 + logger.error("save erro.", e);
  1017 + throw e;
  1018 + }
  1019 + return maps;
  1020 + }
  1021 +
  1022 + @Override
  1023 + public Map<String, List<Dlb>> updeteHistory(List<Map<String, Object>> listpbDc,String date,
  1024 + String gsdm,String fgsdm,String line) {
  1025 + // TODO Auto-generated method stub
  1026 + Map<String, List<Dlb>> mapList=new HashMap<String,List<Dlb>>();
  1027 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
  1028 + // 保留两位小数
  1029 + DecimalFormat df = new DecimalFormat("#.00");
  1030 + List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,"","","nbbm");
  1031 + List<Dlb> dlbList_upd=new ArrayList<Dlb>();
  1032 + List<Dlb> dlbList_del=new ArrayList<Dlb>();
  1033 + try{
  1034 + for (int j = 0; j < dlbList.size(); j++) {
  1035 + Dlb t=dlbList.get(j);
  1036 + boolean fage=true;
  1037 + if(StringUtils.isEmpty(t.getLp())){
  1038 + fage=false;
  1039 + }else{
  1040 + for (int i = 0; i < listpbDc.size(); i++) {
  1041 + Map<String, Object> m = listpbDc.get(i);
  1042 + if(t.getNbbm().equals(m.get("clZbh").toString())
  1043 + &&t.getJsy().equals(m.get("jGh").toString())
  1044 + &&t.getXlbm().equals(m.get("xlBm").toString())
  1045 + &&t.getLp().equals(m.get("lpName").toString())){
  1046 + //该条记录不用删除
  1047 + fage =false;
  1048 + dlbList_upd.add(t);
  1049 + }
  1050 + }
  1051 + }
  1052 +
  1053 + if(fage){
  1054 + if(t.getXlbm().equals(line)){
  1055 + dlbList_del.add(t);
  1056 + }
  1057 + }
  1058 + }
  1059 + mapList.put("delList", dlbList_del);
  1060 + Map<String, Double> lcMap=new HashMap<String,Double>();
  1061 + for (int i = 0; i < listpbDc.size(); i++) {
  1062 + String cl=listpbDc.get(i).get("clZbh").toString();
  1063 + Double lc= listpbDc.get(i).get("totalKilometers") == null ? 0.0
  1064 + : Double.parseDouble(listpbDc.get(i).get("totalKilometers").toString());
  1065 + if(lcMap.get(cl)==null){
  1066 + lcMap.put(cl, lc);
  1067 + }else{
  1068 + double lc_=lcMap.get(cl);
  1069 + lcMap.remove(cl);
  1070 + lcMap.put(cl, Arith.add(lc, lc_));
  1071 + }
  1072 + }
  1073 + Map<String, Double> shMap=new HashMap<String,Double>();
  1074 + for (int i = 0; i < dlbList_upd.size(); i++) {
  1075 + Dlb dlb=dlbList_upd.get(i);
  1076 + String cl=dlb.getNbbm();
  1077 + if(shMap.get(cl)==null){
  1078 + shMap.put(cl, dlb.getSh());
  1079 + }else{
  1080 + double sh=shMap.get(cl);
  1081 + shMap.remove(cl);
  1082 + shMap.put(cl, Arith.add(sh, dlb.getSh()));
  1083 + }
  1084 + }
  1085 + List<Jdl> jdlList=jdlRepository.JdlList(date);
  1086 + Map<String, Object> newMap_=new HashMap<String,Object>();
  1087 + Map<String, Object> cMap=new HashMap<String, Object>();
  1088 + List<Map<String, Object>> listpb_=listpbDc;
  1089 + Collections.sort(listpbDc,new NbbmJcsxMap());
  1090 + List<Dlb> updateDlb=new ArrayList<Dlb>();
  1091 + for (int x = 0; x < listpb_.size(); x++) {
  1092 + String type = "add";
  1093 + Map<String, Object> map_ = listpb_.get(x);
  1094 + if(newMap_.get(map_.get("clZbh").toString())==null){
  1095 + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString());
  1096 + //车辆总里程
  1097 + double zlc =lcMap.get(map_.get("clZbh").toString());
  1098 + //车辆总加电量
  1099 + double zjzl = 0.0;
  1100 + for (int i = 0; i < jdlList.size(); i++) {
  1101 + Jdl jdl=jdlList.get(i);
  1102 + if(map_.get("clZbh").toString().equals(jdl.getNbbm())
  1103 + &&map_.get("company").toString().equals(jdl.getGsBm())
  1104 + &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){
  1105 + zjzl = Arith.add(zjzl,jdl.getJdl());
  1106 + }
  1107 + }
  1108 + double clsh=0.0;
  1109 + if(shMap.get(map_.get("clZbh").toString())==null){
  1110 + clsh=0.0;
  1111 + }else{
  1112 + clsh=shMap.get(map_.get("clZbh").toString());
  1113 + }
  1114 + zjzl =Arith.sub(zjzl, clsh);
  1115 + Double nextJzyl = 0.0;
  1116 + for (int i = 0; i < listpbDc.size(); i++) {
  1117 + Map<String, Object> map = listpbDc.get(i);
  1118 + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){
  1119 + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
  1120 + Dlb t = new Dlb();
  1121 + for (int k = 0; k < dlbList_upd.size(); k++) {
  1122 + Dlb t1 = dlbList_upd.get(k);
  1123 + if (t1.getNbbm().equals(map.get("clZbh").toString())
  1124 + && t1.getJsy().equals(map.get("jGh").toString())
  1125 + && t1.getXlbm().equals(map.get("xlBm").toString())
  1126 + && t1.getLp().equals(map.get("lpName").toString())) {
  1127 + t = t1;
  1128 + type = "update";
  1129 + }
  1130 +
  1131 + }
  1132 + Double lc= Double.parseDouble(map.get("totalKilometers").toString());
  1133 + if(map.get("seqNumber").toString().equals("1")){
  1134 + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  1135 + Double dh=0.0;
  1136 + if(zlc>0){
  1137 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  1138 + }
  1139 + nextJzyl =Arith.sub(zjzl,dh);
  1140 + if(zlc>0){
  1141 +// long l=Math.round(nextJzyl);
  1142 + double ylxs=nextJzyl;
  1143 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  1144 + if(dh<0){
  1145 + t.setHd(0.0);
  1146 + t.setCdl(0.0);
  1147 + nextJzyl=Arith.add(ylxs, dh);
  1148 + }else{
  1149 + t.setHd(dh);
  1150 + t.setCdl(dh);
  1151 + nextJzyl=ylxs;
  1152 + }
  1153 + }else{
  1154 + t.setHd(0.0);
  1155 + t.setCdl(0.0);
  1156 + }
  1157 + }else{
  1158 + Double dh=0.0;
  1159 + if(zlc>0){
  1160 + dh = Double.parseDouble(df.format(zjzl * (lc / zlc)));
  1161 + }
  1162 + nextJzyl =Arith.sub( nextJzyl,dh);
  1163 + if(zlc>0){
  1164 +// long l=0l;
  1165 + double ylxs=0.0;
  1166 + if(i==listpbDc.size()-1){
  1167 +// ylxs=czyl;
  1168 + }else{
  1169 + if(listpbDc.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){
  1170 +// l=Math.round(nextJzyl);
  1171 + ylxs=nextJzyl;
  1172 + }
  1173 +
  1174 + }
  1175 + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs));
  1176 + if(dh<0){
  1177 + t.setHd(0.0);
  1178 + t.setCdl(0.0);
  1179 + nextJzyl=Arith.add(ylxs, dh);
  1180 + }else{
  1181 + t.setHd(dh);
  1182 + t.setCdl(dh);
  1183 + nextJzyl=ylxs;
  1184 + }
  1185 + }else{
  1186 + t.setHd(0.0);
  1187 + t.setCdl(0.0);
  1188 + }
  1189 + }
  1190 + t.setCzcd(100.0);
  1191 + t.setJzcd(100.0);
  1192 + t.setNbbm(map.get("clZbh").toString());
  1193 + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString());
  1194 + t.setZlc(map.get("totalKilometers") == null ? 0.0
  1195 + : Double.parseDouble(map.get("totalKilometers").toString()));
  1196 + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString());
  1197 + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString()));
  1198 + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
  1199 + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
  1200 + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
  1201 + t.setRq(sdf.parse(date));
  1202 + t.setLp(map.get("lpName").toString());
  1203 + t.setCdl(Arith.add(t.getCdl(), t.getSh()));
  1204 + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
  1205 + if(type.equals("add")){
  1206 + t.setCreatetime(new Date());
  1207 + }else{
  1208 + t.setUpdatetime(new Date());
  1209 + }
  1210 + }
  1211 +
  1212 + if(t.getHd()<0){
  1213 + t.setHd(0.0);
  1214 + }
  1215 + if(t.getCdl()<0){
  1216 + t.setCdl(0.0);
  1217 + }
  1218 + updateDlb.add(t);
  1219 + }
  1220 + }
  1221 + }
  1222 + }
  1223 + mapList.put("updList", updateDlb);
  1224 + }catch(Exception e){
  1225 + logger.error("save erro.", e);
  1226 + }
  1227 + return mapList;
  1228 + }
  1229 +
  1230 + @Override
  1231 + public Map<String, Object> update(Map<String, Object> map) {
  1232 + if(map.get("id")!=null){
  1233 + if(map.get("id").toString().length()>0){
  1234 + Integer id=Integer.parseInt(map.get("id").toString());
  1235 + String jsy=map.get("jsy").toString();
  1236 + Dlb t=repository.findById(id).get();
  1237 + t.setJsy(jsy);
  1238 + repository.save(t);
  1239 + map.put("status", ResponseCode.SUCCESS);
  1240 + }
  1241 + }
  1242 + return map;
  1243 + }
  1244 +
  1245 +}
  1246 +
  1247 +class NbbmJcsxMap implements Comparator<Map<String, Object>>{
  1248 + @Override
  1249 + public int compare(Map<String, Object> o1, Map<String, Object> o2) {
  1250 + // TODO Auto-generated method stub
  1251 + return (o1.get("clZbh").toString()+o1.get("seqNumber").toString()).compareTo((o2.get("clZbh").toString()+o1.get("seqNumber").toString()));
  1252 + }
  1253 +}
... ...
src/main/java/com/bsth/service/oil/impl/QlbServiceImpl.java
... ... @@ -96,8 +96,6 @@ public class QlbServiceImpl extends BaseServiceImpl&lt;Qlb,Integer&gt; implements QlbS
96 96 Map<String, Object> newMap=new HashMap<String,Object>();
97 97 //当天QLB信息
98 98 List<Qlb> qlList=repository.obtainQl(rq, "", "", line, "", "nbbm");
99   - //当天YLXXB信息
100   - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,"");
101 99 //当天加氢信息表
102 100 List<Jql> jqlList=jqlRepository.JqlList(rq);
103 101 //前一天所有车辆最后进场班次信息
... ... @@ -233,8 +231,6 @@ public class QlbServiceImpl extends BaseServiceImpl&lt;Qlb,Integer&gt; implements QlbS
233 231 // TODO Auto-generated method stub
234 232 // 当天QLB信息
235 233 List<Qlb> qlList = this.listOrderBy(rq,gsbm,fgsbm,"",nbbm,"nbbm");
236   - // 当天YLXXB信息
237   - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0, gsbm);
238 234 // 从排班表中计算出行驶的总里程
239 235 List<Map<String, Object>> listpb =new ArrayList<Map<String, Object>>();
240 236 List<Map<String, Object>> listpbs=scheduleRealInfoService.yesterdayDataList("", rq, gsbm, fgsbm, "", nbbm);
... ... @@ -1041,7 +1037,6 @@ public class QlbServiceImpl extends BaseServiceImpl&lt;Qlb,Integer&gt; implements QlbS
1041 1037 }
1042 1038 }
1043 1039 List<Jql> jqlList=jqlRepository.JqlList(date);
1044   - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0, gsdm);
1045 1040 Map<String, Object> newMap_=new HashMap<String,Object>();
1046 1041 Map<String, Object> cMap=new HashMap<String, Object>();
1047 1042 List<Map<String, Object>> listpb_=listpbQc;
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -109,7 +109,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
109 109 Map<String, Boolean> carsMap=new HashMap<String, Boolean>();
110 110 for (int i = 0; i < carsList.size(); i++) {
111 111 Cars c=carsList.get(i);
112   - carsMap.put(c.getInsideCode(), c.getSfdc());
  112 + carsMap.put(c.getInsideCode(), (c.getSfdc()!=null?c.getSfdc():false)
  113 + || (c.getHydrogen()!=null?c.getHydrogen():false));//电车或氢能源车,排除这些类型就都是油车
113 114 }
114 115 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
115 116 Date dNow = new Date(); //当前时间
... ... @@ -136,14 +137,13 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
136 137 List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", "");
137 138  
138 139 for(int x=0;x<listpb.size();x++){
139   - boolean sfdc=true;
140   - Map<String, Object> map=listpb.get(x);
141   - if (carsMap.get(map.get("clZbh").toString())!=null) {
142   - sfdc= carsMap.get(map.get("clZbh").toString());
143   - }else{
144   - sfdc=true;
  140 + boolean sfyc = true;//是否油车
  141 + Map<String, Object> map = listpb.get(x);
  142 + if (carsMap.get(map.get("clZbh").toString()) != null
  143 + && carsMap.get(map.get("clZbh").toString())) {
  144 + sfyc = false;
145 145 }
146   - if(!sfdc){
  146 + if(sfyc){
147 147 //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
148 148 Ylb t=new Ylb();
149 149 for(int k=0;k<ylList.size();k++){
... ... @@ -249,7 +249,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
249 249 Map<String, Boolean> carsMap = new HashMap<String, Boolean>();
250 250 for (int i = 0; i < carsList.size(); i++) {
251 251 Cars c = carsList.get(i);
252   - carsMap.put(c.getInsideCode(), c.getSfdc());
  252 + carsMap.put(c.getInsideCode(), (c.getSfdc()!=null?c.getSfdc():false)
  253 + || (c.getHydrogen()!=null?c.getHydrogen():false));//电车或氢能源车,排除这些类型就都是油车
253 254 }
254 255 String rq = map2.get("rq").toString();
255 256 String line = "";
... ... @@ -348,14 +349,13 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
348 349 Map<String, Object> cMap=new HashMap<String, Object>();
349 350 for (int x = 0; x < listpb.size(); x++) {
350 351 String type = "add";
351   - boolean sfdc = true;
  352 + boolean sfyc = true;//是否油车
352 353 Map<String, Object> map = listpb.get(x);
353   - if (carsMap.get(map.get("clZbh").toString()) != null) {
354   - sfdc = carsMap.get(map.get("clZbh").toString());
355   - } else {
356   - sfdc = true;
  354 + if (carsMap.get(map.get("clZbh").toString()) != null
  355 + && carsMap.get(map.get("clZbh").toString())) {
  356 + sfyc = false;
357 357 }
358   - if (!sfdc) {
  358 + if (sfyc) {
359 359 // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
360 360 Ylb t = new Ylb();
361 361 for (int k = 0; k < ylList.size(); k++) {
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -152,17 +152,17 @@ public class ReportServiceImpl implements ReportService{
152 152 PreparedStatement ps = null;
153 153 ResultSet rs = null;
154 154 String year=date.substring(0,4);
155   - String sql = "select * from bsth_c_arrival_info_"+year+" where device_id=? AND line_id=? "
156   - + " AND weeks_year>=? AND weeks_year<=? AND ts >= ? AND ts <=? order by ts";
  155 + String sql = "select * from bsth_c_arrival_info_"+year+" where weeks_year in (?, ?) AND line_id=? "
  156 + + " AND ts >= ? AND ts <=? AND device_id=? order by ts";
157 157 try{
158 158 conn = DBUtils_MS.getConnection();
159 159 ps = conn.prepareStatement(sql);
160   - ps.setString(1, sbbb);
161   - ps.setString(2,line);
162   - ps.setInt(3, weeks_year);
163   - ps.setInt(4, weeks_year_next);
164   - ps.setLong(5, date1);
165   - ps.setLong(6, date2);
  160 + ps.setInt(1, weeks_year);
  161 + ps.setInt(2, weeks_year_next);
  162 + ps.setString(3,line);
  163 + ps.setLong(4, date1);
  164 + ps.setLong(5, date2);
  165 + ps.setString(6, sbbb);
166 166 rs = ps.executeQuery();
167 167  
168 168 list = resultSet2Set(rs);
... ... @@ -253,6 +253,7 @@ public class ReportServiceImpl implements ReportService{
253 253  
254 254  
255 255 public List<ArrivalInfo> load2(String line,Long date1,Long date2,Date dates1,Date dates2,String zd,String zdlx,String fcsj){
  256 + SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy");
256 257 List<ArrivalInfo> list = new ArrayList<ArrivalInfo>();
257 258 Calendar cal = Calendar.getInstance();
258 259 cal.setTime(dates1);
... ... @@ -264,18 +265,43 @@ public class ReportServiceImpl implements ReportService{
264 265 PreparedStatement ps = null;
265 266 ResultSet rs = null;
266 267 String year=fcsj.substring(0,4);
267   - String sql = "select * from bsth_c_arrival_info_"+year+" where line_id=? AND weeks_year>=? "
268   - + " AND weeks_year<=? AND ts > ? AND ts <=? AND up_down=? AND stop_no like ? order by ts";
  268 +
  269 + String year1 = yearFormat.format(dates1);
  270 + String year2 = yearFormat.format(dates2);
  271 + List<Integer> weeksList = new ArrayList<Integer>();
  272 + if(year1.equals(year2)){
  273 + //把每一周的编号加入list,一年最多五十几周。最多循环60次避免意外死循环
  274 + for(int w = 0, weeks_num = weeks_year1; w < 60 && weeks_num <= weeks_year2; w++, weeks_num++){
  275 + weeksList.add(weeks_num);
  276 + }
  277 + } else {
  278 + weeksList.add(weeks_year1);
  279 + weeksList.add(weeks_year2);
  280 + }
  281 +
  282 + String tempStr = "";
  283 + for(int i = 0; i < weeksList.size(); i++){
  284 + tempStr += "?,";
  285 + }
  286 + if(tempStr.length() > 0){
  287 + tempStr = tempStr.substring(0, tempStr.length() - 1);
  288 + }
  289 +
  290 + String sql = "select * from bsth_c_arrival_info_"+year+" where weeks_year in ("+tempStr+") "
  291 + + " AND line_id=? AND up_down=? AND stop_no like ? AND ts between ? AND ? order by ts";
  292 + System.out.println(sql);
269 293 try{
270 294 conn = DBUtils_MS.getConnection();
271 295 ps = conn.prepareStatement(sql);
272   - ps.setString(1, line);
273   - ps.setInt(2, weeks_year1);
274   - ps.setInt(3, weeks_year2);
275   - ps.setLong(4, date1);
276   - ps.setLong(5, date2);
277   - ps.setString(6, zdlx);
278   - ps.setString(7, "%"+zd+"%");
  296 + int no = 1;
  297 + for(;no <= weeksList.size(); no++){
  298 + ps.setInt(no, weeksList.get(no-1));
  299 + }
  300 + ps.setString(no++, line);
  301 + ps.setString(no++, zdlx);
  302 + ps.setString(no++, ""+zd+"%");
  303 + ps.setLong(no++, date1);
  304 + ps.setLong(no++, date2);
279 305 rs = ps.executeQuery();
280 306  
281 307 list = resultSet2Set(rs);
... ... @@ -2193,16 +2219,16 @@ public class ReportServiceImpl implements ReportService{
2193 2219 PreparedStatement ps = null;
2194 2220 ResultSet rs = null;
2195 2221 String year=date.substring(0,4);
2196   - String sql = "select * from bsth_c_arrival_info_"+year+" where line_id=? AND weeks_year=? "
2197   - + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts";
  2222 + String sql = "select * from bsth_c_arrival_info_"+year+" where weeks_year=? AND line_id=? "
  2223 + + " AND up_down=? AND ts >= ? AND ts <=? order by device_id,ts";
2198 2224 try{
2199 2225 conn = DBUtils_MS.getConnection();
2200 2226 ps = conn.prepareStatement(sql);
2201   - ps.setString(1, line);
2202   - ps.setInt(2, weeks_year1);
2203   - ps.setLong(3, date1);
2204   - ps.setLong(4, date2);
2205   - ps.setInt(5, zd);
  2227 + ps.setInt(1, weeks_year1);
  2228 + ps.setString(2, line);
  2229 + ps.setInt(3, zd);
  2230 + ps.setLong(4, date1);
  2231 + ps.setLong(5, date2);
2206 2232 rs = ps.executeQuery();
2207 2233  
2208 2234 list = resultSet2Set(rs);
... ... @@ -2243,16 +2269,16 @@ public class ReportServiceImpl implements ReportService{
2243 2269 PreparedStatement ps = null;
2244 2270 ResultSet rs = null;
2245 2271 String year=date.substring(0,4);
2246   - String sql = "select * from bsth_c_arrival_info_"+year+" where line_id=? AND weeks_year=? "
2247   - + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts";
  2272 + String sql = "select * from bsth_c_arrival_info_"+year+" where weeks_year=? AND line_id=? "
  2273 + + " AND up_down=? AND ts >= ? AND ts <=? order by device_id,ts";
2248 2274 try{
2249 2275 conn = DBUtils_MS.getConnection();
2250 2276 ps = conn.prepareStatement(sql);
2251   - ps.setString(1, line);
2252   - ps.setInt(2, weeks_year1);
2253   - ps.setLong(3, date1);
2254   - ps.setLong(4, date2);
2255   - ps.setInt(5, zd);
  2277 + ps.setInt(1, weeks_year1);
  2278 + ps.setString(2, line);
  2279 + ps.setInt(3, zd);
  2280 + ps.setLong(4, date1);
  2281 + ps.setLong(5, date2);
2256 2282 rs = ps.executeQuery();
2257 2283  
2258 2284 list = resultSet2Set(rs);
... ... @@ -3854,12 +3880,12 @@ public class ReportServiceImpl implements ReportService{
3854 3880 PreparedStatement ps = null;
3855 3881 ResultSet rs = null;
3856 3882 String year=date.substring(0,4);
3857   - String sql = "select * from bsth_c_arrival_info_"+year+" where line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
  3883 + String sql = "select * from bsth_c_arrival_info_"+year+" where weeks_year=? AND line_id=? AND ts > ? AND ts <=? order by ts";
3858 3884 try{
3859 3885 conn = DBUtils_MS.getConnection();
3860 3886 ps = conn.prepareStatement(sql);
3861   - ps.setString(1,line);
3862   - ps.setInt(2, weeks_year);
  3887 + ps.setInt(1, weeks_year);
  3888 + ps.setString(2,line);
3863 3889 ps.setLong(3, date1);
3864 3890 ps.setLong(4, date2);
3865 3891 rs = ps.executeQuery();
... ...
src/main/resources/application-test.properties
... ... @@ -13,9 +13,9 @@ spring.jpa.show-sql= false
13 13  
14 14 #DATABASE
15 15 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
16   -spring.datasource.url= jdbc:mysql://10.10.200.148:3306/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
  16 +spring.datasource.url= jdbc:mysql://192.170.100.114/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
17 17 spring.datasource.username= root
18   -spring.datasource.password= root
  18 +spring.datasource.password= root2jsp
19 19 spring.datasource.type= com.zaxxer.hikari.HikariDataSource
20 20  
21 21 #DATASOURCE SETTING
... ... @@ -33,21 +33,26 @@ spring.datasource.hikari.register-mbeans=true
33 33 ## gps client data
34 34 http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all
35 35 ## gateway real data
36   -http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/
  36 +http.gps.real.url= http://192.170.100.252:8080/transport_server/rtgps/
37 37 ## gateway send directive
38   -#http.send.directive = http://10.10.200.79:8080/transport_server/message/
  38 +##http.send.directive = http://192.170.100.252:8080/transport_server/message/
39 39 ## rfid data
40   -http.rfid.url= http://10.10.200.82:9000/rfid
  40 +http.rfid.url= http://192.170.100.80:9000/rfid
  41 +## wxsb
  42 +http.report.url.05= http://116.228.197.222:8081/ygjwsystem_j2ee/clbx/clbx_dd.do
  43 +http.report.url.22= http://116.247.73.122:9098/jgjwsystem_j2ee/clbx/clbx_dd.do
  44 +http.report.url.26= http://116.236.141.34:8088/nhjwsystem_j2ee/clbx/clbx_dd.do
  45 +http.report.url.55= http://180.168.216.248:8088/snjwsystem_j2ee/clbx/clbx_dd.do
41 46 ## http ticketing interface
42 47 http.ticketing.interface= http://112.64.187.3:1080/gjService/request
43 48 http.mtplan.interface= https://112.64.45.51/wxk-prod-api/service-api/pdgj/schedule/byinfo
44 49 ## first last generate
45   -ms.fl.generate=false
  50 +ms.fl.generate=true
46 51 ## dsm ack interface
47 52 dsm.ack.url= http://211.95.61.66:9008/modules/dsmCheckTheRecord/addDsm?
48 53 ## cp ack interface
49 54 cp.ack.url= http://114.80.178.12:8778/prod-api/serverApi/instructionsIssue/confirm/
50 55 ## admin mail
51   -admin.mail= 113252620@qq.com
  56 +admin.mail= 3090342880@qq.com
52 57 ## enabled
53   -enabled.whiteip= true
54 58 \ No newline at end of file
  59 +enabled.whiteip= false
55 60 \ No newline at end of file
... ...
src/main/resources/datatools/config-dev.properties
... ... @@ -83,7 +83,7 @@ datatools.guideboards_dataoutputktr=/datatools/ktrs/guideboardDataOutput.ktr
83 83 datatools.vehicle_datasyncktr=/datatools/ktrs/vehicleDataSync.ktr
84 84  
85 85 # 车辆库访问url
86   -datatools.cars_interface=http://180.166.5.82:8076/cars/getCarsInterface
  86 +datatools.cars_interface=http://58.247.254.118:8076/cars/getCarsInterface
87 87 #datatools.cars_interface=http://192.170.101.132:8076/cars/getCarsInterface
88 88  
89 89 # TODO:
... ...
src/main/resources/datatools/ktrs/vehicleDataSync.ktr
... ... @@ -56,7 +56,7 @@
56 56 </parameter>
57 57 <parameter>
58 58 <name>url</name>
59   - <default_value>http&#x3a;&#x2f;&#x2f;180.166.5.82&#x3a;8076&#x2f;cars&#x2f;getCarsInterface</default_value>
  59 + <default_value>http&#x3a;&#x2f;&#x2f;58.247.254.118&#x3a;8076&#x2f;cars&#x2f;getCarsInterface</default_value>
60 60 <description>&#x8f66;&#x8f86;&#x5e93;&#x7cfb;&#x7edf;&#x7684;&#x76f8;&#x5173;url&#x5730;&#x5740;</description>
61 61 </parameter>
62 62 </parameters>
... ... @@ -703,6 +703,30 @@
703 703 </attributes>
704 704 </connection>
705 705 <connection>
  706 + <name>&#x5916;&#x7f51;vpn&#x4e34;&#x6e2f;&#x673a;&#x52a1;oracle</name>
  707 + <server>10.10.150.114</server>
  708 + <type>ORACLE</type>
  709 + <access>Native</access>
  710 + <database>helowin</database>
  711 + <port>1521</port>
  712 + <username>lgjw</username>
  713 + <password>Encrypted 2be98afc86aa7f2e4cb79ce10d295a5cd</password>
  714 + <servername/>
  715 + <data_tablespace/>
  716 + <index_tablespace/>
  717 + <attributes>
  718 + <attribute><code>FORCE_IDENTIFIERS_TO_LOWERCASE</code><attribute>N</attribute></attribute>
  719 + <attribute><code>FORCE_IDENTIFIERS_TO_UPPERCASE</code><attribute>N</attribute></attribute>
  720 + <attribute><code>IS_CLUSTERED</code><attribute>N</attribute></attribute>
  721 + <attribute><code>PORT_NUMBER</code><attribute>1521</attribute></attribute>
  722 + <attribute><code>PRESERVE_RESERVED_WORD_CASE</code><attribute>N</attribute></attribute>
  723 + <attribute><code>QUOTE_ALL_FIELDS</code><attribute>N</attribute></attribute>
  724 + <attribute><code>SUPPORTS_BOOLEAN_DATA_TYPE</code><attribute>Y</attribute></attribute>
  725 + <attribute><code>SUPPORTS_TIMESTAMP_DATA_TYPE</code><attribute>Y</attribute></attribute>
  726 + <attribute><code>USE_POOLING</code><attribute>N</attribute></attribute>
  727 + </attributes>
  728 + </connection>
  729 + <connection>
706 730 <name>&#x5916;&#x7f51;&#x5357;&#x6c47;&#x673a;&#x52a1;oracle</name>
707 731 <server>58.247.254.118</server>
708 732 <type>ORACLE</type>
... ... @@ -978,7 +1002,7 @@
978 1002 <displayHeader>Y</displayHeader>
979 1003 <limitRows>N</limitRows>
980 1004 <limitRowsNumber>0</limitRowsNumber>
981   - <logmessage>&#x5f00;&#x59cb;&#x83b7;&#x53d6; &#x24;&#x7b;ssgs&#x7d; &#x8fdc;&#x7aef;&#x6570;&#x636e;&#xff0c;&#x5e76;&#x5904;&#x7406;&#x8f93;&#x51fa;&#xa;&#x83b7;&#x53d6;&#x6570;&#x636e; api url&#x3d;&#x24;&#x7b;url&#x7d;&#xa;url&#x53c2;&#x6570;&#xff08;&#x5bc6;&#x94a5;&#xff09;password&#x3d;&#x24;&#x7b;password&#x7d;&#xa;&#x6570;&#x636e;&#x6e90;&#x8fc7;&#x6ee4;&#x53c2;&#x6570;&#xff1a;&#xa;1&#x3001;&#x8f66;&#x8f86;&#x81ea;&#x7f16;&#x53f7; &#x24;&#x7b;paramClzbh&#x7d;&#xa;2&#x3001;&#x5f00;&#x59cb;&#x65f6;&#x95f4; &#x24;&#x7b;paramFrom&#x7d;&#xa;3&#x3001;&#x7ed3;&#x675f;&#x65f6;&#x95f4; &#x24;&#x7b;paramTo&#x7d;&#xa;4&#x3001;&#x6570;&#x636e;&#x68c0;&#x9a8c;&#x9519;&#x8bef;&#x6587;&#x4ef6; &#x24;&#x7b;file_validate_error&#x7d;&#xa;5&#x3001;&#x5f85;&#x5904;&#x7406;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_prepare&#x7d;&#xa;6&#x3001;&#x65b0;&#x589e;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_add_error&#x7d;&#xa;7&#x3001;&#x66f4;&#x65b0;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_update_error&#x7d;&#xa;8&#x3001;&#x6dfb;&#x52a0;&#x8f66;&#x8f86;&#x8bbe;&#x5907;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_deivce_add_error&#x7d;</logmessage>
  1005 + <logmessage>&#x5f00;&#x59cb;&#x83b7;&#x53d6;&#x8fdc;&#x7aef;&#x6570;&#x636e;&#xff0c;&#x5e76;&#x5904;&#x7406;&#x8f93;&#x51fa;&#xa;&#x83b7;&#x53d6;&#x6570;&#x636e; api url&#x3d;&#x24;&#x7b;url&#x7d;&#xa;url&#x53c2;&#x6570;&#xff08;&#x5bc6;&#x94a5;&#xff09;password&#x3d;&#x24;&#x7b;password&#x7d;&#xa;&#x6570;&#x636e;&#x6e90;&#x8fc7;&#x6ee4;&#x53c2;&#x6570;&#xff1a;&#xa;1&#x3001;&#x8f66;&#x8f86;&#x81ea;&#x7f16;&#x53f7; &#x24;&#x7b;paramClzbh&#x7d;&#xa;2&#x3001;&#x5f00;&#x59cb;&#x65f6;&#x95f4; &#x24;&#x7b;paramFrom&#x7d;&#xa;3&#x3001;&#x7ed3;&#x675f;&#x65f6;&#x95f4; &#x24;&#x7b;paramTo&#x7d;&#xa;4&#x3001;&#x6570;&#x636e;&#x68c0;&#x9a8c;&#x9519;&#x8bef;&#x6587;&#x4ef6; &#x24;&#x7b;file_validate_error&#x7d;&#xa;5&#x3001;&#x5f85;&#x5904;&#x7406;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_prepare&#x7d;&#xa;6&#x3001;&#x65b0;&#x589e;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_add_error&#x7d;&#xa;7&#x3001;&#x66f4;&#x65b0;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_update_error&#x7d;&#xa;8&#x3001;&#x6dfb;&#x52a0;&#x8f66;&#x8f86;&#x8bbe;&#x5907;&#x9519;&#x8bef;&#x6570;&#x636e;&#x6587;&#x4ef6; &#x24;&#x7b;file_deivce_add_error&#x7d;</logmessage>
982 1006 <fields>
983 1007 </fields>
984 1008 <cluster_schema/>
... ... @@ -1055,6 +1079,20 @@
1055 1079 <function>&#x3d;</function>
1056 1080 <rightvalue/>
1057 1081 <value><name>constant</name><type>Boolean</type><text>Y</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition>
  1082 + <condition>
  1083 + <negated>N</negated>
  1084 + <operator>OR</operator>
  1085 + <leftvalue>isSfmixUpdate</leftvalue>
  1086 + <function>&#x3d;</function>
  1087 + <rightvalue/>
  1088 + <value><name>constant</name><type>Boolean</type><text>Y</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition>
  1089 + <condition>
  1090 + <negated>N</negated>
  1091 + <operator>OR</operator>
  1092 + <leftvalue>isChpUpdate</leftvalue>
  1093 + <function>&#x3d;</function>
  1094 + <rightvalue/>
  1095 + <value><name>constant</name><type>Boolean</type><text>Y</text><length>-1</length><precision>-1</precision><isnull>N</isnull><mask/></value> </condition>
1058 1096 </conditions>
1059 1097 </condition>
1060 1098 </compare>
... ... @@ -1196,6 +1234,14 @@
1196 1234 <rename>&#x672c;&#x5730;_&#x662f;&#x5426;&#x7535;&#x8f66;</rename>
1197 1235 <length>-2</length>
1198 1236 <precision>-2</precision>
  1237 + </field> <field> <name>sfmix</name>
  1238 + <rename>&#x672c;&#x5730;_&#x662f;&#x5426;&#x6df7;&#x5408;&#x52a8;&#x529b;</rename>
  1239 + <length>-2</length>
  1240 + <precision>-2</precision>
  1241 + </field> <field> <name>car_plate</name>
  1242 + <rename>&#x672c;&#x5730;_&#x8f66;&#x724c;&#x53f7;</rename>
  1243 + <length>-2</length>
  1244 + <precision>-2</precision>
1199 1245 </field> <select_unspecified>N</select_unspecified>
1200 1246 </fields> <cluster_schema/>
1201 1247 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
... ... @@ -1370,6 +1416,16 @@
1370 1416 <type>Boolean</type>
1371 1417 <format/>
1372 1418 </field>
  1419 + <field>
  1420 + <name>&#x672c;&#x5730;_&#x662f;&#x5426;&#x6df7;&#x5408;&#x52a8;&#x529b;</name>
  1421 + <type>Boolean</type>
  1422 + <format/>
  1423 + </field>
  1424 + <field>
  1425 + <name>&#x672c;&#x5730;_&#x8f66;&#x724c;&#x53f7;</name>
  1426 + <type>String</type>
  1427 + <format/>
  1428 + </field>
1373 1429 </fields>
1374 1430 <custom>
1375 1431 <header_font_name>arial</header_font_name>
... ... @@ -1783,7 +1839,7 @@
1783 1839 <optimizationLevel>9</optimizationLevel>
1784 1840 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
1785 1841 <jsScript_name>Script 1</jsScript_name>
1786   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f;---------------- &#x65b0;&#x589e;&#x7528;&#x7684;&#x5b57;&#x6bb5;&#x91cd;&#x65b0;&#x547d;&#x540d;&#xff08;&#x65b9;&#x4fbf;&#x540e;&#x7eed;&#x64cd;&#x4f5c;&#xff09;-----------&#x2f;&#x2f;&#xa;var insideCode_add &#x3d; clzbh&#x3b; &#x2f;&#x2f; &#x8f66;&#x8f86;&#x81ea;&#x7f16;&#x53f7;&#xa;var carPlate_add &#x3d; cph&#x3b; &#x2f;&#x2f; &#x8f66;&#x724c;&#x53f7;&#xa;var carCode_add &#x3d; clzbh&#x3b; &#x2f;&#x2f; &#x8f66;&#x8f86;&#x7f16;&#x7801;&#xff08;&#x521d;&#x59cb;&#x4f7f;&#x7528;&#x81ea;&#x7f16;&#x53f7;&#x4ee3;&#x66ff;&#xff09;&#xa;var supplierName_add &#x3d; &#x22;1&#x22;&#x3b; &#x2f;&#x2f; &#x4f9b;&#x5e94;&#x5546;&#x540d;&#x79f0;&#xff08;&#x5b57;&#x5178;&#xff1a;1&#x3d;&#x5df4;&#x58eb;&#x62d3;&#x534e;&#xff09;&#xa;var businessCode_add &#x3d; gsdm&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var company_add &#x3d; gsmc&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var brancheCompanyCode_add &#x3d; fgsdm&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var brancheCompany_add &#x3d; fgsmc&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var equipmentCode_add &#x3d; gsdm &#x2b; clzbh.replace&#x28;&#x2f;-&#x2f;g, &#x22;&#x22;&#x29;&#x3b; &#x2f;&#x2f; &#x8bbe;&#x5907;&#x7f16;&#x53f7;&#xff08;&#x521d;&#x59cb;&#x4f7f;&#x7528;&#x516c;&#x53f8;&#x4ee3;&#x7801;&#x2b;&#x8f66;&#x8f86;&#x81ea;&#x7f16;&#x53f7;&#x53bb;&#x9664;&#x4e2d;&#x95f4;-&#xff0c;&#x5982;&#xff1a;S0I-039 -&#x3e; 22S0I039&#xff09;&#xa;var scrapState_add &#x3d; 0&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x62a5;&#x5e9f;&#xa;var scrapDate_add&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#xa;var scrapCode_add&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x53f7;&#xa;var sfdc_add&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7535;&#x8f66;&#xa;if &#x28;carState &#x3d;&#x3d; &#x27;3&#x27; &#x7c;&#x7c; scrapType &#x3d;&#x3d; &#x27;1&#x27;&#x29; &#x7b;&#xa; scrapState_add &#x3d; 1&#x3b;&#xa; scrapDate_add &#x3d; scrapDate &#x3d;&#x3d; null &#x3f; null &#x3a; str2date&#x28;scrapDate, &#x27;yyyy-MM-dd&#x27;&#x29;&#x3b;&#xa; equipmentCode_add &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_add&#x3b;&#xa; scrapCode_add &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_add&#x3b;&#xa;&#x7d;&#xa;if &#x28;carEnergyType &#x3d;&#x3d; &#x27;&#x5e38;&#x89c4;&#x67f4;&#x6cb9;&#x27;&#x29; &#x7b;&#xa; sfdc_add &#x3d; 0&#x3b;&#xa;&#x7d; else &#x7b;&#xa; sfdc_add &#x3d; 1&#x3b;&#xa;&#x7d;&#xa;var createDate_add &#x3d; new Date&#x28;&#x29;&#x3b; &#x2f;&#x2f; &#x521b;&#x5efa;&#x65f6;&#x95f4;&#xa;var updateDate_add &#x3d; createDate_add&#x3b; &#x2f;&#x2f; &#x66f4;&#x65b0;&#x65f6;&#x95f4;</jsScript_script>
  1842 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f;---------------- &#x65b0;&#x589e;&#x7528;&#x7684;&#x5b57;&#x6bb5;&#x91cd;&#x65b0;&#x547d;&#x540d;&#xff08;&#x65b9;&#x4fbf;&#x540e;&#x7eed;&#x64cd;&#x4f5c;&#xff09;-----------&#x2f;&#x2f;&#xa;var insideCode_add &#x3d; clzbh&#x3b; &#x2f;&#x2f; &#x8f66;&#x8f86;&#x81ea;&#x7f16;&#x53f7;&#xa;var carPlate_add &#x3d; cph&#x3b; &#x2f;&#x2f; &#x8f66;&#x724c;&#x53f7;&#xa;var carCode_add &#x3d; clzbh&#x3b; &#x2f;&#x2f; &#x8f66;&#x8f86;&#x7f16;&#x7801;&#xff08;&#x521d;&#x59cb;&#x4f7f;&#x7528;&#x81ea;&#x7f16;&#x53f7;&#x4ee3;&#x66ff;&#xff09;&#xa;var supplierName_add &#x3d; &#x22;1&#x22;&#x3b; &#x2f;&#x2f; &#x4f9b;&#x5e94;&#x5546;&#x540d;&#x79f0;&#xff08;&#x5b57;&#x5178;&#xff1a;1&#x3d;&#x5df4;&#x58eb;&#x62d3;&#x534e;&#xff09;&#xa;var businessCode_add &#x3d; gsdm&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var company_add &#x3d; gsmc&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var brancheCompanyCode_add &#x3d; fgsdm&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var brancheCompany_add &#x3d; fgsmc&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var equipmentCode_add &#x3d; gsdm &#x2b; clzbh.replace&#x28;&#x2f;-&#x2f;g, &#x22;&#x22;&#x29;&#x3b; &#x2f;&#x2f; &#x8bbe;&#x5907;&#x7f16;&#x53f7;&#xff08;&#x521d;&#x59cb;&#x4f7f;&#x7528;&#x516c;&#x53f8;&#x4ee3;&#x7801;&#x2b;&#x8f66;&#x8f86;&#x81ea;&#x7f16;&#x53f7;&#x53bb;&#x9664;&#x4e2d;&#x95f4;-&#xff0c;&#x5982;&#xff1a;S0I-039 -&#x3e; 22S0I039&#xff09;&#xa;var scrapState_add &#x3d; 0&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x62a5;&#x5e9f;&#xa;var scrapDate_add&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#xa;var scrapCode_add&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x53f7;&#xa;var sfdc_add&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7eaf;&#x7535;&#x8f66;&#xa;var sfmix_add&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x6df7;&#x5408;&#x52a8;&#x529b;&#xa;if &#x28;carState &#x3d;&#x3d; &#x27;3&#x27; &#x7c;&#x7c; scrapType &#x3d;&#x3d; &#x27;1&#x27;&#x29; &#x7b;&#xa; scrapState_add &#x3d; 1&#x3b;&#xa; scrapDate_add &#x3d; scrapDate &#x3d;&#x3d; null &#x3f; null &#x3a; str2date&#x28;scrapDate, &#x27;yyyy-MM-dd&#x27;&#x29;&#x3b;&#xa; equipmentCode_add &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_add&#x3b;&#xa; scrapCode_add &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_add&#x3b;&#xa;&#x7d;&#xa;if &#x28;carEnergyType &#x3d;&#x3d; &#x27;&#x7eaf;&#x7535;&#x52a8;&#x27; &#x7c;&#x7c; carEnergyType &#x3d;&#x3d; &#x27;&#x53cc;&#x7535;&#x5f0f;&#x7eaf;&#x7535;&#x52a8;&#x27; &#x7c;&#x7c; carEnergyType &#x3d;&#x3d; &#x27;&#x5feb;&#x5145;&#x5f0f;&#x7eaf;&#x7535;&#x52a8;&#x27; &#x7c;&#x7c; carEnergyType &#x3d;&#x3d; &#x27;&#x8d85;&#x7ea7;&#x7535;&#x5bb9;&#x27;&#x29; &#x7b;&#xa; sfdc_add &#x3d; 1&#x3b;&#xa;&#x7d; else &#x7b;&#xa; sfdc_add &#x3d; 0&#x3b;&#xa;&#x7d;&#xa;if &#x28;carEnergyType &#x3d;&#x3d; &#x27;&#x63d2;&#x7535;&#x5f0f;&#x6df7;&#x5408;&#x52a8;&#x529b;&#x27; &#x7c;&#x7c; carEnergyType &#x3d;&#x3d; &#x27;&#x6df7;&#x5408;&#x52a8;&#x529b;&#x27;&#x29; &#x7b;&#xa; sfmix_add &#x3d; 1&#x3b;&#xa;&#x7d; else &#x7b;&#xa; sfmix_add &#x3d; 0&#x3b;&#xa;&#x7d;&#xa;var createDate_add &#x3d; new Date&#x28;&#x29;&#x3b; &#x2f;&#x2f; &#x521b;&#x5efa;&#x65f6;&#x95f4;&#xa;var updateDate_add &#x3d; createDate_add&#x3b; &#x2f;&#x2f; &#x66f4;&#x65b0;&#x65f6;&#x95f4;</jsScript_script>
1787 1843 </jsScript> </jsScripts> <fields> <field> <name>insideCode_add</name>
1788 1844 <rename>insideCode_add</rename>
1789 1845 <type>String</type>
... ... @@ -1862,6 +1918,12 @@
1862 1918 <length>-1</length>
1863 1919 <precision>-1</precision>
1864 1920 <replace>N</replace>
  1921 + </field> <field> <name>sfmix_add</name>
  1922 + <rename>sfmix_add</rename>
  1923 + <type>Integer</type>
  1924 + <length>-1</length>
  1925 + <precision>-1</precision>
  1926 + <replace>N</replace>
1865 1927 </field> <field> <name>createDate_add</name>
1866 1928 <rename>createDate_add</rename>
1867 1929 <type>Date</type>
... ... @@ -1964,6 +2026,10 @@
1964 2026 <stream_name>sfdc_add</stream_name>
1965 2027 </field>
1966 2028 <field>
  2029 + <column_name>sfmix</column_name>
  2030 + <stream_name>sfmix_add</stream_name>
  2031 + </field>
  2032 + <field>
1967 2033 <column_name>create_date</column_name>
1968 2034 <stream_name>createDate_add</stream_name>
1969 2035 </field>
... ... @@ -2191,6 +2257,11 @@
2191 2257 <format/>
2192 2258 </field>
2193 2259 <field>
  2260 + <name>sfmix_add</name>
  2261 + <type>Integer</type>
  2262 + <format/>
  2263 + </field>
  2264 + <field>
2194 2265 <name>NrErrors</name>
2195 2266 <type>Integer</type>
2196 2267 <format/>
... ... @@ -2292,7 +2363,7 @@
2292 2363 <optimizationLevel>9</optimizationLevel>
2293 2364 <jsScripts> <jsScript> <jsScript_type>0</jsScript_type>
2294 2365 <jsScript_name>Script 1</jsScript_name>
2295   - <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f;---------------- &#x66f4;&#x65b0;&#x7528;&#x7684;&#x5b57;&#x6bb5;&#x91cd;&#x65b0;&#x547d;&#x540d;&#xff08;&#x65b9;&#x4fbf;&#x540e;&#x7eed;&#x64cd;&#x4f5c;&#xff09;-----------&#x2f;&#x2f;&#xa;&#x2f;&#x2f; TODO&#xff1a;&#x540e;&#x9762;&#x8fd8;&#x6709;&#x66f4;&#x591a;&#x7684;&#x66f4;&#x65b0;&#x5b57;&#x6bb5;&#xa;&#xa;var update_date &#x3d; new Date&#x28;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f;------------ 1&#x3001;&#x516c;&#x53f8;&#x5206;&#x516c;&#x53f8;&#x76f8;&#x5173;&#x5b57;&#x6bb5; -----------&#x2f;&#x2f;&#xa;var company_update &#x3d; gsmc&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var branche_company_update &#x3d; fgsmc&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var business_code_update &#x3d; gsdm&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var branch_company_code_update &#x3d; fgsdm&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var isGsUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;&#x21;company_update.equals&#x28;company&#x29;&#x29; &#x7b;&#xa; isGsUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;if &#x28;&#x21;branche_company_update.equals&#x28;branche_company&#x29;&#x29; &#x7b;&#xa; isGsUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f;------------- 2&#x3001;&#x62a5;&#x5e9f;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var equipmentCode_update &#x3d; equipment_code&#x3b; &#x2f;&#x2f; &#x8bbe;&#x5907;&#x7f16;&#x53f7;&#xa;var scrapCode_update &#x3d; scrap_code&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x53f7;&#xa;var scrapState_update &#x3d; &#x28;scrap_state &#x3d;&#x3d; true &#x3f; 1 &#x3a; 0&#x29;&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x72b6;&#x6001;&#xa;var scrapState_update_b &#x3d; scrap_state&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x72b6;&#x6001;&#xa;var scrapDate_update &#x3d; scrap_date&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#xa;var isScrapUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;carState &#x3d;&#x3d; &#x27;3&#x27; &#x7c;&#x7c; scrapType &#x3d;&#x3d; &#x27;1&#x27;&#x29; &#x7b;&#xa; scrapState_update_b &#x3d; true&#x3b;&#xa; scrapState_update &#x3d; 1&#x3b;&#xa; &#x2f;&#x2f; &#x4f7f;&#x7528;&#x8f66;&#x8f86;&#x5e93;&#x7684;&#x62a5;&#x5e9f;&#x65f6;&#x95f4;&#xa; scrapDate_update &#x3d; scrapDate &#x3d;&#x3d; null &#x3f; null &#x3a; str2date&#x28;scrapDate, &#x27;yyyy-MM-dd&#x27;&#x29;&#x3b;&#xa; &#x2f;&#x2f; &#x8f66;&#x8f86;&#x5e93;&#x62a5;&#x5e9f;&#x65f6;&#x95f4;&#x4e3a;&#x7a7a;&#xff0c;&#x518d;&#x4f7f;&#x7528;&#x5f53;&#x524d;&#x65f6;&#x95f4;&#xa; if &#x28;scrapDate_update &#x3d;&#x3d; null&#x29; &#x7b;&#xa; scrapDate_update &#x3d; new Date&#x28;&#x29;&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#x8bbe;&#x5b9a;&#x4f4d;&#x5f53;&#x524d;&#x65e5;&#x671f;&#xa; &#x7d;&#xa; equipmentCode_update &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_update&#x3b;&#xa; scrapCode_update &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_update&#x3b;&#xa;&#x7d;&#xa;if &#x28;scrapState_update_b &#x21;&#x3d; scrap_state&#x29; &#x7b;&#xa; isScrapUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#x2f;&#x2f;-------------- 3&#x3001;&#x662f;&#x5426;&#x7535;&#x8f66;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var sfdc_update &#x3d; &#x28;carEnergyType &#x3d;&#x3d; &#x27;&#x5e38;&#x89c4;&#x67f4;&#x6cb9;&#x27; &#x3f; 0 &#x3a; 1&#x29;&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7535;&#x8f66;&#xa;var sfdc_update_b &#x3d; &#x28;sfdc &#x3d;&#x3d; true &#x3f; true &#x3a; false&#x29;&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7535;&#x8f66;&#xa;var isSfdcUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;sfdc_update_b &#x21;&#x3d; sfdc&#x29; &#x7b; &#xa; isSfdcUpdate &#x3d; true&#x3b;&#xa;&#x7d;</jsScript_script>
  2366 + <jsScript_script>&#x2f;&#x2f;Script here&#xa;&#xa;&#x2f;&#x2f;---------------- &#x66f4;&#x65b0;&#x7528;&#x7684;&#x5b57;&#x6bb5;&#x91cd;&#x65b0;&#x547d;&#x540d;&#xff08;&#x65b9;&#x4fbf;&#x540e;&#x7eed;&#x64cd;&#x4f5c;&#xff09;-----------&#x2f;&#x2f;&#xa;&#x2f;&#x2f; TODO&#xff1a;&#x540e;&#x9762;&#x8fd8;&#x6709;&#x66f4;&#x591a;&#x7684;&#x66f4;&#x65b0;&#x5b57;&#x6bb5;&#xa;&#xa;var update_date &#x3d; new Date&#x28;&#x29;&#x3b;&#xa;&#xa;&#x2f;&#x2f;------------ 1&#x3001;&#x516c;&#x53f8;&#x5206;&#x516c;&#x53f8;&#x76f8;&#x5173;&#x5b57;&#x6bb5; -----------&#x2f;&#x2f;&#xa;var company_update &#x3d; gsmc&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var branche_company_update &#x3d; fgsmc&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x540d;&#x79f0;&#xa;var business_code_update &#x3d; gsdm&#x3b; &#x2f;&#x2f; &#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var branch_company_code_update &#x3d; fgsdm&#x3b; &#x2f;&#x2f; &#x5206;&#x516c;&#x53f8;&#x4ee3;&#x7801;&#xa;var isGsUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;&#x21;company_update.equals&#x28;company&#x29;&#x29; &#x7b;&#xa; isGsUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;if &#x28;&#x21;branche_company_update.equals&#x28;branche_company&#x29;&#x29; &#x7b;&#xa; isGsUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f;------------- 2&#x3001;&#x62a5;&#x5e9f;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var equipmentCode_update &#x3d; equipment_code&#x3b; &#x2f;&#x2f; &#x8bbe;&#x5907;&#x7f16;&#x53f7;&#xa;var scrapCode_update &#x3d; scrap_code&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x53f7;&#xa;var scrapState_update &#x3d; &#x28;scrap_state &#x3d;&#x3d; true &#x3f; 1 &#x3a; 0&#x29;&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x72b6;&#x6001;&#xa;var scrapState_update_b &#x3d; scrap_state&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x72b6;&#x6001;&#xa;var scrapDate_update &#x3d; scrap_date&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#xa;var isScrapUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;carState &#x3d;&#x3d; &#x27;3&#x27; &#x7c;&#x7c; scrapType &#x3d;&#x3d; &#x27;1&#x27;&#x29; &#x7b;&#xa; scrapState_update_b &#x3d; true&#x3b;&#xa; scrapState_update &#x3d; 1&#x3b;&#xa; &#x2f;&#x2f; &#x4f7f;&#x7528;&#x8f66;&#x8f86;&#x5e93;&#x7684;&#x62a5;&#x5e9f;&#x65f6;&#x95f4;&#xa; scrapDate_update &#x3d; scrapDate &#x3d;&#x3d; null &#x3f; null &#x3a; str2date&#x28;scrapDate, &#x27;yyyy-MM-dd&#x27;&#x29;&#x3b;&#xa; &#x2f;&#x2f; &#x8f66;&#x8f86;&#x5e93;&#x62a5;&#x5e9f;&#x65f6;&#x95f4;&#x4e3a;&#x7a7a;&#xff0c;&#x518d;&#x4f7f;&#x7528;&#x5f53;&#x524d;&#x65f6;&#x95f4;&#xa; if &#x28;scrapDate_update &#x3d;&#x3d; null&#x29; &#x7b;&#xa; scrapDate_update &#x3d; new Date&#x28;&#x29;&#x3b; &#x2f;&#x2f; &#x62a5;&#x5e9f;&#x65e5;&#x671f;&#x8bbe;&#x5b9a;&#x4f4d;&#x5f53;&#x524d;&#x65e5;&#x671f;&#xa; &#x7d;&#xa; equipmentCode_update &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_update&#x3b;&#xa; scrapCode_update &#x3d; &#x27;BF-&#x27; &#x2b; equipmentCode_update&#x3b;&#xa;&#x7d;&#xa;if &#x28;scrapState_update_b &#x21;&#x3d; scrap_state&#x29; &#x7b;&#xa; isScrapUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#x2f;&#x2f;-------------- 3-1&#x3001;&#x662f;&#x5426;&#x7eaf;&#x7535;&#x8f66;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var sfdc_update &#x3d; 0&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7eaf;&#x7535;&#x8f66;&#xff08;&#x5f85;&#x66f4;&#x65b0;&#xff09;&#xa;if &#x28;carEnergyType &#x3d;&#x3d; &#x27;&#x7eaf;&#x7535;&#x52a8;&#x27; &#x7c;&#x7c; carEnergyType &#x3d;&#x3d; &#x27;&#x53cc;&#x7535;&#x5f0f;&#x7eaf;&#x7535;&#x52a8;&#x27; &#x7c;&#x7c; carEnergyType &#x3d;&#x3d; &#x27;&#x5feb;&#x5145;&#x5f0f;&#x7eaf;&#x7535;&#x52a8;&#x27; &#x7c;&#x7c; carEnergyType &#x3d;&#x3d; &#x27;&#x8d85;&#x7ea7;&#x7535;&#x5bb9;&#x27;&#x29; &#x7b;&#xa; sfdc_update &#x3d; 1&#x3b;&#xa;&#x7d;&#xa;var sfdc_update_b &#x3d; 0&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x7eaf;&#x7535;&#x8f66;&#xff08;&#x539f;&#x59cb;&#x6570;&#x636e;&#xff09;&#xa;if &#x28;sfdc &#x3d;&#x3d; null&#x29; &#x7b; &#xa; sfdc_update_b &#x3d; null&#x3b;&#xa;&#x7d; else &#x7b;&#xa; sfdc_update_b &#x3d; &#x28;sfdc &#x3d;&#x3d; true &#x3f; 1 &#x3a; 0&#x29;&#x3b;&#xa;&#x7d;&#xa;var isSfdcUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0; &#xa;if &#x28;sfdc_update_b &#x21;&#x3d; sfdc_update&#x29; &#x7b; &#xa; isSfdcUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f;-------------- 3-2&#x3001;&#x662f;&#x5426;&#x6df7;&#x5408;&#x52a8;&#x529b;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ------------&#x2f;&#x2f;&#xa;var sfmix_update &#x3d; 0&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x6df7;&#x5408;&#x52a8;&#x529b;&#xff08;&#x5f85;&#x66f4;&#x65b0;&#xff09;&#xa;if &#x28;carEnergyType &#x3d;&#x3d; &#x27;&#x63d2;&#x7535;&#x5f0f;&#x6df7;&#x5408;&#x52a8;&#x529b;&#x27; &#x7c;&#x7c; carEnergyType &#x3d;&#x3d; &#x27;&#x6df7;&#x5408;&#x52a8;&#x529b;&#x27;&#x29; &#x7b;&#xa; sfmix_update &#x3d; 1&#x3b;&#xa;&#x7d;&#xa;var sfmix_update_b &#x3d; 0&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x6df7;&#x5408;&#x52a8;&#x529b;&#xff08;&#x539f;&#x59cb;&#x6570;&#x636e;&#xff09;&#xa;if &#x28;sfmix &#x3d;&#x3d; null&#x29; &#x7b;&#xa; sfmix_update_b &#x3d; null&#x3b;&#xa;&#x7d; else &#x7b;&#xa; sfmix_update_b &#x3d; &#x28;sfmix &#x3d;&#x3d; true &#x3f; 1 &#x3a; 0&#x29;&#x3b;&#xa;&#x7d;&#xa;var isSfmixUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;sfmix_update_b &#x21;&#x3d; sfmix_update&#x29; &#x7b; &#xa; isSfmixUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;&#xa;&#x2f;&#x2f;--------------- 4&#x3001;&#x8f66;&#x724c;&#x53f7;&#x76f8;&#x5173;&#x5b57;&#x6bb5; ---------------&#x2f;&#x2f;&#xa;var cph_update &#x3d; cph&#x3b; &#x2f;&#x2f; &#x5f85;&#x66f4;&#x65b0;&#x8f66;&#x724c;&#x53f7;&#xa;var isChpUpdate &#x3d; false&#x3b; &#x2f;&#x2f; &#x662f;&#x5426;&#x66f4;&#x65b0;&#xa;if &#x28;&#x21;cph_update.equals&#x28;car_plate&#x29;&#x29; &#x7b;&#xa; isChpUpdate &#x3d; true&#x3b;&#xa;&#x7d;&#xa;</jsScript_script>
2296 2367 </jsScript> </jsScripts> <fields> <field> <name>update_date</name>
2297 2368 <rename>update_date</rename>
2298 2369 <type>Date</type>
... ... @@ -2383,6 +2454,30 @@
2383 2454 <length>-1</length>
2384 2455 <precision>-1</precision>
2385 2456 <replace>N</replace>
  2457 + </field> <field> <name>sfmix_update</name>
  2458 + <rename>sfmix_update</rename>
  2459 + <type>Integer</type>
  2460 + <length>-1</length>
  2461 + <precision>-1</precision>
  2462 + <replace>N</replace>
  2463 + </field> <field> <name>isSfmixUpdate</name>
  2464 + <rename>isSfmixUpdate</rename>
  2465 + <type>Boolean</type>
  2466 + <length>-1</length>
  2467 + <precision>-1</precision>
  2468 + <replace>N</replace>
  2469 + </field> <field> <name>cph_update</name>
  2470 + <rename>cph_update</rename>
  2471 + <type>String</type>
  2472 + <length>-1</length>
  2473 + <precision>-1</precision>
  2474 + <replace>N</replace>
  2475 + </field> <field> <name>isChpUpdate</name>
  2476 + <rename>isChpUpdate</rename>
  2477 + <type>Boolean</type>
  2478 + <length>-1</length>
  2479 + <precision>-1</precision>
  2480 + <replace>N</replace>
2386 2481 </field> </fields> <cluster_schema/>
2387 2482 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
2388 2483 <xloc>670</xloc>
... ... @@ -2454,6 +2549,14 @@
2454 2549 <rename>sfdc_update</rename>
2455 2550 </value>
2456 2551 <value>
  2552 + <name>sfmix</name>
  2553 + <rename>sfmix_update</rename>
  2554 + </value>
  2555 + <value>
  2556 + <name>car_plate</name>
  2557 + <rename>cph_update</rename>
  2558 + </value>
  2559 + <value>
2457 2560 <name>update_date</name>
2458 2561 <rename>update_date</rename>
2459 2562 </value>
... ... @@ -2563,6 +2666,16 @@
2563 2666 <format/>
2564 2667 </field>
2565 2668 <field>
  2669 + <name>sfmix_update</name>
  2670 + <type>Integer</type>
  2671 + <format/>
  2672 + </field>
  2673 + <field>
  2674 + <name>cph_update</name>
  2675 + <type>String</type>
  2676 + <format/>
  2677 + </field>
  2678 + <field>
2566 2679 <name>NrErrors</name>
2567 2680 <type>Integer</type>
2568 2681 <format/>
... ... @@ -2731,6 +2844,18 @@
2731 2844 <default/>
2732 2845 <type>Integer</type>
2733 2846 </value>
  2847 + <value>
  2848 + <name>sfmix</name>
  2849 + <rename>sfmix</rename>
  2850 + <default/>
  2851 + <type>Integer</type>
  2852 + </value>
  2853 + <value>
  2854 + <name>car_plate</name>
  2855 + <rename>car_plate</rename>
  2856 + <default/>
  2857 + <type>String</type>
  2858 + </value>
2734 2859 </lookup>
2735 2860 <cluster_schema/>
2736 2861 <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
... ...