Commit f5c88b2bfcf3ce9b417ed01f37fdd694bc431e35
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 | 2 | |
| 3 | 3 | import java.util.Map; |
| 4 | 4 | |
| 5 | +import org.slf4j.Logger; | |
| 6 | +import org.slf4j.LoggerFactory; | |
| 5 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
| ... | ... | @@ -34,6 +36,9 @@ public class StationController extends BaseController<Station, Integer> { |
| 34 | 36 | |
| 35 | 37 | @Autowired |
| 36 | 38 | private StationService service; |
| 39 | + | |
| 40 | + /** 日志记录器 */ | |
| 41 | + private static final Logger LOGGER = LoggerFactory.getLogger(StationController.class); | |
| 37 | 42 | |
| 38 | 43 | /** |
| 39 | 44 | * @Description :TODO(根据坐标点匹配数据库中的站点) |
| ... | ... | @@ -153,10 +158,13 @@ public class StationController extends BaseController<Station, Integer> { |
| 153 | 158 | */ |
| 154 | 159 | @RequestMapping(value="updateStationAndSectionCode" , method = RequestMethod.GET) |
| 155 | 160 | public int updateStationAndSectionCode(@RequestParam Integer stationCount, Integer sectionCount) { |
| 161 | + System.out.println(stationCount+" _ "+ sectionCount ); | |
| 156 | 162 | for(int i = 0; i < stationCount; i++) { |
| 163 | + System.out.println(stationCount); | |
| 157 | 164 | GetUIDAndCode.getStationId(); |
| 158 | 165 | } |
| 159 | 166 | for(int i = 0; i < sectionCount; i++) { |
| 167 | + System.out.println(sectionCount); | |
| 160 | 168 | GetUIDAndCode.getSectionId(); |
| 161 | 169 | } |
| 162 | 170 | return 1; | ... | ... |
src/main/java/com/bsth/controller/schedule/core/CarConfigInfoController.java
| 1 | 1 | package com.bsth.controller.schedule.core; |
| 2 | 2 | |
| 3 | +import com.bsth.common.Constants; | |
| 3 | 4 | import com.bsth.common.ResponseCode; |
| 4 | 5 | import com.bsth.controller.schedule.BController; |
| 5 | 6 | import com.bsth.entity.schedule.CarConfigInfo; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 6 | 8 | import com.bsth.repository.schedule.CarConfigInfoRepository; |
| 7 | 9 | import com.bsth.service.schedule.CarConfigInfoService; |
| 8 | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| ... | ... | @@ -12,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 14 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | 15 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 16 | |
| 17 | +import javax.servlet.http.HttpServletRequest; | |
| 18 | +import javax.servlet.http.HttpSession; | |
| 15 | 19 | import java.util.HashMap; |
| 16 | 20 | import java.util.List; |
| 17 | 21 | import java.util.Map; |
| ... | ... | @@ -58,4 +62,70 @@ public class CarConfigInfoController extends BController<CarConfigInfo, Long> { |
| 58 | 62 | |
| 59 | 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 | 1 | package com.bsth.controller.schedule.core; |
| 2 | 2 | |
| 3 | +import com.bsth.common.Constants; | |
| 3 | 4 | import com.bsth.common.ResponseCode; |
| 4 | 5 | import com.bsth.controller.schedule.BController; |
| 5 | 6 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 7 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 6 | 8 | import com.bsth.repository.schedule.EmployeeConfigInfoRepository; |
| 7 | 9 | import com.bsth.service.schedule.EmployeeConfigInfoService; |
| 8 | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 9 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 10 | 12 | import org.springframework.web.bind.annotation.*; |
| 11 | 13 | |
| 14 | +import javax.servlet.http.HttpServletRequest; | |
| 15 | +import javax.servlet.http.HttpSession; | |
| 12 | 16 | import java.util.HashMap; |
| 13 | 17 | import java.util.List; |
| 14 | 18 | import java.util.Map; |
| ... | ... | @@ -91,6 +95,54 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo |
| 91 | 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 | 146 | @RequestMapping(value = "/validate_spy", method = RequestMethod.GET) |
| 95 | 147 | public Map<String, Object> validate_spy(@RequestParam Map<String, Object> param) { |
| 96 | 148 | Map<String, Object> rtn = new HashMap<>(); |
| ... | ... | @@ -130,4 +182,50 @@ public class EmployeeConfigInfoController extends BController<EmployeeConfigInfo |
| 130 | 182 | } |
| 131 | 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 | 1 | package com.bsth.controller.sys; |
| 2 | 2 | |
| 3 | -import java.util.List; | |
| 4 | 3 | import java.util.Map; |
| 5 | 4 | |
| 6 | -import com.bsth.security.SecurityMetadataSourceService; | |
| 7 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | 7 | import org.springframework.web.bind.annotation.RequestMethod; |
| ... | ... | @@ -21,22 +19,9 @@ public class ResourceController extends BaseController<Resource, Integer>{ |
| 21 | 19 | |
| 22 | 20 | @Autowired |
| 23 | 21 | ResourceService resourceService; |
| 24 | - | |
| 25 | - @Autowired | |
| 26 | - SecurityMetadataSourceService securityMetadataSourceService; | |
| 27 | 22 | |
| 28 | 23 | @RequestMapping(value = "/batch", method = RequestMethod.POST) |
| 29 | 24 | public Map<String, Object> save(@RequestParam String array){ |
| 30 | 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<Role, Integer>{ |
| 44 | 44 | public Map<String, Object> roleInfo(@RequestParam Integer id){ |
| 45 | 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 | 81 | * @param prev |
| 82 | 82 | */ |
| 83 | 83 | private void inStation(GpsEntity gps, GpsEntity prev) { |
| 84 | + logger.info("进站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")"); | |
| 84 | 85 | ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm()); |
| 85 | 86 | boolean flow = true; |
| 86 | 87 | //要经过2个中途站才能进 | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
| ... | ... | @@ -74,6 +74,7 @@ public class OutStationProcess { |
| 74 | 74 | * @param gps |
| 75 | 75 | */ |
| 76 | 76 | private void outStation(GpsEntity gps, GpsEntity prev) { |
| 77 | + logger.info("进站记录(到达时间:" + gps.getArrTime() + " 进出站状态:" + gps.getInstation() + " 站点编号:" + gps.getStopNo() + " deviceId:" + gps.getDeviceId() + " nbbm:" + gps.getNbbm() + ")"); | |
| 77 | 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 | 108 | try { |
| 109 | 109 | if (gps.getInstation() <= 0 || null == sch) |
| 110 | 110 | return; |
| 111 | + logger.info("carArrive id: " + sch.getId()); | |
| 111 | 112 | |
| 112 | 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 | 15 | public interface CarDeviceRepository extends BaseRepository<CarDevice, Long> { |
| 16 | 16 | @Query(value="select s from CarDevice s where s.newDeviceNo=?1 and s.qyrq<=?2 ") |
| 17 | 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 | 1 | package com.bsth.repository.sys; |
| 2 | 2 | |
| 3 | 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 | 5 | import org.springframework.stereotype.Repository; |
| 11 | 6 | |
| 12 | 7 | import com.bsth.entity.sys.Resource; |
| 13 | 8 | import com.bsth.repository.BaseRepository; |
| 14 | -import org.springframework.transaction.annotation.Propagation; | |
| 15 | -import org.springframework.transaction.annotation.Transactional; | |
| 16 | 9 | |
| 17 | 10 | @Repository |
| 18 | 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<CalcWaybill, Integer |
| 1237 | 1237 | s.setYwlc(Arith.add(s.getYwlc()!=null?s.getYwlc():0, s_.getYwlc())); |
| 1238 | 1238 | s.setQtlc(Arith.add(s.getQtlc()!=null?s.getQtlc():0, s_.getQtlc())); |
| 1239 | 1239 | s.setLjlc(Arith.add(s.getLjlc()!=null?s.getLjlc():0, s_.getLjlc())); |
| 1240 | + if(s_.getLjkslc() == null){ | |
| 1241 | + s_.setLjkslc(0d); | |
| 1242 | + } | |
| 1240 | 1243 | s.setLjkslc(Arith.add(s.getLjkslc()!=null?s.getLjkslc():0, s_.getLjkslc())); |
| 1241 | 1244 | s.setJhbcq(s.getJhbcq() + s_.getJhbcq()); |
| 1242 | 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 | 536 | //发送邮件 |
| 537 | 537 | EmailBean mail = new EmailBean(); |
| 538 | 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 | 540 | sendEmailController.sendMail(emailSendToAddress, mail); |
| 541 | 541 | logger.info("setLD-sendMail:邮件发送成功!"); |
| 542 | 542 | }catch (Exception e){ |
| ... | ... | @@ -945,11 +945,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 945 | 945 | */ |
| 946 | 946 | @Override |
| 947 | 947 | public String setSKB(String ids) { |
| 948 | - String result = "failure"; | |
| 948 | + String result = "上传失败,"; | |
| 949 | 949 | StringBuffer sBuffer = new StringBuffer(); |
| 950 | 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 | 953 | try { |
| 954 | 954 | String[] idArray = ids.split(","); |
| 955 | 955 | StringBuffer sBufferA ,sBufferB ,sBufferC ; |
| ... | ... | @@ -965,14 +965,21 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 965 | 965 | sBuffer.append("<SKBs>"); |
| 966 | 966 | HashMap<String,String> paramMap; |
| 967 | 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 | 975 | for (int i = 0; i < idArray.length; i++) { |
| 969 | - long ttinfoId = Long.valueOf(idArray[i]); | |
| 976 | + ttinfoId = Long.valueOf(idArray[i]); | |
| 970 | 977 | ttInfo = ttInfoRepository.findOne(ttinfoId); |
| 971 | 978 | if(ttInfo == null) |
| 972 | 979 | continue; |
| 973 | 980 | ttinfoList.add(ttInfo); // 保存时刻表 |
| 974 | 981 | // 得到时刻表版本号 |
| 975 | - int lineVersion = ttInfo.getLineVersion(); | |
| 982 | + lineVersion = ttInfo.getLineVersion(); | |
| 976 | 983 | // 查询历史站点路由 |
| 977 | 984 | lsStationCode2NameMap = getLsStationCode(ttInfo.getXl().getLineCode(),lineVersion); |
| 978 | 985 | // 查询历史站点路由 |
| ... | ... | @@ -988,16 +995,35 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 988 | 995 | param = new HashMap(); |
| 989 | 996 | param.put("line.id_eq", ttInfo.getXl().getId()); |
| 990 | 997 | lineInformation = lineInformationRepository.findOne(new CustomerSpecs<LineInformation>(param)); |
| 998 | + // 初始化 | |
| 999 | + isLogStation = true; | |
| 991 | 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 | 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 | 1021 | sBufferB = new StringBuffer(); |
| 996 | 1022 | sBufferC = new StringBuffer(); |
| 997 | 1023 | sBufferB.append("<KSRQ>").append(sdfnyr.format(ttInfo.getQyrq())).append("</KSRQ>"); |
| 998 | 1024 | // 结束日期暂时不要,节假日的班次表才需要,如春节的班次表 |
| 999 | 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 | 1027 | sBufferB.append("<TBYY>").append("").append("</TBYY>"); |
| 1002 | 1028 | sBufferB.append("<UPDT>").append(sdfnyrsfm.format(new Date())).append("</UPDT>"); |
| 1003 | 1029 | sBufferB.append("<BCList>"); |
| ... | ... | @@ -1021,22 +1047,51 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1021 | 1047 | if(changeTimeFormat(ttInfoDetail) == null){ |
| 1022 | 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 | 1056 | sBufferC.append("<BC>"); |
| 1025 | 1057 | sBufferC.append("<LPBH>").append(ttInfoDetail.getLp().getLpNo()).append("</LPBH>"); |
| 1026 | 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 | 1061 | otherMap.put("stationMark","B"); |
| 1031 | 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 | 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 | 1082 | otherMap.put("stationMark","E"); |
| 1038 | 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 | 1095 | sBufferC.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>"); |
| 1041 | 1096 | sBufferC.append("</BC>"); |
| 1042 | 1097 | // 0:上行;1:下行 |
| ... | ... | @@ -1055,10 +1110,11 @@ public class TrafficManageServiceImpl implements TrafficManageService{ |
| 1055 | 1110 | sBufferA.append("<JHYYLC>").append(df.format(yylc)).append("</JHYYLC>"); |
| 1056 | 1111 | sBuffer.append(sBufferA).append(sBufferB).append(sBufferC); |
| 1057 | 1112 | } |
| 1113 | + logger.info("setSKB:"+"ttinfoId:"+ttinfoId+";当前站点版本号:"+lineVersion+";查询历史站点路由:"+lsStationCode2NameMap+";查询历史站点编号:"+lsStationName2YgcNumber); | |
| 1058 | 1114 | } |
| 1059 | 1115 | sBuffer.append("</SKBs>"); |
| 1060 | 1116 | if(ssop.setSKB(userNameOther, passwordOther, sBuffer.toString()).isSuccess()){ |
| 1061 | - result = "success"; | |
| 1117 | + result = "上传成功"; | |
| 1062 | 1118 | SKBUploadLogger skbUploadLogger ; |
| 1063 | 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<ScheduleRealInf |
| 1210 | 1210 | |
| 1211 | 1211 | } |
| 1212 | 1212 | String device = ""; |
| 1213 | + String device2 =""; | |
| 1214 | + long qyrqTime=0l; | |
| 1213 | 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 | 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 | 1256 | } else { |
| 1231 | 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 | 1263 | obj[3] = sdf.format(new Date(Long.parseLong(obj[3].toString()))); |
| 1237 | 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 | 1280 | if (type != null && type.length() != 0 && type.equals("export")) { |
| 1242 | 1281 | String lineName = BasicData.lineCode2NameMap.get(line); |
| 1243 | 1282 | SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), |
| ... | ... | @@ -2234,6 +2273,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 2234 | 2273 | } |
| 2235 | 2274 | try { |
| 2236 | 2275 | String dateTime = sdfSimple.format(sdfMonth.parse(date)); |
| 2276 | + if(!endDate.equals(date)){ | |
| 2277 | + dateTime += "-" + sdfSimple.format(sdfMonth.parse(endDate)); | |
| 2278 | + } | |
| 2237 | 2279 | String lineName = BasicData.lineCode2NameMap.get(line); |
| 2238 | 2280 | listI.add(tempList.iterator()); |
| 2239 | 2281 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; |
| ... | ... | @@ -3210,6 +3252,63 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3210 | 3252 | String zdsj1 = ""; |
| 3211 | 3253 | String zdsjActual1 = ""; |
| 3212 | 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 | 3312 | for (int i = 0; i < listInfo.size(); i++) { |
| 3214 | 3313 | ScheduleRealInfo t = listInfo.get(i); |
| 3215 | 3314 | if (!lpName.equals(t.getLpName())) { |
| ... | ... | @@ -3228,8 +3327,44 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3228 | 3327 | lpName = t.getLpName(); |
| 3229 | 3328 | list.add(t); |
| 3230 | 3329 | } |
| 3231 | - | |
| 3330 | +/* | |
| 3232 | 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 | 3368 | List<ScheduleRealInfo> xList = new ArrayList<ScheduleRealInfo>(); |
| 3234 | 3369 | List<ScheduleRealInfo> yList = new ArrayList<ScheduleRealInfo>(); |
| 3235 | 3370 | List<ScheduleRealInfo> zList = new ArrayList<ScheduleRealInfo>(); |
| ... | ... | @@ -5612,6 +5747,23 @@ class AccountXlbm implements Comparator<Map<String, Object>> { |
| 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 | 5767 | class compareFcsjType implements Comparator<ScheduleRealInfo> { |
| 5616 | 5768 | @Override |
| 5617 | 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 | 863 | if (sch.isSflj()) |
| 864 | 864 | continue; |
| 865 | 865 | cts = sch.getcTasks(); |
| 866 | + if(isInOut(sch)) | |
| 867 | + continue; | |
| 866 | 868 | //有子任务 |
| 867 | 869 | if (cts != null && cts.size() > 0) { |
| 868 | 870 | for(ChildTaskPlan c : cts){ |
| ... | ... | @@ -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 | 888 | else if(sch.getStatus() == -1 && !sch.isCcService()){ |
| 888 | 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 | 1825 | newMap.put("dz", scheduleRealInfo.getQdzName()); |
| 1826 | 1826 | newMap.put("sj", scheduleRealInfo.getFcsj()); |
| 1827 | 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 | 1829 | list.add(newMap); |
| 1830 | 1830 | } |
| 1831 | 1831 | // }else{ | ... | ... |
src/main/java/com/bsth/service/schedule/CarConfigInfoService.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.CarConfigInfo; |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 4 | 5 | import com.bsth.service.schedule.exception.ScheduleException; |
| 5 | 6 | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * Created by xu on 16/5/9. |
| 8 | 11 | */ |
| 9 | 12 | public interface CarConfigInfoService extends BService<CarConfigInfo, Long> { |
| 10 | 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 | 20 | void toggleCancel(Long id) throws ScheduleException; |
| 21 | + | |
| 22 | + | |
| 12 | 23 | } | ... | ... |
src/main/java/com/bsth/service/schedule/EmployeeConfigInfoService.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 4 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 4 | 5 | import com.bsth.service.schedule.exception.ScheduleException; |
| 5 | 6 | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 6 | 9 | /** |
| 7 | 10 | * Created by xu on 16/5/10. |
| 8 | 11 | */ |
| ... | ... | @@ -13,8 +16,17 @@ public interface EmployeeConfigInfoService extends BService<EmployeeConfigInfo, |
| 13 | 16 | void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException; |
| 14 | 17 | // 验证驾驶员是否配置在指定线路 |
| 15 | 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 | 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 | 30 | void toggleCancel(Long id) throws ScheduleException; |
| 19 | 31 | Long getMaxDbbm(Integer xlId); |
| 20 | 32 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/CarConfigInfoServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Cars; | |
| 3 | 4 | import com.bsth.entity.schedule.CarConfigInfo; |
| 4 | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 5 | 7 | import com.bsth.service.schedule.CarConfigInfoService; |
| 8 | +import com.bsth.service.schedule.CarsService; | |
| 6 | 9 | import com.bsth.service.schedule.ScheduleRule1FlatService; |
| 7 | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 8 | 11 | import com.bsth.service.schedule.utils.DataToolsFile; |
| ... | ... | @@ -25,6 +28,8 @@ import java.util.Map; |
| 25 | 28 | public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> implements CarConfigInfoService { |
| 26 | 29 | @Autowired |
| 27 | 30 | private ScheduleRule1FlatService scheduleRule1FlatService; |
| 31 | + @Autowired | |
| 32 | + private CarsService carsService; | |
| 28 | 33 | |
| 29 | 34 | @Autowired |
| 30 | 35 | @Qualifier(value = "carConfig_dataTool") |
| ... | ... | @@ -45,6 +50,57 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> |
| 45 | 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 | 104 | @Transactional |
| 49 | 105 | public void validate_cars(CarConfigInfo carConfigInfo) throws ScheduleException { |
| 50 | 106 | // 相同车辆不能同时配置 |
| ... | ... | @@ -73,6 +129,17 @@ public class CarConfigInfoServiceImpl extends BServiceImpl<CarConfigInfo, Long> |
| 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 | 143 | @Transactional |
| 77 | 144 | @Override |
| 78 | 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 | 12 | import org.springframework.transaction.annotation.Transactional; |
| 13 | 13 | import org.springframework.util.CollectionUtils; |
| 14 | 14 | |
| 15 | +import java.util.Date; | |
| 15 | 16 | import java.util.HashMap; |
| 16 | 17 | import java.util.Map; |
| 17 | 18 | |
| ... | ... | @@ -29,6 +30,8 @@ public class CarDeviceServiceImpl extends BServiceImpl<CarDevice, Long> implemen |
| 29 | 30 | // 查找对应的车辆基础信息,更新设备编号数据 |
| 30 | 31 | Cars cars = carsService.findById(carDevice.getCl()); |
| 31 | 32 | cars.setEquipmentCode(carDevice.getNewDeviceNo()); |
| 33 | + // 设备启用日期使用后台日期 | |
| 34 | + carDevice.setQyrq(new Date()); | |
| 32 | 35 | return super.save(carDevice); |
| 33 | 36 | } |
| 34 | 37 | ... | ... |
src/main/java/com/bsth/service/schedule/impl/EmployeeConfigInfoServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule.impl; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Personnel; | |
| 3 | 4 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 4 | 5 | import com.bsth.entity.schedule.rule.ScheduleRule1Flat; |
| 6 | +import com.bsth.entity.sys.CompanyAuthority; | |
| 5 | 7 | import com.bsth.service.schedule.EmployeeConfigInfoService; |
| 8 | +import com.bsth.service.schedule.EmployeeService; | |
| 6 | 9 | import com.bsth.service.schedule.ScheduleRule1FlatService; |
| 7 | 10 | import com.bsth.service.schedule.exception.ScheduleException; |
| 8 | 11 | import com.bsth.service.schedule.utils.DataToolsFile; |
| ... | ... | @@ -28,6 +31,8 @@ import java.util.*; |
| 28 | 31 | public class EmployeeConfigInfoServiceImpl extends BServiceImpl<EmployeeConfigInfo, Long> implements EmployeeConfigInfoService { |
| 29 | 32 | @Autowired |
| 30 | 33 | private ScheduleRule1FlatService scheduleRule1FlatService; |
| 34 | + @Autowired | |
| 35 | + private EmployeeService employeeService; | |
| 31 | 36 | |
| 32 | 37 | @Autowired |
| 33 | 38 | @Qualifier(value = "employeeConfig_dataTool") |
| ... | ... | @@ -110,6 +115,57 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<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 | 169 | @Transactional |
| 114 | 170 | @Override |
| 115 | 171 | public void validate_spy(EmployeeConfigInfo employeeConfigInfo) throws ScheduleException { |
| ... | ... | @@ -137,6 +193,57 @@ public class EmployeeConfigInfoServiceImpl extends BServiceImpl<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 | 247 | @Transactional |
| 141 | 248 | @Override |
| 142 | 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 | 55 | if(subCompany.length() != 0) |
| 56 | 56 | sql += " and fgs_bm = '"+subCompany+"'"; |
| 57 | 57 | |
| 58 | + sql += " order by gs_bm, fgs_bm, xl_bm"; | |
| 59 | + | |
| 58 | 60 | list = jdbcTemplate.query(sql, |
| 59 | 61 | new RowMapper<ScheduleRealInfo>(){ |
| 60 | 62 | @Override |
| ... | ... | @@ -62,6 +64,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 62 | 64 | ScheduleRealInfo schedule = new ScheduleRealInfo(); |
| 63 | 65 | schedule.setScheduleDateStr(rs.getString("schedule_date_str")); |
| 64 | 66 | schedule.setRealExecDate(rs.getString("real_exec_date")); |
| 67 | + schedule.setXlBm(rs.getString("xl_bm")); | |
| 65 | 68 | schedule.setXlName(rs.getString("xl_name")); |
| 66 | 69 | schedule.setLpName(rs.getString("lp_name")); |
| 67 | 70 | schedule.setBcType(rs.getString("bc_type")); |
| ... | ... | @@ -325,7 +328,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 325 | 328 | Set<String> lineSet = getNotOperation(); |
| 326 | 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 | 334 | if(map.get("company")!=null) |
| 330 | 335 | company = map.get("company").toString(); |
| 331 | 336 | if(map.get("subCompany")!=null) |
| ... | ... | @@ -338,9 +343,27 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 338 | 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 | 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 | 367 | for(ScheduleRealInfo schedule : list){ |
| 345 | 368 | String key = schedule.getXlName(); |
| 346 | 369 | if(key == null || key.trim().equals("") || lineSet.contains(key)) |
| ... | ... | @@ -1317,20 +1340,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1317 | 1340 | |
| 1318 | 1341 | String xlbm = s.getXlBm(); |
| 1319 | 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 | 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 | 1349 | } else { |
| 1333 | - flag = true; | |
| 1350 | + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){ | |
| 1351 | + flag = true; | |
| 1352 | + } | |
| 1334 | 1353 | } |
| 1335 | 1354 | if(!flag){ |
| 1336 | 1355 | continue; |
| ... | ... | @@ -1596,20 +1615,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1596 | 1615 | |
| 1597 | 1616 | boolean flag = false; |
| 1598 | 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 | 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 | 1624 | } else { |
| 1612 | - flag = true; | |
| 1625 | + if(lineNature.containsKey(xlbm) && !lineNature.get(xlbm)){ | |
| 1626 | + flag = true; | |
| 1627 | + } | |
| 1613 | 1628 | } |
| 1614 | 1629 | if(!flag){ |
| 1615 | 1630 | continue; |
| ... | ... | @@ -2137,19 +2152,20 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 2137 | 2152 | |
| 2138 | 2153 | String sql_="select * from bsth_c_s_sp_info_real " |
| 2139 | 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 | 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 | 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 | 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 | 2170 | List<Map<String, Object>> tempList = jdbcTemplate.query(sql, |
| 2155 | 2171 | new RowMapper<Map<String, Object>>(){ |
| ... | ... | @@ -2184,20 +2200,16 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 2184 | 2200 | List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); |
| 2185 | 2201 | for(Map<String, Object> m : tempList){ |
| 2186 | 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 | 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 | 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
src/main/java/com/bsth/service/sys/RoleService.java
| ... | ... | @@ -10,12 +10,4 @@ public interface RoleService extends BaseService<Role, Integer>{ |
| 10 | 10 | Map<String, Object> settRoleModules(Integer roleId, String mIds); |
| 11 | 11 | |
| 12 | 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 | 1 | package com.bsth.service.sys.impl; |
| 2 | 2 | |
| 3 | -import java.util.ArrayList; | |
| 4 | 3 | import java.util.HashMap; |
| 5 | 4 | import java.util.List; |
| 6 | 5 | import java.util.Map; |
| 7 | 6 | |
| 8 | -import com.bsth.entity.sys.SysUser; | |
| 9 | -import com.bsth.security.util.SecurityUtils; | |
| 10 | 7 | import org.slf4j.Logger; |
| 11 | 8 | import org.slf4j.LoggerFactory; |
| 12 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -43,15 +40,4 @@ public class ResourceServiceImpl extends BaseServiceImpl<Resource, Integer> impl |
| 43 | 40 | public List<Resource> findByRolesId(Integer id) { |
| 44 | 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 | 1 | package com.bsth.service.sys.impl; |
| 2 | 2 | |
| 3 | -import java.sql.PreparedStatement; | |
| 4 | -import java.sql.SQLException; | |
| 5 | 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 | 11 | import org.slf4j.Logger; |
| 14 | 12 | import org.slf4j.LoggerFactory; |
| 15 | 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 | 14 | import org.springframework.stereotype.Service; |
| 21 | 15 | |
| 22 | 16 | import com.bsth.common.ResponseCode; |
| ... | ... | @@ -27,11 +21,6 @@ import com.bsth.repository.sys.ModuleRepository; |
| 27 | 21 | import com.bsth.repository.sys.RoleRepository; |
| 28 | 22 | import com.bsth.service.impl.BaseServiceImpl; |
| 29 | 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 | 25 | @Service |
| 37 | 26 | public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements |
| ... | ... | @@ -44,15 +33,6 @@ public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements |
| 44 | 33 | |
| 45 | 34 | @Autowired |
| 46 | 35 | ModuleRepository moduleRepository; |
| 47 | - | |
| 48 | - @Autowired | |
| 49 | - ResourceRepository resourceRepository; | |
| 50 | - | |
| 51 | - @Autowired | |
| 52 | - SecurityMetadataSourceService securityMetadataSourceService; | |
| 53 | - | |
| 54 | - @Autowired | |
| 55 | - JdbcTemplate jdbcTemplate; | |
| 56 | 36 | |
| 57 | 37 | SimpleDateFormat sdfMinute = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| 58 | 38 | |
| ... | ... | @@ -123,39 +103,4 @@ public class RoleServiceImpl extends BaseServiceImpl<Role, Integer> implements |
| 123 | 103 | map.put("userNames", userNames); |
| 124 | 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 | 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 | 28 | ##\u5B9E\u65F6gps |
| 29 | 29 | http.gps.real.url= http://192.168.168.171:8080/transport_server/rtgps/ |
| 30 | 30 | ##\u6D88\u606F\u4E0B\u53D1 |
| 31 | -http.send.directive = http://192.168.168.171:8080/transport_server/message/ | |
| 32 | 31 | \ No newline at end of file |
| 32 | +http.send.directive = http://192.168.168.171:8080/transport_server/message/ | ... | ... |