Commit f5c88b2bfcf3ce9b417ed01f37fdd694bc431e35

Authored by 王通
2 parents acb0370e cccd1d92

Merge branch 'pudong' into minhang

# Conflicts:
#	src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
#	src/main/java/com/bsth/repository/sys/ResourceRepository.java
#	src/main/java/com/bsth/service/sys/impl/RoleServiceImpl.java
#	src/main/resources/application-prod.properties
#	src/main/resources/static/pages/permission/resource/list.html
#	src/main/resources/traffic-jdbc.properties
Showing 28 changed files with 887 additions and 403 deletions

Too many changes to show.

To preserve performance only 28 of 98 files are displayed.

src/main/java/com/bsth/controller/StationController.java
@@ -2,6 +2,8 @@ package com.bsth.controller; @@ -2,6 +2,8 @@ package com.bsth.controller;
2 2
3 import java.util.Map; 3 import java.util.Map;
4 4
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
5 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
6 import org.springframework.web.bind.annotation.RequestMapping; 8 import org.springframework.web.bind.annotation.RequestMapping;
7 import org.springframework.web.bind.annotation.RequestMethod; 9 import org.springframework.web.bind.annotation.RequestMethod;
@@ -34,6 +36,9 @@ public class StationController extends BaseController<Station, Integer> { @@ -34,6 +36,9 @@ public class StationController extends BaseController<Station, Integer> {
34 36
35 @Autowired 37 @Autowired
36 private StationService service; 38 private StationService service;
  39 +
  40 + /** 日志记录器 */
  41 + private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class);
37 42
38 /** 43 /**
39 * @Description :TODO(根据坐标点匹配数据库中的站点) 44 * @Description :TODO(根据坐标点匹配数据库中的站点)
@@ -153,10 +158,13 @@ public class StationController extends BaseController<Station, Integer> { @@ -153,10 +158,13 @@ public class StationController extends BaseController<Station, Integer> {
153 */ 158 */
154 @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) 159 @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET)
155 public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { 160 public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) {
  161 + System.out.println(stationCount+" _ "+ sectionCount );
156 for(int i = 0; i < stationCount; i++) { 162 for(int i = 0; i < stationCount; i++) {
  163 + System.out.println(stationCount);
157 GetUIDAndCode.getStationId(); 164 GetUIDAndCode.getStationId();
158 } 165 }
159 for(int i = 0; i < sectionCount; i++) { 166 for(int i = 0; i < sectionCount; i++) {
  167 + System.out.println(sectionCount);
160 GetUIDAndCode.getSectionId(); 168 GetUIDAndCode.getSectionId();
161 } 169 }
162 return 1; 170 return 1;
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
1 package com.bsth.controller.schedule.core; 1 package com.bsth.controller.schedule.core;
2 2
  3 +import com.bsth.common.Constants;
3 import com.bsth.common.ResponseCode; 4 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 5 import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.CarConfigInfo; 6 import com.bsth.entity.schedule.CarConfigInfo;
  7 +import com.bsth.entity.sys.CompanyAuthority;
6 import com.bsth.repository.schedule.CarConfigInfoRepository; 8 import com.bsth.repository.schedule.CarConfigInfoRepository;
7 import com.bsth.service.schedule.CarConfigInfoService; 9 import com.bsth.service.schedule.CarConfigInfoService;
8 import com.bsth.service.schedule.exception.ScheduleException; 10 import com.bsth.service.schedule.exception.ScheduleException;
@@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMethod; @@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
12 import org.springframework.web.bind.annotation.RequestParam; 14 import org.springframework.web.bind.annotation.RequestParam;
13 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
14 16
  17 +import javax.servlet.http.HttpServletRequest;
  18 +import javax.servlet.http.HttpSession;
15 import java.util.HashMap; 19 import java.util.HashMap;
16 import java.util.List; 20 import java.util.List;
17 import java.util.Map; 21 import java.util.Map;
@@ -58,4 +62,70 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; { @@ -58,4 +62,70 @@ public class CarConfigInfoController extends BController&lt;CarConfigInfo, Long&gt; {
58 62
59 return rtn; 63 return rtn;
60 } 64 }
  65 +
  66 + @RequestMapping(value = "/validate_cars_gs", method = RequestMethod.GET)
  67 + public Map<String, Object> validate_cars_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  68 + HttpSession session = request.getSession();
  69 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  70 +
  71 + Map<String, Object> rtn = new HashMap<>();
  72 + try {
  73 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  74 + null,
  75 + param.get("xl.id_eq"),
  76 + param.get("xl.name_eq"),
  77 + param.get("cl.id_eq")
  78 + );
  79 + carConfigInfoService.validate_cars_gs(carConfigInfo, cmyAuths);
  80 + rtn.put("status", ResponseCode.SUCCESS);
  81 + } catch (ScheduleException exp) {
  82 + rtn.put("status", ResponseCode.ERROR);
  83 + rtn.put("msg", exp.getMessage());
  84 + }
  85 +
  86 + return rtn;
  87 + }
  88 +
  89 + @RequestMapping(value = "/validate_cars_fgs", method = RequestMethod.GET)
  90 + public Map<String, Object> validate_cars_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  91 + HttpSession session = request.getSession();
  92 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  93 +
  94 + Map<String, Object> rtn = new HashMap<>();
  95 + try {
  96 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  97 + null,
  98 + param.get("xl.id_eq"),
  99 + param.get("xl.name_eq"),
  100 + param.get("cl.id_eq")
  101 + );
  102 + carConfigInfoService.validate_cars_fgs(carConfigInfo, cmyAuths);
  103 + rtn.put("status", ResponseCode.SUCCESS);
  104 + } catch (ScheduleException exp) {
  105 + rtn.put("status", ResponseCode.ERROR);
  106 + rtn.put("msg", exp.getMessage());
  107 + }
  108 +
  109 + return rtn;
  110 + }
  111 +
  112 + @RequestMapping(value = "/validate_cars_config", method = RequestMethod.GET)
  113 + public Map<String, Object> validate_cars_config(@RequestParam Map<String, Object> param) {
  114 + Map<String, Object> rtn = new HashMap<>();
  115 + try {
  116 + CarConfigInfo carConfigInfo = new CarConfigInfo(
  117 + null,
  118 + param.get("xl.id_eq"),
  119 + param.get("xl.name_eq"),
  120 + param.get("cl.id_eq")
  121 + );
  122 + carConfigInfoService.validate_cars_config(carConfigInfo);
  123 + rtn.put("status", ResponseCode.SUCCESS);
  124 + } catch (ScheduleException exp) {
  125 + rtn.put("status", ResponseCode.ERROR);
  126 + rtn.put("msg", exp.getMessage());
  127 + }
  128 +
  129 + return rtn;
  130 + }
61 } 131 }
src/main/java/com/bsth/controller/schedule/core/EmployeeConfigInfoController.java
1 package com.bsth.controller.schedule.core; 1 package com.bsth.controller.schedule.core;
2 2
  3 +import com.bsth.common.Constants;
3 import com.bsth.common.ResponseCode; 4 import com.bsth.common.ResponseCode;
4 import com.bsth.controller.schedule.BController; 5 import com.bsth.controller.schedule.BController;
5 import com.bsth.entity.schedule.EmployeeConfigInfo; 6 import com.bsth.entity.schedule.EmployeeConfigInfo;
  7 +import com.bsth.entity.sys.CompanyAuthority;
6 import com.bsth.repository.schedule.EmployeeConfigInfoRepository; 8 import com.bsth.repository.schedule.EmployeeConfigInfoRepository;
7 import com.bsth.service.schedule.EmployeeConfigInfoService; 9 import com.bsth.service.schedule.EmployeeConfigInfoService;
8 import com.bsth.service.schedule.exception.ScheduleException; 10 import com.bsth.service.schedule.exception.ScheduleException;
9 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.web.bind.annotation.*; 12 import org.springframework.web.bind.annotation.*;
11 13
  14 +import javax.servlet.http.HttpServletRequest;
  15 +import javax.servlet.http.HttpSession;
12 import java.util.HashMap; 16 import java.util.HashMap;
13 import java.util.List; 17 import java.util.List;
14 import java.util.Map; 18 import java.util.Map;
@@ -91,6 +95,54 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo @@ -91,6 +95,54 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
91 return rtn; 95 return rtn;
92 } 96 }
93 97
  98 + @RequestMapping(value = "/validate_jsy_gs", method = RequestMethod.GET)
  99 + public Map<String, Object> validate_jsy_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  100 + HttpSession session = request.getSession();
  101 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  102 +
  103 + Map<String, Object> rtn = new HashMap<>();
  104 + try {
  105 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  106 + null,
  107 + param.get("xl.id_eq"),
  108 + param.get("xl.name_eq"),
  109 + param.get("jsy.id_eq"),
  110 + null
  111 + );
  112 + employeeConfigInfoService.validate_jsy_gs(employeeConfigInfo, cmyAuths);
  113 + rtn.put("status", ResponseCode.SUCCESS);
  114 + } catch (ScheduleException exp) {
  115 + rtn.put("status", ResponseCode.ERROR);
  116 + rtn.put("msg", exp.getMessage());
  117 + }
  118 +
  119 + return rtn;
  120 + }
  121 +
  122 + @RequestMapping(value = "/validate_jsy_fgs", method = RequestMethod.GET)
  123 + public Map<String, Object> validate_jsy_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  124 + HttpSession session = request.getSession();
  125 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  126 +
  127 + Map<String, Object> rtn = new HashMap<>();
  128 + try {
  129 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  130 + null,
  131 + param.get("xl.id_eq"),
  132 + param.get("xl.name_eq"),
  133 + param.get("jsy.id_eq"),
  134 + null
  135 + );
  136 + employeeConfigInfoService.validate_jsy_fgs(employeeConfigInfo, cmyAuths);
  137 + rtn.put("status", ResponseCode.SUCCESS);
  138 + } catch (ScheduleException exp) {
  139 + rtn.put("status", ResponseCode.ERROR);
  140 + rtn.put("msg", exp.getMessage());
  141 + }
  142 +
  143 + return rtn;
  144 + }
  145 +
94 @RequestMapping(value = "/validate_spy", method = RequestMethod.GET) 146 @RequestMapping(value = "/validate_spy", method = RequestMethod.GET)
95 public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) { 147 public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) {
96 Map<String, Object> rtn = new HashMap<>(); 148 Map<String, Object> rtn = new HashMap<>();
@@ -130,4 +182,50 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo @@ -130,4 +182,50 @@ public class EmployeeConfigInfoController extends BController&lt;EmployeeConfigInfo
130 } 182 }
131 return rtn; 183 return rtn;
132 } 184 }
  185 +
  186 + @RequestMapping(value = "/validate_spy_gs", method = RequestMethod.GET)
  187 + public Map<String, Object> validate_spy_gs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  188 + HttpSession session = request.getSession();
  189 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  190 +
  191 + Map<String, Object> rtn = new HashMap<>();
  192 + try {
  193 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  194 + null,
  195 + param.get("xl.id_eq"),
  196 + param.get("xl.name_eq"),
  197 + null,
  198 + param.get("spy.id_eq")
  199 + );
  200 + employeeConfigInfoService.validate_spy_gs(employeeConfigInfo, cmyAuths);
  201 + rtn.put("status", ResponseCode.SUCCESS);
  202 + } catch (ScheduleException exp) {
  203 + rtn.put("status", ResponseCode.ERROR);
  204 + rtn.put("msg", exp.getMessage());
  205 + }
  206 + return rtn;
  207 + }
  208 +
  209 + @RequestMapping(value = "/validate_spy_fgs", method = RequestMethod.GET)
  210 + public Map<String, Object> validate_spy_fgs(HttpServletRequest request, @RequestParam Map<String, Object> param) {
  211 + HttpSession session = request.getSession();
  212 + List<CompanyAuthority> cmyAuths = (List<CompanyAuthority>) session.getAttribute(Constants.COMPANY_AUTHORITYS);
  213 +
  214 + Map<String, Object> rtn = new HashMap<>();
  215 + try {
  216 + EmployeeConfigInfo employeeConfigInfo = new EmployeeConfigInfo(
  217 + null,
  218 + param.get("xl.id_eq"),
  219 + param.get("xl.name_eq"),
  220 + null,
  221 + param.get("spy.id_eq")
  222 + );
  223 + employeeConfigInfoService.validate_spy_fgs(employeeConfigInfo, cmyAuths);
  224 + rtn.put("status", ResponseCode.SUCCESS);
  225 + } catch (ScheduleException exp) {
  226 + rtn.put("status", ResponseCode.ERROR);
  227 + rtn.put("msg", exp.getMessage());
  228 + }
  229 + return rtn;
  230 + }
