Commit 60cdd640c4113055947323bf4b171794cdeb9c91

Authored by 徐烜
2 parents f8d22eff 3a9befa5

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

Showing 45 changed files with 2069 additions and 911 deletions

Too many changes to show.

To preserve performance only 45 of 122 files are displayed.

README.md
@@ -447,9 +447,5 @@ @@ -447,9 +447,5 @@
447 | direction | float | 角度0-359 | 447 | direction | float | 角度0-359 |
448 | inTemp | int | 车内温度 | 448 | inTemp | int | 车内温度 |
449 | serviceState | long | 设备状态字 | 449 | serviceState | long | 设备状态字 |
450 -<<<<<<< HEAD  
451 -| daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |  
452 -=======  
453 | daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 | 450 | daysYear | int | 对应年中的天数 为分区字段 查询一定要用此字段过滤 |
454 451
455 ->>>>>>> af8ec3bedc8644f5813e9adab12a163e93cc7f50  
src/main/java/com/bsth/controller/LineVersionsController.java
1 package com.bsth.controller; 1 package com.bsth.controller;
2 2
3 -import java.util.List;  
4 -import java.util.Map;  
5 - 3 +import com.bsth.entity.LineVersions;
  4 +import com.bsth.repository.LineRepository;
  5 +import com.bsth.service.LineVersionsService;
6 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.RequestMapping; 7 import org.springframework.web.bind.annotation.RequestMapping;
8 import org.springframework.web.bind.annotation.RequestMethod; 8 import org.springframework.web.bind.annotation.RequestMethod;
9 import org.springframework.web.bind.annotation.RequestParam; 9 import org.springframework.web.bind.annotation.RequestParam;
10 import org.springframework.web.bind.annotation.RestController; 10 import org.springframework.web.bind.annotation.RestController;
11 11
12 -import com.bsth.entity.LineVersions;  
13 -import com.bsth.repository.LineRepository;  
14 -import com.bsth.service.LineVersionsService; 12 +import java.util.List;
  13 +import java.util.Map;
15 14
16 /** 15 /**
17 * 16 *
@@ -75,7 +74,11 @@ public class LineVersionsController extends BaseController&lt;LineVersions, Integer @@ -75,7 +74,11 @@ public class LineVersionsController extends BaseController&lt;LineVersions, Integer
75 public Map<String, Object> add(@RequestParam Map<String, Object> map) { 74 public Map<String, Object> add(@RequestParam Map<String, Object> map) {
76 return service.add(map); 75 return service.add(map);
77 } 76 }
78 - 77 + @RequestMapping(value = "delete", method = RequestMethod.POST)
  78 + public Map<String, Object> delete(@RequestParam (defaultValue = "id") int id) {
  79 + return service.delete(id);
  80 + }
  81 +
79 /** 82 /**
80 * 根据线路id获取当前版本号 83 * 根据线路id获取当前版本号
81 * 84 *
src/main/java/com/bsth/controller/calc/CalcExportController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.text.SimpleDateFormat;
  4 +import java.util.ArrayList;
  5 +import java.util.HashMap;
  6 +import java.util.Iterator;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.RequestParam;
  14 +import org.springframework.web.bind.annotation.RestController;
  15 +
  16 +import com.bsth.common.ResponseCode;
  17 +import com.bsth.entity.calc.CalcWaybill;
  18 +import com.bsth.entity.mcy_forms.Waybillday;
  19 +import com.bsth.service.calc.CalcMixService;
  20 +import com.bsth.service.calc.CalcWaybillService;
  21 +import com.bsth.util.ReportUtils;
  22 +
  23 +@RestController
  24 +@RequestMapping("calc_export")
  25 +public class CalcExportController {
  26 +
  27 + @Autowired
  28 + CalcWaybillService service;
  29 +
  30 + @Autowired
  31 + CalcMixService clacMixService;
  32 +
  33 + @RequestMapping(value = "/waybilldayExport", method = RequestMethod.GET)
  34 + public Map<String, Object> calcjsyspyExport(@RequestParam Map<String, Object> map) {
  35 +
  36 + String line="";
  37 + if(map.get("line")!=null){
  38 + line=map.get("line").toString().trim();
  39 + }
  40 + String lineName="";
  41 + if(map.get("lineName")!=null){
  42 + lineName=map.get("lineName").toString().trim();
  43 + }
  44 + String startDate="";
  45 + if(map.get("startDate")!=null){
  46 + startDate=map.get("startDate").toString().trim();
  47 + }
  48 + String endDate="";
  49 + if(map.get("endDate")!=null){
  50 + endDate=map.get("endDate").toString().trim();
  51 + }
  52 + String cont="";
  53 + if(map.get("cont")!=null){
  54 + cont=map.get("cont").toString().trim();
  55 + }
  56 + String empnames="";
  57 + if(map.get("empnames")!=null){
  58 + empnames=map.get("empnames").toString().trim();
  59 + }
  60 + String gsdmManth="";
  61 + if(map.get("gsdmManth")!=null){
  62 + gsdmManth=map.get("gsdmManth").toString().trim();
  63 + }
  64 + String fgsdmManth="";
  65 + if(map.get("fgsdmManth")!=null){
  66 + fgsdmManth=map.get("fgsdmManth").toString().trim();
  67 + }
  68 +
  69 + Map<String, Object> resMap = new HashMap<String, Object>();
  70 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  71 + List<Map<String, Object>> list = clacMixService.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth);
  72 +
  73 + Map<String, Object> temp = new HashMap<String, Object>();
  74 + temp.put("i", "序号");
  75 + temp.put("jName", empnames);
  76 + temp.put("jhyybc", "计划营运班次");
  77 + temp.put("jhfyybc", "计划空驶班次");
  78 + temp.put("sjyybc", "实际营运班次");
  79 + temp.put("sjfyybc", "实际空驶班次");
  80 + temp.put("lbbc", "烂班班次");
  81 + temp.put("ljbc", "临加班次");
  82 + temp.put("jhzlc", "计划总里程");
  83 + temp.put("jhyylc", "计划营运里程");
  84 + temp.put("jhfyylc", "计划空驶里程");
  85 + temp.put("sjzlc", "实际总里程");
  86 + temp.put("sjyylc", "实际营运里程");
  87 + temp.put("sjfyylc", "实际空驶里程");
  88 + temp.put("lblc", "烂班里程");
  89 + temp.put("ljyylc", "临加营运里程");
  90 + temp.put("ljfyylc", "临加空驶里程");
  91 + resList.add(temp);
  92 + for(int i = 0; i < list.size(); i++){
  93 + temp = list.get(i);
  94 + temp.put("i", i+1);
  95 + resList.add(temp);
  96 + }
  97 +
  98 + String date = startDate.replaceAll("-", "");
  99 + if(!startDate.equals(endDate)){
  100 + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", "");
  101 + }
  102 +
  103 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  104 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  105 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  106 + Map<String,Object> mm = new HashMap<String, Object>();
  107 + ReportUtils ee = new ReportUtils();
  108 +
  109 + try {
  110 + listI.add(resList.iterator());
  111 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  112 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcjsyspy.xls",
  113 + path+"export/"+date+"-"+lineName+"-人车班次公里统计.xls");
  114 + resMap.put("status", ResponseCode.SUCCESS);
  115 + } catch (Exception e) {
  116 + e.printStackTrace();
  117 + resMap.put("status", ResponseCode.ERROR);
  118 + }
  119 + return resMap;
  120 + }
  121 +
  122 + @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET)
  123 + public Map<String, Object> singledataExportTj(@RequestParam Map<String, Object> map) {
  124 +
  125 + String line="";
  126 + if(map.get("line")!=null){
  127 + line=map.get("line").toString().trim();
  128 + }
  129 + String lineName="";
  130 + if(map.get("lineName")!=null){
  131 + lineName=map.get("lineName").toString().trim();
  132 + }
  133 + String startDate="";
  134 + if(map.get("startDate")!=null){
  135 + startDate=map.get("startDate").toString().trim();
  136 + }
  137 + String endDate="";
  138 + if(map.get("endDate")!=null){
  139 + endDate=map.get("endDate").toString().trim();
  140 + }
  141 + String tjtype="";
  142 + if(map.get("tjtype")!=null){
  143 + tjtype=map.get("tjtype").toString().trim();
  144 + }
  145 + String cont="";
  146 + if(map.get("cont")!=null){
  147 + cont=map.get("cont").toString().trim();
  148 + }
  149 + String gsdmSing="";
  150 + if(map.get("gsdmSing")!=null){
  151 + gsdmSing=map.get("gsdmSing").toString().trim();
  152 + }
  153 + String fgsdmSing="";
  154 + if(map.get("fgsdmSing")!=null){
  155 + fgsdmSing=map.get("fgsdmSing").toString().trim();
  156 + }
  157 +
  158 + Map<String, Object> resMap = new HashMap<String, Object>();
  159 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  160 + List<Map<String, Object>> list = clacMixService.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing);
  161 +
  162 + Map<String, Object> temp = new HashMap<String, Object>();
  163 + temp.put("i", "序号");
  164 + temp.put("gS", "所属公司");
  165 + temp.put("xlName", "线路");
  166 + temp.put("jName", tjtype);
  167 + temp.put("jhzlc", "计划公里");
  168 + temp.put("sjzlc", "行驶里程(包括空放)");
  169 + temp.put("sjfyylc", "空驶里程");
  170 + temp.put("hyl", "耗油量");
  171 + temp.put("jzl", "加注量");
  172 + temp.put("sh", "非营业用油");
  173 +
  174 + resList.add(temp);
  175 + for(int i = 0; i < list.size(); i++){
  176 + temp = list.get(i);
  177 + temp.put("i", i+1);
  178 + if(temp.get("xlName") == null){
  179 + temp.put("xlName", "");
  180 + }
  181 + resList.add(temp);
  182 + }
  183 +
  184 + String date = startDate.replaceAll("-", "");
  185 + if(!startDate.equals(endDate)){
  186 + date = startDate.replaceAll("-", "") + "-" + endDate.replaceAll("-", "");
  187 + }
  188 +
  189 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  190 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  191 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  192 + Map<String,Object> mm = new HashMap<String, Object>();
  193 + ReportUtils ee = new ReportUtils();
  194 +
  195 + try {
  196 + listI.add(resList.iterator());
  197 + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/";
  198 + ee.excelReplace(listI, new Object[] { mm }, path+"mould/calcsingledata.xls",
  199 + path+"export/"+date+"-"+lineName+"-路单数据(统计).xls");
  200 + resMap.put("status", ResponseCode.SUCCESS);
  201 + } catch (Exception e) {
  202 + e.printStackTrace();
  203 + resMap.put("status", ResponseCode.ERROR);
  204 + }
  205 + return resMap;
  206 + }
  207 +
  208 +}
src/main/java/com/bsth/controller/calc/CalcMixController.java 0 → 100644
  1 +package com.bsth.controller.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RequestMethod;
  9 +import org.springframework.web.bind.annotation.RequestParam;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import com.bsth.service.calc.CalcMixService;
  13 +
  14 +@RestController
  15 +@RequestMapping("calc_mix")
  16 +public class CalcMixController {
  17 +
  18 + @Autowired
  19 + CalcMixService service;
  20 +
  21 + @RequestMapping(value="/calcjsyspy")
  22 + public List<Map<String, Object>> calcjsyspy(@RequestParam Map<String, Object> map){
  23 + String line="";
  24 + if(map.get("line")!=null){
  25 + line=map.get("line").toString().trim();
  26 + }
  27 + String startDate="";
  28 + if(map.get("startDate")!=null){
  29 + startDate=map.get("startDate").toString().trim();
  30 + }
  31 + String endDate="";
  32 + if(map.get("endDate")!=null){
  33 + endDate=map.get("endDate").toString().trim();
  34 + }
  35 + String empnames="";
  36 + if(map.get("empnames")!=null){
  37 + empnames=map.get("empnames").toString().trim();
  38 + }
  39 + String cont="";
  40 + if(map.get("cont")!=null){
  41 + cont=map.get("cont").toString().trim();
  42 + }
  43 + String gsdmManth="";
  44 + if(map.get("gsdmManth")!=null){
  45 + gsdmManth=map.get("gsdmManth").toString().trim();
  46 + }
  47 + String fgsdmManth="";
  48 + if(map.get("fgsdmManth")!=null){
  49 + fgsdmManth=map.get("fgsdmManth").toString().trim();
  50 + }
  51 + return service.calcjsyspy(line, startDate, endDate, empnames, cont, gsdmManth, fgsdmManth);
  52 + }
  53 +
  54 + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
  55 + public List<Map<String, Object>> singledatatj(@RequestParam Map<String, Object> map) {
  56 + String line="";
  57 + if(map.get("line")!=null){
  58 + line=map.get("line").toString().trim();
  59 + }
  60 + String startDate="";
  61 + if(map.get("startDate")!=null){
  62 + startDate=map.get("startDate").toString().trim();
  63 + }
  64 + String endDate="";
  65 + if(map.get("endDate")!=null){
  66 + endDate=map.get("endDate").toString().trim();
  67 + }
  68 + String tjtype="";
  69 + if(map.get("tjtype")!=null){
  70 + tjtype=map.get("tjtype").toString().trim();
  71 + }
  72 + String cont="";
  73 + if(map.get("cont")!=null){
  74 + cont=map.get("cont").toString().trim();
  75 + }
  76 + String gsdmSing="";
  77 + if(map.get("gsdmSing")!=null){
  78 + gsdmSing=map.get("gsdmSing").toString().trim();
  79 + }
  80 + String fgsdmSing="";
  81 + if(map.get("fgsdmSing")!=null){
  82 + fgsdmSing=map.get("fgsdmSing").toString().trim();
  83 + }
  84 + return service.singledatatj(line, startDate, endDate, tjtype, cont, gsdmSing, fgsdmSing);
  85 + }
  86 +
  87 +}
src/main/java/com/bsth/controller/realcontrol/RealMapController.java
@@ -49,6 +49,12 @@ public class RealMapController { @@ -49,6 +49,12 @@ public class RealMapController {
49 return realMapService.findRouteByLine(idx); 49 return realMapService.findRouteByLine(idx);
50 } 50 }
51 51
  52 +
  53 + @RequestMapping(value = "/findRouteAndVersionByLine")
  54 + public Map<String, Object> findRouteByLineAndVersion(@RequestParam String idx) {
  55 + return realMapService.findRouteAndVersionByLine(idx);
  56 + }
  57 +
52 @RequestMapping(value = "/multiRouteByLine") 58 @RequestMapping(value = "/multiRouteByLine")
53 public Map<String, Object> multiRouteByLine(@RequestParam String codeStr) { 59 public Map<String, Object> multiRouteByLine(@RequestParam String codeStr) {
54 return realMapService.multiRouteByLine(codeStr); 60 return realMapService.multiRouteByLine(codeStr);
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
@@ -711,6 +711,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo, @@ -711,6 +711,13 @@ public class ScheduleRealInfoController extends BaseController&lt;ScheduleRealInfo,
711 public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ 711 public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){
712 return scheduleRealInfoService.deleteToHistory(id); 712 return scheduleRealInfoService.deleteToHistory(id);
713 } 713 }
  714 +
  715 + @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST)
  716 + public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){
  717 + Map<String, Object> map =new HashMap<>();
  718 + map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode));
  719 + return map;
  720 + }
714 721
715 /** 722 /**
716 * 从历史库里删除临加班次 723 * 从历史库里删除临加班次
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
@@ -44,7 +44,7 @@ public class CalcOilThread extends Thread{ @@ -44,7 +44,7 @@ public class CalcOilThread extends Thread{
44 dlbService.obtainDsq(); 44 dlbService.obtainDsq();
45 logger.info("计算路单里程加注量结束!"); 45 logger.info("计算路单里程加注量结束!");
46 logger.info("开始计算班次准点率...."); 46 logger.info("开始计算班次准点率....");
47 - sheetService.saveSheetList(""); 47 + //sheetService.saveSheetList("");
48 logger.info("计算班次准点率结束!"); 48 logger.info("计算班次准点率结束!");
49 49
50 logger.info("开始保存重新统计数据...."); 50 logger.info("开始保存重新统计数据....");
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -231,6 +231,15 @@ public class ScheduleRealInfo { @@ -231,6 +231,15 @@ public class ScheduleRealInfo {
231 * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成 231 * 换车营运标记 true 表示该主任务由 【中途换车子任务】 级联生成
232 */ 232 */
233 private boolean ccService; 233 private boolean ccService;
  234 + private Integer lpChange;
  235 +
  236 + public Integer getLpChange() {
  237 + return lpChange;
  238 + }
  239 +
  240 + public void setLpChange(Integer lpChange) {
  241 + this.lpChange = lpChange;
  242 + }