133 } 231 }
src/main/java/com/bsth/controller/sys/ResourceController.java
1 package com.bsth.controller.sys; 1 package com.bsth.controller.sys;
2 2
3 -import java.util.List;  
4 import java.util.Map; 3 import java.util.Map;
5 4
6 -import com.bsth.security.SecurityMetadataSourceService;  
7 import org.springframework.beans.factory.annotation.Autowired; 5 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.web.bind.annotation.RequestMapping; 6 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RequestMethod; 7 import org.springframework.web.bind.annotation.RequestMethod;
@@ -21,22 +19,9 @@ public class ResourceController extends BaseController&lt;Resource, Integer&gt;{ @@ -21,22 +19,9 @@ public class ResourceController extends BaseController&lt;Resource, Integer&gt;{
21 19
22 @Autowired 20 @Autowired
23 ResourceService resourceService; 21 ResourceService resourceService;
24 -  
25 - @Autowired  
26 - SecurityMetadataSourceService securityMetadataSourceService;  
27 22
28 @RequestMapping(value = "/batch", method = RequestMethod.POST) 23 @RequestMapping(value = "/batch", method = RequestMethod.POST)
29 public Map<String, Object> save(@RequestParam String array){ 24 public Map<String, Object> save(@RequestParam String array){
30 return resourceService.saveList(JSON.parseArray(array, Resource.class)); 25 return resourceService.saveList(JSON.parseArray(array, Resource.class));
31 } 26 }
32 -  
33 - /***  
34 - * 查询所有资源信息,如果当前角色id拥有该资源就将原Resource实体类中的enable改为true否则为false  
35 - * @param roleId  
36 - * @return  
37 - */  
38 - @RequestMapping(value = "/findResource",method = RequestMethod.GET)  
39 - public List<Resource> findResource(Integer roleId){  
40 - return resourceService.findResource(roleId);  
41 - }  
42 } 27 }
src/main/java/com/bsth/controller/sys/RoleController.java
@@ -44,17 +44,4 @@ public class RoleController extends BaseController&lt;Role, Integer&gt;{ @@ -44,17 +44,4 @@ public class RoleController extends BaseController&lt;Role, Integer&gt;{
44 public Map<String, Object> roleInfo(@RequestParam Integer id){ 44 public Map<String, Object> roleInfo(@RequestParam Integer id){
45 return roleService.roleInfo(id); 45 return roleService.roleInfo(id);
46 } 46 }
47 -  
48 - /**  
49 - *  
50 - * @Title: settRoleModules  
51 - * @Description: TODO(为角色设置资源)  
52 - * @param @param roleId 角色ID  
53 - * @param @param mIds 模块ID字符串(1,2,3,4)  
54 - * @throws  
55 - */  
56 - @RequestMapping(value = "/settResources",method = RequestMethod.POST)  
57 - public Map<String, Object> settResources(@RequestParam Integer roleId, @RequestParam String rIds){  
58 - return roleService.settRoleResources(roleId,rIds);  
59 - }  
60 } 47 }
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
@@ -81,6 +81,7 @@ public class InStationProcess { @@ -81,6 +81,7 @@ public class InStationProcess {
81 * @param prev 81 * @param prev
82 */ 82 */
83 private void inStation(GpsEntity gps, GpsEntity prev) { 83 private void inStation(GpsEntity gps, GpsEntity prev) {
  84 + logger.info("进站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")");
84 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); 85 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
85 boolean flow = true; 86 boolean flow = true;
86 //要经过2个中途站才能进 87 //要经过2个中途站才能进
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
@@ -74,6 +74,7 @@ public class OutStationProcess { @@ -74,6 +74,7 @@ public class OutStationProcess {
74 * @param gps 74 * @param gps
75 */ 75 */
76 private void outStation(GpsEntity gps, GpsEntity prev) { 76 private void outStation(GpsEntity gps, GpsEntity prev) {
  77 + logger.info("进站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")");
77 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); 78 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
78 79
79 //起点发车 80 //起点发车
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
@@ -108,6 +108,7 @@ public class LateAdjustHandle implements ApplicationContextAware { @@ -108,6 +108,7 @@ public class LateAdjustHandle implements ApplicationContextAware {
108 try { 108 try {
109 if (gps.getInstation() <= 0 || null == sch) 109 if (gps.getInstation() <= 0 || null == sch)
110 return; 110 return;
  111 + logger.info("carArrive id: " + sch.getId());
111 112
112 if (!lateSchMap.containsKey(sch.getId())) { 113 if (!lateSchMap.containsKey(sch.getId())) {
113 //班次是否误点(可能处于误点线程扫描的空隙,所以再判定一次) 114 //班次是否误点(可能处于误点线程扫描的空隙,所以再判定一次)
src/main/java/com/bsth/repository/CarDeviceRepository.java
@@ -15,4 +15,10 @@ import org.springframework.stereotype.Repository; @@ -15,4 +15,10 @@ import org.springframework.stereotype.Repository;
15 public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> { 15 public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> {
16 @Query(value="select s from CarDevice s where s.newDeviceNo=?1 and s.qyrq<=?2 ") 16 @Query(value="select s from CarDevice s where s.newDeviceNo=?1 and s.qyrq<=?2 ")
17 List<CarDevice> findCarDevice(String device,Date date ); 17 List<CarDevice> findCarDevice(String device,Date date );
  18 +
  19 + @Query(value="select s from CarDevice s where s.oldDeviceNo=?1 and s.qyrq>=?2 ")
  20 + List<CarDevice> findCarOldDevice(String device,Date date );
  21 +
  22 + @Query(value="select s from CarDevice s where s.clZbh=?1 and s.qyrq>=?2 ")
  23 + List<CarDevice> findCarCode(String code,Date date );
18 } 24 }
src/main/java/com/bsth/repository/sys/ResourceRepository.java
1 package com.bsth.repository.sys; 1 package com.bsth.repository.sys;
2 2
3 import java.util.List; 3 import java.util.List;
4 -import java.util.Set;  
5 4
6 -import org.springframework.data.jpa.domain.Specification;  
7 -import org.springframework.data.jpa.repository.Modifying;  
8 -import org.springframework.data.jpa.repository.Query;  
9 -import org.springframework.data.repository.query.Param;  
10 import org.springframework.stereotype.Repository; 5 import org.springframework.stereotype.Repository;
11 6
12 import com.bsth.entity.sys.Resource; 7 import com.bsth.entity.sys.Resource;
13 import com.bsth.repository.BaseRepository; 8 import com.bsth.repository.BaseRepository;
14 -import org.springframework.transaction.annotation.Propagation;  
15 -import org.springframework.transaction.annotation.Transactional;  
16 9
17 @Repository 10 @Repository
18 public interface ResourceRepository extends BaseRepository<Resource, Integer> { 11 public interface ResourceRepository extends BaseRepository<Resource, Integer> {
19 12
20 - List<Resource> findByRolesId(Integer roleId);  
21 -  
22 - /***  
23 - * 查询所有资源信息,如果当前角色id拥有该资源就将原Resource实体类中的enable改为true否则为false  
24 - * @param roleId 角色id  
25 - * @return  
26 - */  
27 - @Query(value = "select a.id ,a.`name`,a.create_date,a.descriptions,a.method,a.module,a.update_date,a.url,if(b.resources is null,0,1) enable from bsth_c_sys_resource a\n" +  
28 - "left join \n" +  
29 - "(select resources from bsth_c_sys_resource_roles where roles = ?1) b\n" +  
30 - "on a.id = b.resources",nativeQuery = true)  
31 - List<Resource> findResource(int roleId); 13 + List<Resource> findByRolesId(Integer roleId);
32 } 14 }
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
@@ -1237,6 +1237,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer @@ -1237,6 +1237,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1237 s.setYwlc(Arith.add(s.getYwlc()!=null?s.getYwlc():0, s_.getYwlc())); 1237 s.setYwlc(Arith.add(s.getYwlc()!=null?s.getYwlc():0, s_.getYwlc()));
1238 s.setQtlc(Arith.add(s.getQtlc()!=null?s.getQtlc():0, s_.getQtlc())); 1238 s.setQtlc(Arith.add(s.getQtlc()!=null?s.getQtlc():0, s_.getQtlc()));
1239 s.setLjlc(Arith.add(s.getLjlc()!=null?s.getLjlc():0, s_.getLjlc())); 1239 s.setLjlc(Arith.add(s.getLjlc()!=null?s.getLjlc():0, s_.getLjlc()));
  1240 + if(s_.getLjkslc() == null){
  1241 + s_.setLjkslc(0d);
  1242 + }
1240 s.setLjkslc(Arith.add(s.getLjkslc()!=null?s.getLjkslc():0, s_.getLjkslc())); 1243 s.setLjkslc(Arith.add(s.getLjkslc()!=null?s.getLjkslc():0, s_.getLjkslc()));
1241 s.setJhbcq(s.getJhbcq() + s_.getJhbcq()); 1244 s.setJhbcq(s.getJhbcq() + s_.getJhbcq());
1242 s.setJhbcz(s.getJhbcz() + s_.getJhbcz()); 1245 s.setJhbcz(s.getJhbcz() + s_.getJhbcz());
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
@@ -536,7 +536,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -536,7 +536,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
536 //发送邮件 536 //发送邮件
537 EmailBean mail = new EmailBean(); 537 EmailBean mail = new EmailBean();
538 mail.setSubject(InetAddress.getLocalHost().getHostAddress()+":路单日志数据"+date); 538 mail.setSubject(InetAddress.getLocalHost().getHostAddress()+":路单日志数据"+date);
539 - mail.setContent(logSuccess+"<br/>成功数:"+countSuccess+"<br/>" +logFailure+"<br/>失败数:"+countFailure); 539 + mail.setContent("成功数:"+countSuccess+"<br/>失败数:"+countFailure+"<br/>" +logSuccess + "<br/>"+logFailure);
540 sendEmailController.sendMail(emailSendToAddress, mail); 540 sendEmailController.sendMail(emailSendToAddress, mail);
541 logger.info("setLD-sendMail:邮件发送成功!"); 541 logger.info("setLD-sendMail:邮件发送成功!");
542 }catch (Exception e){ 542 }catch (Exception e){
@@ -945,11 +945,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -945,11 +945,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
945 */ 945 */
946 @Override 946 @Override
947 public String setSKB(String ids) { 947 public String setSKB(String ids) {
948 - String result = "failure"; 948 + String result = "上传失败,";
949 StringBuffer sBuffer = new StringBuffer(); 949 StringBuffer sBuffer = new StringBuffer();
950 DecimalFormat df = new DecimalFormat("######0.000"); 950 DecimalFormat df = new DecimalFormat("######0.000");
951 - Map<String,String> lsStationCode2NameMap;  
952 - Map<String, Integer> lsStationName2YgcNumber; 951 + Map<String,String> lsStationCode2NameMap = null;
  952 + Map<String, Integer> lsStationName2YgcNumber = null;
953 try { 953 try {
954 String[] idArray = ids.split(","); 954 String[] idArray = ids.split(",");
955 StringBuffer sBufferA ,sBufferB ,sBufferC ; 955 StringBuffer sBufferA ,sBufferB ,sBufferC ;
@@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{
965 sBuffer.append("<SKBs>"); 965 sBuffer.append("<SKBs>");
966 HashMap<String,String> paramMap; 966 HashMap<String,String> paramMap;
967 HashMap<String,String> otherMap = new HashMap<>(); 967 HashMap<String,String> otherMap = new HashMap<>();
  968 + // 线路编码、周几执行、发车站点名称、发车站点序号、到达站点名称、到达站点序号
  969 + String xlbm,zjzx,fczdmc,zdxh,ddzdmc,ddxh;
  970 + // 得到时刻表版本号
  971 + int lineVersion;
  972 + long ttinfoId;
  973 + // 是否输出站点信息
  974 + boolean isLogStation;
968 for (int i = 0; i < idArray.length; i++) { 975 for (int i = 0; i < idArray.length; i++) {
969 - long ttinfoId = Long.valueOf(idArray[i]); 976 + ttinfoId = Long.valueOf(idArray[i]);
970 ttInfo = ttInfoRepository.findOne(ttinfoId); 977 ttInfo = ttInfoRepository.findOne(ttinfoId);
971 if(ttInfo == null) 978 if(ttInfo == null)
972 continue; 979 continue;
973 ttinfoList.add(ttInfo); // 保存时刻表 980 ttinfoList.add(ttInfo); // 保存时刻表
974 // 得到时刻表版本号 981 // 得到时刻表版本号
975 - int lineVersion = ttInfo.getLineVersion(); 982 + lineVersion = ttInfo.getLineVersion();
976 // 查询历史站点路由 983 // 查询历史站点路由
977 lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); 984 lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion);
978 // 查询历史站点路由 985 // 查询历史站点路由
@@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{
988 param = new HashMap(); 995 param = new HashMap();
989 param.put("line.id_eq", ttInfo.getXl().getId()); 996 param.put("line.id_eq", ttInfo.getXl().getId());
990 lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); 997 lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param));
  998 + // 初始化
  999 + isLogStation = true;
991 if(ttInfoDetailIterator.hasNext()){ 1000 if(ttInfoDetailIterator.hasNext()){
  1001 + // 得到线路信息
  1002 + Line line = lineRepository.findOne(ttInfo.getXl().getId());
  1003 + if(line == null){
  1004 + result += "未找到相应的线路信息,请设置线路信息后再上传";
  1005 + return result;
  1006 + }
  1007 + // 得到上海市线路编码
  1008 + xlbm = line.getShanghaiLinecode();
  1009 + if("".equals(xlbm) || "null".equals(xlbm)){
  1010 + result += "线路编码为空,请设置线路编码后再上传";
  1011 + return result;
  1012 + }
  1013 + // 拿到周几执行
  1014 + zjzx = changeRuleDay(ttInfo.getRule_days());
  1015 + if("".equals(zjzx) || "null".equals(zjzx)){
  1016 + result += "时刻表执行时间为空,请设置执行时间后再上传";
  1017 + return result;
  1018 + }
992 sBuffer.append("<SKB>"); 1019 sBuffer.append("<SKB>");
993 - sBuffer.append("<XLBM>").append(BasicData.lineId2ShangHaiCodeMap.get(ttInfo.getXl().getId()))  
994 - .append("</XLBM>"); 1020 + sBuffer.append("<XLBM>").append(xlbm).append("</XLBM>");
995 sBufferB = new StringBuffer(); 1021 sBufferB = new StringBuffer();
996 sBufferC = new StringBuffer(); 1022 sBufferC = new StringBuffer();
997 sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); 1023 sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>");
998 // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 1024 // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表
999 sBufferB.append("<JSRQ>").append("").append("</JSRQ>"); 1025 sBufferB.append("<JSRQ>").append("").append("</JSRQ>");
1000 - sBufferB.append("<ZJZX>").append(changeRuleDay(ttInfo.getRule_days())).append("</ZJZX>"); 1026 + sBufferB.append("<ZJZX>").append(zjzx).append("</ZJZX>");
1001 sBufferB.append("<TBYY>").append("").append("</TBYY>"); 1027 sBufferB.append("<TBYY>").append("").append("</TBYY>");
1002 sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); 1028 sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>");
1003 sBufferB.append("<BCList>"); 1029 sBufferB.append("<BCList>");
@@ -1021,22 +1047,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1021,22 +1047,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1021 if(changeTimeFormat(ttInfoDetail) == null){ 1047 if(changeTimeFormat(ttInfoDetail) == null){
1022 continue; 1048 continue;
1023 } 1049 }
  1050 + // 发生站点名称
  1051 + fczdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getQdzCode());
  1052 + if("".equals(fczdmc) || "null".equals(fczdmc)){
  1053 + result += "发车站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传";
  1054 + return result;
  1055 + }
1024 sBufferC.append("<BC>"); 1056 sBufferC.append("<BC>");
1025 sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); 1057 sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>");
1026 sBufferC.append("<SXX>").append(sxx).append("</SXX>"); 1058 sBufferC.append("<SXX>").append(sxx).append("</SXX>");
1027 - sBufferC.append("<FCZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()  
1028 - +"_"+ttInfoDetail.getQdzCode())).append("</FCZDMC>"); 1059 + sBufferC.append("<FCZDMC>").append(fczdmc).append("</FCZDMC>");
1029 // 起点站的参数 1060 // 起点站的参数
1030 otherMap.put("stationMark","B"); 1061 otherMap.put("stationMark","B");
1031 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 1062 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
1032 - sBufferC.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</ZDXH>"); 1063 + if(isLogStation){// 输出起点站信息
  1064 + logger.info("setSKB:"+"起点站信息:"+paramMap);
  1065 + }
  1066 + // 发车站点序号
  1067 + zdxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber));
  1068 + if("".equals(zdxh) || "null".equals(zdxh) || "0".equals(zdxh)){
  1069 + result += "发车站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传";
  1070 + return result;
  1071 + }
  1072 + // 到达站点名称
  1073 + ddzdmc = lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()+"_"+ttInfoDetail.getZdzCode());
  1074 + if("".equals(ddzdmc) || "null".equals(ddzdmc)){
  1075 + result += "到达站点名称为空,请根据时刻表当前的版本号设置好历史站点路由再上传";
  1076 + return result;
  1077 + }
  1078 + sBufferC.append("<ZDXH>").append(zdxh).append("</ZDXH>");
1033 sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>"); 1079 sBufferC.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
1034 - sBufferC.append("<DDZDMC>").append(lsStationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()  
1035 - +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>");  
1036 - // 起点站的参数 1080 + sBufferC.append("<DDZDMC>").append(ddzdmc).append("</DDZDMC>");
  1081 + // 终点站的参数
1037 otherMap.put("stationMark","E"); 1082 otherMap.put("stationMark","E");
1038 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap); 1083 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
1039 - sBufferC.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber)).append("</DDXH>"); 1084 + if(isLogStation){// 输出终点站信息
  1085 + logger.info("setSKB:"+"终点站信息:"+paramMap);
  1086 + }
  1087 + // 到达站点序号
  1088 + ddxh = String.valueOf(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,lsStationName2YgcNumber));
  1089 + if("".equals(ddxh) || "null".equals(ddxh) || "0".equals(ddxh)){
  1090 + result += "到达站点序号为空,请根据时刻表当前的版本号设置好历史站点路由再上传";
  1091 + return result;
  1092 + }
  1093 + isLogStation = false; // 一条线路只输出一次,后面的不输出了
  1094 + sBufferC.append("<DDXH>").append(ddxh).append("</DDXH>");
1040 sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); 1095 sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
1041 sBufferC.append("</BC>"); 1096 sBufferC.append("</BC>");
1042 // 0:上行;1:下行 1097 // 0:上行;1:下行
@@ -1055,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ @@ -1055,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1055 sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); 1110 sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>");
1056 sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); 1111 sBuffer.append(sBufferA).append(sBufferB).append(sBufferC);
1057 } 1112 }
  1113 + logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber);