234 243
235 public boolean isDfAuto() { 244 public boolean isDfAuto() {
236 return dfAuto; 245 return dfAuto;
src/main/java/com/bsth/entity/search/PredicatesBuilder.java
@@ -9,6 +9,7 @@ import java.text.NumberFormat; @@ -9,6 +9,7 @@ import java.text.NumberFormat;
9 import java.text.ParseException; 9 import java.text.ParseException;
10 import java.text.SimpleDateFormat; 10 import java.text.SimpleDateFormat;
11 import java.util.ArrayList; 11 import java.util.ArrayList;
  12 +import java.util.Calendar;
12 import java.util.Date; 13 import java.util.Date;
13 import java.util.List; 14 import java.util.List;
14 15
@@ -37,7 +38,13 @@ public class PredicatesBuilder { @@ -37,7 +38,13 @@ public class PredicatesBuilder {
37 if(Date.class.isAssignableFrom(leftType) && 38 if(Date.class.isAssignableFrom(leftType) &&
38 String.class.isAssignableFrom(rightType)){ 39 String.class.isAssignableFrom(rightType)){
39 DateTime dateTime = new DateTime(object); 40 DateTime dateTime = new DateTime(object);
40 - return cb.equal(expression, dateTime.toDate()); 41 + Date startTime = dateTime.toDate();//设置起始时间
  42 + Calendar c = Calendar.getInstance();
  43 + c.setTime(startTime);
  44 + c.add(Calendar.DAY_OF_MONTH, 1);
  45 + // 设置结束时间,起始时间为结束时间加1天
  46 + Date endTime = c.getTime();
  47 + return cb.between((Path<Date>) expression,startTime,endTime);
41 } 48 }
42 else { 49 else {
43 return cb.equal(expression, object); 50 return cb.equal(expression, object);
src/main/java/com/bsth/entity/traffic/SKBUploadLogger.java
1 package com.bsth.entity.traffic; 1 package com.bsth.entity.traffic;
2 2
3 -import com.bsth.entity.schedule.TTInfo; 3 +import com.bsth.entity.Line;
4 import com.bsth.entity.sys.SysUser; 4 import com.bsth.entity.sys.SysUser;
5 import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6 6
@@ -33,7 +33,7 @@ public class SKBUploadLogger { @@ -33,7 +33,7 @@ public class SKBUploadLogger {
33 33
34 /** 时刻表信息 */ 34 /** 时刻表信息 */
35 @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY) 35 @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
36 - private TTInfo ttInfo; 36 + private Line line;
37 37
38 /** 用户 关联 */ 38 /** 用户 关联 */
39 @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY) 39 @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
@@ -43,6 +43,23 @@ public class SKBUploadLogger { @@ -43,6 +43,23 @@ public class SKBUploadLogger {
43 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") 43 @Column(updatable = false, name = "create_date", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
44 private Date createDate; 44 private Date createDate;
45 45
  46 + // 上传的参数
  47 + @Column( name = "upload_xml" , columnDefinition="TEXT")
  48 + private String uploadXml;
  49 +
  50 + // 上传的参数2
  51 + @Column( name = "upload_xml_sub" , columnDefinition="TEXT")
  52 + private String uploadXmlSub;
  53 +
  54 + // 日志类型 1:时刻表;2:上传线路;3:上传路单
  55 + private String type;
  56 +
  57 + // 模板名称
  58 + private String name;
  59 +
  60 + // 上传状态:是否成功 1:成功;0:失败
  61 + private String state;
  62 +
46 public Integer getId() { 63 public Integer getId() {
47 return id; 64 return id;
48 } 65 }
@@ -51,14 +68,6 @@ public class SKBUploadLogger { @@ -51,14 +68,6 @@ public class SKBUploadLogger {
51 this.id = id; 68 this.id = id;
52 } 69 }
53 70
54 - public TTInfo getTtInfo() {  
55 - return ttInfo;  
56 - }  
57 -  
58 - public void setTtInfo(TTInfo ttInfo) {  
59 - this.ttInfo = ttInfo;  
60 - }  
61 -  
62 public SysUser getUser() { 71 public SysUser getUser() {
63 return user; 72 return user;
64 } 73 }
@@ -71,7 +80,29 @@ public class SKBUploadLogger { @@ -71,7 +80,29 @@ public class SKBUploadLogger {
71 return createDate; 80 return createDate;
72 } 81 }
73 82
74 - public void setCreateDate(Date createDate) {  
75 - this.createDate = createDate;  
76 - } 83 + public void setCreateDate(Date createDate) { this.createDate = createDate; }
  84 +
  85 + public String getUploadXml() { return uploadXml; }
  86 +
  87 + public void setUploadXml(String uploadXml) { this.uploadXml = uploadXml; }
  88 +
  89 + public String getState() { return state; }
  90 +
  91 + public void setState(String state) { this.state = state; }
  92 +
  93 + public Line getLine() { return line;}
  94 +
  95 + public void setLine(Line line) { this.line = line; }
  96 +
  97 + public String getType() { return type; }
  98 +
  99 + public void setType(String type) { this.type = type; }
  100 +
  101 + public String getName() { return name; }
  102 +
  103 + public void setName(String name) { this.name = name; }
  104 +
  105 + public String getUploadXmlSub() {return uploadXmlSub;}
  106 +
  107 + public void setUploadXmlSub(String uploadXmlSub) {this.uploadXmlSub = uploadXmlSub; }
77 } 108 }
src/main/java/com/bsth/repository/StationRouteRepository.java
@@ -392,6 +392,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int @@ -392,6 +392,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
392 392
393 @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) 393 @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
394 @Override 394 @Override
  395 + @Query(value = "select r from StationRoute r where r.destroy=0")
395 List<StationRoute> findAll(); 396 List<StationRoute> findAll();
396 397
397 @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2") 398 @Query("select new map(sr.station.id as stationid, sr.stationName as stationname) from StationRoute sr where sr.line.id=?1 and sr.directions=?2")
src/main/java/com/bsth/repository/calc/CalcWaybillRepository.java
@@ -58,4 +58,15 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ @@ -58,4 +58,15 @@ public interface CalcWaybillRepository extends BaseRepository&lt;CalcWaybill, Integ
58 @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1") 58 @Query("select DISTINCT s from ScheduleRealInfo s where s.scheduleDateStr=?1")
59 List<ScheduleRealInfo> findAllScheduleByDate(String schDate); 59 List<ScheduleRealInfo> findAllScheduleByDate(String schDate);
60 60
  61 +
  62 + //按照时间段统计,公司下线路 (驾驶员)
  63 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and CONCAT(jGh,'/',jName) like %?6% order by c.xl")
  64 + List<CalcWaybill> scheduleByJsy(String line,String date,String date2,String gsdm,String fgsdm,String jsy);
  65 + //按照时间段统计,公司下线路 (售票员)
  66 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and CONCAT(sGh,'/',sName) like %?6% order by c.xl")
  67 + List<CalcWaybill> scheduleBySpy(String line,String date,String date2,String gsdm,String fgsdm,String spy);
  68 + //按照时间段统计,公司下线路 (车辆自编号)
  69 + @Query(value="select DISTINCT c from CalcWaybill c where c.xl like %?1% and c.rqStr between ?2 and ?3 and c.gsdm like %?4% and c.fgsdm like %?5% and cl like %?6% order by c.xl")
  70 + List<CalcWaybill> scheduleByZbh(String line,String date,String date2,String gsdm,String fgsdm,String zbh);
  71 +
61 } 72 }
src/main/java/com/bsth/repository/oil/DlbRepository.java
1 package com.bsth.repository.oil; 1 package com.bsth.repository.oil;
2 2
  3 +import java.util.Date;
3 import java.util.List; 4 import java.util.List;
4 5
5 import org.springframework.data.jpa.repository.Modifying; 6 import org.springframework.data.jpa.repository.Modifying;
@@ -41,6 +42,14 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{ @@ -41,6 +42,14 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
41 + " and s.nbbm in ?5 order by nbbm,jcsx") 42 + " and s.nbbm in ?5 order by nbbm,jcsx")
42 List<Dlb> listDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); 43 List<Dlb> listDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
43 44
  45 + @Query(value="select s from Dlb s "
  46 + + " where s.rq=?1 "
  47 + + " and s.ssgsdm like %?2% "
  48 + + " and s.fgsdm like %?3%"
  49 + + " and s.xlbm like %?4% "
  50 + + " and s.nbbm in ?5 order by nbbm,jcsx")
  51 + List<Dlb> listDlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  52 +
44 53
45 /** 54 /**
46 * 55 *
@@ -73,6 +82,15 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{ @@ -73,6 +82,15 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
73 + " and s.nbbm in ?5 ") 82 + " and s.nbbm in ?5 ")
74 List<Object[]> sumDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); 83 List<Object[]> sumDlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
75 84
  85 + @Query(value="select cdl,hd,sh from Dlb s "
  86 + + " where s.rq=?1"
  87 + + " and s.ssgsdm like %?2% "
  88 + + " and s.fgsdm like %?3%"
  89 + + " and s.xlbm like %?4% "
  90 + + " and s.nbbm in ?5 ")
  91 + List<Object[]> sumDlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  92 +
  93 +
76 @Query(value="select ifnull(cdl,0),ifnull(hd,0),ifnull(sh,0) from bsth_c_dlb " 94 @Query(value="select ifnull(cdl,0),ifnull(hd,0),ifnull(sh,0) from bsth_c_dlb "
77 + " where rq=?1 " 95 + " where rq=?1 "
78 + " and ssgsdm like %?2% " 96 + " and ssgsdm like %?2% "
src/main/java/com/bsth/repository/oil/YlbRepository.java
@@ -133,6 +133,15 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -133,6 +133,15 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
133 + " and s.nbbm in ?5 ") 133 + " and s.nbbm in ?5 ")
134 List<Object[]> sumYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); 134 List<Object[]> sumYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
135 135
  136 + @Query(value="select jzl,yh,sh from Ylb s "
  137 + + " where s.rq=?1 "
  138 + + " and s.ssgsdm like %?2% "
  139 + + " and s.fgsdm like %?3%"
  140 + + " and s.xlbm like %?4% "
  141 + + " and s.nbbm in ?5 ")
  142 + List<Object[]> sumYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  143 +
  144 +
136 @Query(value="select ifnull(jzl,0),ifnull(yh,0),ifnull(sh,0) from bsth_c_ylb " 145 @Query(value="select ifnull(jzl,0),ifnull(yh,0),ifnull(sh,0) from bsth_c_ylb "
137 + " where rq=?1 " 146 + " where rq=?1 "
138 + " and ssgsdm like %?2% " 147 + " and ssgsdm like %?2% "
@@ -151,6 +160,14 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{ @@ -151,6 +160,14 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
151 + " and s.nbbm in ?5 order by nbbm,jcsx") 160 + " and s.nbbm in ?5 order by nbbm,jcsx")
152 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm); 161 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
153 162
  163 + @Query(value="select s from Ylb s "
  164 + + " where s.rq=?1 "
  165 + + " and s.ssgsdm =?2 "
  166 + + " and s.fgsdm =?3 "
  167 + + " and s.xlbm like %?4% "
  168 + + " and s.nbbm in ?5 order by nbbm,jcsx")
  169 + List<Ylb> listYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
  170 +
154 171
155 @Transactional 172 @Transactional
156 @Modifying 173 @Modifying
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
@@ -223,4 +223,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI @@ -223,4 +223,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
223 @Override 223 @Override
224 List<ScheduleRealInfo> findAll(); 224 List<ScheduleRealInfo> findAll();
225 225
  226 + @Modifying
  227 + @Transactional
  228 + @Query(value = "update ScheduleRealInfo s set s.lpChange=1 where s.id=?1 ")
  229 + Integer updateLpChange(Long id);
  230 +
  231 + @Query(value = "select count (s.id) from ScheduleRealInfo s where s.clZbh=?1 and s.scheduleDateStr=?2 and s.xlBm=?3 and s.qdzCode=?4")
  232 + Long isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode);
  233 +
226 } 234 }
src/main/java/com/bsth/repository/sys/RoleRepository.java
@@ -3,6 +3,7 @@ package com.bsth.repository.sys; @@ -3,6 +3,7 @@ package com.bsth.repository.sys;
3 3
4 import javax.transaction.Transactional; 4 import javax.transaction.Transactional;
5 5
  6 +import org.springframework.data.jpa.domain.Specification;
6 import org.springframework.data.jpa.repository.Modifying; 7 import org.springframework.data.jpa.repository.Modifying;
7 import org.springframework.data.jpa.repository.Query; 8 import org.springframework.data.jpa.repository.Query;
8 import org.springframework.stereotype.Repository; 9 import org.springframework.stereotype.Repository;
@@ -10,6 +11,8 @@ import org.springframework.stereotype.Repository; @@ -10,6 +11,8 @@ import org.springframework.stereotype.Repository;
10 import com.bsth.entity.sys.Role; 11 import com.bsth.entity.sys.Role;
11 import com.bsth.repository.BaseRepository; 12 import com.bsth.repository.BaseRepository;
12 13
  14 +import java.util.List;
  15 +
13 @Repository 16 @Repository
14 public interface RoleRepository extends BaseRepository<Role, Integer>{ 17 public interface RoleRepository extends BaseRepository<Role, Integer>{
15 18
@@ -21,4 +24,7 @@ public interface RoleRepository extends BaseRepository&lt;Role, Integer&gt;{ @@ -21,4 +24,7 @@ public interface RoleRepository extends BaseRepository&lt;Role, Integer&gt;{
21 @Transactional 24 @Transactional
22 @Query("update Role r set r.codeName=?1, r.roleName=?2, r.enable=?3, r.descriptions=?4 where r.id=?5") 25 @Query("update Role r set r.codeName=?1, r.roleName=?2, r.enable=?3, r.descriptions=?4 where r.id=?5")
23 void update(String codeName, String roleName, boolean enable, String descriptions, Integer id); 26 void update(String codeName, String roleName, boolean enable, String descriptions, Integer id);
  27 +
  28 + @Query(value = "select * from role where id in(?1)",nativeQuery = true)
  29 + List<Role> findAllById(String ids);
24 } 30 }
src/main/java/com/bsth/service/calc/CalcMixService.java 0 → 100644
  1 +package com.bsth.service.calc;
  2 +
  3 +import java.util.List;
  4 +import java.util.Map;
  5 +
  6 +/**
  7 + * Created by 19/02/28.
  8 + */
  9 +public interface CalcMixService {
  10 +
  11 + List<Map<String, Object>> calcjsyspy(String line, String startDate, String endDate, String cont, String empnames, String gsdmManth, String fgsdmManth);
  12 +
  13 + List<Map<String, Object>> singledatatj(String line, String startDate, String endDate, String tjtype, String cont, String gsdmSing, String fgsdmSing);
  14 +
  15 +}
src/main/java/com/bsth/service/calc/impl/CalcMixServiceImpl.java 0 → 100644
  1 +package com.bsth.service.calc.impl;
  2 +
  3 +import java.sql.ResultSet;
  4 +import java.sql.SQLException;
  5 +import java.util.ArrayList;
  6 +import java.util.HashMap;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import com.bsth.data.BasicData;
  11 +import com.bsth.entity.calc.CalcWaybill;
  12 +import com.bsth.entity.mcy_forms.Singledata;
  13 +import com.bsth.repository.calc.CalcWaybillRepository;
  14 +import com.bsth.service.calc.CalcMixService;
  15 +import com.bsth.util.Arith;
  16 +
  17 +import org.slf4j.Logger;
  18 +import org.slf4j.LoggerFactory;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.jdbc.core.JdbcTemplate;
  21 +import org.springframework.jdbc.core.RowMapper;
  22 +import org.springframework.stereotype.Service;
  23 +
  24 +/**
  25 + * Created by 19/02/28.
  26 + */
  27 +@Service
  28 +public class CalcMixServiceImpl implements CalcMixService {
  29 +
  30 + @Autowired
  31 + private CalcWaybillRepository calcRepository;
  32 +
  33 + @Autowired
  34 + JdbcTemplate jdbcTemplate;
  35 +
  36 +
  37 + Logger logger = LoggerFactory.getLogger(this.getClass());
  38 +
  39 +
  40 + @Override
  41 + public List<Map<String, Object>> calcjsyspy(String line, String date, String date2,
  42 + String empnames, String cont, String gsdm, String fgsdm) {
  43 +
  44 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  45 + List<CalcWaybill> list = null;
  46 +
  47 + int flag = 0;
  48 + if("驾驶员".equals(empnames)){
  49 + flag = 1;
  50 + list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont);
  51 + } else if("售票员".equals(empnames)){
  52 + flag = 2;
  53 + list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont);
  54 + } else if("车辆自编号".equals(empnames)){
  55 + flag = 3;
  56 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont);
  57 + }
  58 +
  59 + List<CalcWaybill> calcList = new ArrayList<CalcWaybill>();
  60 + Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>();
  61 +
  62 + CalcWaybill zjCalc = this.initCalcWaybill();
  63 + zjCalc.setjName("合计");
  64 + for(CalcWaybill c : list){
  65 + String key = "";
  66 + if(flag == 1){
  67 + if(c.getjGh() != null && c.getjName() != null)
  68 + key = c.getjGh() + "/" + c.getjName();
  69 + } else if(flag == 2){
  70 + if(c.getsGh() != null && c.getsName() != null)
  71 + key = c.getsGh() + "/" + c.getsName();
  72 + } else if(flag == 3){
  73 + if(c.getCl() != null)
  74 + key = c.getCl();
  75 + }
  76 +
  77 + if(key.trim().length() == 0 || "/".equals(key))
  78 + continue;
  79 +
  80 + CalcWaybill calc = null;
  81 + if(calcMap.containsKey(key)){
  82 + calc = calcMap.get(key);
  83 + } else {
  84 + calc = this.initCalcWaybill();
  85 + calc.setjName(key);
  86 + calcList.add(calc);
  87 + calcMap.put(key, calc);
  88 + }
  89 +
  90 + this.summation(calc, c);
  91 +
  92 + this.summation(zjCalc, c);
  93 +
  94 + }
  95 + calcList.add(zjCalc);
  96 + calcMap.put("合计", zjCalc);
  97 +
  98 + for(CalcWaybill c : calcList){
  99 + Map<String, Object> m = new HashMap<String, Object>();
  100 + m.put("jName", c.getjName());
  101 + m.put("jhyybc", c.getJhyybc());
  102 + m.put("jhfyybc", c.getJhfyybc());
  103 + m.put("sjyybc", c.getSjyybc());
  104 + m.put("sjfyybc", c.getSjfyybc());
  105 + m.put("lbbc", c.getLbbc());
  106 + m.put("ljbc", c.getLjbc());
  107 + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc()));
  108 + m.put("jhyylc", c.getJhyylc());
  109 + m.put("jhfyylc", c.getJhfyylc());
  110 + m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc()));
  111 + m.put("sjyylc", c.getSjyylc());
  112 + m.put("sjfyylc", c.getSjfyylc());
  113 + m.put("lblc", c.getLblc());
  114 + m.put("ljyylc", c.getLjyylc());
  115 + m.put("ljfyylc", c.getLjfyylc());
  116 + resList.add(m);
  117 + }
  118 +
  119 + return resList;
  120 + }
  121 +
  122 + public CalcWaybill initCalcWaybill(){
  123 + CalcWaybill calc = new CalcWaybill();
  124 + calc.setJhyybc(0);
  125 + calc.setJhyylc(0d);
  126 + calc.setJhfyybc(0);
  127 + calc.setJhfyylc(0d);
  128 + calc.setSjyybc(0);
  129 + calc.setSjyylc(0d);
  130 + calc.setSjfyybc(0);
  131 + calc.setSjfyylc(0d);
  132 + calc.setLbbc(0);
  133 + calc.setLblc(0d);
  134 + calc.setLjbc(0);
  135 + calc.setLjyylc(0d);
  136 + calc.setLjfyylc(0d);
  137 + return calc;
  138 + }
  139 +
  140 + public CalcWaybill summation(CalcWaybill c1, CalcWaybill c2){
  141 + c1.setJhyybc(c1.getJhyybc() + c2.getJhyybc());
  142 + c1.setJhyylc(Arith.add(c1.getJhyylc(), c2.getJhyylc()));
  143 + c1.setJhfyybc(c1.getJhfyybc() + c2.getJhfyybc());
  144 + c1.setJhfyylc(Arith.add(c1.getJhfyylc(), c2.getJhfyylc()));
  145 + c1.setSjyybc(c1.getSjyybc() + c2.getSjyybc());
  146 + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getSjyylc()));
  147 + c1.setSjyylc(Arith.add(c1.getSjyylc(), c2.getLjyylc()));
  148 + c1.setSjfyybc(c1.getSjfyybc() + c2.getSjfyybc());
  149 + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getSjfyylc()));
  150 + c1.setSjfyylc(Arith.add(c1.getSjfyylc(), c2.getLjfyylc()));
  151 + c1.setLbbc(c1.getLbbc() + c2.getLbbc());
  152 + c1.setLblc(Arith.add(c1.getLblc(), c2.getLblc()));
  153 + c1.setLjbc(c1.getLjbc() + c2.getLjbc());
  154 + c1.setLjyylc(Arith.add(c1.getLjyylc(), c2.getLjyylc()));
  155 + c1.setLjfyylc(Arith.add(c1.getLjfyylc(), c2.getLjfyylc()));
  156 + return c1;
  157 + }
  158 +
  159 + @Override
  160 + public List<Map<String, Object>> singledatatj(String line,
  161 + String date, String date2,
  162 + String tjtype, String cont,
  163 + String gsdm, String fgsdm) {
  164 +
  165 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  166 + List<CalcWaybill> list = null;
  167 +
  168 + int flag = 0;
  169 + if("驾驶员".equals(tjtype)){
  170 + flag = 1;
  171 + list = calcRepository.scheduleByJsy(line, date, date2, gsdm, fgsdm, cont);
  172 + } else if("售票员".equals(tjtype)){
  173 + flag = 2;
  174 + list = calcRepository.scheduleBySpy(line, date, date2, gsdm, fgsdm, cont);
  175 + } else if("车辆自编号".equals(tjtype)){
  176 + flag = 3;
  177 + list = calcRepository.scheduleByZbh(line, date, date2, gsdm, fgsdm, cont);
  178 + }
  179 +
  180 + List<CalcWaybill> calcList = new ArrayList<CalcWaybill>();
  181 + Map<String, CalcWaybill> calcMap = new HashMap<String, CalcWaybill>();
  182 +
  183 + CalcWaybill zjCalc = this.initCalcWaybill();
  184 + zjCalc.setjName("合计");
  185 + for(CalcWaybill c : list){
  186 + String key = "";
  187 + if(flag == 1){
  188 + if(c.getjGh() != null && c.getjName() != null)
  189 + key += c.getjGh() + "/" + c.getjName();
  190 + } else if(flag == 2){
  191 + if(c.getsGh() != null && c.getsName() != null)
  192 + key += c.getsGh() + "/" + c.getsName();
  193 + } else if(flag == 3){
  194 + if(c.getCl() != null)
  195 + key += c.getCl();
  196 + }
  197 +
  198 + if(key.trim().length() == 0 || "/".equals(key))
  199 + continue;
  200 +
  201 + String jName = key;
  202 + key = c.getXl() + "/" + key;
  203 +
  204 + CalcWaybill calc = null;
  205 + if(calcMap.containsKey(key)){
  206 + calc = calcMap.get(key);
  207 + } else {
  208 + calc = this.initCalcWaybill();
  209 + calc.setXlName(c.getXlName());
  210 + calc.setXl(c.getXl());
  211 + calc.setjName(jName);
  212 + calcList.add(calc);
  213 + calcMap.put(key, calc);
  214 + }
  215 +
  216 + this.summation(calc, c);
  217 +
  218 + this.summation(zjCalc, c);
  219 +
  220 + }
  221 + calcList.add(zjCalc);
  222 + calcMap.put("合计", zjCalc);
  223 +
  224 + Map<String, Map<String, Object>> keyMap = new HashMap<String, Map<String, Object>>();
  225 + for(CalcWaybill c : calcList){
  226 + Map<String, Object> m = new HashMap<String, Object>();
  227 + m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  228 + m.put("xl", c.getXl());
  229 + m.put("xlName", c.getXlName());
  230 + m.put("jName", c.getjName());
  231 + m.put("jhyybc", c.getJhyybc());
  232 + m.put("jhfyybc", c.getJhfyybc());
  233 + m.put("sjyybc", c.getSjyybc());
  234 + m.put("sjfyybc", c.getSjfyybc());
  235 + m.put("lbbc", c.getLbbc());
  236 + m.put("ljbc", c.getLjbc());
  237 + m.put("jhzlc", Arith.add(c.getJhyylc(), c.getJhfyylc()));
  238 + m.put("jhyylc", c.getJhyylc());
  239 + m.put("jhfyylc", c.getJhfyylc());
  240 + m.put("sjzlc", Arith.add(c.getSjyylc(), c.getSjfyylc()));
  241 + m.put("sjyylc", c.getSjyylc());
  242 + m.put("sjfyylc", c.getSjfyylc());
  243 + m.put("lblc", c.getLblc());
  244 + m.put("ljyylc", c.getLjyylc());
  245 + m.put("ljfyylc", c.getLjfyylc());
  246 + if(flag != 2){
  247 + m.put("hyl", 0);
  248 + m.put("jzl", 0);
  249 + m.put("sh", 0);
  250 + }
  251 + resList.add(m);
  252 + keyMap.put(c.getXl() + "/" + c.getjName(), m);
  253 + }
  254 +
  255 + String linesql="";
  256 + if(!line.equals("")){
  257 + linesql +=" and xlbm ='"+line+"' ";
  258 + }
  259 + if(!gsdm.equals("")){
  260 + linesql +=" and ssgsdm ='"+gsdm+"' ";
  261 + }
  262 + if(!fgsdm.equals("")){
  263 + linesql +=" and fgsdm ='"+fgsdm+"' ";
  264 + }
  265 + String nysql="SELECT id,xlbm,nbbm,jsy,jzl as jzl,yh as yh,sh as sh,fgsdm FROM bsth_c_ylb"
  266 + + " WHERE rq >= '"+date+"' and rq <= '"+date2+"'"
  267 + + linesql
  268 + + " union"
  269 + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh,fgsdm FROM bsth_c_dlb"
  270 + + " WHERE rq >= '"+date2+"' and rq <= '"+date2+"'"
  271 + + linesql;
  272 + List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
  273 + @Override
  274 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  275 + Singledata sin = new Singledata();
  276 + sin.setxL(arg0.getString("xlbm"));
  277 + sin.setJsy(arg0.getString("jsy"));
  278 + sin.setClzbh(arg0.getString("nbbm"));
  279 + sin.setJzl(arg0.getString("jzl"));
  280 + sin.setHyl(arg0.getString("yh"));
  281 + sin.setUnyyyl(arg0.getString("sh"));
  282 + sin.setgS(arg0.getString("fgsdm"));
  283 + return sin;
  284 + }
  285 + });
  286 +
  287 + if(flag != 2){
  288 + Map<String, Object> last = resList.get(resList.size()-1);
  289 + last.put("hyl", 0);
  290 + last.put("jzl", 0);
  291 + last.put("sh", 0);
  292 +
  293 + //统计油,电表中手动添加的或者有加注没里程的数据
  294 + for (int i = 0; i < listNy.size(); i++) {
  295 + Singledata sin_=listNy.get(i);
  296 + String xl=sin_.getxL();
  297 + String str = "";
  298 + if(flag == 1){
  299 + str = sin_.getJsy() + "/" + BasicData.allPerson.get(gsdm+"-"+sin_.getJsy());
  300 + } else {
  301 + str = sin_.getClzbh();
  302 + }
  303 +// boolean fages=true;
  304 + if(keyMap.containsKey(xl + "/" + str)){
  305 + Map<String, Object> m = keyMap.get(xl + "/" + str);
  306 + m.put("hyl", Arith.add(m.get("hyl"), sin_.getHyl()!=null?sin_.getHyl():0));
  307 + m.put("jzl", Arith.add(m.get("jzl"), sin_.getJzl()!=null?sin_.getJzl():0));
  308 + m.put("sh", Arith.add(m.get("sh"), sin_.getUnyyyl()!=null?sin_.getUnyyyl():0));
  309 + last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl")));
  310 + last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl")));
  311 + last.put("sh", Arith.add(last.get("sh"), m.get("sh")));
  312 + } else {
  313 + Map<String, Object> m = new HashMap<String, Object>();
  314 + m.put("gS", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  315 + m.put("xl", xl);
  316 + m.put("xlName", BasicData.lineCodeAllNameMap.get(xl));
  317 + m.put("jName", str);
  318 + m.put("jhzlc", 0);
  319 + m.put("sjzlc", 0);
  320 + m.put("sjfyylc", 0);
  321 + m.put("hyl", sin_.getHyl()!=null?sin_.getHyl():0);
  322 + m.put("jzl", sin_.getJzl()!=null?sin_.getJzl():0);
  323 + m.put("sh", sin_.getUnyyyl()!=null?sin_.getUnyyyl():0);
  324 + last.put("hyl", Arith.add(last.get("hyl"), m.get("hyl")));
  325 + last.put("jzl", Arith.add(last.get("jzl"), m.get("jzl")));
  326 + last.put("sh", Arith.add(last.get("sh"), m.get("sh")));
  327 +
  328 + keyMap.put(xl + "/" + str, m);
  329 + }
  330 + }
  331 + resList.remove(last);
  332 + resList.add(last);
  333 + }
  334 +
  335 + return resList;
  336 + }
  337 +
  338 +}