1058 } 1114 }
1059 sBuffer.append("</SKBs>"); 1115 sBuffer.append("</SKBs>");
1060 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ 1116 if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){
1061 - result = "success"; 1117 + result = "上传成功";
1062 SKBUploadLogger skbUploadLogger ; 1118 SKBUploadLogger skbUploadLogger ;
1063 SysUser user = SecurityUtils.getCurrentUser(); 1119 SysUser user = SecurityUtils.getCurrentUser();
1064 // 保存时刻表上传记录 1120 // 保存时刻表上传记录
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -1210,34 +1210,73 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1210,34 +1210,73 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1210 1210
1211 } 1211 }
1212 String device = ""; 1212 String device = "";
  1213 + String device2 ="";
  1214 + long qyrqTime=0l;
1213 if (!code.equals("")) { 1215 if (!code.equals("")) {
1214 - device = BasicData.deviceId2NbbmMap.inverse().get(code); 1216 + try {
  1217 + List<CarDevice> deviceList=carDeviceRepository.findCarCode(code, sdf.parse(date+ " 00:00:00"));
  1218 + if(deviceList.size()>0){
  1219 + device=deviceList.get(0).getOldDeviceNo();
  1220 + Date qyrq=deviceList.get(0).getQyrq();
  1221 + qyrqTime=qyrq.getTime();
  1222 + if(qyrqTime<t){
  1223 + device2=deviceList.get(0).getNewDeviceNo();
  1224 + }
  1225 + }else{
  1226 + device = BasicData.deviceId2NbbmMap.inverse().get(code);
  1227 + }
  1228 + } catch (ParseException e) {
  1229 + // TODO Auto-generated catch block
  1230 + e.printStackTrace();
  1231 + }
1215 } 1232 }
1216 - List<Object[]> list = scheduleRealInfoRepository.historyMessage(line, d, t, device);  
1217 - for (Object[] obj : list) { 1233 + List<Object[]> list=new ArrayList<Object[]>();
  1234 +
  1235 + List<Object[]> list0 =scheduleRealInfoRepository.historyMessage(line, d, t, device);
  1236 + for (Object[] obj : list0) {
1218 if (obj != null) { 1237 if (obj != null) {
1219 -  
1220 - if (BasicData.deviceId2NbbmMap.get(obj[0].toString()) == null) {  
1221 - List<CarDevice> carDeviceList = new ArrayList<CarDevice>();  
1222 - try {  
1223 - carDeviceList = carDeviceRepository.findCarDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString())));  
1224 - } catch (Exception e) {  
1225 - // TODO Auto-generated catch block  
1226 - e.printStackTrace();  
1227 - }  
1228 - if (carDeviceList.size() > 0) {  
1229 - obj[0] = carDeviceList.get(0).getClZbh(); 1238 + if(code.equals("")){
  1239 + if (BasicData.deviceId2NbbmMap.get(obj[0].toString()) == null) {
  1240 + List<CarDevice> carDeviceList = new ArrayList<CarDevice>();
  1241 + try {
  1242 + carDeviceList = carDeviceRepository.findCarDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString())));
  1243 + //启用日期大于营运日期 还是根据旧设备号查询
  1244 + if(carDeviceList.size()==0){
  1245 + carDeviceList = carDeviceRepository.findCarOldDevice(obj[0].toString(), new Date(Long.parseLong(obj[3].toString())));
  1246 + }
  1247 + } catch (Exception e) {
  1248 + // TODO Auto-generated catch block
  1249 + e.printStackTrace();
  1250 + }
  1251 + if (carDeviceList.size() > 0) {
  1252 + obj[0] = carDeviceList.get(0).getClZbh();
  1253 + } else {
  1254 + obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString());
  1255 + }
1230 } else { 1256 } else {
1231 obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString()); 1257 obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString());
1232 } 1258 }
1233 - } else {  
1234 - obj[0] = BasicData.deviceId2NbbmMap.get(obj[0].toString());  
1235 - } 1259 + }else{
  1260 + obj[0]=code;
  1261 + }
  1262 +