src/main/java/com/bsth/service/calc/impl/CalcToolServiceImpl.java
@@ -181,12 +181,12 @@ public class CalcToolServiceImpl implements CalcToolService { @@ -181,12 +181,12 @@ public class CalcToolServiceImpl implements CalcToolService {
181 if(i != l){ 181 if(i != l){
182 CalcWaybill c1 = listCal.get(i); 182 CalcWaybill c1 = listCal.get(i);
183 CalcWaybill c2 = listCal.get(l); 183 CalcWaybill c2 = listCal.get(l);
184 -  
185 - c1.setSjyylc(c1.getSjyylc() + c2.getSjyylc());  
186 - c1.setSjfyylc(c1.getSjfyylc() + c2.getSjfyylc());  
187 - c1.setLjyylc(c1.getLjyylc() + c2.getLjyylc());  
188 - c1.setLjfyylc(c1.getLjfyylc() + c2.getLjfyylc());  
189 - 184 +//
  185 +// c1.setSjyylc(c1.getSjyylc() + c2.getSjyylc());
  186 +// c1.setSjfyylc(c1.getSjfyylc() + c2.getSjfyylc());
  187 +// c1.setLjyylc(c1.getLjyylc() + c2.getLjyylc());
  188 +// c1.setLjfyylc(c1.getLjfyylc() + c2.getLjfyylc());
  189 +//
190 listCal.remove(l); 190 listCal.remove(l);
191 } else { 191 } else {
192 break; 192 break;
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
@@ -376,7 +376,7 @@ public class GeoDataServiceImpl implements GeoDataService { @@ -376,7 +376,7 @@ public class GeoDataServiceImpl implements GeoDataService {
376 lVersion.setLineCode(lineCode); 376 lVersion.setLineCode(lineCode);
377 377
378 //如果有待启用的版本,设置为历史版本 378 //如果有待启用的版本,设置为历史版本
379 - jdbcTemplate.update("update bsth_c_line_versions set `status`=0, start_date=null,end_date=null where line_code='"+lineCode+"' and `status`=2"); 379 + jdbcTemplate.update("update bsth_c_line_versions set `status`=2, start_date=null,end_date=null where line_code='"+lineCode+"' and `status`=0");
380 380
381 //入库线路版本 381 //入库线路版本
382 jdbcTemplate.update("insert into bsth_c_line_versions(name, line, line_code, versions, start_date, create_date, update_date, remark,status, isupdate) " + 382 jdbcTemplate.update("insert into bsth_c_line_versions(name, line, line_code, versions, start_date, create_date, update_date, remark,status, isupdate) " +
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -12,9 +12,11 @@ import com.bsth.data.pilot80.PilotReport; @@ -12,9 +12,11 @@ import com.bsth.data.pilot80.PilotReport;
12 import com.bsth.data.safe_driv.SafeDriv; 12 import com.bsth.data.safe_driv.SafeDriv;
13 import com.bsth.data.safe_driv.SafeDrivCenter; 13 import com.bsth.data.safe_driv.SafeDrivCenter;
14 import com.bsth.data.schedule.DayOfSchedule; 14 import com.bsth.data.schedule.DayOfSchedule;
  15 +import com.bsth.entity.LineVersions;
15 import com.bsth.entity.directive.D80; 16 import com.bsth.entity.directive.D80;
16 import com.bsth.entity.realcontrol.ScheduleRealInfo; 17 import com.bsth.entity.realcontrol.ScheduleRealInfo;
17 import com.bsth.repository.CarParkRepository; 18 import com.bsth.repository.CarParkRepository;
  19 +import com.bsth.repository.LineVersionsRepository;
18 import com.bsth.repository.StationRepository; 20 import com.bsth.repository.StationRepository;
19 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; 21 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
20 import com.bsth.service.gps.entity.*; 22 import com.bsth.service.gps.entity.*;
@@ -81,6 +83,10 @@ public class GpsServiceImpl implements GpsService { @@ -81,6 +83,10 @@ public class GpsServiceImpl implements GpsService {
81 @Autowired 83 @Autowired
82 ScheduleRealInfoRepository scheduleRealInfoRepository; 84 ScheduleRealInfoRepository scheduleRealInfoRepository;
83 85
  86 +
  87 + @Autowired
  88 + LineVersionsRepository lineVersionsRepository;
  89 +
84 // 历史gps查询 90 // 历史gps查询
85 @Override 91 @Override
86 public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) { 92 public List<Map<String, Object>> history(String device, Long startTime, Long endTime, int directions) {
@@ -222,7 +228,35 @@ public class GpsServiceImpl implements GpsService { @@ -222,7 +228,35 @@ public class GpsServiceImpl implements GpsService {
222 //查询GPS数据 228 //查询GPS数据
223 JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource()); 229 JdbcTemplate jdbcTemplate_ms = new JdbcTemplate(DBUtils_MS.getDataSource());
224 List<Map<String, Object>> dataList = jdbcTemplate_ms.queryForList(sql.toString()); 230 List<Map<String, Object>> dataList = jdbcTemplate_ms.queryForList(sql.toString());
225 - 231 + if (!dataList.isEmpty()){
  232 +
  233 + int lineId=Integer.parseInt(map_get_str(dataList.get(0), "LINE_ID"));
  234 + List<LineVersions> lvs=lineVersionsRepository.findBylineId(lineId);
  235 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
  236 + List<Map<String,Object>> vlist=new ArrayList<>();
  237 + Map<String,Object> vMap;
  238 + if (lvs!=null&&!lvs.isEmpty()){
  239 + for (LineVersions lv : lvs) {
  240 + vMap=new HashMap();
  241 + Long sd=lv.getStartDate().getTime();
  242 + Long ed=lv.getEndDate().getTime();
  243 + if (sd<st&&et<ed){
  244 + vMap.put("version",lv.getVersions());
  245 + vMap.put("vtime","all");
  246 + vlist.add(vMap);
  247 + }else if(sd<st&&et>ed&&st<ed){
  248 + vMap.put("version",lv.getVersions());
  249 + vMap.put("endTime",lv.getEndDate().getTime());
  250 + vlist.add(vMap);
  251 + }else if(st<sd&&et<ed&&sd<et){
  252 + vMap.put("version",lv.getVersions());
  253 + vMap.put("startTime",lv.getStartDate().getTime());
  254 + vlist.add(vMap);
  255 + }
  256 + }
  257 + }
  258 + rsMap.put("lineVerson",vlist);
  259 + }
226 Float lon, lat; 260 Float lon, lat;
227 Location bdLoc, gdLoc; 261 Location bdLoc, gdLoc;
228 int inOutStop; 262 int inOutStop;
@@ -714,6 +748,7 @@ public class GpsServiceImpl implements GpsService { @@ -714,6 +748,7 @@ public class GpsServiceImpl implements GpsService {
714 rs.put("outboundList", outboundList); 748 rs.put("outboundList", outboundList);
715 rs.put("sumMileage", new DecimalFormat(".##").format(sum / 1000)); 749 rs.put("sumMileage", new DecimalFormat(".##").format(sum / 1000));
716 rs.put("dcs", gpsMap.get("dcs")); 750 rs.put("dcs", gpsMap.get("dcs"));
  751 + rs.put("lineVerson",gpsMap.get("lineVerson"));
717 } catch (Exception e) { 752 } catch (Exception e) {
718 logger.error("", e); 753 logger.error("", e);
719 rs.put("status", ResponseCode.ERROR); 754 rs.put("status", ResponseCode.ERROR);
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
@@ -505,7 +505,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -505,7 +505,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
505 } 505 }
506 506
507 String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName() 507 String key = schedule.getXlBm() + "/" + schedule.getXlName() + "/" + schedule.getQdzName()
508 - + "/" + schedule.getFgsName() + "/" + schedule.getFgsBm(); 508 + + "/" + schedule.getFgsBm();
509 if(!keyMap.containsKey(key)) 509 if(!keyMap.containsKey(key))
510 keyMap.put(key, new ArrayList<ScheduleRealInfo>()); 510 keyMap.put(key, new ArrayList<ScheduleRealInfo>());
511 keyMap.get(key).add(schedule); 511 keyMap.get(key).add(schedule);
@@ -618,8 +618,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -618,8 +618,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
618 tempMap.put("line", split[1]); 618 tempMap.put("line", split[1]);
619 tempMap.put("qdz", split[2]); 619 tempMap.put("qdz", split[2]);
620 tempMap.put("company", companyName); 620 tempMap.put("company", companyName);
621 - tempMap.put("subCompany", split[3]);  
622 - tempMap.put("fgsbm", split[4]); 621 + tempMap.put("subCompany", subCompanyName);
  622 + tempMap.put("fgsbm", split[3]);
623 long jhInterval = 0l; 623 long jhInterval = 0l;
624 long sjInterval = 0l; 624 long sjInterval = 0l;
625 for(Long i : fcsjs) 625 for(Long i : fcsjs)
@@ -677,7 +677,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -677,7 +677,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
677 }else if(statu.equals("0")){ 677 }else if(statu.equals("0")){
678 List<Long> longList = new ArrayList<Long>(); 678 List<Long> longList = new ArrayList<Long>();
679 for(String key : keyList){ 679 for(String key : keyList){
680 - long xlBm = Long.valueOf(key.split("/")[4]) * 1000000l + Long.valueOf(key.split("/")[0]); 680 + long xlBm = Long.valueOf(key.split("/")[3]) * 1000000l + Long.valueOf(key.split("/")[0]);
681 if(!longList.contains(xlBm)) 681 if(!longList.contains(xlBm))
682 longList.add(xlBm); 682 longList.add(xlBm);
683 Collections.sort(longList); 683 Collections.sort(longList);
@@ -685,7 +685,7 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -685,7 +685,7 @@ public class BusIntervalServiceImpl implements BusIntervalService {
685 for(long xlBm : longList){ 685 for(long xlBm : longList){
686 for(String key : keyList){ 686 for(String key : keyList){
687 String[] split = key.split("/"); 687 String[] split = key.split("/");
688 - long kl = Long.valueOf(split[4]) * 1000000l + Long.valueOf(split[0]); 688 + long kl = Long.valueOf(split[3]) * 1000000l + Long.valueOf(split[0]);
689 if(kl == xlBm){ 689 if(kl == xlBm){
690 Map<String, Object> tempMap = new HashMap<String, Object>(); 690 Map<String, Object> tempMap = new HashMap<String, Object>();
691 List<Long> fcsjs = new ArrayList<Long>(); 691 List<Long> fcsjs = new ArrayList<Long>();
@@ -712,8 +712,8 @@ public class BusIntervalServiceImpl implements BusIntervalService { @@ -712,8 +712,8 @@ public class BusIntervalServiceImpl implements BusIntervalService {
712 tempMap.put("line", split[1]); 712 tempMap.put("line", split[1]);
713 tempMap.put("qdz", split[2]); 713 tempMap.put("qdz", split[2]);
714 tempMap.put("company", companyName); 714 tempMap.put("company", companyName);
715 - tempMap.put("subCompany", split[3]);  
716 - tempMap.put("fgsbm", split[4]); 715 + tempMap.put("subCompany", subCompanyName);
  716 + tempMap.put("fgsbm", split[3]);
717 tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/"); 717 tempMap.put("jhInterval", fcsjs.size()>0?df.format((double)fcsj/fcsjs.size()):"/");
718 tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/"); 718 tempMap.put("sjInterval", fcsjAs.size()>0?df.format((double)fcsjA/fcsjAs.size()):"/");
719 tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/"); 719 tempMap.put("MaxInterval", fcsjAs.size()>0?fcsjAs.get(fcsjAs.size() - 1):"/");
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
3 -import java.sql.PreparedStatement;  
4 -import java.sql.SQLException;  
5 -import java.text.ParseException;  
6 -import java.text.SimpleDateFormat;  
7 -import java.util.Date;  
8 -import java.util.HashMap;  
9 -import java.util.List;  
10 -import java.util.Map;  
11 -  
12 -import org.springframework.beans.factory.annotation.Autowired;  
13 -import org.springframework.jdbc.core.BatchPreparedStatementSetter;  
14 -import org.springframework.jdbc.core.JdbcTemplate;  
15 -import org.springframework.stereotype.Service;  
16 -import org.springframework.transaction.annotation.Transactional;  
17 -  
18 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
19 import com.alibaba.fastjson.JSONArray; 4 import com.alibaba.fastjson.JSONArray;
20 import com.bsth.common.ResponseCode; 5 import com.bsth.common.ResponseCode;
@@ -31,6 +16,20 @@ import com.bsth.repository.LsStationRouteRepository; @@ -31,6 +16,20 @@ import com.bsth.repository.LsStationRouteRepository;
31 import com.bsth.service.LineVersionsService; 16 import com.bsth.service.LineVersionsService;
32 import com.bsth.service.SectionRouteService; 17 import com.bsth.service.SectionRouteService;
33 import com.bsth.service.StationRouteService; 18 import com.bsth.service.StationRouteService;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  21 +import org.springframework.jdbc.core.JdbcTemplate;
  22 +import org.springframework.stereotype.Service;
  23 +import org.springframework.transaction.annotation.Transactional;
  24 +
  25 +import java.sql.PreparedStatement;
  26 +import java.sql.SQLException;
  27 +import java.text.ParseException;
  28 +import java.text.SimpleDateFormat;
  29 +import java.util.Date;
  30 +import java.util.HashMap;
  31 +import java.util.List;
  32 +import java.util.Map;
34 33
35 /** 34 /**
36 * 35 *
@@ -97,8 +96,10 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ @@ -97,8 +96,10 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
97 int statu = repository.update(id,line,lineCode,new java.sql.Date(startDate.getTime()), 96 int statu = repository.update(id,line,lineCode,new java.sql.Date(startDate.getTime()),
98 new java.sql.Date(endDate.getTime()),versions,status,remark); 97 new java.sql.Date(endDate.getTime()),versions,status,remark);
99 LineVersions upLineVersions = repository.findBylineIdAndVersions(line.getId(),versions); 98 LineVersions upLineVersions = repository.findBylineIdAndVersions(line.getId(),versions);
100 - upLineVersions.setEndDate(new java.sql.Date(startDate.getTime()));  
101 - repository.save(upLineVersions); 99 + if(upLineVersions != null){
  100 + upLineVersions.setEndDate(new java.sql.Date(startDate.getTime()));
  101 + repository.save(upLineVersions);
  102 + }
102 if (statu==1) { 103 if (statu==1) {
103 resultMap.put("status", ResponseCode.SUCCESS); 104 resultMap.put("status", ResponseCode.SUCCESS);
104 } else { 105 } else {
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
1 package com.bsth.service.impl; 1 package com.bsth.service.impl;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 -import com.bsth.entity.*; 4 +import com.bsth.entity.Line;
  5 +import com.bsth.entity.LsStationRoute;
  6 +import com.bsth.entity.Station;
  7 +import com.bsth.entity.StationRoute;
  8 +import com.bsth.entity.StationRouteCache;
5 import com.bsth.entity.search.CustomerSpecs; 9 import com.bsth.entity.search.CustomerSpecs;
6 -import com.bsth.repository.*; 10 +import com.bsth.repository.LineRepository;
  11 +import com.bsth.repository.LsStationRouteRepository;
  12 +import com.bsth.repository.SectionRouteRepository;
  13 +import com.bsth.repository.StationRepository;
  14 +import com.bsth.repository.StationRouteCacheRepository;
  15 +import com.bsth.repository.StationRouteRepository;
7 import com.bsth.service.StationRouteService; 16 import com.bsth.service.StationRouteService;
8 import com.bsth.util.ExcelUtil; 17 import com.bsth.util.ExcelUtil;
9 import com.bsth.util.FTPClientUtils; 18 import com.bsth.util.FTPClientUtils;
10 -import com.bsth.util.PackTarGZUtils;  
11 import com.bsth.util.Geo.GeoUtils; 19 import com.bsth.util.Geo.GeoUtils;
12 import com.bsth.util.Geo.Point; 20 import com.bsth.util.Geo.Point;
  21 +import com.bsth.util.PackTarGZUtils;
13 import com.bsth.util.db.DBUtils_MS; 22 import com.bsth.util.db.DBUtils_MS;
14 import com.google.common.base.Splitter; 23 import com.google.common.base.Splitter;
15 import org.springframework.beans.factory.annotation.Autowired; 24 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,13 +27,17 @@ import org.springframework.data.domain.Sort.Direction; @@ -18,13 +27,17 @@ import org.springframework.data.domain.Sort.Direction;
18 import org.springframework.stereotype.Service; 27 import org.springframework.stereotype.Service;
19 import org.springframework.transaction.annotation.Transactional; 28 import org.springframework.transaction.annotation.Transactional;
20 29
  30 +import javax.servlet.http.HttpServletResponse;
21 import java.io.ByteArrayInputStream; 31 import java.io.ByteArrayInputStream;
22 import java.io.File; 32 import java.io.File;
23 import java.io.InputStream; 33 import java.io.InputStream;
24 import java.text.DecimalFormat; 34 import java.text.DecimalFormat;
25 -import java.util.*;  
26 -  
27 -import javax.servlet.http.HttpServletResponse; 35 +import java.util.ArrayList;
  36 +import java.util.HashMap;
  37 +import java.util.Iterator;
  38 +import java.util.List;
  39 +import java.util.Map;
  40 +import java.util.Properties;
28 41
29 /** 42 /**
30 * 43 *
@@ -93,7 +106,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -93,7 +106,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
93 public Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp) { 106 public Map<String, Object> getSectionRouteExport(Integer id, HttpServletResponse resp) {
94 Map<String, Object> resultMap = new HashMap<String, Object>(); 107 Map<String, Object> resultMap = new HashMap<String, Object>();
95 try { 108 try {
96 - // List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>(); 109 + // List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
97 Map<String,Object> resultExcel = new HashMap<String,Object>();//导出参数的对象 110 Map<String,Object> resultExcel = new HashMap<String,Object>();//导出参数的对象
98 /* 添加表头*/ 111 /* 添加表头*/
99 List<String> title = new ArrayList<String>(); 112 List<String> title = new ArrayList<String>();
@@ -113,10 +126,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ @@ -113,10 +126,10 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
113 if(strtionList == null){ 126 if(strtionList == null){
114 logger.info("没有数据导,出用户信息失败!"); 127 logger.info("没有数据导,出用户信息失败!");
115 } else { 128 } else {
116 - 129 +
117 for (int i = 0; i < strtionList.size(); i++) { 130 for (int i = 0; i < strtionList.size(); i++) {
118 StationRoute station = strtionList.get(i); 131 StationRoute station = strtionList.get(i);
119 - 132 +
120 List<String> varList = new ArrayList<String>(); 133 List<String> varList = new ArrayList<String>();
121 varList.add(station.getLine().getId().toString()); 134 varList.add(station.getLine().getId().toString());
122 varList.add(station.getDirections().toString()); 135 varList.add(station.getDirections().toString());
src/main/java/com/bsth/service/impl/StationServiceImpl.java
@@ -1372,8 +1372,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem @@ -1372,8 +1372,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1372 // 匹配到了用数据库中的点替换 1372 // 匹配到了用数据库中的点替换
1373 if (GeoUtils.isPointInCircle(point, circle)) { 1373 if (GeoUtils.isPointInCircle(point, circle)) {
1374 map.put("name", s.getStationName().toString()); 1374 map.put("name", s.getStationName().toString());
1375 - map.put("potion_lng", points[0]);  
1376 - map.put("potion_lat", points[1]); 1375 + // 匹配到站点后用这个站点的名字,但是使用gps点作为中心点
  1376 +// map.put("potion_lng", points[0]);
  1377 +// map.put("potion_lat", points[1]);
  1378 + map.put("potion_lng", lon);
  1379 + map.put("potion_lat", lat);
1377 map.put("isHave", "true"); 1380 map.put("isHave", "true");
1378 map.put("id", s.getId()); 1381 map.put("id", s.getId());
1379 isMatch = true; 1382 isMatch = true;
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory; @@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
32 import org.springframework.beans.factory.annotation.Autowired; 32 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.data.domain.Sort; 33 import org.springframework.data.domain.Sort;
34 import org.springframework.data.domain.Sort.Direction; 34 import org.springframework.data.domain.Sort.Direction;
  35 +import org.springframework.security.core.context.SecurityContextHolder;
35 import org.springframework.stereotype.Service; 36 import org.springframework.stereotype.Service;
36 37
37 import java.io.*; 38 import java.io.*;
@@ -65,6 +66,10 @@ import java.util.regex.Pattern; @@ -65,6 +66,10 @@ import java.util.regex.Pattern;
65 public class TrafficManageServiceImpl implements TrafficManageService{ 66 public class TrafficManageServiceImpl implements TrafficManageService{
66 67
67 Logger logger = LoggerFactory.getLogger(this.getClass()); 68 Logger logger = LoggerFactory.getLogger(this.getClass());
  69 + // 运管处上传日志类型
  70 + public static final String UPLOAD_TYPE_SKB = "1";
  71 + public static final String UPLOAD_TYPE_XL = "2";
  72 + public static final String UPLOAD_TYPE_LD = "3";
68 73
69 // 线路repository 74 // 线路repository
70 @Autowired 75 @Autowired
@@ -170,7 +175,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -170,7 +175,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
170 @Override 175 @Override
171 public String setXL(String ids) { 176 public String setXL(String ids) {
172 String result = "failure"; 177 String result = "failure";
173 - StringBuffer sBuffer = new StringBuffer(); 178 + String xml ;
174 String[] idArray = ids.split(","); 179 String[] idArray = ids.split(",");
175 try { 180 try {
176 for (String id : idArray) { 181 for (String id : idArray) {
@@ -185,12 +190,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -185,12 +190,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
185 if(line == null){ 190 if(line == null){
186 continue; 191 continue;
187 } 192 }
188 - List<StationRoute> upStationsList ;// 上行站点路由集  
189 - List<StationRoute> downStationsList;// 下行站点路由集  
190 - List<Object[]> downPointList;// 下行站点集  
191 - List<Object[]> upPointList;// 上行站点集  
192 - sBuffer.append("<XLs>");  
193 - sBuffer.append("<XL>");  
194 if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){ 193 if(BasicData.lineId2ShangHaiCodeMap.get(line.getId()) == null){
195 return result; 194 return result;
196 } 195 }
@@ -200,56 +199,25 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -200,56 +199,25 @@ public class TrafficManageServiceImpl implements TrafficManageService{
200 if(lineInformation == null){ 199 if(lineInformation == null){
201 continue; 200 continue;
202 } 201 }
203 - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>");  
204 - sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>");  
205 - sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>");  
206 - sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>");  
207 - sBuffer.append("<QZLC>").append(lineInformation.getUpMileage()).append("</QZLC>");  
208 - sBuffer.append("<ZQLC>").append(lineInformation.getDownMileage()).append("</ZQLC>");  
209 - sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>");  
210 - sBuffer.append("<UPDATE_DATE>").append(sdfnyr.format(new Date())).append("</UPDATE_DATE>");  
211 -  
212 - // 循环添加站点信息  
213 - sBuffer.append("<StationList>");  
214 -  
215 - // 先查上行  
216 - upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0);  
217 - Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode());  
218 - int startId = 1;  
219 - startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap);  
220 - // 环线不查下行  
221 - if(line.getLinePlayType() != 1){  
222 - // 再查下行  
223 - downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1);  
224 - packagStationXml(downStationsList, sBuffer, startId,stationNumMap);  
225 - }  
226 - sBuffer.append("</StationList>");  
227 -  
228 - // 循环添加站点点位信息  
229 - sBuffer.append("<LinePointList>");  
230 - upPointList = sectionRepository.getSectionDirByLineId(line.getId(),0);  
231 - startId = 1;  
232 - startId = packagStationPointXml(upPointList, sBuffer, startId);  
233 - // 环线不查下行  
234 - if(line.getLinePlayType() != 1){  
235 - downPointList = sectionRepository.getSectionDirByLineId(line.getId(),1);  
236 - packagStationPointXml(downPointList, sBuffer, startId);  
237 - }  
238 - sBuffer.append("</LinePointList>");  
239 - sBuffer.append("</XL>");  
240 - sBuffer.append("</XLs>");  
241 - // 临时添加,后面删除  
242 - if(sBuffer.indexOf("<ZDXH>0</ZDXH>") != -1){ 202 + // 取得封装好的xml
  203 + xml = getSetXlXml(line,lineInformation);
  204 + // 站点序号不能为0,如果为0,则返回错误
  205 + if(xml.indexOf("<ZDXH>0</ZDXH>") != -1){
243 return "0"; 206 return "0";
244 } 207 }
  208 + String state;// 是否上传成功
245 // 调用上传方法 209 // 调用上传方法
246 - if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){ 210 + if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,xml).isSuccess()){
247 result = "success"; 211 result = "success";
  212 + state = "1";
248 }else{ 213 }else{
249 result = "failure"; 214 result = "failure";
  215 + state = "0";
250 } 216 }
251 - logger.info("setXL:"+sBuffer.toString()); 217 + logger.info("setXL:"+xml);
252 logger.info("setXL:"+result); 218 logger.info("setXL:"+result);
  219 + // 保存运管处上传记录
  220 + saveYgcUploadLog(line,xml,TrafficManageServiceImpl.UPLOAD_TYPE_XL,state);
253 } 221 }
254 } catch (Exception e) { 222 } catch (Exception e) {
255 logger.error("setXL:",e); 223 logger.error("setXL:",e);
@@ -422,10 +390,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -422,10 +390,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
422 HashMap logXlbmMap = new HashMap(); 390 HashMap logXlbmMap = new HashMap();
423 Results results = null; 391 Results results = null;
424 String str = "",xlbm; 392 String str = "",xlbm;
  393 + // 保存线路(运管处日志用)
  394 + Map<String , Line> logLineMap = null;
425 try { 395 try {
426 int counter = 0; // 计数器 396 int counter = 0; // 计数器
427 int per = 10; // 每几条线路上传一次路单 397 int per = 10; // 每几条线路上传一次路单
428 -  
429 List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date); 398 List<ScheduleRealInfo> list = scheduleRealInfoRepository.setLD(date);
430 List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLDGroup(date); 399 List<Map<String,Object>> listGroup = scheduleRealInfoRepository.setLDGroup(date);
431 Map<String,Object> map = new HashMap(); 400 Map<String,Object> map = new HashMap();
@@ -444,13 +413,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -444,13 +413,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{
444 if(counter % per == 0){ 413 if(counter % per == 0){
445 sf = new StringBuffer(); 414 sf = new StringBuffer();
446 sf.append("<DLDS>"); 415 sf.append("<DLDS>");
  416 + logLineMap = new HashMap<>();
447 } 417 }
448 counter ++; 418 counter ++;
449 xlbm = BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm")+""); 419 xlbm = BasicData.lineCode2ShangHaiCodeMap.get(schRealInfo.get("xlBm")+"");
450 - // 保存一次路单的线路编码,用于发送邮箱  
451 - if(logXlbmMap.get(xlbm) == null){ 420 + // 保存一线次路单的路编码,用于发送邮箱
  421 + if(xlbm != null && !xlbm.equals("null") && logXlbmMap.get(xlbm) == null){
452 logXlbmMap.put(xlbm,xlbm); 422 logXlbmMap.put(xlbm,xlbm);
453 } 423 }
  424 + logLineMap.put(line.getLineCode(),line);
454 sf.append("<DLD>"); 425 sf.append("<DLD>");
455 sf.append("<RQ>"+date+"</RQ>"); 426 sf.append("<RQ>"+date+"</RQ>");
456 sf.append("<XLBM>"+xlbm+"</XLBM>"); 427 sf.append("<XLBM>"+xlbm+"</XLBM>");
@@ -513,7 +484,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -513,7 +484,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
513 str = sf.toString().replace("'","");// 去掉'号 484 str = sf.toString().replace("'","");// 去掉'号
514 results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); 485 results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str));
515 // 记录日志 486 // 记录日志
516 - result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str); 487 + result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str,logLineMap);
517 } 488 }
518 } 489 }
519 // 每per条线路上传后剩下的数据再上传 490 // 每per条线路上传后剩下的数据再上传
@@ -521,9 +492,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -521,9 +492,9 @@ public class TrafficManageServiceImpl implements TrafficManageService{
521 sf.append("</DLDS>"); 492 sf.append("</DLDS>");
522 str = sf.toString().replace("'","");// 去掉'号 493 str = sf.toString().replace("'","");// 去掉'号
523 results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str)); 494 results = ssop.setLD(userNameOther, passwordOther, StringEscapeUtils.unescapeHtml(str));
  495 + // 记录日志
  496 + result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str,logLineMap);
524 } 497 }
525 - // 记录日志  
526 - result = logRecord(results,logXlbmMap,logXlbmSuccessMap,logXlbmFailureMap,logSuccess,logFailure,str);  
527 } catch (Exception e) { 498 } catch (Exception e) {
528 logger.error("setLD:",e); 499 logger.error("setLD:",e);
529 logFailure.append(e).append("<br/>"); 500 logFailure.append(e).append("<br/>");
@@ -558,21 +529,26 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -558,21 +529,26 @@ public class TrafficManageServiceImpl implements TrafficManageService{
558 * @param str 529 * @param str
559 */ 530 */
560 private String logRecord(Results results,HashMap logXlbmMap,HashMap logXlbmSuccessMap,HashMap logXlbmFailureMap,StringBuffer logSuccess, 531 private String logRecord(Results results,HashMap logXlbmMap,HashMap logXlbmSuccessMap,HashMap logXlbmFailureMap,StringBuffer logSuccess,
561 - StringBuffer logFailure,String str){ 532 + StringBuffer logFailure,String str,Map<String ,Line> logLineMap){
562 String result = "failure"; 533 String result = "failure";
  534 + String state;
563 // 记录日志 535 // 记录日志
564 if(results != null){ 536 if(results != null){
565 if(results.isSuccess()){// 上传成功 537 if(results.isSuccess()){// 上传成功
566 // 把上线成功的线路编码放入 logXlbmSuccessMap,并记录logSuccess 538 // 把上线成功的线路编码放入 logXlbmSuccessMap,并记录logSuccess
567 countSuccess += fillMailXlbmMap(logXlbmMap,logXlbmSuccessMap,logSuccess); 539 countSuccess += fillMailXlbmMap(logXlbmMap,logXlbmSuccessMap,logSuccess);
568 result = "success"; 540 result = "success";
  541 + state = "1";
569 }else{// 上传失败 542 }else{// 上传失败
570 // 把上线失败的线路编码放入 logXlbmFailureMap,并记录logFailure 543 // 把上线失败的线路编码放入 logXlbmFailureMap,并记录logFailure
571 countFailure += fillMailXlbmMap(logXlbmMap,logXlbmFailureMap,logFailure); 544 countFailure += fillMailXlbmMap(logXlbmMap,logXlbmFailureMap,logFailure);
572 result = "failure"; 545 result = "failure";
  546 + state = "0";
573 } 547 }
574 logger.info("setLD:"+str); 548 logger.info("setLD:"+str);
575 logger.info("setLD:"+result); 549 logger.info("setLD:"+result);
  550 + // 保存运管处上传记录
  551 + saveYgcUploadLog(logLineMap,str,TrafficManageServiceImpl.UPLOAD_TYPE_LD,state);
576 results = null; 552 results = null;
577 logXlbmMap = new HashMap(); 553 logXlbmMap = new HashMap();
578 } 554 }
@@ -946,7 +922,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -946,7 +922,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
946 @Override 922 @Override
947 public String setSKB(String ids) { 923 public String setSKB(String ids) {
948 String result = "上传失败,"; 924 String result = "上传失败,";
949 - StringBuffer sBuffer = new StringBuffer(); 925 + StringBuffer sBuffer = new StringBuffer("<SKBs>");
950 DecimalFormat df = new DecimalFormat("######0.000"); 926 DecimalFormat df = new DecimalFormat("######0.000");
951 Map<String,String> lsStationCode2NameMap = null; 927 Map<String,String> lsStationCode2NameMap = null;
952 Map<String, Integer> lsStationName2YgcNumber = null; 928 Map<String, Integer> lsStationName2YgcNumber = null;
@@ -962,7 +938,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -962,7 +938,6 @@ public class TrafficManageServiceImpl implements TrafficManageService{
962 LineInformation lineInformation; 938 LineInformation lineInformation;
963 Iterator<TTInfoDetail> ttInfoDetailIterator; 939 Iterator<TTInfoDetail> ttInfoDetailIterator;
964 HashMap<String,Object> param ; 940 HashMap<String,Object> param ;
965 - sBuffer.append("<SKBs>");  
966 HashMap<String,String> paramMap; 941 HashMap<String,String> paramMap;
967 HashMap<String,String> otherMap = new HashMap<>(); 942 HashMap<String,String> otherMap = new HashMap<>();
968 // 线路编码、周几执行、发车站点名称、发车站点序号、到达站点名称、到达站点序号 943 // 线路编码、周几执行、发车站点名称、发车站点序号、到达站点名称、到达站点序号
@@ -1113,29 +1088,103 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1113,29 +1088,103 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1113 logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber); 1088 logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber);
1114 } 1089 }
1115 sBuffer.append("</SKBs>"); 1090 sBuffer.append("</SKBs>");
1116 - if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){  
1117 - result = "上传成功";  
1118 - SKBUploadLogger skbUploadLogger ;  
1119 - SysUser user = SecurityUtils.getCurrentUser();  
1120 - // 保存时刻表上传记录  
1121 - for(TTInfo ttInfo1 : ttinfoList){  
1122 - skbUploadLogger = new SKBUploadLogger();  
1123 - skbUploadLogger.setTtInfo(ttInfo1);  
1124 - skbUploadLogger.setUser(user);  
1125 - skbUploadLoggerRepository.save(skbUploadLogger);  
1126 - }  
1127 - } 1091 + String state;// 是否上传成功
  1092 + if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
  1093 + result = "上传成功";
  1094 + state = "1";
  1095 + }else{// 上传失败
  1096 + result = "上传失败";
  1097 + state = "0";
  1098 + }
  1099 + // 保存运管处上传记录
  1100 + saveYgcUploadLog(ttinfoList,sBuffer.toString(),TrafficManageServiceImpl.UPLOAD_TYPE_SKB,state);
1128 } catch (Exception e) { 1101 } catch (Exception e) {
1129 logger.error("setSKB:", e); 1102 logger.error("setSKB:", e);
1130 e.printStackTrace(); 1103 e.printStackTrace();
1131 }finally{ 1104 }finally{
1132 - logger.info("setSKB:"+sBuffer.toString());  
1133 - logger.info("setSKB:"+result); 1105 + logger.info("setSKB:"+sBuffer.toString());
  1106 + logger.info("setSKB:"+result);
1134 } 1107 }
1135 return result; 1108 return result;
1136 } 1109 }
1137 1110
1138 /** 1111 /**
  1112 + * 保存上传运管处的日志
  1113 + * @param obj 参数
  1114 + * @param type 日志类型
  1115 + * @param xml 上传参数
  1116 + */
  1117 + private void saveYgcUploadLog(Object obj,String xml,String type,String state){
  1118 + SKBUploadLogger skbUploadLogger = new SKBUploadLogger();
  1119 + SysUser user;
  1120 + // 如果不是人为上传,SysUser则为空,设置上传人员为管理员
  1121 + if(SecurityContextHolder.getContext() == null || SecurityContextHolder.getContext().getAuthentication() == null){
  1122 + user = new SysUser();
  1123 + user.setId(1);
  1124 + }else{// 获取上传人员
  1125 + user = SecurityUtils.getCurrentUser();
  1126 + }
  1127 + // 最大的字符长度
  1128 + int maxLength = 60000;
  1129 + int cutLength = 50000;// 需要截取的字符长度
  1130 + String xml_sub = null;
  1131 + skbUploadLogger.setType(type);// 设置类型
  1132 + // 判断xml是否超长,如果超长,则截取
  1133 + if(xml != null && xml.length() > maxLength){
  1134 + int xmlLength = xml.length();
  1135 + int cutCount = xmlLength / cutLength + (xmlLength % cutLength > 0 ? 1 : 0);
  1136 + if(cutCount > 2){
  1137 + xml = "由于上传参数内容超长,请查看服务器的系统日志";
  1138 + }else if(cutCount == 2){
  1139 + xml_sub =xml.substring(cutLength);
  1140 + xml = xml.substring(0,cutLength);
  1141 + }else{
  1142 + // 不做处理
  1143 + }
  1144 + }
  1145 + skbUploadLogger.setUploadXml(xml);// 上传的参数
  1146 + skbUploadLogger.setUploadXmlSub(xml_sub);
  1147 + skbUploadLogger.setState(state);// 状态:是否成功
  1148 + skbUploadLogger.setUser(user);
  1149 + // 时刻表
  1150 + if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_SKB)){
  1151 + List<TTInfo> ttInfoList = (List<TTInfo>)obj;
  1152 + String name = "";
  1153 + Line line = null;
  1154 + for(TTInfo ttInfo : ttInfoList){
  1155 + name += ttInfo.getName() + " ";
  1156 + line = ttInfo.getXl();
  1157 + }
  1158 + skbUploadLogger.setLine(line);
  1159 + skbUploadLogger.setUser(user);
  1160 + skbUploadLogger.setName(name);
  1161 + skbUploadLoggerRepository.save(skbUploadLogger);
  1162 + }else{
  1163 + if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_XL)){
  1164 + Line line = (Line) obj;
  1165 + String name = line.getName() + "线路停靠站上传";
  1166 + skbUploadLogger.setLine(line);
  1167 + skbUploadLogger.setName(name);
  1168 + skbUploadLoggerRepository.save(skbUploadLogger);
  1169 + }else if(type.equals(TrafficManageServiceImpl.UPLOAD_TYPE_LD)){
  1170 + Map<String ,Line> logLineMap = (Map<String ,Line> )obj;
  1171 + for (String key : logLineMap.keySet()) {
  1172 + Line line = logLineMap.get(key);
  1173 + String name = line.getName() + "路单上传";
  1174 + skbUploadLogger = new SKBUploadLogger();
  1175 + skbUploadLogger.setType(type);// 设置类型
  1176 + skbUploadLogger.setUploadXml(xml);// 上传的参数
  1177 + skbUploadLogger.setUploadXmlSub(xml_sub);
  1178 + skbUploadLogger.setState(state);// 状态:是否成功
  1179 + skbUploadLogger.setUser(user);
  1180 + skbUploadLogger.setLine(line);
  1181 + skbUploadLogger.setName(name);
  1182 + skbUploadLoggerRepository.save(skbUploadLogger);
  1183 + }
  1184 + }
  1185 + }
  1186 + }
  1187 + /**
1139 * 上传线路人员车辆配置信息 1188 * 上传线路人员车辆配置信息
1140 */ 1189 */
1141 @Override 1190 @Override
@@ -1640,4 +1689,50 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1640,4 +1689,50 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1640 } 1689 }
1641 return tempStationName2YgcNumber; 1690 return tempStationName2YgcNumber;
1642 } 1691 }
  1692 +
  1693 + private String getSetXlXml(Line line,LineInformation lineInformation){
  1694 + StringBuffer sBuffer = new StringBuffer();
  1695 + List<StationRoute> upStationsList ;// 上行站点路由集
  1696 + List<StationRoute> downStationsList;// 下行站点路由集
  1697 + List<Object[]> downPointList;// 下行站点集
  1698 + List<Object[]> upPointList;// 上行站点集
  1699 + sBuffer.append("<XLs>");
  1700 + sBuffer.append("<XL>");
  1701 + sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(line.getId())).append("</XLBM>");
  1702 + sBuffer.append("<XLMC>").append(line.getName()).append("</XLMC>");
  1703 + sBuffer.append("<QDZ>").append(line.getStartStationName()).append("</QDZ>");
  1704 + sBuffer.append("<ZDZ>").append(line.getEndStationName()).append("</ZDZ>");
  1705 + sBuffer.append("<QZLC>").append(lineInformation.getUpMileage()).append("</QZLC>");
  1706 + sBuffer.append("<ZQLC>").append(lineInformation.getDownMileage()).append("</ZQLC>");
  1707 + sBuffer.append("<XLGH>").append(line.getLinePlayType()).append("</XLGH>");
  1708 + sBuffer.append("<UPDATE_DATE>").append(sdfnyr.format(new Date())).append("</UPDATE_DATE>");
  1709 + // 循环添加站点信息
  1710 + sBuffer.append("<StationList>");
  1711 + // 先查上行
  1712 + upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0);
  1713 + Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode());
  1714 + int startId = 1;
  1715 + startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap);
  1716 + // 环线不查下行
  1717 + if(line.getLinePlayType() != 1){
  1718 + // 再查下行
  1719 + downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1);
  1720 + packagStationXml(downStationsList, sBuffer, startId,stationNumMap);
  1721 + }
  1722 + sBuffer.append("</StationList>");
  1723 + // 循环添加站点点位信息
  1724 + sBuffer.append("<LinePointList>");
  1725 + upPointList = sectionRepository.getSectionDirByLineId(line.getId(),0);
  1726 + startId = 1;
  1727 + startId = packagStationPointXml(upPointList, sBuffer, startId);
  1728 + // 环线不查下行
  1729 + if(line.getLinePlayType() != 1){
  1730 + downPointList = sectionRepository.getSectionDirByLineId(line.getId(),1);
  1731 + packagStationPointXml(downPointList, sBuffer, startId);
  1732 + }
  1733 + sBuffer.append("</LinePointList>");
  1734 + sBuffer.append("</XL>");
  1735 + sBuffer.append("</XLs>");
  1736 + return sBuffer.toString();
  1737 + }
1643 } 1738 }
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
@@ -662,82 +662,97 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -662,82 +662,97 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
662 @Override 662 @Override
663 public List<Dlb> listDlb(Map<String, Object> map) { 663 public List<Dlb> listDlb(Map<String, Object> map) {
664 // TODO Auto-generated method stub 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 -  
674 - if(nbbm.trim()!=""){  
675 - stringList.add(nbbm);  
676 - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);  
677 - }else{  
678 - //全部  
679 - if(sxtj.equals("0")){  
680 - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);  
681 - for (int i = 0; i < objectLists.size(); i++) {  
682 - String clbm=objectLists.get(i)[0].toString();  
683 - stringList.add(clbm);  
684 - }  
685 - if(stringList.size()>0){  
686 - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList);  
687 - }  
688 - }else{  
689 - List<Object[]> objectLists;  
690 - if(sxtj.equals("3")){  
691 - //有加油没里程  
692 - objectLists=repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm); 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);
693 for (int i = 0; i < objectLists.size(); i++) { 687 for (int i = 0; i < objectLists.size(); i++) {
694 - String clbm=objectLists.get(i)[0].toString();  
695 - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());  
696 - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());  
697 - if(jzl>0 && zlc<=0){  
698 - stringList.add(clbm);  
699 - }  
700 - 688 + String clbm = objectLists.get(i)[0].toString();
  689 + stringList.add(clbm);