1236 obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); 1263 obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
1237 obj[4] = BasicData.lineCode2NameMap.get(line); 1264 obj[4] = BasicData.lineCode2NameMap.get(line);
1238 } 1265 }
1239 } 1266 }
1240 - 1267 + list.addAll(list0);
  1268 + if(!device2.equals("")){
  1269 + List<Object[]> list1 =scheduleRealInfoRepository.historyMessage(line, d, t, device2);
  1270 + for (Object[] obj : list1) {
  1271 + if (obj != null) {
  1272 + obj[0] =code;
  1273 + obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString())));
  1274 + obj[4] = BasicData.lineCode2NameMap.get(line);
  1275 + }
  1276 + }
  1277 + list.addAll(list1);
  1278 + }
  1279 +
1241 if (type != null && type.length() != 0 && type.equals("export")) { 1280 if (type != null && type.length() != 0 && type.equals("export")) {
1242 String lineName = BasicData.lineCode2NameMap.get(line); 1281 String lineName = BasicData.lineCode2NameMap.get(line);
1243 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), 1282 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
@@ -2234,6 +2273,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -2234,6 +2273,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2234 } 2273 }
2235 try { 2274 try {
2236 String dateTime = sdfSimple.format(sdfMonth.parse(date)); 2275 String dateTime = sdfSimple.format(sdfMonth.parse(date));
  2276 + if(!endDate.equals(date)){
  2277 + dateTime += "-" + sdfSimple.format(sdfMonth.parse(endDate));
  2278 + }
2237 String lineName = BasicData.lineCode2NameMap.get(line); 2279 String lineName = BasicData.lineCode2NameMap.get(line);
2238 listI.add(tempList.iterator()); 2280 listI.add(tempList.iterator());
2239 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; 2281 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
@@ -3210,6 +3252,63 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3210,6 +3252,63 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3210 String zdsj1 = ""; 3252 String zdsj1 = "";
3211 String zdsjActual1 = ""; 3253 String zdsjActual1 = "";
3212 List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date); 3254 List<ScheduleRealInfo> listInfo = scheduleRealInfoRepository.scheduleDdrb(line, date);
  3255 +
  3256 + /*
  3257 + * 对计划发车时间相同的班次进行排序 out最前 in最后
  3258 + */
  3259 + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
  3260 + String minfcsj = "02:00";
  3261 + List<Line> lineList = lineRepository.findLineByCode(line);
  3262 + if (lineList.size() > 0) {
  3263 + String sqlMinYysj = "select start_opt from bsth_c_line_config where "
  3264 + + " id = ("
  3265 + + "select max(id) from bsth_c_line_config where line ='" + lineList.get(0).getId() + "'"
  3266 + + ")";
  3267 + minfcsj = jdbcTemplate.queryForObject(sqlMinYysj, String.class);
  3268 + }
  3269 + String[] minSjs = minfcsj.split(":");
  3270 + Long minSj = Long.parseLong(minSjs[0]) * 60 + Long.parseLong(minSjs[1]);
  3271 + for (int i = 0; i < listInfo.size(); i++) {
  3272 + ScheduleRealInfo s = listInfo.get(i);
  3273 + if (s.getBcType().equals("out")) {
  3274 + s.setRemark("1");
  3275 + } else if (s.getBcType().equals("in")) {
  3276 + s.setRemark("3");
  3277 + } else {
  3278 + s.setRemark("2");
  3279 + }
  3280 + String[] fcsj = s.getFcsj().split(":");
  3281 + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]);
  3282 +
  3283 + Long fscjT = 0L;
  3284 + if (fcsjL < minSj) {
  3285 + Calendar calendar = new GregorianCalendar();
  3286 + calendar.setTime(s.getScheduleDate());
  3287 + calendar.add(calendar.DATE, 1);
  3288 + s.setScheduleDate(calendar.getTime());
  3289 + try {
  3290 + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime();
  3291 + } catch (ParseException e) {
  3292 + // TODO Auto-generated catch block
  3293 + e.printStackTrace();
  3294 + }
  3295 +
  3296 + } else {
  3297 + try {
  3298 + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime();
  3299 + } catch (ParseException e) {
  3300 + // TODO Auto-generated catch block
  3301 + e.printStackTrace();
  3302 + }
  3303 + ;
  3304 + }
  3305 + s.setFcsjT(fscjT);
  3306 + }
  3307 + List<ScheduleRealInfo> listInfo2=new ArrayList<ScheduleRealInfo>();
  3308 + listInfo2.addAll(listInfo);
  3309 + Collections.sort(listInfo, new compareLpFcsjType());
  3310 + System.out.println(listInfo);
  3311 + Collections.sort(listInfo2,new compareDirLpFcsjType());
3213 for (int i = 0; i < listInfo.size(); i++) { 3312 for (int i = 0; i < listInfo.size(); i++) {
3214 ScheduleRealInfo t = listInfo.get(i); 3313 ScheduleRealInfo t = listInfo.get(i);
3215 if (!lpName.equals(t.getLpName())) { 3314 if (!lpName.equals(t.getLpName())) {
@@ -3228,8 +3327,44 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -3228,8 +3327,44 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3228 lpName = t.getLpName(); 3327 lpName = t.getLpName();
3229 list.add(t); 3328 list.add(t);
3230 } 3329 }
3231 - 3330 +/*
3232 List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleDdrb2(line, date); 3331 List<ScheduleRealInfo> listInfo2 = scheduleRealInfoRepository.scheduleDdrb2(line, date);
  3332 + for (int i = 0; i < listInfo2.size(); i++) {
  3333 + ScheduleRealInfo s = listInfo2.get(i);
  3334 + if (s.getBcType().equals("out")) {
  3335 + s.setRemark("1");
  3336 + } else if (s.getBcType().equals("in")) {
  3337 + s.setRemark("3");
  3338 + } else {
  3339 + s.setRemark("2");
  3340 + }
  3341 + String[] fcsj = s.getFcsj().split(":");
  3342 + Long fcsjL = Long.parseLong(fcsj[0]) * 60 + Long.parseLong(fcsj[1]);
  3343 +
  3344 + Long fscjT = 0L;
  3345 + if (fcsjL < minSj) {
  3346 + Calendar calendar = new GregorianCalendar();
  3347 + calendar.setTime(s.getScheduleDate());
  3348 + calendar.add(calendar.DATE, 1);
  3349 + s.setScheduleDate(calendar.getTime());
  3350 + try {
  3351 + fscjT = sdf.parse(sdf.format(s.getScheduleDate()) + " " + s.getFcsj()).getTime();
  3352 + } catch (ParseException e) {
  3353 + // TODO Auto-generated catch block
  3354 + e.printStackTrace();
  3355 + }
  3356 +
  3357 + } else {
  3358 + try {
  3359 + fscjT = sdf.parse(s.getScheduleDateStr() + " " + s.getFcsj()).getTime();
  3360 + } catch (ParseException e) {
  3361 + // TODO Auto-generated catch block
  3362 + e.printStackTrace();
  3363 + }
  3364 + ;
  3365 + }
  3366 + s.setFcsjT(fscjT);
  3367 + }*/
3233 List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); 3368 List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>();
3234 List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); 3369 List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>();
3235 List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); 3370 List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>();
@@ -5612,6 +5747,23 @@ class AccountXlbm implements Comparator&lt;Map&lt;String, Object&gt;&gt; { @@ -5612,6 +5747,23 @@ class AccountXlbm implements Comparator&lt;Map&lt;String, Object&gt;&gt; {
5612 } 5747 }
5613 } 5748 }
5614 5749
  5750 +class compareLpFcsjType implements Comparator<ScheduleRealInfo> {
  5751 + @Override
  5752 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  5753 + // TODO Auto-generated method stub
  5754 + return (o1.getLpName()+o1.getFcsjT() + o1.getRemark()).compareTo(o2.getLpName()+o2.getFcsjT() + o2.getRemark());
  5755 + }
  5756 +
  5757 +}
  5758 +
  5759 +class compareDirLpFcsjType implements Comparator<ScheduleRealInfo> {
  5760 + @Override
  5761 + public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
  5762 + // TODO Auto-generated method stub
  5763 + return (o1.getXlDir()+o1.getFcsjT() + o1.getRemark()+o1.getLpName()).compareTo(o2.getXlDir()+o2.getFcsjT() + o2.getRemark()+o2.getLpName());
  5764 + }
  5765 +
  5766 +}