701 } 690 }
702 -  
703 - }else if(sxtj.equals("4")){  
704 - //有里程没加油  
705 - objectLists=repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);  
706 - for (int i = 0; i < objectLists.size(); i++) {  
707 - String clbm=objectLists.get(i)[0].toString();  
708 - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());  
709 - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());  
710 - if(zlc>0 && jzl<=0){  
711 - stringList.add(clbm);  
712 - }  
713 - 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);
714 } 696 }
715 - }else{  
716 - objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);  
717 - for (int i = 0; i < objectLists.size(); i++) {  
718 - String clbm=objectLists.get(i)[0].toString();  
719 - int cs=Integer.parseInt(objectLists.get(i)[1].toString());  
720 - //一车一单  
721 - if(sxtj.equals("1")){  
722 - if(cs==1){ 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) {
723 stringList.add(clbm); 707 stringList.add(clbm);
724 } 708 }
725 - }  
726 - //一车多单  
727 - if(sxtj.equals("2")){  
728 - if(cs>1){ 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) {
729 stringList.add(clbm); 720 stringList.add(clbm);
730 } 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 + }
731 } 741 }
732 } 742 }
733 - }  
734 -  
735 - if(stringList.size()>0){  
736 - listDlb=repository.listDlb(rq, gsbm, fgsbm, xlbm, stringList); 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 + }
737 } 750 }
738 } 751 }
  752 + } catch (ParseException e) {
  753 + // TODO Auto-generated catch block
  754 + e.printStackTrace();
739 } 755 }
740 -  
741 return listDlb; 756 return listDlb;
742 } 757 }
743 758
@@ -751,86 +766,97 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -751,86 +766,97 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
751 String xlbm = map.get("xlbm_like").toString().trim(); 766 String xlbm = map.get("xlbm_like").toString().trim();
752 String nbbm = map.get("nbbm_eq").toString(); 767 String nbbm = map.get("nbbm_eq").toString();
753 String sxtj = map.get("sxtj").toString(); 768 String sxtj = map.get("sxtj").toString();
754 - if (nbbm.trim() != "") {  
755 - stringList.add(nbbm);  
756 - } else {  
757 - if (!sxtj.equals("0")) {  
758 - List<Object[]> objectLists;  
759 - if (sxtj.equals("3")) {  
760 - // 有加油没里程  
761 - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);  
762 - for (int i = 0; i < objectLists.size(); i++) {  
763 - String clbm = objectLists.get(i)[0].toString();  
764 - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());  
765 - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());  
766 - if (jzl > 0 && zlc <= 0) {  
767 - stringList.add(clbm);  
768 - }  
769 -  
770 - } 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 + }
771 788
772 - } else if (sxtj.equals("4")) {  
773 - // 有里程没加油  
774 - objectLists = repository.checkNbmmDl(rq, gsbm, fgsbm, xlbm, nbbm);  
775 - for (int i = 0; i < objectLists.size(); i++) {  
776 - String clbm = objectLists.get(i)[0].toString();  
777 - double jzl = Double.parseDouble(objectLists.get(i)[1].toString());  
778 - double zlc = Double.parseDouble(objectLists.get(i)[2].toString());  
779 - if (zlc > 0 && jzl <= 0) {  
780 - stringList.add(clbm);  
781 } 789 }
782 790
783 - }  
784 - } else {  
785 - objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);  
786 - for (int i = 0; i < objectLists.size(); i++) {  
787 - String clbm = objectLists.get(i)[0].toString();  
788 - int cs = Integer.parseInt(objectLists.get(i)[1].toString());  
789 - // 一车一单  
790 -  
791 - if (sxtj.equals("1")) {  
792 - if (cs == 1) { 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) {
793 stringList.add(clbm); 799 stringList.add(clbm);
794 } 800 }
  801 +
795 } 802 }
796 - // 一车多单  
797 - if (sxtj.equals("2")) {  
798 - if (cs > 1) {  
799 - stringList.add(clbm); 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 + }
800 } 820 }
801 } 821 }
802 } 822 }
803 } 823 }
804 } 824 }
805 - }  
806 - List<Object[]> sumYlbList = new ArrayList<Object[]>();  
807 if (sxtj.equals("0")) { 825 if (sxtj.equals("0")) {
808 sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm); 826 sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);
809 } else { 827 } else {
810 if (stringList.size() > 0) { 828 if (stringList.size() > 0) {
811 - 829 +
812 // String strings[]=new String[stringList.size()]; 830 // String strings[]=new String[stringList.size()];
813 // for(int i=0;i<stringList.size();i++){ 831 // for(int i=0;i<stringList.size();i++){
814 // strings[i]=stringList.get(i); 832 // strings[i]=stringList.get(i);
815 // } 833 // }
816 - sumYlbList = repository.sumDlb(rq, gsbm, fgsbm, xlbm, stringList);  
817 - }  
818 -// else {  
819 -// sumYlbList = repository.sumDlb2(rq, gsbm, fgsbm, xlbm, nbbm);  
820 -// }  
821 - }  
822 - Double jzl = 0.0, yh = 0.0, sh = 0.0;  
823 - for (int i = 0; i < sumYlbList.size(); i++) {  
824 - jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));  
825 - yh = Arith.add(yh, Double.valueOf(sumYlbList.get(i)[1].toString()));  
826 - sh = Arith.add(sh, Double.valueOf(sumYlbList.get(i)[2].toString())); 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 + // }
827 } 843 }
828 -  
829 - Map<String, Object> sumMap = new HashMap<String, Object>();  
830 - sumMap.put("jzl", jzl);  
831 - sumMap.put("yh", yh);  
832 - sumMap.put("sh", sh);  
833 - return sumMap; 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;
834 } 860 }
835 861
836 862
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -1108,6 +1108,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1108,6 +1108,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1108 String xlbm=map.get("xlbm_like").toString().trim(); 1108 String xlbm=map.get("xlbm_like").toString().trim();
1109 String nbbm=map.get("nbbm_eq").toString(); 1109 String nbbm=map.get("nbbm_eq").toString();
1110 String sxtj=map.get("sxtj").toString(); 1110 String sxtj=map.get("sxtj").toString();
  1111 + String type=map.get("type").toString();
  1112 + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1113 + List<Object[]> sumYlbList=new ArrayList<Object[]>();
  1114 + try {
1111 if(nbbm.trim()!=""){ 1115 if(nbbm.trim()!=""){
1112 stringList.add(nbbm); 1116 stringList.add(nbbm);
1113 }else{ 1117 }else{
@@ -1160,7 +1164,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1160,7 +1164,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1160 } 1164 }
1161 } 1165 }
1162 } 1166 }
1163 - List<Object[]> sumYlbList=new ArrayList<Object[]>();  
1164 if(sxtj.equals("0")){ 1167 if(sxtj.equals("0")){
1165 sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm); 1168 sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm,nbbm);
1166 }else{ 1169 }else{
@@ -1170,14 +1173,20 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1170,14 +1173,20 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1170 // for(int i=0;i<stringList.size();i++){ 1173 // for(int i=0;i<stringList.size();i++){
1171 // strings[i]=stringList.get(i); 1174 // strings[i]=stringList.get(i);
1172 // } 1175 // }
1173 - sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList); 1176 + if (type.equals("1"))
  1177 + sumYlbList=repository.sumYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1178 + else
  1179 + sumYlbList=repository.sumYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1174 } 1180 }
1175 // else{ 1181 // else{
1176 // sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm); 1182 // sumYlbList=repository.sumYlb2(rq, gsbm, fgsbm, xlbm, nbbm);
1177 // } 1183 // }
1178 1184
1179 } 1185 }
1180 - 1186 + } catch (ParseException e) {
  1187 + // TODO Auto-generated catch block
  1188 + e.printStackTrace();
  1189 + }
1181 Double jzl=0.0,yh=0.0,sh=0.0; 1190 Double jzl=0.0,yh=0.0,sh=0.0;
1182 for (int i = 0; i < sumYlbList.size(); i++) { 1191 for (int i = 0; i < sumYlbList.size(); i++) {
1183 jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString())); 1192 jzl = Arith.add(jzl, Double.valueOf(sumYlbList.get(i)[0].toString()));
@@ -1189,6 +1198,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1189,6 +1198,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1189 sumMap.put("jzl", jzl); 1198 sumMap.put("jzl", jzl);
1190 sumMap.put("yh", yh); 1199 sumMap.put("yh", yh);
1191 sumMap.put("sh", sh); 1200 sumMap.put("sh", sh);
  1201 +
1192 // String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb " 1202 // String sql="select sum(jzl),sum(yh),sum(sh) from bsth_c_ylb "
1193 // + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) " 1203 // + " where to_days('"+map.get("rq").toString()+"')=to_days(rq) "
1194 // + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' " 1204 // + " and ssgsdm like '%"+map.get("ssgsdm_like").toString()+"%' "
@@ -1206,96 +1216,118 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -1206,96 +1216,118 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1206 @Override 1216 @Override
1207 public List<Ylb> listYlb(Map<String, Object> map) { 1217 public List<Ylb> listYlb(Map<String, Object> map) {
1208 // TODO Auto-generated method stub 1218 // TODO Auto-generated method stub
1209 - List<Ylb> listYlb=new ArrayList<Ylb>();  
1210 - List<String> stringList=new ArrayList<String>();  
1211 - String rq=map.get("rq").toString();  
1212 - String gsbm=map.get("ssgsdm_like").toString();  
1213 - String fgsbm=map.get("fgsdm_like").toString();  
1214 - String xlbm=map.get("xlbm_like").toString().trim();  
1215 - String nbbm=map.get("nbbm_eq").toString();  
1216 - String sxtj=map.get("sxtj").toString();  
1217 - if(nbbm.trim()!=""){  
1218 - stringList.add(nbbm);  
1219 - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);  
1220 - if(objectLists.size()>0){  
1221 - int cs=Integer.parseInt(objectLists.get(0)[1].toString());  
1222 - if(sxtj.equals("1")){  
1223 - if(cs==1){  
1224 - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);  
1225 - }  
1226 - }else if(sxtj.equals("2")){  
1227 - if(cs>1){  
1228 - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); 1219 + List<Ylb> listYlb = new ArrayList<Ylb>();
  1220 + try {
  1221 + List<String> stringList = new ArrayList<String>();
  1222 + String rq = map.get("rq").toString();
  1223 + String gsbm = map.get("ssgsdm_like").toString();
  1224 + String fgsbm = map.get("fgsdm_like").toString();
  1225 + String xlbm = map.get("xlbm_like").toString().trim();
  1226 + String nbbm = map.get("nbbm_eq").toString();
  1227 + String sxtj = map.get("sxtj").toString();
  1228 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  1229 + String type = map.get("type").toString();
  1230 + if (nbbm.trim() != "") {
  1231 + stringList.add(nbbm);
  1232 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  1233 + if (objectLists.size() > 0) {
  1234 + int cs = Integer.parseInt(objectLists.get(0)[1].toString());
  1235 + if (sxtj.equals("1")) {
  1236 + if (cs == 1) {
  1237 + if (type.equals("1"))
  1238 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1239 + else
  1240 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1241 +
  1242 + }
  1243 + } else if (sxtj.equals("2")) {
  1244 + if (cs > 1) {
  1245 + if (type.equals("1"))
  1246 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1247 + else
  1248 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1249 + }
  1250 + } else {
  1251 + if (type.equals("1"))
  1252 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1253 + else
  1254 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1229 } 1255 }
1230 - }else{  
1231 - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);  
1232 - }  
1233 - }  
1234 -  
1235 - }else{  
1236 - //全部  
1237 - if(sxtj.equals("0")){  
1238 - List<Object[]> objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);  
1239 - for (int i = 0; i < objectLists.size(); i++) {  
1240 - String clbm=objectLists.get(i)[0].toString();  
1241 - stringList.add(clbm);  
1242 - }  
1243 - if(stringList.size()>0){  
1244 - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);  
1245 } 1256 }
1246 - }else{  
1247 - List<Object[]> objectLists;  
1248 - if(sxtj.equals("3")){  
1249 - //有加油没里程  
1250 - objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm); 1257 +
  1258 + } else {
  1259 + // 全部
  1260 + if (sxtj.equals("0")) {
  1261 + List<Object[]> objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
1251 for (int i = 0; i < objectLists.size(); i++) { 1262 for (int i = 0; i < objectLists.size(); i++) {
1252 - String clbm=objectLists.get(i)[0].toString();  
1253 - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());  
1254 - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());  
1255 - if(jzl>0 && zlc<=0){  
1256 - stringList.add(clbm);  
1257 - }  
1258 - 1263 + String clbm = objectLists.get(i)[0].toString();
  1264 + stringList.add(clbm);
1259 } 1265 }
1260 -  
1261 - }else if(sxtj.equals("4")){  
1262 - //有里程没加油  
1263 - objectLists=repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);  
1264 - for (int i = 0; i < objectLists.size(); i++) {  
1265 - String clbm=objectLists.get(i)[0].toString();  
1266 - double jzl=Double.parseDouble(objectLists.get(i)[1].toString());  
1267 - double zlc=Double.parseDouble(objectLists.get(i)[2].toString());  
1268 - if(zlc>0 && jzl<=0){  
1269 - stringList.add(clbm);  
1270 - }  
1271 - 1266 + if (stringList.size() > 0) {
  1267 + if (type.equals("1"))
  1268 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1269 + else
  1270 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
1272 } 1271 }
1273 - }else{  
1274 - objectLists=repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm,nbbm);  
1275 - for (int i = 0; i < objectLists.size(); i++) {  
1276 - String clbm=objectLists.get(i)[0].toString();  
1277 - int cs=Integer.parseInt(objectLists.get(i)[1].toString());  
1278 - //一车一单  
1279 - if(sxtj.equals("1")){  
1280 - if(cs==1){ 1272 + } else {
  1273 + List<Object[]> objectLists;
  1274 + if (sxtj.equals("3")) {
  1275 + // 有加油没里程
  1276 + objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  1277 + for (int i = 0; i < objectLists.size(); i++) {
  1278 + String clbm = objectLists.get(i)[0].toString();
  1279 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  1280 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  1281 + if (jzl > 0 && zlc <= 0) {
1281 stringList.add(clbm); 1282 stringList.add(clbm);
1282 } 1283 }
1283 - }  
1284 - //一车多单  
1285 - if(sxtj.equals("2")){  
1286 - if(cs>1){ 1284 +
  1285 + }
  1286 +
  1287 + } else if (sxtj.equals("4")) {
  1288 + // 有里程没加油
  1289 + objectLists = repository.checkNbmmYl(rq, gsbm, fgsbm, xlbm, nbbm);
  1290 + for (int i = 0; i < objectLists.size(); i++) {
  1291 + String clbm = objectLists.get(i)[0].toString();
  1292 + double jzl = Double.parseDouble(objectLists.get(i)[1].toString());
  1293 + double zlc = Double.parseDouble(objectLists.get(i)[2].toString());
  1294 + if (zlc > 0 && jzl <= 0) {
1287 stringList.add(clbm); 1295 stringList.add(clbm);
1288 } 1296 }
  1297 +
  1298 + }
  1299 + } else {
  1300 + objectLists = repository.checkNbmmNum(rq, gsbm, fgsbm, xlbm, nbbm);
  1301 + for (int i = 0; i < objectLists.size(); i++) {
  1302 + String clbm = objectLists.get(i)[0].toString();
  1303 + int cs = Integer.parseInt(objectLists.get(i)[1].toString());
  1304 + // 一车一单
  1305 + if (sxtj.equals("1")) {
  1306 + if (cs == 1) {
  1307 + stringList.add(clbm);
  1308 + }
  1309 + }
  1310 + // 一车多单
  1311 + if (sxtj.equals("2")) {
  1312 + if (cs > 1) {
  1313 + stringList.add(clbm);
  1314 + }
  1315 + }
1289 } 1316 }
1290 } 1317 }
1291 - }  
1292 -  
1293 - if(stringList.size()>0){  
1294 - listYlb=repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList); 1318 +
  1319 + if (stringList.size() > 0) {
  1320 + if (type.equals("1"))
  1321 + listYlb = repository.listYlb(rq, gsbm, fgsbm, xlbm, stringList);
  1322 + else
  1323 + listYlb = repository.listYlb_s(sdf.parse(rq+" 00:00:00"), gsbm, fgsbm, xlbm, stringList);
  1324 + }
1295 } 1325 }
1296 } 1326 }
  1327 + } catch (ParseException e) {
  1328 + // TODO Auto-generated catch block
  1329 + e.printStackTrace();
1297 } 1330 }
1298 -  
1299 return listYlb; 1331 return listYlb;
1300 } 1332 }
1301 1333
src/main/java/com/bsth/service/realcontrol/RealMapService.java
@@ -12,6 +12,8 @@ public interface RealMapService { @@ -12,6 +12,8 @@ public interface RealMapService {
12 12
13 Map<String, Object> findRouteByLine(String idx); 13 Map<String, Object> findRouteByLine(String idx);
14 14
  15 + Map<String, Object> findRouteAndVersionByLine(String idx);
  16 +
15 Map<String,Object> findRouteAndStationByLine(String lineCode); 17 Map<String,Object> findRouteAndStationByLine(String lineCode);
16 18
17 Map<String,Object> multiSectionRoute(String codeIdx); 19 Map<String,Object> multiSectionRoute(String codeIdx);
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
@@ -193,4 +193,5 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L @@ -193,4 +193,5 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
193 193
194 List<Map<String, Object>> scheduleCorrectionReport(String gsdm, String fgsdm, 194 List<Map<String, Object>> scheduleCorrectionReport(String gsdm, String fgsdm,
195 String line, String date, String date2); 195 String line, String date, String date2);
  196 + Integer isCircleQdz(String clzbh,String sdr,String xlbm,String qdzCode);
196 } 197 }
src/main/java/com/bsth/service/realcontrol/dto/SectionRouteCoords.java
@@ -24,6 +24,16 @@ public class SectionRouteCoords { @@ -24,6 +24,16 @@ public class SectionRouteCoords {
24 24
25 private Float sectionTime; 25 private Float sectionTime;
26 26
  27 + private Integer versions;
  28 +
  29 + public Integer getVersions() {
  30 + return versions;
  31 + }
  32 +
  33 + public void setVersions(Integer versions) {
  34 + this.versions = versions;
  35 + }
  36 +
27 public int getId() { 37 public int getId() {
28 return id; 38 return id;
29 } 39 }
src/main/java/com/bsth/service/realcontrol/impl/RealMapServiceImpl.java
@@ -42,7 +42,7 @@ public class RealMapServiceImpl implements RealMapService { @@ -42,7 +42,7 @@ public class RealMapServiceImpl implements RealMapService {
42 } 42 }
43 inStr = " (" + inStr.substring(1) + ")"; 43 inStr = " (" + inStr.substring(1) + ")";
44 44
45 - String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,s.G_LONX,s.G_LATY,s.RADIUS,s.SHAPES_TYPE,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID, r.STATION_ROUTE_CODE from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStr + " and r.destroy=0"; 45 + String sql = "select r.LINE_CODE,r.STATION_NAME,r.STATION_CODE,r.STATION_MARK,r.DIRECTIONS,r.DISTANCES,r.TO_TIME, r.VERSIONS,s.G_LONX,s.G_LATY,s.RADIUS,s.SHAPES_TYPE,ST_AsText(s.G_POLYGON_GRID) as G_POLYGON_GRID, r.STATION_ROUTE_CODE,r.versions from bsth_c_stationroute r inner join bsth_c_station s on r.station=s.id where r.line_code in " + inStr + " and r.destroy=0";
46 46
47 List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class)); 47 List<StationSpatialData> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(StationSpatialData.class));
48 rs.put("status", ResponseCode.SUCCESS); 48 rs.put("status", ResponseCode.SUCCESS);
@@ -84,7 +84,7 @@ public class RealMapServiceImpl implements RealMapService { @@ -84,7 +84,7 @@ public class RealMapServiceImpl implements RealMapService {
84 } 84 }
85 inCond.deleteCharAt(inCond.length() - 1).append(")"); 85 inCond.deleteCharAt(inCond.length() - 1).append(")");
86 86
87 - String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code"; 87 + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME,r.versions FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code";
88 List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class)); 88 List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class));
89 89
90 //排序 90 //排序
@@ -133,6 +133,64 @@ public class RealMapServiceImpl implements RealMapService { @@ -133,6 +133,64 @@ public class RealMapServiceImpl implements RealMapService {
133 } 133 }
134 134
135 @Override 135 @Override
  136 + public Map<String, Object> findRouteAndVersionByLine(String idx) {
  137 + Map<String, Object> rs = new HashMap<>();
  138 + StringBuilder inCond = new StringBuilder("(");
  139 + List<String> codeList = Splitter.on(",").splitToList(idx);
  140 + for(String lineCode : codeList){
  141 + inCond.append("'" + lineCode + "',");
  142 + }
  143 + inCond.deleteCharAt(inCond.length() - 1).append(")");
  144 +
  145 + String sql = "SELECT r.ID,r.LINE_CODE,r.SECTION_CODE,r.SECTIONROUTE_CODE,r.DIRECTIONS,s.SECTION_NAME,ST_AsText(s.GSECTION_VECTOR) GSECTION_VECTOR,s.SECTION_DISTANCE,s.SECTION_TIME,r.versions FROM bsth_c_sectionroute r INNER JOIN bsth_c_section s on r.section_code=s.section_code WHERE r.line_code in "+inCond.toString()+" and r.destroy=0 order by sectionroute_code";
  146 + List<SectionRouteCoords> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SectionRouteCoords.class));
  147 +
  148 + //排序
  149 + Collections.sort(list, new Comparator<SectionRouteCoords>() {
  150 + @Override
  151 + public int compare(SectionRouteCoords o1, SectionRouteCoords o2) {
  152 + return Integer.parseInt(o1.getSectionrouteCode()) - Integer.parseInt(o2.getSectionrouteCode());
  153 + }
  154 + });
  155 +
  156 + ArrayListMultimap<String, SectionRouteCoords> listMultimap = ArrayListMultimap.create();
  157 + for (SectionRouteCoords sr : list) {
  158 + //按lineCode 分组
  159 + listMultimap.put(sr.getLineCode()+"_"+sr.getVersions(), sr);
  160 + }
  161 + //坐标转换
  162 + Map<String, Object> subMap;
  163 + Set<String> ks = listMultimap.keySet();
  164 + List<SectionRouteCoords> sublist;
  165 + List<String> upList,downList;
  166 + String vectorStr = "";
  167 + for(String k : ks){
  168 + subMap = new HashMap<>();
  169 + sublist = listMultimap.get(k);
  170 + upList = new ArrayList<>();
  171 + downList = new ArrayList<>();
  172 + for(SectionRouteCoords sr : sublist){
  173 + vectorStr = sr.getGsectionVector();
  174 + vectorStr = vectorStr.substring(11, vectorStr.length() - 2);
  175 + if (sr.getDirections() == 0)
  176 + upList.add(vectorStr);
  177 + else
  178 + downList.add(vectorStr);
  179 + }
  180 + subMap.put("up", upList);
  181 + //subMap.put("upJoins", jointCoords(upList));
  182 + subMap.put("down", downList);
  183 + subMap.put("up_bd", multiWgsToBd(upList));
  184 + subMap.put("down_bd", multiWgsToBd(downList));
  185 + subMap.put("up_gcj", multiWgsToGcj(upList));
  186 + subMap.put("down_gcj", multiWgsToGcj(downList));
  187 +
  188 + rs.put(k, subMap);
  189 + }
  190 + return rs;
  191 + }
  192 +
  193 + @Override
136 public Map<String, Object> findRouteAndStationByLine(String lineCode) { 194 public Map<String, Object> findRouteAndStationByLine(String lineCode) {
137 Map<String, Object> rs = new HashMap<>(); 195 Map<String, Object> rs = new HashMap<>();
138 try { 196 try {
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -5606,8 +5606,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -5606,8 +5606,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5606 ScheduleRealInfo leftSch, rightSch = null; 5606 ScheduleRealInfo leftSch, rightSch = null;
5607 for (int i = 0; i < largeList.size(); i++) { 5607 for (int i = 0; i < largeList.size(); i++) {
5608 leftSch = largeList.get(i); 5608 leftSch = largeList.get(i);
  5609 + leftSch.setLpChange(1);
5609 if (i < smallList.size()) { 5610 if (i < smallList.size()) {
5610 rightSch = smallList.get(i); 5611 rightSch = smallList.get(i);
  5612 + rightSch.setLpChange(1);
5611 ts.add(rightSch); 5613 ts.add(rightSch);
5612 } else { 5614 } else {
5613 //不对称时多出来的 5615 //不对称时多出来的
@@ -5626,6 +5628,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -5626,6 +5628,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5626 5628
5627 carSet.add(leftSch.getClZbh()); 5629 carSet.add(leftSch.getClZbh());
5628 carSet.add(rightSch.getClZbh()); 5630 carSet.add(rightSch.getClZbh());
  5631 + scheduleRealInfoRepository.updateLpChange(leftSch.getId());
  5632 + scheduleRealInfoRepository.updateLpChange(rightSch.getId());
5629 } 5633 }
5630 5634
5631 //重新计算路牌的起点应到时间 5635 //重新计算路牌的起点应到时间
@@ -5981,6 +5985,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -5981,6 +5985,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
5981 lMap.add(resMap); 5985 lMap.add(resMap);
5982 return lMap; 5986 return lMap;
5983 } 5987 }
  5988 +
  5989 + @Override
  5990 + public Integer isCircleQdz(String clzbh, String sdr, String xlbm, String qdzCode) {
  5991 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  5992 + String time =sdf.format(Long.parseLong(sdr));
  5993 +
  5994 + Long num=scheduleRealInfoRepository.isCircleQdz(clzbh, time, xlbm, qdzCode);
  5995 + Integer num2=num==0L?0:1;
  5996 + return num2;
  5997 + }
5984 } 5998 }
5985 5999
5986 class AccountMap implements Comparator<Map<String, Object>> { 6000 class AccountMap implements Comparator<Map<String, Object>> {
src/main/java/com/bsth/service/report/impl/CalcSheetServiceImpl.java
@@ -790,11 +790,11 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -790,11 +790,11 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
790 if(map.get("fgsdmTurn")!=null){ 790 if(map.get("fgsdmTurn")!=null){
791 fgs=map.get("fgsdmTurn").toString().trim(); 791 fgs=map.get("fgsdmTurn").toString().trim();
792 } 792 }
793 -// String nature="0";  
794 -// if(map.get("nature")!=null){  
795 -// nature=map.get("nature").toString();  
796 -// }  
797 -// Map<String, Boolean> lineMap=lineService.lineNature(); 793 + String nature="0";
  794 + if(map.get("nature")!=null){
  795 + nature=map.get("nature").toString();
  796 + }
  797 + Map<String, Boolean> lineMap=lineService.lineNature();
798 798
799 String startDate=map.get("startDate").toString(); 799 String startDate=map.get("startDate").toString();
800 String endDate=map.get("endDate").toString(); 800 String endDate=map.get("endDate").toString();
@@ -847,16 +847,82 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im @@ -847,16 +847,82 @@ public class CalcSheetServiceImpl extends BaseServiceImpl&lt;CalcSheet, Integer&gt; im
847 return s; 847 return s;
848 } 848 }
849 }); 849 });
  850 +
  851 +
  852 + List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
  853 + int jhcc = 0, sjcc = 0;
  854 + int jhcczgf = 0, sjcczgf = 0;
  855 + int count=0;
  856 + Map<String, String> xlMap=new HashMap<String,String>();
  857 + for(Map<String, Object> m : lists){
  858 + if(nature.equals("0")){
  859 + list.add(m);
  860 + jhcc += Integer.valueOf(m.get("jhcc").toString());
  861 + sjcc += Integer.valueOf(m.get("sjcc").toString());
  862 + jhcczgf += Integer.valueOf(m.get("jhcczgf").toString());
  863 + sjcczgf +=Integer.valueOf(m.get("sjcczgf").toString());
  864 + if(xlMap.get(m.get("xl").toString())==null){
  865 + count++;
  866 + xlMap.put(m.get("xl").toString(), m.get("xl").toString());
  867 + }
  868 + }else if(nature.equals("1")){
  869 + if(lineMap.get(m.get("xl").toString())){
  870 + list.add(m);
  871 + jhcc += Integer.valueOf(m.get("jhcc").toString());
  872 + sjcc += Integer.valueOf(m.get("sjcc").toString());
  873 + jhcczgf += Integer.valueOf(m.get("jhcczgf").toString());
  874 + sjcczgf +=Integer.valueOf(m.get("sjcczgf").toString());
  875 + if(xlMap.get(m.get("xl").toString())==null){
  876 + count++;
  877 + xlMap.put(m.get("xl").toString(), m.get("xl").toString());
  878 + }
  879 + }
  880 + }else{
  881 + if(!lineMap.get(m.get("xl").toString())){
  882 + list.add(m);
  883 + jhcc += Integer.valueOf(m.get("jhcc").toString());
  884 + sjcc += Integer.valueOf(m.get("sjcc").toString());
  885 + jhcczgf += Integer.valueOf(m.get("jhcczgf").toString());
  886 + sjcczgf +=Integer.valueOf(m.get("sjcczgf").toString());
  887 + if(xlMap.get(m.get("xl").toString())==null){
  888 + count++;
  889 + xlMap.put(m.get("xl").toString(), m.get("xl").toString());
  890 + }
  891 + }
  892 + }
  893 +
  894 + }
  895 +
  896 + Map<String, Object> tempMap=new HashMap<String,Object>();
  897 + tempMap.put("rq", "分类汇总");
  898 + tempMap.put("line_", "共" + list.size() + "条线路");
  899 + tempMap.put("xlName", "共" +count + "条线路");
  900 + tempMap.put("jhcc", jhcc);
  901 + tempMap.put("sjcc", sjcc);
  902 + tempMap.put("sjcczgf", sjcczgf);
  903 + tempMap.put("jhcczgf", jhcczgf);
  904 + tempMap.put("sm", "");
  905 + list.add(tempMap);
  906 + if(jhcc != 0 && sjcc != 0){
  907 + tempMap.put("ccl", df.format(((float)sjcc / jhcc)*100)+"%");
  908 + }else{
  909 + tempMap.put("ccl", "0.00%");
  910 + }
  911 + if(jhcczgf != 0 && sjcczgf != 0){
  912 + tempMap.put("cclzgf", df.format(((float)sjcczgf / jhcczgf)*100)+"%");
  913 + }else{
  914 + tempMap.put("cclzgf", "0.00%");
  915 + }
850 if (type.equals("export")) { 916 if (type.equals("export")) {
851 String lineName=map.get("lineName").toString(); 917 String lineName=map.get("lineName").toString();
852 ReportUtils ee = new ReportUtils(); 918 ReportUtils ee = new ReportUtils();
853 List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); 919 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
854 - listI.add(lists.iterator()); 920 + listI.add(list.iterator());
855 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 921 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
856 ee.excelReplace(listI, new Object[] { map }, path + "mould/calcTurnoutrateZgf.xls", path + "export/" 922 ee.excelReplace(listI, new Object[] { map }, path + "mould/calcTurnoutrateZgf.xls", path + "export/"
857 + dates + "-" + lineName + "-营运线路出车率统计表.xls"); 923 + dates + "-" + lineName + "-营运线路出车率统计表.xls");
858 } 924 }
859 - return lists; 925 + return list;
860 } 926 }
861 927
862 @Override 928 @Override
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
@@ -1647,22 +1647,47 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -1647,22 +1647,47 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1647 } 1647 }
1648 }else{ 1648 }else{
1649 Set<ChildTaskPlan> childTaskPlans = t.getcTasks(); 1649 Set<ChildTaskPlan> childTaskPlans = t.getcTasks();
1650 - if(!childTaskPlans.isEmpty()){  
1651 - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();  
1652 - while (it.hasNext()) {  
1653 - ChildTaskPlan childTaskPlan = it.next();  
1654 - if(childTaskPlan.getCcId()==null){  
1655 - if("empty".equals(childTaskPlan.getMileageType())&&"临加".equals(childTaskPlan.getType1())){  
1656 - if (!childTaskPlan.isDestroy()) {  
1657 - Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();  
1658 - ljks=Arith.add(ljks,jhgl);  
1659 - } 1650 + if(isInOut(t)){
  1651 + if(childTaskPlans.isEmpty()){
  1652 + double jhlc=t.getJhlc()==null?0:t.getJhlc();
  1653 + double jhlcOrig=t.getJhlcOrig()==null?0:t.getJhlcOrig();
  1654 + double zjlc=Arith.sub(jhlc, jhlcOrig);
  1655 + if(zjlc>0){
  1656 + ljks=Arith.add(zjlc, ljks);
  1657 + }
  1658 + }else{
  1659 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1660 + while (it.hasNext()) {
  1661 + ChildTaskPlan childTaskPlan = it.next();
  1662 + if(childTaskPlan.getCcId()==null){
  1663 + if("empty".equals(childTaskPlan.getMileageType())&&"临加".equals(childTaskPlan.getType1())){
  1664 + if (!childTaskPlan.isDestroy()) {
  1665 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1666 + ljks=Arith.add(ljks,jhgl);
  1667 + }
  1668 + }
1660 } 1669 }
1661 - }  
1662 - } 1670 + }
  1671 + }
  1672 +
  1673 + }else{
  1674 + if(!childTaskPlans.isEmpty()){
  1675 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1676 + while (it.hasNext()) {
  1677 + ChildTaskPlan childTaskPlan = it.next();
  1678 + if(childTaskPlan.getCcId()==null){
  1679 + if("empty".equals(childTaskPlan.getMileageType())&&"临加".equals(childTaskPlan.getType1())){
  1680 + if (!childTaskPlan.isDestroy()) {
  1681 + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1682 + ljks=Arith.add(ljks,jhgl);
  1683 + }
  1684 + }
  1685 + }
  1686 + }
  1687 + }
1663 } 1688 }
1664 -  
1665 } 1689 }
  1690 +