5615 class compareFcsjType implements Comparator<ScheduleRealInfo> { 5767 class compareFcsjType implements Comparator<ScheduleRealInfo> {
5616 @Override 5768 @Override
5617 public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) { 5769 public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
@@ -863,6 +863,8 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -863,6 +863,8 @@ public class CulateMileageServiceImpl implements CulateMileageService{
863 if (sch.isSflj()) 863 if (sch.isSflj())
864 continue; 864 continue;
865 cts = sch.getcTasks(); 865 cts = sch.getcTasks();
  866 + if(isInOut(sch))
  867 + continue;
866 //有子任务 868 //有子任务
867 if (cts != null && cts.size() > 0) { 869 if (cts != null && cts.size() > 0) {
868 for(ChildTaskPlan c : cts){ 870 for(ChildTaskPlan c : cts){
@@ -881,8 +883,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{ @@ -881,8 +883,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
881 } 883 }
882 } 884 }
883 } 885 }
884 - else if(isInOut(sch))  
885 - continue; 886 +
886 //主任务烂班 887 //主任务烂班
887 else if(sch.getStatus() == -1 && !sch.isCcService()){ 888 else if(sch.getStatus() == -1 && !sch.isCcService()){
888 if(sch.getAdjustExps().equals(item) || 889 if(sch.getAdjustExps().equals(item) ||
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
@@ -1825,7 +1825,7 @@ public class ReportServiceImpl implements ReportService{ @@ -1825,7 +1825,7 @@ public class ReportServiceImpl implements ReportService{
1825 newMap.put("dz", scheduleRealInfo.getQdzName()); 1825 newMap.put("dz", scheduleRealInfo.getQdzName());
1826 newMap.put("sj", scheduleRealInfo.getFcsj()); 1826 newMap.put("sj", scheduleRealInfo.getFcsj());
1827 newMap.put("ljlc", scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); 1827 newMap.put("ljlc", scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc());
1828 - newMap.put("jyqp", scheduleRealInfo.getRealMileage()==null?"":scheduleRealInfo.getRealMileage()); 1828 + newMap.put("jyqp", scheduleRealInfo.getRemarks()==null?"":scheduleRealInfo.getRemarks());
1829 list.add(newMap); 1829 list.add(newMap);
1830 } 1830 }
1831 // }else{ 1831 // }else{
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 import com.bsth.entity.schedule.CarConfigInfo; 3 import com.bsth.entity.schedule.CarConfigInfo;
  4 +import com.bsth.entity.sys.CompanyAuthority;
4 import com.bsth.service.schedule.exception.ScheduleException; 5 import com.bsth.service.schedule.exception.ScheduleException;
5 6
  7 +import java.util.List;
  8 +
6 /** 9 /**
7 * Created by xu on 16/5/9. 10 * Created by xu on 16/5/9.
8 */ 11 */
9 public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { 12 public interface CarConfigInfoService extends BService<CarConfigInfo, Long> {
10 void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException; 13 void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException;
  14 + // 判定车辆是否配置在当前线路中
  15 + void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException;
  16 + // 判定车辆所属公司和当前用户的所属公司
  17 + void validate_cars_gs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException;
  18 + // 判定车辆所属分公司和当前用户的所属分公司
  19 + void validate_cars_fgs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException;
11 void toggleCancel(Long id) throws ScheduleException; 20 void toggleCancel(Long id) throws ScheduleException;
  21 +
  22 +
12 } 23 }
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
1 package com.bsth.service.schedule; 1 package com.bsth.service.schedule;
2 2
3 import com.bsth.entity.schedule.EmployeeConfigInfo; 3 import com.bsth.entity.schedule.EmployeeConfigInfo;
  4 +import com.bsth.entity.sys.CompanyAuthority;
4 import com.bsth.service.schedule.exception.ScheduleException; 5 import com.bsth.service.schedule.exception.ScheduleException;
5 6
  7 +import java.util.List;
  8 +
6 /** 9 /**
7 * Created by xu on 16/5/10. 10 * Created by xu on 16/5/10.
8 */ 11 */
@@ -13,8 +16,17 @@ public interface EmployeeConfigInfoService extends BService&lt;EmployeeConfigInfo, @@ -13,8 +16,17 @@ public interface EmployeeConfigInfoService extends BService&lt;EmployeeConfigInfo,
13 void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 16 void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
14 // 验证驾驶员是否配置在指定线路 17 // 验证驾驶员是否配置在指定线路
15 void validate_jsy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 18 void validate_jsy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
  19 + // 判定驾驶员所属公司和当前用户的所属公司
  20 + void validate_jsy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException;
  21 + // 判定驾驶员所属分公司和当前用户的所属分公司
  22 + void validate_jsy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException;
16 // 验证售票员是否配置在指定线路 23 // 验证售票员是否配置在指定线路
17 void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; 24 void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException;
  25 + // 判定驾驶员所属公司和当前用户的所属公司
  26 + void validate_spy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException;
  27 + // 判定驾驶员所属分公司和当前用户的所属分公司
  28 + void validate_spy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException;
  29 +
18 void toggleCancel(Long id) throws ScheduleException; 30 void toggleCancel(Long id) throws ScheduleException;
19 Long getMaxDbbm(Integer xlId); 31 Long getMaxDbbm(Integer xlId);
20 } 32 }
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
1 package com.bsth.service.schedule.impl; 1 package com.bsth.service.schedule.impl;
2 2
  3 +import com.bsth.entity.Cars;
3 import com.bsth.entity.schedule.CarConfigInfo; 4 import com.bsth.entity.schedule.CarConfigInfo;
4 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 5 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  6 +import com.bsth.entity.sys.CompanyAuthority;
5 import com.bsth.service.schedule.CarConfigInfoService; 7 import com.bsth.service.schedule.CarConfigInfoService;
  8 +import com.bsth.service.schedule.CarsService;
6 import com.bsth.service.schedule.ScheduleRule1FlatService; 9 import com.bsth.service.schedule.ScheduleRule1FlatService;
7 import com.bsth.service.schedule.exception.ScheduleException; 10 import com.bsth.service.schedule.exception.ScheduleException;
8 import com.bsth.service.schedule.utils.DataToolsFile; 11 import com.bsth.service.schedule.utils.DataToolsFile;
@@ -25,6 +28,8 @@ import java.util.Map; @@ -25,6 +28,8 @@ import java.util.Map;
25 public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService { 28 public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService {
26 @Autowired 29 @Autowired
27 private ScheduleRule1FlatService scheduleRule1FlatService; 30 private ScheduleRule1FlatService scheduleRule1FlatService;
  31 + @Autowired
  32 + private CarsService carsService;
28 33
29 @Autowired 34 @Autowired
30 @Qualifier(value = "carConfig_dataTool") 35 @Qualifier(value = "carConfig_dataTool")
@@ -45,6 +50,57 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt; @@ -45,6 +50,57 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
45 return dataToolsService.exportData(params); 50 return dataToolsService.exportData(params);
46 } 51 }
47 52
  53 + @Override
  54 + public void validate_cars_gs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  55 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  56 + throw new ScheduleException("当前用户没有公司权限!");
  57 + }
  58 +
  59 + boolean isFind = false;
  60 + Cars cars = carsService.findById(carConfigInfo.getCl().getId());
  61 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  62 + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode())) {
  63 + isFind = true;
  64 + break;
  65 + }
  66 + }
  67 + if (!isFind) {
  68 + throw new ScheduleException("当前车辆不在用户所属公司中!");
  69 + }
  70 + }
  71 +
  72 + @Override
  73 + public void validate_cars_fgs(CarConfigInfo carConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  74 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  75 + throw new ScheduleException("当前用户没有分公司权限!");
  76 + }
  77 +
  78 + boolean isFind = false;
  79 + Cars cars = carsService.findById(carConfigInfo.getCl().getId());
  80 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  81 + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode())) {
  82 + isFind = true;
  83 + break;
  84 + }
  85 + }
  86 + if (!isFind) {
  87 + // 如果没有公司权限,验证通过
  88 + return;
  89 + }
  90 +
  91 + isFind = false;
  92 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  93 + if (companyAuthority.getCompanyCode().equals(cars.getBusinessCode()) &&
  94 + companyAuthority.getSubCompanyCode().equals(cars.getBrancheCompanyCode())) {
  95 + isFind = true;
  96 + break;
  97 + }
  98 + }
  99 + if (!isFind) {
  100 + throw new ScheduleException("当前车辆不在用户所属分公司中!");
  101 + }
  102 + }
  103 +
48 @Transactional 104 @Transactional
49 public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException { 105 public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException {
50 // 相同车辆不能同时配置 106 // 相同车辆不能同时配置
@@ -73,6 +129,17 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt; @@ -73,6 +129,17 @@ public class CarConfigInfoServiceImpl extends BServiceImpl&lt;CarConfigInfo, Long&gt;
73 129
74 } 130 }
75 131
  132 + @Override
  133 + public void validate_cars_config(CarConfigInfo carConfigInfo) throws ScheduleException {
  134 + Map<String, Object> param = new HashMap<>();
  135 + param.put("xl.id_eq", carConfigInfo.getXl().getId());
  136 + param.put("cl.id_eq", carConfigInfo.getCl().getId());
  137 + List<CarConfigInfo> carConfigInfos = list(param);
  138 + if (CollectionUtils.isEmpty(carConfigInfos)) {
  139 + throw new ScheduleException("当前车辆没有配置在当前线路中,不属于当前线路!");
  140 + }
  141 + }
  142 +
76 @Transactional 143 @Transactional
77 @Override 144 @Override
78 public void delete(Long aLong) throws ScheduleException { 145 public void delete(Long aLong) throws ScheduleException {
src/main/java/com/bsth/service/schedule/impl/CarDeviceServiceImpl.java
@@ -12,6 +12,7 @@ import org.springframework.transaction.annotation.Propagation; @@ -12,6 +12,7 @@ import org.springframework.transaction.annotation.Propagation;
12 import org.springframework.transaction.annotation.Transactional; 12 import org.springframework.transaction.annotation.Transactional;
13 import org.springframework.util.CollectionUtils; 13 import org.springframework.util.CollectionUtils;
14 14
  15 +import java.util.Date;
15 import java.util.HashMap; 16 import java.util.HashMap;
16 import java.util.Map; 17 import java.util.Map;
17 18
@@ -29,6 +30,8 @@ public class CarDeviceServiceImpl extends BServiceImpl&lt;CarDevice, Long&gt; implemen @@ -29,6 +30,8 @@ public class CarDeviceServiceImpl extends BServiceImpl&lt;CarDevice, Long&gt; implemen
29 // 查找对应的车辆基础信息,更新设备编号数据 30 // 查找对应的车辆基础信息,更新设备编号数据
30 Cars cars = carsService.findById(carDevice.getCl()); 31 Cars cars = carsService.findById(carDevice.getCl());
31 cars.setEquipmentCode(carDevice.getNewDeviceNo()); 32 cars.setEquipmentCode(carDevice.getNewDeviceNo());
  33 + // 设备启用日期使用后台日期
  34 + carDevice.setQyrq(new Date());
32 return super.save(carDevice); 35 return super.save(carDevice);
33 } 36 }
34 37
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
1 package com.bsth.service.schedule.impl; 1 package com.bsth.service.schedule.impl;
2 2
  3 +import com.bsth.entity.Personnel;
3 import com.bsth.entity.schedule.EmployeeConfigInfo; 4 import com.bsth.entity.schedule.EmployeeConfigInfo;
4 import com.bsth.entity.schedule.rule.ScheduleRule1Flat; 5 import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  6 +import com.bsth.entity.sys.CompanyAuthority;
5 import com.bsth.service.schedule.EmployeeConfigInfoService; 7 import com.bsth.service.schedule.EmployeeConfigInfoService;
  8 +import com.bsth.service.schedule.EmployeeService;
6 import com.bsth.service.schedule.ScheduleRule1FlatService; 9 import com.bsth.service.schedule.ScheduleRule1FlatService;
7 import com.bsth.service.schedule.exception.ScheduleException; 10 import com.bsth.service.schedule.exception.ScheduleException;
8 import com.bsth.service.schedule.utils.DataToolsFile; 11 import com.bsth.service.schedule.utils.DataToolsFile;
@@ -28,6 +31,8 @@ import java.util.*; @@ -28,6 +31,8 @@ import java.util.*;
28 public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService { 31 public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService {
29 @Autowired 32 @Autowired
30 private ScheduleRule1FlatService scheduleRule1FlatService; 33 private ScheduleRule1FlatService scheduleRule1FlatService;
  34 + @Autowired
  35 + private EmployeeService employeeService;
31 36
32 @Autowired 37 @Autowired
33 @Qualifier(value = "employeeConfig_dataTool") 38 @Qualifier(value = "employeeConfig_dataTool")
@@ -110,6 +115,57 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn @@ -110,6 +115,57 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
110 } 115 }
111 } 116 }
112 117
  118 + @Override
  119 + public void validate_jsy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  120 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  121 + throw new ScheduleException("当前用户没有公司权限!");
  122 + }
  123 +
  124 + boolean isFind = false;
  125 + Personnel personnel = employeeService.findById(employeeConfigInfo.getJsy().getId());
  126 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  127 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
  128 + isFind = true;
  129 + break;
  130 + }
  131 + }
  132 + if (!isFind) {
  133 + throw new ScheduleException("当前驾驶员不在用户所属公司中!");
  134 + }
  135 + }
  136 +
  137 + @Override
  138 + public void validate_jsy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  139 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  140 + throw new ScheduleException("当前用户没有分公司权限!");
  141 + }
  142 +
  143 + boolean isFind = false;
  144 + Personnel personnel = employeeService.findById(employeeConfigInfo.getJsy().getId());
  145 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  146 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
  147 + isFind = true;
  148 + break;
  149 + }
  150 + }
  151 + if (!isFind) {
  152 + // 如果没有公司权限,验证通过
  153 + return;
  154 + }
  155 +
  156 + isFind = false;
  157 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  158 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode()) &&
  159 + companyAuthority.getSubCompanyCode().equals(personnel.getBrancheCompanyCode())) {
  160 + isFind = true;
  161 + break;
  162 + }
  163 + }
  164 + if (!isFind) {
  165 + throw new ScheduleException("当前驾驶员不在用户所属分公司中!");
  166 + }
  167 + }
  168 +