1666 } 1691 }
1667 return ljks; 1692 return ljks;
1668 } 1693 }
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -385,9 +385,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -385,9 +385,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
385 // zgfEnd = sdf.parse(date + "08:30").getTime(); 385 // zgfEnd = sdf.parse(date + "08:30").getTime();
386 // wgfBegin = sdf.parse(date + "16:00").getTime(); 386 // wgfBegin = sdf.parse(date + "16:00").getTime();
387 // wgfEnd = sdf.parse(date + "18:00").getTime(); 387 // wgfEnd = sdf.parse(date + "18:00").getTime();
388 - zgfBegin = 6l * 60l + 30l; 388 + zgfBegin = 6l * 60l + 31l;
389 zgfEnd = 8l * 60l + 30l; 389 zgfEnd = 8l * 60l + 30l;
390 - wgfBegin = 16l * 60l + 0l; 390 + wgfBegin = 16l * 60l + 1l;
391 wgfEnd = 18l * 60l + 0l; 391 wgfEnd = 18l * 60l + 0l;
392 } catch (Exception e) { 392 } catch (Exception e) {
393 // TODO Auto-generated catch block 393 // TODO Auto-generated catch block
@@ -414,15 +414,23 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -414,15 +414,23 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
414 subCompanyName = schedule.getFgsName(); 414 subCompanyName = schedule.getFgsName();
415 415
416 //早晚高峰时段执行率 416 //早晚高峰时段执行率
417 - if(schedule.getFcsjT() >= zgfBegin && schedule.getFcsjT() <= zgfEnd){  
418 - jhzgf++;  
419 - if(schedule.getFcsjActual() != null) 417 + if(!schedule.getBcType().equals("in") && !schedule.getBcType().equals("out") && !schedule.getBcType().equals("ldks")){
  418 + if(schedule.getFcsjT() >= zgfBegin && schedule.getFcsjT() <= zgfEnd){
  419 + jhzgf++;
  420 + }
  421 + if(schedule.getFcsjActual() != null && !schedule.isDestroy()
  422 + && schedule.getFcsjActualTime() >= zgfBegin
  423 + && schedule.getFcsjActualTime() <= zgfEnd){
420 sjzgf++; 424 sjzgf++;
421 - }  
422 - if(schedule.getFcsjT() >= wgfBegin && schedule.getFcsjT() <= wgfEnd){  
423 - jhwgf++;  
424 - if(schedule.getFcsjActual() != null) 425 + }
  426 + if(schedule.getFcsjT() >= wgfBegin && schedule.getFcsjT() <= wgfEnd){
  427 + jhwgf++;
  428 + }
  429 + if(schedule.getFcsjActual() != null && !schedule.isDestroy()
  430 + && schedule.getFcsjActualTime() >= wgfBegin
  431 + && schedule.getFcsjActualTime() <= wgfEnd){
425 sjwgf++; 432 sjwgf++;
  433 + }
426 } 434 }
427 435
428 //班次数和出场数 436 //班次数和出场数
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/CalcuParam.java
1 -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;  
2 -  
3 -import org.joda.time.DateTime;  
4 -  
5 -/**  
6 - * 计算用参数。  
7 - */  
8 -public class CalcuParam {  
9 - /** 线路Id */  
10 - private Integer xlId;  
11 -  
12 - /** 计划开始计算日期 */  
13 - private DateTime fromDate;  
14 - /** 计划结束计算日期 */  
15 - private DateTime toDate;  
16 -  
17 - public Integer getXlId() {  
18 - return xlId;  
19 - }  
20 -  
21 - public void setXlId(Integer xlId) {  
22 - this.xlId = xlId;  
23 - }  
24 -  
25 - public DateTime getFromDate() {  
26 - return fromDate;  
27 - }  
28 -  
29 - public void setFromDate(DateTime fromDate) {  
30 - this.fromDate = fromDate;  
31 - }  
32 -  
33 - public DateTime getToDate() {  
34 - return toDate;  
35 - }  
36 -  
37 - public void setToDate(DateTime toDate) {  
38 - this.toDate = toDate;  
39 - }  
40 -} 1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import org.joda.time.DateTime;
  4 +
  5 +/**
  6 + * 计算用参数。
  7 + */
  8 +public class CalcuParam {
  9 + /** 线路Id */
  10 + private Integer xlId;
  11 +
  12 + /** 计划开始计算日期 */
  13 + private DateTime fromDate;
  14 + /** 计划结束计算日期 */
  15 + private DateTime toDate;
  16 +
  17 + public Integer getXlId() {
  18 + return xlId;
  19 + }
  20 +
  21 + public void setXlId(Integer xlId) {
  22 + this.xlId = xlId;
  23 + }
  24 +
  25 + public DateTime getFromDate() {
  26 + return fromDate;
  27 + }
  28 +
  29 + public void setFromDate(DateTime fromDate) {
  30 + this.fromDate = fromDate;
  31 + }
  32 +
  33 + public DateTime getToDate() {
  34 + return toDate;
  35 + }
  36 +
  37 + public void setToDate(DateTime toDate) {
  38 + this.toDate = toDate;
  39 + }
  40 +}
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ErrorInfoFunction.java
1 -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;  
2 -  
3 -  
4 -import com.bsth.entity.schedule.EmployeeConfigInfo;  
5 -import com.bsth.entity.schedule.GuideboardInfo;  
6 -import org.apache.commons.lang3.StringUtils;  
7 -import org.apache.commons.lang3.math.NumberUtils;  
8 -import org.kie.api.runtime.rule.AccumulateFunction;  
9 -  
10 -import java.io.*;  
11 -import java.util.HashMap;  
12 -import java.util.Map;  
13 -  
14 -/**  
15 - * 查找错误函数。  
16 - */  
17 -public class ErrorInfoFunction implements AccumulateFunction {  
18 - @Override  
19 - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {  
20 -  
21 - }  
22 -  
23 - @Override  
24 - public void writeExternal(ObjectOutput out) throws IOException {  
25 -  
26 - }  
27 -  
28 - protected static class ErrorInfoContext implements Externalizable {  
29 - /** 错误数量 */  
30 - public Integer errorCount = 0;  
31 - /** 错误Map,Map<规则id,errorInfo> */  
32 - public Map<Long, ValidateRuleResult.ErrorInfo> errorInfoMap = new HashMap<>();  
33 -  
34 - public ErrorInfoContext() {  
35 -  
36 - }  
37 -  
38 - @Override  
39 - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {  
40 - errorCount = in.readInt();  
41 - errorInfoMap = (Map<Long, ValidateRuleResult.ErrorInfo>) in.readObject();  
42 -  
43 - }  
44 -  
45 - @Override  
46 - public void writeExternal(ObjectOutput out) throws IOException {  
47 - out.writeInt(errorCount);  
48 - out.writeObject(errorInfoMap);  
49 - }  
50 -  
51 - }  
52 -  
53 - @Override  
54 - public Serializable createContext() {  
55 - return new ErrorInfoContext();  
56 - }  
57 -  
58 - @Override  
59 - public void init(Serializable serializable) throws Exception {  
60 - ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;  
61 - errorInfoContext.errorCount = 0;  
62 - errorInfoContext.errorInfoMap = new HashMap<>();  
63 - }  
64 -  
65 - @Override  
66 - public void accumulate(Serializable serializable, Object o) {  
67 - ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;  
68 - WrapInput wrapInput = (WrapInput) o;  
69 -  
70 - ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo();  
71 - errorInfo.setRuleId(wrapInput.getRuleId());  
72 - errorInfo.setClZbh(wrapInput.getClZbh());  
73 - errorInfo.setQyrq(wrapInput.getQyrq());  
74 -  
75 - // 1、车辆配置验证  
76 - if (StringUtils.isNotEmpty(wrapInput.getClZbh())) { // 自编号不能为空  
77 - if (wrapInput.getCcInfos().get(wrapInput.getClZbh()) == null) { // 车辆配置不在当前线路上  
78 - errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!");  
79 - }  
80 - } else {  
81 - errorInfo.getErrorDescList().add("自编号不能为空,请重新编辑保存!");  
82 - }  
83 -  
84 - // 2、路牌id,路牌名字,路牌起始索引验证  
85 - if (StringUtils.isNotEmpty(wrapInput.getLpIds()) &&  
86 - StringUtils.isNotEmpty(wrapInput.getLpNames())) { // 冗余的路牌id和路牌名字都不能为空  
87 - String[] lpIds = wrapInput.getLpIds().split(",");  
88 - String[] lpNames = wrapInput.getLpNames().split(",");  
89 - if (lpIds.length == lpNames.length) { // 路牌id和路牌名字个数一致  
90 - for (int i = 0; i < lpIds.length; i++) {  
91 - if (!NumberUtils.isDigits(lpIds[i])) { // 冗余路牌id必须是数字  
92 - errorInfo.getErrorDescList().add("冗余路牌id必须是数字,请重新编辑保存!");  
93 - break;  
94 - }  
95 -  
96 - GuideboardInfo lpInfo = wrapInput.getLpInfos().get(NumberUtils.toLong(lpIds[i]));  
97 - if (lpInfo == null) { // 路牌不在当前线路上  
98 - errorInfo.getErrorDescList().add("路牌不在当前线路上,请重新编辑保存!");  
99 - } else {  
100 - if (StringUtils.isEmpty(lpNames[i]) ||  
101 - !(lpNames[i].equals(lpInfo.getLpName()))) { // 路牌id和路牌名字不对应  
102 - errorInfo.getErrorDescList().add("路牌id和路牌名字不对应,请重新编辑保存!");  
103 - break;  
104 - }  
105 - }  
106 - }  
107 -  
108 - if (wrapInput.getLpStartIndex() < 1 ||  
109 - wrapInput.getLpStartIndex() > lpIds.length) { // 路牌起始索引溢出  
110 - errorInfo.getErrorDescList().add("路牌起始索引溢出,请重新编辑保存!");  
111 - }  
112 - } else {  
113 - errorInfo.getErrorDescList().add("路牌id和路牌名字个数不一致,请重新编辑保存!");  
114 - }  
115 - } else {  
116 - errorInfo.getErrorDescList().add("冗余的路牌id和路牌名字都不能为空,请重新编辑保存!");  
117 - }  
118 -  
119 - // 3、人员配置,搭班编码,人员起始索引验证  
120 - if (StringUtils.isNotEmpty(wrapInput.getEcIds()) &&  
121 - StringUtils.isNotEmpty(wrapInput.getEcDbbms())) { // 冗余的人员配置id和人员搭班编码都不能为空  
122 - String[] ecIds = wrapInput.getEcIds().split(",");  
123 - String[] ecDbbms = wrapInput.getEcDbbms().split(",");  
124 - if (ecIds.length == ecDbbms.length) { // 人员配置id和搭班编码个数一致  
125 - for (int i = 0; i < ecIds.length; i++) {  
126 - if (ecIds[i].contains("-")) { // 分班标识  
127 - String[] fb_ecIds = ecIds[i].split("-");  
128 - String[] fb_ecDbbms = ecDbbms[i].split("-");  
129 - if (fb_ecIds.length != 2 || fb_ecDbbms.length != 2) { // 只能早晚分班  
130 - errorInfo.getErrorDescList().add("只能早晚分班,请重新编辑保存!");  
131 - break;  
132 - } else {  
133 - EmployeeConfigInfo fb_ecInfo1 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[0]));  
134 - EmployeeConfigInfo fb_ecInfo2 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[1]));  
135 - if (fb_ecInfo1 == null || fb_ecInfo2 == null) { // 分班的人员配置不在当前线路  
136 - errorInfo.getErrorDescList().add("分班的人员配置不在当前线路,请重新编辑保存!");  
137 - break;  
138 - } else {  
139 - if (StringUtils.isEmpty(fb_ecDbbms[0]) ||  
140 - StringUtils.isEmpty(fb_ecDbbms[1]) ||  
141 - !(fb_ecDbbms[0].equals(fb_ecInfo1.getDbbm())) ||  
142 - !(fb_ecDbbms[1].equals(fb_ecInfo2.getDbbm()))) { // 分班人员配置id和搭班编码不对应  
143 - errorInfo.getErrorDescList().add("分班人员配置id和搭班编码不对应,请重新编辑保存!");  
144 - break;  
145 - }  
146 - }  
147 - }  
148 -  
149 - } else {  
150 - if (!NumberUtils.isDigits(ecIds[i])) { // 冗余的人员配置id必须是数字  
151 - errorInfo.getErrorDescList().add("冗余的人员配置id必须是数字,请重新编辑保存!");  
152 - break;  
153 - }  
154 -  
155 - EmployeeConfigInfo ecInfo = wrapInput.getEcInfos().get(NumberUtils.toLong(ecIds[i]));  
156 - if (ecInfo == null) { // 人员配置不在当前线路  
157 - errorInfo.getErrorDescList().add("人员配置不在当前线路,请重新编辑保存!");  
158 - break;  
159 - } else {  
160 - if (StringUtils.isEmpty(ecDbbms[i]) ||  
161 - !(ecDbbms[i].equals(ecInfo.getDbbm()))) { // 人员配置id和搭班编码不对应  
162 - errorInfo.getErrorDescList().add("人员配置id和搭班编码不对应,请重新编辑保存!");  
163 - break;  
164 - }  
165 - }  
166 - }  
167 - }  
168 -  
169 - if (wrapInput.getEcStartIndex() < 1 ||  
170 - wrapInput.getEcStartIndex() > ecIds.length) { // 人员起始索引溢出  
171 - errorInfo.getErrorDescList().add("人员起始索引溢出,请重新编辑保存!");  
172 - }  
173 - } else {  
174 - errorInfo.getErrorDescList().add("人员配置id和搭班编码个数不一致,请重新编辑保存!");  
175 - }  
176 - }  
177 -  
178 - if (errorInfo.getErrorDescList().size() > 0) {  
179 - errorInfoContext.errorCount ++;  
180 - errorInfoContext.errorInfoMap.put(wrapInput.getRuleId(), errorInfo);  
181 - }  
182 -  
183 - }  
184 -  
185 - @Override  
186 - public void reverse(Serializable serializable, Object o) throws Exception {  
187 - ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;  
188 - WrapInput wrapInput = (WrapInput) o;  
189 -  
190 - if (errorInfoContext.errorInfoMap.get(wrapInput.getRuleId()) != null) {  
191 - errorInfoContext.errorInfoMap.remove(wrapInput.getRuleId());  
192 - errorInfoContext.errorCount --;  
193 - }  
194 - }  
195 -  
196 - @Override  
197 - public Object getResult(Serializable serializable) throws Exception {  
198 - ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;  
199 - return errorInfoContext.errorInfoMap;  
200 - }  
201 -  
202 - @Override  
203 - public boolean supportsReverse() {  
204 - return true;  
205 - }  
206 -  
207 - @Override  
208 - public Class<?> getResultType() {  
209 - return Map.class;  
210 - }  
211 -  
212 -} 1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +
  4 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  5 +import com.bsth.entity.schedule.GuideboardInfo;
  6 +import org.apache.commons.lang3.StringUtils;
  7 +import org.apache.commons.lang3.math.NumberUtils;
  8 +import org.kie.api.runtime.rule.AccumulateFunction;
  9 +
  10 +import java.io.*;
  11 +import java.util.HashMap;
  12 +import java.util.Map;
  13 +
  14 +/**
  15 + * 查找错误函数。
  16 + */
  17 +public class ErrorInfoFunction implements AccumulateFunction {
  18 + @Override
  19 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  20 +
  21 + }
  22 +
  23 + @Override
  24 + public void writeExternal(ObjectOutput out) throws IOException {
  25 +
  26 + }
  27 +
  28 + protected static class ErrorInfoContext implements Externalizable {
  29 + /** 错误数量 */
  30 + public Integer errorCount = 0;
  31 + /** 错误Map,Map<规则id,errorInfo> */
  32 + public Map<Long, ValidateRuleResult.ErrorInfo> errorInfoMap = new HashMap<>();
  33 +
  34 + public ErrorInfoContext() {
  35 +
  36 + }
  37 +
  38 + @Override
  39 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  40 + errorCount = in.readInt();
  41 + errorInfoMap = (Map<Long, ValidateRuleResult.ErrorInfo>) in.readObject();
  42 +
  43 + }
  44 +
  45 + @Override
  46 + public void writeExternal(ObjectOutput out) throws IOException {
  47 + out.writeInt(errorCount);
  48 + out.writeObject(errorInfoMap);
  49 + }
  50 +
  51 + }
  52 +
  53 + @Override
  54 + public Serializable createContext() {
  55 + return new ErrorInfoContext();
  56 + }
  57 +
  58 + @Override
  59 + public void init(Serializable serializable) throws Exception {
  60 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  61 + errorInfoContext.errorCount = 0;
  62 + errorInfoContext.errorInfoMap = new HashMap<>();
  63 + }
  64 +
  65 + @Override
  66 + public void accumulate(Serializable serializable, Object o) {
  67 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  68 + WrapInput wrapInput = (WrapInput) o;
  69 +
  70 + ValidateRuleResult.ErrorInfo errorInfo = new ValidateRuleResult.ErrorInfo();
  71 + errorInfo.setRuleId(wrapInput.getRuleId());
  72 + errorInfo.setClZbh(wrapInput.getClZbh());
  73 + errorInfo.setQyrq(wrapInput.getQyrq());
  74 +
  75 + // 1、车辆配置验证
  76 + if (StringUtils.isNotEmpty(wrapInput.getClZbh())) { // 自编号不能为空
  77 + if (wrapInput.getCcInfos().get(wrapInput.getClZbh()) == null) { // 车辆配置不在当前线路上
  78 + errorInfo.getErrorDescList().add("车辆配置不在当前线路,请重新编辑保存!");
  79 + }
  80 + } else {
  81 + errorInfo.getErrorDescList().add("自编号不能为空,请重新编辑保存!");
  82 + }
  83 +
  84 + // 2、路牌id,路牌名字,路牌起始索引验证
  85 + if (StringUtils.isNotEmpty(wrapInput.getLpIds()) &&
  86 + StringUtils.isNotEmpty(wrapInput.getLpNames())) { // 冗余的路牌id和路牌名字都不能为空
  87 + String[] lpIds = wrapInput.getLpIds().split(",");
  88 + String[] lpNames = wrapInput.getLpNames().split(",");
  89 + if (lpIds.length == lpNames.length) { // 路牌id和路牌名字个数一致
  90 + for (int i = 0; i < lpIds.length; i++) {
  91 + if (!NumberUtils.isDigits(lpIds[i])) { // 冗余路牌id必须是数字
  92 + errorInfo.getErrorDescList().add("冗余路牌id必须是数字,请重新编辑保存!");
  93 + break;
  94 + }
  95 +
  96 + GuideboardInfo lpInfo = wrapInput.getLpInfos().get(NumberUtils.toLong(lpIds[i]));
  97 + if (lpInfo == null) { // 路牌不在当前线路上
  98 + errorInfo.getErrorDescList().add("路牌不在当前线路上,请重新编辑保存!");
  99 + } else {
  100 + if (StringUtils.isEmpty(lpNames[i]) ||
  101 + !(lpNames[i].equals(lpInfo.getLpName()))) { // 路牌id和路牌名字不对应
  102 + errorInfo.getErrorDescList().add("路牌id和路牌名字不对应,请重新编辑保存!");
  103 + break;
  104 + }
  105 + }
  106 + }
  107 +
  108 + if (wrapInput.getLpStartIndex() < 1 ||
  109 + wrapInput.getLpStartIndex() > lpIds.length) { // 路牌起始索引溢出
  110 + errorInfo.getErrorDescList().add("路牌起始索引溢出,请重新编辑保存!");
  111 + }
  112 + } else {
  113 + errorInfo.getErrorDescList().add("路牌id和路牌名字个数不一致,请重新编辑保存!");
  114 + }
  115 + } else {
  116 + errorInfo.getErrorDescList().add("冗余的路牌id和路牌名字都不能为空,请重新编辑保存!");
  117 + }
  118 +
  119 + // 3、人员配置,搭班编码,人员起始索引验证
  120 + if (StringUtils.isNotEmpty(wrapInput.getEcIds()) &&
  121 + StringUtils.isNotEmpty(wrapInput.getEcDbbms())) { // 冗余的人员配置id和人员搭班编码都不能为空
  122 + String[] ecIds = wrapInput.getEcIds().split(",");
  123 + String[] ecDbbms = wrapInput.getEcDbbms().split(",");
  124 + if (ecIds.length == ecDbbms.length) { // 人员配置id和搭班编码个数一致
  125 + for (int i = 0; i < ecIds.length; i++) {
  126 + if (ecIds[i].contains("-")) { // 分班标识
  127 + String[] fb_ecIds = ecIds[i].split("-");
  128 + String[] fb_ecDbbms = ecDbbms[i].split("-");
  129 + if (fb_ecIds.length != 2 || fb_ecDbbms.length != 2) { // 只能早晚分班
  130 + errorInfo.getErrorDescList().add("只能早晚分班,请重新编辑保存!");
  131 + break;
  132 + } else {
  133 + EmployeeConfigInfo fb_ecInfo1 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[0]));
  134 + EmployeeConfigInfo fb_ecInfo2 = wrapInput.getEcInfos().get(NumberUtils.toLong(fb_ecIds[1]));
  135 + if (fb_ecInfo1 == null || fb_ecInfo2 == null) { // 分班的人员配置不在当前线路
  136 + errorInfo.getErrorDescList().add("分班的人员配置不在当前线路,请重新编辑保存!");
  137 + break;
  138 + } else {
  139 + if (StringUtils.isEmpty(fb_ecDbbms[0]) ||
  140 + StringUtils.isEmpty(fb_ecDbbms[1]) ||
  141 + !(fb_ecDbbms[0].equals(fb_ecInfo1.getDbbm())) ||
  142 + !(fb_ecDbbms[1].equals(fb_ecInfo2.getDbbm()))) { // 分班人员配置id和搭班编码不对应
  143 + errorInfo.getErrorDescList().add("分班人员配置id和搭班编码不对应,请重新编辑保存!");
  144 + break;
  145 + }
  146 + }
  147 + }
  148 +
  149 + } else {
  150 + if (!NumberUtils.isDigits(ecIds[i])) { // 冗余的人员配置id必须是数字
  151 + errorInfo.getErrorDescList().add("冗余的人员配置id必须是数字,请重新编辑保存!");
  152 + break;
  153 + }
  154 +
  155 + EmployeeConfigInfo ecInfo = wrapInput.getEcInfos().get(NumberUtils.toLong(ecIds[i]));
  156 + if (ecInfo == null) { // 人员配置不在当前线路
  157 + errorInfo.getErrorDescList().add("人员配置不在当前线路,请重新编辑保存!");
  158 + break;
  159 + } else {
  160 + if (StringUtils.isEmpty(ecDbbms[i]) ||
  161 + !(ecDbbms[i].equals(ecInfo.getDbbm()))) { // 人员配置id和搭班编码不对应
  162 + errorInfo.getErrorDescList().add("人员配置id和搭班编码不对应,请重新编辑保存!");
  163 + break;
  164 + }
  165 + }
  166 + }
  167 + }
  168 +
  169 + if (wrapInput.getEcStartIndex() < 1 ||
  170 + wrapInput.getEcStartIndex() > ecIds.length) { // 人员起始索引溢出
  171 + errorInfo.getErrorDescList().add("人员起始索引溢出,请重新编辑保存!");
  172 + }
  173 + } else {
  174 + errorInfo.getErrorDescList().add("人员配置id和搭班编码个数不一致,请重新编辑保存!");
  175 + }
  176 + }
  177 +
  178 + if (errorInfo.getErrorDescList().size() > 0) {
  179 + errorInfoContext.errorCount ++;
  180 + errorInfoContext.errorInfoMap.put(wrapInput.getRuleId(), errorInfo);
  181 + }
  182 +
  183 + }
  184 +
  185 + @Override
  186 + public void reverse(Serializable serializable, Object o) throws Exception {
  187 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  188 + WrapInput wrapInput = (WrapInput) o;
  189 +
  190 + if (errorInfoContext.errorInfoMap.get(wrapInput.getRuleId()) != null) {
  191 + errorInfoContext.errorInfoMap.remove(wrapInput.getRuleId());
  192 + errorInfoContext.errorCount --;
  193 + }
  194 + }
  195 +
  196 + @Override
  197 + public Object getResult(Serializable serializable) throws Exception {
  198 + ErrorInfoContext errorInfoContext = (ErrorInfoContext) serializable;
  199 + return errorInfoContext.errorInfoMap;
  200 + }
  201 +
  202 + @Override
  203 + public boolean supportsReverse() {
  204 + return true;
  205 + }
  206 +
  207 + @Override
  208 + public Class<?> getResultType() {
  209 + return Map.class;
  210 + }
  211 +
  212 +}
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/ValidateRuleResult.java
1 -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.Date;  
5 -import java.util.List;  
6 -  
7 -/**  
8 - * 输出结果值。  
9 - */  
10 -public class ValidateRuleResult {  
11 - /** 线路id */  
12 - private Integer xlId;  
13 - /** 规则总数量 */  
14 - private Integer count;  
15 - /** 启用的规则数量 */  
16 - private Integer qyCount;  
17 - /** 启用规则中的错误数量 */  
18 - private Integer qyErrorCount;  
19 - /** 错误列表 */  
20 - private List<ErrorInfo> errorInfos = new ArrayList<>();  
21 -  
22 - public Integer getXlId() {  
23 - return xlId;  
24 - }  
25 -  
26 - public void setXlId(Integer xlId) {  
27 - this.xlId = xlId;  
28 - }  
29 -  
30 - public Integer getCount() {  
31 - return count;  
32 - }  
33 -  
34 - public void setCount(Integer count) {  
35 - this.count = count;  
36 - }  
37 -  
38 - public Integer getQyCount() {  
39 - return qyCount;  
40 - }  
41 -  
42 - public void setQyCount(Integer qyCount) {  
43 - this.qyCount = qyCount;  
44 - }  
45 -  
46 - public Integer getQyErrorCount() {  
47 - return qyErrorCount;  
48 - }  
49 -  
50 - public void setQyErrorCount(Integer qyErrorCount) {  
51 - this.qyErrorCount = qyErrorCount;  
52 - }  
53 -  
54 - public List<ErrorInfo> getErrorInfos() {  
55 - return errorInfos;  
56 - }  
57 -  
58 - public void setErrorInfos(List<ErrorInfo> errorInfos) {  
59 - this.errorInfos = errorInfos;  
60 - }  
61 -  
62 - public static class ErrorInfo {  
63 - /** 规则id */  
64 - private Long ruleId;  
65 - /** 车辆自编号 */  
66 - private String clZbh;  
67 - /** 启用日期 */  
68 - private Date qyrq;  
69 - /** 错误描述 */  
70 - private List<String> errorDescList = new ArrayList<>();  
71 -  
72 - public Long getRuleId() {  
73 - return ruleId;  
74 - }  
75 -  
76 - public void setRuleId(Long ruleId) {  
77 - this.ruleId = ruleId;  
78 - }  
79 -  
80 - public String getClZbh() {  
81 - return clZbh;  
82 - }  
83 -  
84 - public void setClZbh(String clZbh) {  
85 - this.clZbh = clZbh;  
86 - }  
87 -  
88 - public Date getQyrq() {  
89 - return qyrq;  
90 - }  
91 -  
92 - public void setQyrq(Date qyrq) {  
93 - this.qyrq = qyrq;  
94 - }  
95 -  
96 - public List<String> getErrorDescList() {  
97 - return errorDescList;  
98 - }  
99 -  
100 - public void setErrorDescList(List<String> errorDescList) {  
101 - this.errorDescList = errorDescList;  
102 - }  
103 - }  
104 -} 1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Date;
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 输出结果值。
  9 + */
  10 +public class ValidateRuleResult {
  11 + /** 线路id */
  12 + private Integer xlId;
  13 + /** 规则总数量 */
  14 + private Integer count;
  15 + /** 启用的规则数量 */
  16 + private Integer qyCount;
  17 + /** 启用规则中的错误数量 */
  18 + private Integer qyErrorCount;
  19 + /** 错误列表 */
  20 + private List<ErrorInfo> errorInfos = new ArrayList<>();
  21 +
  22 + public Integer getXlId() {
  23 + return xlId;
  24 + }
  25 +
  26 + public void setXlId(Integer xlId) {
  27 + this.xlId = xlId;
  28 + }
  29 +
  30 + public Integer getCount() {
  31 + return count;
  32 + }
  33 +
  34 + public void setCount(Integer count) {
  35 + this.count = count;
  36 + }
  37 +
  38 + public Integer getQyCount() {
  39 + return qyCount;
  40 + }
  41 +
  42 + public void setQyCount(Integer qyCount) {
  43 + this.qyCount = qyCount;
  44 + }
  45 +
  46 + public Integer getQyErrorCount() {
  47 + return qyErrorCount;
  48 + }
  49 +
  50 + public void setQyErrorCount(Integer qyErrorCount) {
  51 + this.qyErrorCount = qyErrorCount;
  52 + }
  53 +
  54 + public List<ErrorInfo> getErrorInfos() {
  55 + return errorInfos;
  56 + }
  57 +
  58 + public void setErrorInfos(List<ErrorInfo> errorInfos) {
  59 + this.errorInfos = errorInfos;
  60 + }
  61 +
  62 + public static class ErrorInfo {
  63 + /** 规则id */
  64 + private Long ruleId;
  65 + /** 车辆自编号 */
  66 + private String clZbh;
  67 + /** 启用日期 */
  68 + private Date qyrq;
  69 + /** 错误描述 */
  70 + private List<String> errorDescList = new ArrayList<>();
  71 +
  72 + public Long getRuleId() {
  73 + return ruleId;
  74 + }
  75 +
  76 + public void setRuleId(Long ruleId) {
  77 + this.ruleId = ruleId;
  78 + }
  79 +
  80 + public String getClZbh() {
  81 + return clZbh;
  82 + }
  83 +
  84 + public void setClZbh(String clZbh) {
  85 + this.clZbh = clZbh;
  86 + }
  87 +
  88 + public Date getQyrq() {
  89 + return qyrq;
  90 + }
  91 +
  92 + public void setQyrq(Date qyrq) {
  93 + this.qyrq = qyrq;
  94 + }
  95 +
  96 + public List<String> getErrorDescList() {
  97 + return errorDescList;
  98 + }
  99 +
  100 + public void setErrorDescList(List<String> errorDescList) {
  101 + this.errorDescList = errorDescList;
  102 + }
  103 + }
  104 +}
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/rule/WrapInput.java
1 -package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;  
2 -  
3 -import com.bsth.entity.schedule.CarConfigInfo;  
4 -import com.bsth.entity.schedule.EmployeeConfigInfo;  
5 -import com.bsth.entity.schedule.GuideboardInfo;  
6 -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;  
7 -import org.springframework.util.CollectionUtils;  
8 -  
9 -import java.util.*;  
10 -  
11 -/**  
12 - * 聚合输入的待判定数据。  
13 - */  
14 -public class WrapInput {  
15 - /** 线路Id */  
16 - private Integer xlId;  
17 - /** 车辆自编号 */  
18 - private String clZbh;  
19 - /** 路牌id列表 */  
20 - private String lpIds;  
21 - /** 路牌名字列表 */  
22 - private String lpNames;  
23 - /** 人员配置列表 */  
24 - private String ecIds;  
25 - /** 人员搭班编码列表 */  
26 - private String ecDbbms;  
27 - /** 路牌循环起始索引 */  
28 - private Integer lpStartIndex;  
29 - /** 人员循环起始索引 */  
30 - private Integer ecStartIndex;  
31 - /** 规则id */  
32 - private Long ruleId;  
33 - /** 启用日期 */  
34 - private Date qyrq;  
35 -  
36 - private Map<String, CarConfigInfo> ccInfos = new HashMap<>();  
37 - private Map<Long, GuideboardInfo> lpInfos = new HashMap<>();  
38 - private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>();  
39 -  
40 - public WrapInput(ScheduleRule1Flat r,  
41 - Map<String, CarConfigInfo> cc,  
42 - Map<Long, GuideboardInfo> lp,  
43 - Map<Long, EmployeeConfigInfo> ec) {  
44 - this.xlId = r.getXl().getId();  
45 - this.clZbh = r.getCarConfigInfo().getCl().getInsideCode();  
46 - this.lpIds = r.getLpIds();  
47 - this.lpNames = r.getLpNames();  
48 - this.ecIds = r.getRyConfigIds();  
49 - this.ecDbbms = r.getRyDbbms();  
50 - this.lpStartIndex = r.getLpStart();  
51 - this.ecStartIndex = r.getRyStart();  
52 - this.ruleId = r.getId();  
53 - this.qyrq = r.getQyrq();  
54 -  
55 - if (!CollectionUtils.isEmpty(cc)) {  
56 - this.ccInfos.putAll(cc);  
57 - }  
58 - if (!CollectionUtils.isEmpty(lp)) {  
59 - this.lpInfos.putAll(lp);  
60 - }  
61 - if (!CollectionUtils.isEmpty(ec)) {  
62 - this.ecInfos.putAll(ec);  
63 - }  
64 -  
65 - }  
66 -  
67 - public Integer getXlId() {  
68 - return xlId;  
69 - }  
70 -  
71 - public void setXlId(Integer xlId) {  
72 - this.xlId = xlId;  
73 - }  
74 -  
75 - public String getClZbh() {  
76 - return clZbh;  
77 - }  
78 -  
79 - public void setClZbh(String clZbh) {  
80 - this.clZbh = clZbh;  
81 - }  
82 -  
83 - public String getLpIds() {  
84 - return lpIds;  
85 - }  
86 -  
87 - public void setLpIds(String lpIds) {  
88 - this.lpIds = lpIds;  
89 - }  
90 -  
91 - public String getLpNames() {  
92 - return lpNames;  
93 - }  
94 -  
95 - public void setLpNames(String lpNames) {  
96 - this.lpNames = lpNames;  
97 - }  
98 -  
99 - public String getEcIds() {  
100 - return ecIds;  
101 - }  
102 -  
103 - public void setEcIds(String ecIds) {  
104 - this.ecIds = ecIds;  
105 - }  
106 -  
107 - public String getEcDbbms() {  
108 - return ecDbbms;  
109 - }  
110 -  
111 - public void setEcDbbms(String ecDbbms) {  
112 - this.ecDbbms = ecDbbms;  
113 - }  
114 -  
115 - public Integer getLpStartIndex() {  
116 - return lpStartIndex;  
117 - }  
118 -  
119 - public void setLpStartIndex(Integer lpStartIndex) {  
120 - this.lpStartIndex = lpStartIndex;  
121 - }  
122 -  
123 - public Integer getEcStartIndex() {  
124 - return ecStartIndex;  
125 - }  
126 -  
127 - public void setEcStartIndex(Integer ecStartIndex) {  
128 - this.ecStartIndex = ecStartIndex;  
129 - }  
130 -  
131 - public Long getRuleId() {  
132 - return ruleId;  
133 - }  
134 -  
135 - public void setRuleId(Long ruleId) {  
136 - this.ruleId = ruleId;  
137 - }  
138 -  
139 - public Date getQyrq() {  
140 - return qyrq;  
141 - }  
142 -  
143 - public void setQyrq(Date qyrq) {  
144 - this.qyrq = qyrq;  
145 - }  
146 -  
147 - public Map<String, CarConfigInfo> getCcInfos() {  
148 - return ccInfos;  
149 - }  
150 -  
151 - public void setCcInfos(Map<String, CarConfigInfo> ccInfos) {  
152 - this.ccInfos = ccInfos;  
153 - }  
154 -  
155 - public Map<Long, GuideboardInfo> getLpInfos() {  
156 - return lpInfos;  
157 - }  
158 -  
159 - public void setLpInfos(Map<Long, GuideboardInfo> lpInfos) {  
160 - this.lpInfos = lpInfos;  
161 - }  
162 -  
163 - public Map<Long, EmployeeConfigInfo> getEcInfos() {  
164 - return ecInfos;  
165 - }  
166 -  
167 - public void setEcInfos(Map<Long, EmployeeConfigInfo> ecInfos) {  
168 - this.ecInfos = ecInfos;  
169 - }  
170 -} 1 +package com.bsth.service.schedule.impl.plan.kBase3.validate.rule;
  2 +
  3 +import com.bsth.entity.schedule.CarConfigInfo;
  4 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  5 +import com.bsth.entity.schedule.GuideboardInfo;
  6 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  7 +import org.springframework.util.CollectionUtils;
  8 +
  9 +import java.util.*;
  10 +
  11 +/**
  12 + * 聚合输入的待判定数据。
  13 + */
  14 +public class WrapInput {
  15 + /** 线路Id */
  16 + private Integer xlId;
  17 + /** 车辆自编号 */
  18 + private String clZbh;
  19 + /** 路牌id列表 */
  20 + private String lpIds;
  21 + /** 路牌名字列表 */
  22 + private String lpNames;
  23 + /** 人员配置列表 */
  24 + private String ecIds;
  25 + /** 人员搭班编码列表 */
  26 + private String ecDbbms;
  27 + /** 路牌循环起始索引 */
  28 + private Integer lpStartIndex;
  29 + /** 人员循环起始索引 */
  30 + private Integer ecStartIndex;
  31 + /** 规则id */
  32 + private Long ruleId;
  33 + /** 启用日期 */
  34 + private Date qyrq;
  35 +
  36 + private Map<String, CarConfigInfo> ccInfos = new HashMap<>();
  37 + private Map<Long, GuideboardInfo> lpInfos = new HashMap<>();
  38 + private Map<Long, EmployeeConfigInfo> ecInfos = new HashMap<>();
  39 +
  40 + public WrapInput(ScheduleRule1Flat r,
  41 + Map<String, CarConfigInfo> cc,
  42 + Map<Long, GuideboardInfo> lp,
  43 + Map<Long, EmployeeConfigInfo> ec) {
  44 + this.xlId = r.getXl().getId();
  45 + this.clZbh = r.getCarConfigInfo().getCl().getInsideCode();
  46 + this.lpIds = r.getLpIds();
  47 + this.lpNames = r.getLpNames();
  48 + this.ecIds = r.getRyConfigIds();
  49 + this.ecDbbms = r.getRyDbbms();
  50 + this.lpStartIndex = r.getLpStart();
  51 + this.ecStartIndex = r.getRyStart();
  52 + this.ruleId = r.getId();
  53 + this.qyrq = r.getQyrq();
  54 +
  55 + if (!CollectionUtils.isEmpty(cc)) {
  56 + this.ccInfos.putAll(cc);
  57 + }
  58 + if (!CollectionUtils.isEmpty(lp)) {
  59 + this.lpInfos.putAll(lp);
  60 + }
  61 + if (!CollectionUtils.isEmpty(ec)) {
  62 + this.ecInfos.putAll(ec);
  63 + }
  64 +
  65 + }
  66 +
  67 + public Integer getXlId() {
  68 + return xlId;
  69 + }
  70 +
  71 + public void setXlId(Integer xlId) {
  72 + this.xlId = xlId;
  73 + }
  74 +
  75 + public String getClZbh() {
  76 + return clZbh;
  77 + }
  78 +
  79 + public void setClZbh(String clZbh) {
  80 + this.clZbh = clZbh;
  81 + }
  82 +
  83 + public String getLpIds() {
  84 + return lpIds;
  85 + }
  86 +
  87 + public void setLpIds(String lpIds) {
  88 + this.lpIds = lpIds;
  89 + }
  90 +
  91 + public String getLpNames() {
  92 + return lpNames;
  93 + }
  94 +
  95 + public void setLpNames(String lpNames) {
  96 + this.lpNames = lpNames;
  97 + }
  98 +
  99 + public String getEcIds() {
  100 + return ecIds;
  101 + }
  102 +
  103 + public void setEcIds(String ecIds) {
  104 + this.ecIds = ecIds;
  105 + }
  106 +
  107 + public String getEcDbbms() {
  108 + return ecDbbms;
  109 + }
  110 +
  111 + public void setEcDbbms(String ecDbbms) {
  112 + this.ecDbbms = ecDbbms;
  113 + }
  114 +
  115 + public Integer getLpStartIndex() {
  116 + return lpStartIndex;
  117 + }
  118 +
  119 + public void setLpStartIndex(Integer lpStartIndex) {
  120 + this.lpStartIndex = lpStartIndex;
  121 + }
  122 +
  123 + public Integer getEcStartIndex() {
  124 + return ecStartIndex;
  125 + }
  126 +
  127 + public void setEcStartIndex(Integer ecStartIndex) {
  128 + this.ecStartIndex = ecStartIndex;
  129 + }
  130 +
  131 + public Long getRuleId() {
  132 + return ruleId;
  133 + }
  134 +
  135 + public void setRuleId(Long ruleId) {
  136 + this.ruleId = ruleId;
  137 + }
  138 +
  139 + public Date getQyrq() {
  140 + return qyrq;
  141 + }
  142 +
  143 + public void setQyrq(Date qyrq) {
  144 + this.qyrq = qyrq;
  145 + }
  146 +
  147 + public Map<String, CarConfigInfo> getCcInfos() {
  148 + return ccInfos;
  149 + }
  150 +
  151 + public void setCcInfos(Map<String, CarConfigInfo> ccInfos) {
  152 + this.ccInfos = ccInfos;
  153 + }
  154 +
  155 + public Map<Long, GuideboardInfo> getLpInfos() {
  156 + return lpInfos;
  157 + }
  158 +
  159 + public void setLpInfos(Map<Long, GuideboardInfo> lpInfos) {
  160 + this.lpInfos = lpInfos;
  161 + }
  162 +
  163 + public Map<Long, EmployeeConfigInfo> getEcInfos() {
  164 + return ecInfos;
  165 + }
  166 +
  167 + public void setEcInfos(Map<Long, EmployeeConfigInfo> ecInfos) {
  168 + this.ecInfos = ecInfos;
  169 + }
  170 +}