113 @Transactional 169 @Transactional
114 @Override 170 @Override
115 public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { 171 public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
@@ -137,6 +193,57 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn @@ -137,6 +193,57 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl&lt;EmployeeConfigIn
137 } 193 }
138 } 194 }
139 195
  196 + @Override
  197 + public void validate_spy_gs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  198 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  199 + throw new ScheduleException("当前用户没有公司权限!");
  200 + }
  201 +
  202 + boolean isFind = false;
  203 + Personnel personnel = employeeService.findById(employeeConfigInfo.getSpy().getId());
  204 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  205 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
  206 + isFind = true;
  207 + break;
  208 + }
  209 + }
  210 + if (!isFind) {
  211 + throw new ScheduleException("当前售票员不在用户所属公司中!");
  212 + }
  213 + }
  214 +
  215 + @Override
  216 + public void validate_spy_fgs(EmployeeConfigInfo employeeConfigInfo, List<CompanyAuthority> companyAuthorityList) throws ScheduleException {
  217 + if (CollectionUtils.isEmpty(companyAuthorityList)) {
  218 + throw new ScheduleException("当前用户没有分公司权限!");
  219 + }
  220 +
  221 + boolean isFind = false;
  222 + Personnel personnel = employeeService.findById(employeeConfigInfo.getSpy().getId());
  223 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  224 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode())) {
  225 + isFind = true;
  226 + break;
  227 + }
  228 + }
  229 + if (!isFind) {
  230 + // 如果没有公司权限,验证通过
  231 + return;
  232 + }
  233 +
  234 + isFind = false;
  235 + for (CompanyAuthority companyAuthority : companyAuthorityList) {
  236 + if (companyAuthority.getCompanyCode().equals(personnel.getCompanyCode()) &&
  237 + companyAuthority.getSubCompanyCode().equals(personnel.getBrancheCompanyCode())) {
  238 + isFind = true;
  239 + break;
  240 + }
  241 + }
  242 + if (!isFind) {
  243 + throw new ScheduleException("当前售票员不在用户所属分公司中!");
  244 + }
  245 + }
  246 +
140 @Transactional 247 @Transactional
141 @Override 248 @Override
142 public void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { 249 public void validate_spy_config(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException {
src/main/java/com/bsth/service/schedule/impl/PeopleCarPlanServiceImpl.java
@@ -55,6 +55,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -55,6 +55,8 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
55 if(subCompany.length() != 0) 55 if(subCompany.length() != 0)
56 sql += " and fgs_bm = '"+subCompany+"'"; 56 sql += " and fgs_bm = '"+subCompany+"'";
57 57
  58 + sql += " order by gs_bm, fgs_bm, xl_bm";
  59 +
58 list = jdbcTemplate.query(sql, 60 list = jdbcTemplate.query(sql,
59 new RowMapper<ScheduleRealInfo>(){ 61 new RowMapper<ScheduleRealInfo>(){
60 @Override 62 @Override
@@ -62,6 +64,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -62,6 +64,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
62 ScheduleRealInfo schedule = new ScheduleRealInfo(); 64 ScheduleRealInfo schedule = new ScheduleRealInfo();
63 schedule.setScheduleDateStr(rs.getString("schedule_date_str")); 65 schedule.setScheduleDateStr(rs.getString("schedule_date_str"));
64 schedule.setRealExecDate(rs.getString("real_exec_date")); 66 schedule.setRealExecDate(rs.getString("real_exec_date"));
  67 + schedule.setXlBm(rs.getString("xl_bm"));
65 schedule.setXlName(rs.getString("xl_name")); 68 schedule.setXlName(rs.getString("xl_name"));
66 schedule.setLpName(rs.getString("lp_name")); 69 schedule.setLpName(rs.getString("lp_name"));
67 schedule.setBcType(rs.getString("bc_type")); 70 schedule.setBcType(rs.getString("bc_type"));
@@ -325,7 +328,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -325,7 +328,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
325 Set<String> lineSet = getNotOperation(); 328 Set<String> lineSet = getNotOperation();
326 DecimalFormat df = new DecimalFormat("###0.##"); 329 DecimalFormat df = new DecimalFormat("###0.##");
327 330
328 - String company = "", subCompany = ""; 331 + String sfyy = "", company = "", subCompany = "";
  332 + if(map.get("sfyy")!=null)
  333 + sfyy = map.get("sfyy").toString();
329 if(map.get("company")!=null) 334 if(map.get("company")!=null)
330 company = map.get("company").toString(); 335 company = map.get("company").toString();
331 if(map.get("subCompany")!=null) 336 if(map.get("subCompany")!=null)
@@ -338,9 +343,27 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -338,9 +343,27 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
338 date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); 343 date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
339 } 344 }
340 345
341 - List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, date); 346 + List<ScheduleRealInfo> schedules = this.getSchedule(company, subCompany, line, date);
  347 + Map<String, Boolean> lineNature = lineService.lineNature();
342 348
  349 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
343 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); 350 Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>();
  351 +
  352 + //是否营运
  353 + for(ScheduleRealInfo schedule : schedules){
  354 + String xlbm = schedule.getXlBm();
  355 + if(sfyy.length() == 0 || sfyy.equals("0")){
  356 + list.add(schedule);
  357 + } else if(sfyy.equals("1")){
  358 + if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){
  359 + list.add(schedule);
  360 + }
  361 + } else {
  362 + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){
  363 + list.add(schedule);
  364 + }
  365 + }
  366 + }
344 for(ScheduleRealInfo schedule : list){ 367 for(ScheduleRealInfo schedule : list){
345 String key = schedule.getXlName(); 368 String key = schedule.getXlName();
346 if(key == null || key.trim().equals("") || lineSet.contains(key)) 369 if(key == null || key.trim().equals("") || lineSet.contains(key))
@@ -1317,20 +1340,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1317,20 +1340,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1317 1340
1318 String xlbm = s.getXlBm(); 1341 String xlbm = s.getXlBm();
1319 boolean flag = false; 1342 boolean flag = false;
1320 - if(sfyy.length() != 0){  
1321 - if(sfyy.equals("0")){ 1343 + if(sfyy.length() == 0 || sfyy.equals("0")){
  1344 + flag = true;
  1345 + } else if(sfyy.equals("1")){
  1346 + if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){
1322 flag = true; 1347 flag = true;
1323 - } else if(sfyy.equals("1")){  
1324 - if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){  
1325 - flag = true;  
1326 - }  
1327 - } else {  
1328 - if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){  
1329 - flag = true;  
1330 - }  
1331 } 1348 }
1332 } else { 1349 } else {
1333 - flag = true; 1350 + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){
  1351 + flag = true;
  1352 + }
1334 } 1353 }
1335 if(!flag){ 1354 if(!flag){
1336 continue; 1355 continue;
@@ -1596,20 +1615,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -1596,20 +1615,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
1596 1615
1597 boolean flag = false; 1616 boolean flag = false;
1598 String xlbm = s.getXlBm(); 1617 String xlbm = s.getXlBm();
1599 - if(sfyy.length() != 0){  
1600 - if(sfyy.equals("0")){ 1618 + if(sfyy.length() == 0 || sfyy.equals("0")){
  1619 + flag = true;
  1620 + } else if(sfyy.equals("1")){
  1621 + if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){
1601 flag = true; 1622 flag = true;
1602 - } else if(sfyy.equals("1")){  
1603 - if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){  
1604 - flag = true;  
1605 - }  
1606 - } else {  
1607 - if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){  
1608 - flag = true;  
1609 - }  
1610 } 1623 }
1611 } else { 1624 } else {
1612 - flag = true; 1625 + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){
  1626 + flag = true;
  1627 + }