src/main/java/com/bsth/service/sys/RoleService.java
1 package com.bsth.service.sys; 1 package com.bsth.service.sys;
2 2
  3 +import java.util.List;
3 import java.util.Map; 4 import java.util.Map;
4 5
5 import com.bsth.entity.sys.Role; 6 import com.bsth.entity.sys.Role;
@@ -10,4 +11,6 @@ public interface RoleService extends BaseService&lt;Role, Integer&gt;{ @@ -10,4 +11,6 @@ public interface RoleService extends BaseService&lt;Role, Integer&gt;{
10 Map<String, Object> settRoleModules(Integer roleId, String mIds); 11 Map<String, Object> settRoleModules(Integer roleId, String mIds);
11 12
12 Map<String, Object> roleInfo(Integer id); 13 Map<String, Object> roleInfo(Integer id);
  14 +
  15 + List<Role> findAllByIds(String ids);
13 } 16 }
src/main/java/com/bsth/service/sys/impl/RoleServiceImpl.java
@@ -103,4 +103,9 @@ public class RoleServiceImpl extends BaseServiceImpl&lt;Role, Integer&gt; implements @@ -103,4 +103,9 @@ public class RoleServiceImpl extends BaseServiceImpl&lt;Role, Integer&gt; implements
103 map.put("userNames", userNames); 103 map.put("userNames", userNames);
104 return map; 104 return map;
105 } 105 }
  106 +
  107 + @Override
  108 + public List<Role> findAllByIds(String ids) {
  109 + return roleRepository.findAllById(ids);
  110 + }
106 } 111 }
src/main/resources/application-dev.properties
@@ -31,4 +31,4 @@ http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all @@ -31,4 +31,4 @@ http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all
31 ## gateway real data 31 ## gateway real data
32 http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/ 32 http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/
33 ## gateway send directive 33 ## gateway send directive
34 -http.send.directive = http://192.168.168.201:9090/transport_server/message/ 34 +http.send.directive = http://192.168.168.201:9090/transport_server/message/
35 \ No newline at end of file 35 \ No newline at end of file
src/main/resources/application-prod.properties
@@ -17,22 +17,15 @@ spring.datasource.max-idle=8 @@ -17,22 +17,15 @@ spring.datasource.max-idle=8
17 spring.datasource.min-idle=8 17 spring.datasource.min-idle=8
18 spring.datasource.initial-size=5 18 spring.datasource.initial-size=5
19 19
20 -spring.datasource.max-wait=10000  
21 -spring.datasource.remove-abandoned=true  
22 -spring.datasource.remove-abandoned-timeout=120  
23 -  
24 spring.datasource.test-on-borrow=true 20 spring.datasource.test-on-borrow=true
25 spring.datasource.test-on-connect=true 21 spring.datasource.test-on-connect=true
26 spring.datasource.test-on-return=true 22 spring.datasource.test-on-return=true
27 spring.datasource.test-while-idle=true 23 spring.datasource.test-while-idle=true
28 spring.datasource.validation-query=select 1 24 spring.datasource.validation-query=select 1
29 -spring.datasource.time-between-eviction-runs-millis=1800000  
30 25
31 ## gps client data 26 ## gps client data
32 http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all 27 http.gps.real.cache.url= http://10.10.150.24:12580/realGps/all
33 ## gateway real data 28 ## gateway real data
34 http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/ 29 http.gps.real.url= http://10.10.200.79:8080/transport_server/rtgps/
35 ## gateway send directive 30 ## gateway send directive
36 -http.send.directive = http://10.10.200.79:8080/transport_server/message/  
37 -## maintenance report  
38 -http.report.url = http://116.247.73.122:9098/jgjwsystem_j2ee/  
39 \ No newline at end of file 31 \ No newline at end of file
  32 +http.send.directive = http://10.10.200.79:8080/transport_server/message/
40 \ No newline at end of file 33 \ No newline at end of file
src/main/resources/application.properties
1 spring.profiles: dev,prod 1 spring.profiles: dev,prod
2 -spring.profiles.active: prod 2 +spring.profiles.active: dev
3 3
4 spring.view.suffix=.html 4 spring.view.suffix=.html
5 server.session-timeout=-1 5 server.session-timeout=-1