1613 } 1628 }
1614 if(!flag){ 1629 if(!flag){
1615 continue; 1630 continue;
@@ -2137,19 +2152,20 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -2137,19 +2152,20 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
2137 2152
2138 String sql_="select * from bsth_c_s_sp_info_real " 2153 String sql_="select * from bsth_c_s_sp_info_real "
2139 + " WHERE schedule_date_str = '"+date+"' "; 2154 + " WHERE schedule_date_str = '"+date+"' ";
2140 - if(line.equals("")){  
2141 - if(company.length() != 0)  
2142 - sql_ += " and gs_bm='"+company+"'";  
2143 - if(subCompany.length() != 0)  
2144 - sql_ += " and fgs_bm='"+subCompany+"'";  
2145 - }else{ 2155 + if(!line.equals("")){
2146 sql_ += " and xl_bm = '"+line+"'"; 2156 sql_ += " and xl_bm = '"+line+"'";
2147 } 2157 }
  2158 + if(company.length() != 0){
  2159 + sql_ += " and gs_bm='"+company+"'";
  2160 + }
  2161 + if(subCompany.length() != 0){
  2162 + sql_ += " and fgs_bm='"+subCompany+"'";
  2163 + }
2148 2164
2149 2165
2150 String sql="SELECT r.id,r.schedule_date_str,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.fcsj," 2166 String sql="SELECT r.id,r.schedule_date_str,r.xl_name,r.xl_bm,r.cl_zbh,r.j_gh,r.j_name,r.fcsj,"
2151 + " r.gs_name,r.fgs_name,CONCAT(r.xl_bm,'_',r.id) as line_sch FROM ("+sql_+") AS r" 2167 + " r.gs_name,r.fgs_name,CONCAT(r.xl_bm,'_',r.id) as line_sch FROM ("+sql_+") AS r"
2152 - + " order by r.xl_name,r.id "; 2168 + + " order by r.gs_bm,r.fgs_bm,r.xl_bm,r.id ";
2153 2169
2154 List<Map<String, Object>> tempList = jdbcTemplate.query(sql, 2170 List<Map<String, Object>> tempList = jdbcTemplate.query(sql,
2155 new RowMapper<Map<String, Object>>(){ 2171 new RowMapper<Map<String, Object>>(){
@@ -2184,20 +2200,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { @@ -2184,20 +2200,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService {
2184 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); 2200 List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
2185 for(Map<String, Object> m : tempList){ 2201 for(Map<String, Object> m : tempList){
2186 String xlbm = m.get("xlbm").toString(); 2202 String xlbm = m.get("xlbm").toString();
2187 - if(sfyy.length() != 0){  
2188 - if(sfyy.equals("0")){ 2203 + if(sfyy.length() == 0 || sfyy.equals("0")){
  2204 + list.add(m);
  2205 + } else if(sfyy.equals("1")){
  2206 + if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){
2189 list.add(m); 2207 list.add(m);
2190 - } else if(sfyy.equals("1")){  
2191 - if(lineNature.containsKey(xlbm) && lineNature.get(xlbm)){  
2192 - list.add(m);  
2193 - }  
2194 - } else {  
2195 - if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){  
2196 - list.add(m);  
2197 - }  
2198 } 2208 }
2199 } else { 2209 } else {
2200 - list.add(m); 2210 + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){
  2211 + list.add(m);
  2212 + }
2201 } 2213 }
2202 } 2214 }
2203 2215
src/main/java/com/bsth/service/schedule/rules/validate/ValidWantLpFunction.java
1 -package com.bsth.service.schedule.rules.validate;  
2 -  
3 -import com.bsth.entity.schedule.SchedulePlanInfo;  
4 -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;  
5 -import org.kie.api.runtime.rule.AccumulateFunction;  
6 -  
7 -import java.io.*;  
8 -import java.text.SimpleDateFormat;  
9 -import java.util.*;  
10 -  
11 -/**  
12 - * 计算缺少路牌错误。  
13 - * 同一天,如果有时刻表路牌没有执行到,统计。  
14 - * 注意:使用这个函数时,要一天计算一次,多天计算无意义。  
15 - */  
16 -public class ValidWantLpFunction implements AccumulateFunction {  
17 - @Override  
18 - public void writeExternal(ObjectOutput out) throws IOException {  
19 - }  
20 -  
21 - @Override  
22 - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {  
23 -  
24 - }  
25 -  
26 - protected static class WantLpInfo implements Externalizable {  
27 - /** 错误描述 */  
28 - public List<ValidateResults_output.ValidInfo> validInfoList = new ArrayList<>();  
29 - /** 每天的路牌班次数量 */  
30 - public Map<String, Integer> lpBcCount = new HashMap<>();  
31 - /** 每天的路牌名字对应 */  
32 - public Map<String, String> lpNamesMap = new HashMap<>();  
33 - /** 排班日期 */  
34 - public Date scheduleDate;  
35 -  
36 - public WantLpInfo() {  
37 -  
38 - }  
39 -  
40 - @Override  
41 - public void writeExternal(ObjectOutput out) throws IOException {  
42 - out.writeObject(validInfoList);  
43 - }  
44 -  
45 - @Override  
46 - public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {  
47 - validInfoList = (List<ValidateResults_output.ValidInfo>) in.readObject();  
48 - }  
49 - }  
50 -  
51 - @Override  
52 - public Serializable createContext() {  
53 - return new WantLpInfo();  
54 - }  
55 -  
56 - @Override  
57 - public void init(Serializable serializable) throws Exception {  
58 - // TODO:  
59 -// System.out.println("init");  
60 - }  
61 -  
62 - @Override  
63 - public void accumulate(Serializable context, Object o) {  
64 - WantLpInfo wantLpInfo = (WantLpInfo) context;  
65 - ValidateResource validateResource = (ValidateResource) o;  
66 -  
67 - SchedulePlanInfo spi = validateResource.getSpi();  
68 - List<LpInfoResult_output> lpiList = validateResource.getLpiList();  
69 -  
70 - // 获取当天所有路牌信息,每个验证对象都带当天所有路牌信息,只需判定一次  
71 - if (wantLpInfo.lpNamesMap.isEmpty()) {  
72 - for (LpInfoResult_output lpInfoResult_output: lpiList) {  
73 - wantLpInfo.lpNamesMap.put(lpInfoResult_output.getLpId(), lpInfoResult_output.getLpName());  
74 - wantLpInfo.lpBcCount.put(lpInfoResult_output.getLpId(), 0);  
75 - }  
76 - }  
77 - if (wantLpInfo.scheduleDate == null) {  
78 - wantLpInfo.scheduleDate = spi.getScheduleDate();  
79 - }  
80 -  
81 - // 累计记录每个排班班次出现次数  
82 - String lpId_spi = spi.getLp().toString();  
83 - wantLpInfo.lpBcCount.put(lpId_spi, wantLpInfo.lpBcCount.get(lpId_spi) + 1);  
84 -  
85 - }  
86 -  
87 - @Override  
88 - public boolean supportsReverse() {  
89 - return true;  
90 - }  
91 -  
92 - @Override  
93 - public void reverse(Serializable context, Object o) throws Exception {  
94 - WantLpInfo wantLpInfo = (WantLpInfo) context;  
95 -  
96 - // 清空数据,下一天继续迭代  
97 - wantLpInfo.lpBcCount.clear();  
98 - wantLpInfo.lpNamesMap.clear();  
99 - wantLpInfo.scheduleDate = null;  
100 - wantLpInfo.validInfoList.clear();  
101 -  
102 -// System.out.println("reverse");  
103 -  
104 - }  
105 -  
106 - @Override  
107 - public Class<?> getResultType() {  
108 - return List.class;  
109 - }  
110 -  
111 - @Override  
112 - public Object getResult(Serializable context) throws Exception {  
113 - WantLpInfo wantLpInfo = (WantLpInfo) context;  
114 -  
115 - SimpleDateFormat sf = new SimpleDateFormat("yyyy年MM月dd日");  
116 - String infoFormat = "日期(%s),路牌(%s),没有排班班次";  
117 -  
118 - for (String lpId : wantLpInfo.lpBcCount.keySet()) {  
119 - if (wantLpInfo.lpBcCount.get(lpId) == 0) {  
120 - // 排班没有班次  
121 - ValidateResults_output.ValidInfo validInfo = new ValidateResults_output.ValidInfo();  
122 - validInfo.setSd(wantLpInfo.scheduleDate);  
123 - validInfo.setDesc(String.format(  
124 - infoFormat,  
125 - sf.format(wantLpInfo.scheduleDate),  
126 - wantLpInfo.lpNamesMap.get(lpId))  
127 - );  
128 - wantLpInfo.validInfoList.add(validInfo);  
129 - }  
130 - }  
131 -  
132 - System.out.println("ValidWantLpFunction==>" + wantLpInfo.lpBcCount);  
133 -  
134 - return wantLpInfo.validInfoList;  
135 - }  
136 -  
137 -}  
138 -  
139 -  
140 -  
141 -  
142 -  
143 -  
144 -  
145 - 1 +package com.bsth.service.schedule.rules.validate;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  5 +import org.kie.api.runtime.rule.AccumulateFunction;
  6 +
  7 +import java.io.*;
  8 +import java.text.SimpleDateFormat;
  9 +import java.util.*;
  10 +
  11 +/**
  12 + * 计算缺少路牌错误。
  13 + * 同一天,如果有时刻表路牌没有执行到,统计。
  14 + * 注意:使用这个函数时,要一天计算一次,多天计算无意义。
  15 + */
  16 +public class ValidWantLpFunction implements AccumulateFunction {
  17 + @Override
  18 + public void writeExternal(ObjectOutput out) throws IOException {
  19 + }
  20 +
  21 + @Override
  22 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  23 +
  24 + }
  25 +
  26 + protected static class WantLpInfo implements Externalizable {
  27 + /** 错误描述 */
  28 + public List<ValidateResults_output.ValidInfo> validInfoList = new ArrayList<>();
  29 + /** 每天的路牌班次数量 */
  30 + public Map<String, Integer> lpBcCount = new HashMap<>();
  31 + /** 每天的路牌名字对应 */
  32 + public Map<String, String> lpNamesMap = new HashMap<>();
  33 + /** 排班日期 */
  34 + public Date scheduleDate;
  35 +
  36 + public WantLpInfo() {
  37 +
  38 + }
  39 +
  40 + @Override
  41 + public void writeExternal(ObjectOutput out) throws IOException {
  42 + out.writeObject(validInfoList);
  43 + }
  44 +
  45 + @Override
  46 + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  47 + validInfoList = (List<ValidateResults_output.ValidInfo>) in.readObject();
  48 + }
  49 + }
  50 +
  51 + @Override
  52 + public Serializable createContext() {
  53 + return new WantLpInfo();
  54 + }
  55 +
  56 + @Override
  57 + public void init(Serializable serializable) throws Exception {
  58 + // TODO:
  59 +// System.out.println("init");
  60 + }
  61 +
  62 + @Override
  63 + public void accumulate(Serializable context, Object o) {
  64 + WantLpInfo wantLpInfo = (WantLpInfo) context;
  65 + ValidateResource validateResource = (ValidateResource) o;
  66 +
  67 + SchedulePlanInfo spi = validateResource.getSpi();
  68 + List<LpInfoResult_output> lpiList = validateResource.getLpiList();
  69 +
  70 + // 获取当天所有路牌信息,每个验证对象都带当天所有路牌信息,只需判定一次
  71 + if (wantLpInfo.lpNamesMap.isEmpty()) {
  72 + for (LpInfoResult_output lpInfoResult_output: lpiList) {
  73 + wantLpInfo.lpNamesMap.put(lpInfoResult_output.getLpId(), lpInfoResult_output.getLpName());
  74 + wantLpInfo.lpBcCount.put(lpInfoResult_output.getLpId(), 0);
  75 + }
  76 + }
  77 + if (wantLpInfo.scheduleDate == null) {
  78 + wantLpInfo.scheduleDate = spi.getScheduleDate();
  79 + }
  80 +
  81 + // 累计记录每个排班班次出现次数
  82 + String lpId_spi = spi.getLp().toString();
  83 + wantLpInfo.lpBcCount.put(lpId_spi, wantLpInfo.lpBcCount.get(lpId_spi) + 1);
  84 +
  85 + }
  86 +
  87 + @Override
  88 + public boolean supportsReverse() {
  89 + return true;
  90 + }
  91 +
  92 + @Override
  93 + public void reverse(Serializable context, Object o) throws Exception {
  94 + WantLpInfo wantLpInfo = (WantLpInfo) context;
  95 +
  96 + // 清空数据,下一天继续迭代
  97 + wantLpInfo.lpBcCount.clear();
  98 + wantLpInfo.lpNamesMap.clear();
  99 + wantLpInfo.scheduleDate = null;
  100 + wantLpInfo.validInfoList.clear();
  101 +
  102 +// System.out.println("reverse");
  103 +
  104 + }
  105 +
  106 + @Override
  107 + public Class<?> getResultType() {
  108 + return List.class;
  109 + }
  110 +
  111 + @Override
  112 + public Object getResult(Serializable context) throws Exception {
  113 + WantLpInfo wantLpInfo = (WantLpInfo) context;
  114 +
  115 + SimpleDateFormat sf = new SimpleDateFormat("yyyy年MM月dd日");
  116 + String infoFormat = "日期(%s),路牌(%s),没有排班班次";
  117 +
  118 + for (String lpId : wantLpInfo.lpBcCount.keySet()) {
  119 + if (wantLpInfo.lpBcCount.get(lpId) == 0) {
  120 + // 排班没有班次
  121 + ValidateResults_output.ValidInfo validInfo = new ValidateResults_output.ValidInfo();
  122 + validInfo.setSd(wantLpInfo.scheduleDate);
  123 + validInfo.setDesc(String.format(
  124 + infoFormat,
  125 + sf.format(wantLpInfo.scheduleDate),
  126 + wantLpInfo.lpNamesMap.get(lpId))
  127 + );
  128 + wantLpInfo.validInfoList.add(validInfo);
  129 + }
  130 + }
  131 +
  132 + System.out.println("ValidWantLpFunction==>" + wantLpInfo.lpBcCount);
  133 +
  134 + return wantLpInfo.validInfoList;
  135 + }
  136 +
  137 +}
  138 +
  139 +
  140 +
  141 +
  142 +
  143 +
  144 +
  145 +
src/main/java/com/bsth/service/schedule/rules/validate/ValidateResource.java
1 -package com.bsth.service.schedule.rules.validate;  
2 -  
3 -import com.bsth.entity.schedule.SchedulePlanInfo;  
4 -import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;  
5 -  
6 -import java.util.Date;  
7 -import java.util.List;  
8 -  
9 -/**  
10 - * 验证操作dsl类。  
11 - */  
12 -public class ValidateResource {  
13 - /** 具体日期 */  
14 - private Date sd;  
15 - /** 当天排班计划 */  
16 - private SchedulePlanInfo spi;  
17 - /** 当天所有路牌信息 */  
18 - private List<LpInfoResult_output> lpiList;  
19 -  
20 - public Date getSd() {  
21 - return sd;  
22 - }  
23 -  
24 - public void setSd(Date sd) {  
25 - this.sd = sd;  
26 - }  
27 -  
28 - public SchedulePlanInfo getSpi() {  
29 - return spi;  
30 - }  
31 -  
32 - public void setSpi(SchedulePlanInfo spi) {  
33 - this.spi = spi;  
34 - }  
35 -  
36 - public List<LpInfoResult_output> getLpiList() {  
37 - return lpiList;  
38 - }  
39 -  
40 - public void setLpiList(List<LpInfoResult_output> lpiList) {  
41 - this.lpiList = lpiList;  
42 - }  
43 -} 1 +package com.bsth.service.schedule.rules.validate;
  2 +
  3 +import com.bsth.entity.schedule.SchedulePlanInfo;
  4 +import com.bsth.service.schedule.rules.ttinfo.LpInfoResult_output;
  5 +
  6 +import java.util.Date;
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 验证操作dsl类。
  11 + */
  12 +public class ValidateResource {
  13 + /** 具体日期 */
  14 + private Date sd;
  15 + /** 当天排班计划 */
  16 + private SchedulePlanInfo spi;
  17 + /** 当天所有路牌信息 */
  18 + private List<LpInfoResult_output> lpiList;
  19 +
  20 + public Date getSd() {
  21 + return sd;
  22 + }
  23 +
  24 + public void setSd(Date sd) {
  25 + this.sd = sd;
  26 + }
  27 +
  28 + public SchedulePlanInfo getSpi() {
  29 + return spi;
  30 + }
  31 +
  32 + public void setSpi(SchedulePlanInfo spi) {
  33 + this.spi = spi;
  34 + }
  35 +
  36 + public List<LpInfoResult_output> getLpiList() {
  37 + return lpiList;
  38 + }
  39 +
  40 + public void setLpiList(List<LpInfoResult_output> lpiList) {
  41 + this.lpiList = lpiList;
  42 + }
  43 +}
src/main/java/com/bsth/service/sys/ResourceService.java
@@ -12,6 +12,4 @@ public interface ResourceService extends BaseService&lt;Resource, Integer&gt; { @@ -12,6 +12,4 @@ public interface ResourceService extends BaseService&lt;Resource, Integer&gt; {
12 12
13 List<Resource> findByRolesId(Integer id); 13 List<Resource> findByRolesId(Integer id);
14 14
15 - List<Resource> findResource(Integer roleId);  
16 -  
17 } 15 }
src/main/java/com/bsth/service/sys/RoleService.java
@@ -10,12 +10,4 @@ public interface RoleService extends BaseService&lt;Role, Integer&gt;{ @@ -10,12 +10,4 @@ public interface RoleService extends BaseService&lt;Role, Integer&gt;{
10 Map<String, Object> settRoleModules(Integer roleId, String mIds); 10 Map<String, Object> settRoleModules(Integer roleId, String mIds);
11 11
12 Map<String, Object> roleInfo(Integer id); 12 Map<String, Object> roleInfo(Integer id);
13 -  
14 - /***  
15 - * 根据角色id设置该角色拥有的资源权限  
16 - * @param roleId 角色id  
17 - * @param rIds 资源id字符串  
18 - * @return  
19 - */  
20 - Map<String, Object> settRoleResources(Integer roleId, String rIds);  
21 } 13 }
src/main/java/com/bsth/service/sys/impl/ResourceServiceImpl.java
1 package com.bsth.service.sys.impl; 1 package com.bsth.service.sys.impl;
2 2
3 -import java.util.ArrayList;  
4 import java.util.HashMap; 3 import java.util.HashMap;
5 import java.util.List; 4 import java.util.List;
6 import java.util.Map; 5 import java.util.Map;
7 6
8 -import com.bsth.entity.sys.SysUser;  
9 -import com.bsth.security.util.SecurityUtils;  
10 import org.slf4j.Logger; 7 import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,15 +40,4 @@ public class ResourceServiceImpl extends BaseServiceImpl&lt;Resource, Integer&gt; impl @@ -43,15 +40,4 @@ public class ResourceServiceImpl extends BaseServiceImpl&lt;Resource, Integer&gt; impl
43 public List<Resource> findByRolesId(Integer id) { 40 public List<Resource> findByRolesId(Integer id) {
44 return resourceRepository.findByRolesId(id); 41 return resourceRepository.findByRolesId(id);
45 } 42 }
46 -  
47 - @Override  
48 - public List<Resource> findResource(Integer roleId) {  
49 - List<Resource> list = new ArrayList<>();  
50 - try{  
51 - list = resourceRepository.findResource(roleId);  
52 - }catch (Exception e){  
53 - logger.error("", e);  
54 - }  
55 - return list;  
56 - }  
57 } 43 }
src/main/java/com/bsth/service/sys/impl/RoleServiceImpl.java
1 package com.bsth.service.sys.impl; 1 package com.bsth.service.sys.impl;
2 2
3 -import java.sql.PreparedStatement;  
4 -import java.sql.SQLException;  
5 import java.text.SimpleDateFormat; 3 import java.text.SimpleDateFormat;
6 -import java.util.*; 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 +import java.util.Set;
7 10
8 -import com.bsth.data.BasicData;  
9 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
10 -import com.bsth.entity.sys.Resource;  
11 -import com.bsth.repository.sys.ResourceRepository;  
12 -import com.bsth.security.SecurityMetadataSourceService;  
13 import org.slf4j.Logger; 11 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory; 12 import org.slf4j.LoggerFactory;
15 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
16 -import org.springframework.jdbc.core.BatchPreparedStatementSetter;  
17 -import org.springframework.jdbc.core.JdbcTemplate;  
18 -import org.springframework.jdbc.datasource.DataSourceTransactionManager;  
19 -import org.springframework.orm.jpa.JpaTransactionManager;  
20 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
21 15
22 import com.bsth.common.ResponseCode; 16 import com.bsth.common.ResponseCode;
@@ -27,11 +21,6 @@ import com.bsth.repository.sys.ModuleRepository; @@ -27,11 +21,6 @@ import com.bsth.repository.sys.ModuleRepository;
27 import com.bsth.repository.sys.RoleRepository; 21 import com.bsth.repository.sys.RoleRepository;
28 import com.bsth.service.impl.BaseServiceImpl; 22 import com.bsth.service.impl.BaseServiceImpl;
29 import com.bsth.service.sys.RoleService; 23 import com.bsth.service.sys.RoleService;
30 -import org.springframework.transaction.TransactionDefinition;  
31 -import org.springframework.transaction.TransactionStatus;  
32 -import org.springframework.transaction.annotation.Propagation;  
33 -import org.springframework.transaction.annotation.Transactional;  
34 -import org.springframework.transaction.support.DefaultTransactionDefinition;  
35 24
36 @Service 25 @Service
37 public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements 26 public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements
@@ -44,15 +33,6 @@ public class RoleServiceImpl extends BaseServiceImpl&lt;Role, Integer&gt; implements @@ -44,15 +33,6 @@ public class RoleServiceImpl extends BaseServiceImpl&lt;Role, Integer&gt; implements
44 33
45 @Autowired 34 @Autowired
46 ModuleRepository moduleRepository; 35 ModuleRepository moduleRepository;
47 -  
48 - @Autowired  
49 - ResourceRepository resourceRepository;  
50 -  
51 - @Autowired  
52 - SecurityMetadataSourceService securityMetadataSourceService;  
53 -  
54 - @Autowired  
55 - JdbcTemplate jdbcTemplate;  
56 36
57 SimpleDateFormat sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"); 37 SimpleDateFormat sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm");
58 38
@@ -123,39 +103,4 @@ public class RoleServiceImpl extends BaseServiceImpl&lt;Role, Integer&gt; implements @@ -123,39 +103,4 @@ public class RoleServiceImpl extends BaseServiceImpl&lt;Role, Integer&gt; implements
123 map.put("userNames", userNames); 103 map.put("userNames", userNames);
124 return map; 104 return map;
125 } 105 }
126 -  
127 - @Override  
128 - public Map<String, Object> settRoleResources(final Integer roleId, String rIds){  
129 - Map<String, Object> map = new HashMap<>();  
130 - DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());  
131 - DefaultTransactionDefinition def = new DefaultTransactionDefinition();  
132 - def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);  
133 - TransactionStatus status = tran.getTransaction(def);  
134 - final String[] ids = rIds.split(",");  
135 - try{  
136 - jdbcTemplate.update("delete from bsth_c_sys_role_resources where roles = ?", roleId);  
137 - jdbcTemplate.batchUpdate("insert into bsth_c_sys_role_resources(resources,roles)" +  
138 - " VALUES (?, ?)", new BatchPreparedStatementSetter() {  
139 - @Override  
140 - public void setValues(PreparedStatement ps, int i) throws SQLException {  
141 - ps.setInt(1, Integer.parseInt(ids[i]));  
142 - ps.setInt(2, roleId);  
143 - }  
144 -  
145 - @Override  
146 - public int getBatchSize() {  
147 - return ids.length;  
148 - }  
149 - });  
150 - tran.commit(status);  
151 - //重新加载security资源  
152 - securityMetadataSourceService.loadResourceDefine();  
153 - map.put("status", ResponseCode.SUCCESS);  
154 - }catch (Exception e){  
155 - tran.rollback(status);  
156 - logger.error("【RoleServiceImpl】【settRoleResources】 : ", e);  
157 - map.put("status", ResponseCode.ERROR);  
158 - }  
159 - return map;  
160 - }  
161 -}  
162 \ No newline at end of file 106 \ No newline at end of file
  107 +}
src/main/resources/application-prod.properties
@@ -28,4 +28,4 @@ spring.datasource.validation-query=select 1 @@ -28,4 +28,4 @@ spring.datasource.validation-query=select 1
28 ##\u5B9E\u65F6gps 28 ##\u5B9E\u65F6gps
29 http.gps.real.url= http://192.168.168.171:8080/transport_server/rtgps/ 29 http.gps.real.url= http://192.168.168.171:8080/transport_server/rtgps/
30 ##\u6D88\u606F\u4E0B\u53D1 30 ##\u6D88\u606F\u4E0B\u53D1
31 -http.send.directive = http://192.168.168.171:8080/transport_server/message/  
32 \ No newline at end of file 31 \ No newline at end of file
  32 +http.send.directive = http://192.168.168.171:8080/transport_server/message/