Commit 6f988cb2c14ceedd770715f75749c52e65e19388
PSM-8
Showing
12 changed files
with
691 additions
and
164 deletions
Too many changes to show.
To preserve performance only 12 of 18 files are displayed.
src/main/java/com/bsth/controller/schedule/CarConfigInfoController.java
| ... | ... | @@ -51,4 +51,9 @@ public class CarConfigInfoController extends BaseController<CarConfigInfo, Long> |
| 51 | 51 | public List<Map<String, Object>> findCarConfigCars() { |
| 52 | 52 | return carConfigInfoRepository.findCarConfigCars(); |
| 53 | 53 | } |
| 54 | + | |
| 55 | + @RequestMapping(value = "/cars2", method = RequestMethod.GET) | |
| 56 | + public List<Map<String, Object>> findCarsFromConfig() { | |
| 57 | + return carConfigInfoRepository.findCarsFromConfig(); | |
| 58 | + } | |
| 54 | 59 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/EmployeeConfigInfoController.java
| ... | ... | @@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 8 | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| 9 | 9 | import org.springframework.web.bind.annotation.*; |
| 10 | 10 | |
| 11 | +import java.util.List; | |
| 11 | 12 | import java.util.Map; |
| 12 | 13 | |
| 13 | 14 | /** |
| ... | ... | @@ -45,4 +46,14 @@ public class EmployeeConfigInfoController extends BaseController<EmployeeConfigI |
| 45 | 46 | public Map<String, Object> save(@RequestBody EmployeeConfigInfo t){ |
| 46 | 47 | return baseService.save(t); |
| 47 | 48 | } |
| 49 | + | |
| 50 | + @RequestMapping(value = "/jsy", method = RequestMethod.GET) | |
| 51 | + public List<Map<String, Object>> findJsyFromConfig() { | |
| 52 | + return employeeConfigInfoRepository.findJsyFromConfig(); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @RequestMapping(value = "/spy", method = RequestMethod.GET) | |
| 56 | + public List<Map<String, Object>> findSpyFromConfig() { | |
| 57 | + return employeeConfigInfoRepository.findSpyFromConfig(); | |
| 58 | + } | |
| 48 | 59 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/SchedulePlanController.java
| ... | ... | @@ -4,10 +4,11 @@ import com.bsth.controller.BaseController; |
| 4 | 4 | import com.bsth.entity.schedule.SchedulePlan; |
| 5 | 5 | import com.bsth.service.schedule.SchedulePlanService; |
| 6 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | -import org.springframework.web.bind.annotation.*; | |
| 7 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 8 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 10 | +import org.springframework.web.bind.annotation.RestController; | |
| 8 | 11 | |
| 9 | -import java.util.Date; | |
| 10 | -import java.util.List; | |
| 11 | 12 | import java.util.Map; |
| 12 | 13 | |
| 13 | 14 | /** |
| ... | ... | @@ -34,21 +35,18 @@ public class SchedulePlanController extends BaseController<SchedulePlan, Long> { |
| 34 | 35 | return baseService.save(t); |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | - // TODO: | |
| 38 | -// @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) | |
| 39 | -// public List<Map<String, Object>> findGroupInfo( | |
| 40 | -// Integer xlid, Date scheduleDate) { | |
| 41 | -// | |
| 42 | -// } | |
| 43 | - | |
| 44 | - @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) | |
| 45 | - public List<Map<String, Object>> findGroupInfo( | |
| 46 | - @PathVariable(value = "xlid") Integer xlid, | |
| 47 | - @PathVariable(value = "date") Date scheduleDate) { | |
| 48 | - return schedulePlanService.findGroupInfo(xlid, scheduleDate); | |
| 38 | + /** | |
| 39 | + * 获取明天的一歌排班计划。 | |
| 40 | + * @return | |
| 41 | + * @throws Exception | |
| 42 | + */ | |
| 43 | + @RequestMapping(value = "/tommorw", method = RequestMethod.GET) | |
| 44 | + public SchedulePlan getTommorwPlan() throws Exception { | |
| 45 | + try { | |
| 46 | + return schedulePlanService.findSchedulePlanTommorw(); | |
| 47 | + } catch (Exception exp) { | |
| 48 | + throw new Exception(exp.getCause()); | |
| 49 | + } | |
| 49 | 50 | } |
| 50 | 51 | |
| 51 | -// public int updateGroupInfo | |
| 52 | - | |
| 53 | - | |
| 54 | 52 | } | ... | ... |
src/main/java/com/bsth/controller/schedule/SchedulePlanInfoController.java
| 1 | 1 | package com.bsth.controller.schedule; |
| 2 | 2 | |
| 3 | +import com.bsth.common.ResponseCode; | |
| 3 | 4 | import com.bsth.controller.BaseController; |
| 4 | 5 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 5 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 6 | -import org.springframework.web.bind.annotation.RestController; | |
| 6 | +import com.bsth.service.schedule.SchedulePlanInfoService; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.web.bind.annotation.*; | |
| 9 | + | |
| 10 | +import java.util.Date; | |
| 11 | +import java.util.HashMap; | |
| 12 | +import java.util.List; | |
| 13 | +import java.util.Map; | |
| 7 | 14 | |
| 8 | 15 | /** |
| 9 | 16 | * Created by xu on 16/6/16. |
| ... | ... | @@ -11,5 +18,30 @@ import org.springframework.web.bind.annotation.RestController; |
| 11 | 18 | @RestController |
| 12 | 19 | @RequestMapping("spic") |
| 13 | 20 | public class SchedulePlanInfoController extends BaseController<SchedulePlanInfo, Long> { |
| 21 | + @Autowired | |
| 22 | + private SchedulePlanInfoService schedulePlanInfoService; | |
| 23 | + | |
| 24 | + @RequestMapping(value = "/groupinfos/{xlid}/{date}", method = RequestMethod.GET) | |
| 25 | + public List<SchedulePlanInfoService.GroupInfo> findGroupInfo( | |
| 26 | + @PathVariable(value = "xlid") Integer xlid, | |
| 27 | + @PathVariable(value = "date") Date scheduleDate) { | |
| 28 | + return schedulePlanInfoService.findGroupInfo(xlid, scheduleDate); | |
| 29 | + } | |
| 30 | + | |
| 31 | + @RequestMapping(value = "/groupinfos/update", method = RequestMethod.POST) | |
| 32 | + public Map<String, Object> updateGroupInfo(@RequestBody SchedulePlanInfoService.GroupInfoUpdate groupInfoUpdate) { | |
| 33 | + Map<String, Object> resultMap = new HashMap<>(); | |
| 34 | + try { | |
| 35 | + schedulePlanInfoService.updateGroupInfo(groupInfoUpdate); | |
| 36 | + | |
| 37 | + resultMap.put("status", ResponseCode.SUCCESS); | |
| 38 | + resultMap.put("msg", "更新成功"); | |
| 39 | + } catch (Exception exp) { | |
| 40 | + exp.printStackTrace(); | |
| 41 | + resultMap.put("status", ResponseCode.ERROR); | |
| 42 | + resultMap.put("msg", exp.getLocalizedMessage()); | |
| 43 | + } | |
| 14 | 44 | |
| 45 | + return resultMap; | |
| 46 | + } | |
| 15 | 47 | } | ... | ... |
src/main/java/com/bsth/repository/schedule/CarConfigInfoRepository.java
| ... | ... | @@ -42,4 +42,7 @@ public interface CarConfigInfoRepository extends BaseRepository<CarConfigInfo, L |
| 42 | 42 | |
| 43 | 43 | @Query("select new map(cc.cl.insideCode as nbbm, cc.id as id) from CarConfigInfo cc") |
| 44 | 44 | List<Map<String, Object>> findCarConfigCars(); |
| 45 | + | |
| 46 | + @Query("select new map(cc.cl.id as id, cc.cl.insideCode as insideCode) from CarConfigInfo cc") | |
| 47 | + List<Map<String, Object>> findCarsFromConfig(); | |
| 45 | 48 | } |
| 46 | 49 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/repository/schedule/EmployeeConfigInfoRepository.java
| ... | ... | @@ -5,6 +5,7 @@ import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 5 | 5 | import com.bsth.repository.BaseRepository; |
| 6 | 6 | |
| 7 | 7 | import java.util.List; |
| 8 | +import java.util.Map; | |
| 8 | 9 | |
| 9 | 10 | import org.springframework.data.domain.Page; |
| 10 | 11 | import org.springframework.data.domain.Pageable; |
| ... | ... | @@ -34,4 +35,18 @@ public interface EmployeeConfigInfoRepository extends BaseRepository<EmployeeCon |
| 34 | 35 | @EntityGraph(value = "employeeConfigInfo_jsy_spy_xl", type = EntityGraph.EntityGraphType.FETCH) |
| 35 | 36 | @Query("select cc from EmployeeConfigInfo cc where cc.id=?1") |
| 36 | 37 | EmployeeConfigInfo findOneExtend(Long aLong); |
| 38 | + | |
| 39 | + @Query("select new map(" + | |
| 40 | + "ec.jsy.id as jsyId, " + | |
| 41 | + "ec.jsy.jobCode as jsyGh, " + | |
| 42 | + "ec.jsy.personnelName as jsyName) " + | |
| 43 | + "from EmployeeConfigInfo ec ") | |
| 44 | + List<Map<String, Object>> findJsyFromConfig(); | |
| 45 | + | |
| 46 | + @Query("select new map(" + | |
| 47 | + "ec.spy.id as spyId, " + | |
| 48 | + "ec.spy.jobCode as spyGh, " + | |
| 49 | + "ec.spy.personnelName as spyName) " + | |
| 50 | + "from EmployeeConfigInfo ec ") | |
| 51 | + List<Map<String, Object>> findSpyFromConfig(); | |
| 37 | 52 | } | ... | ... |
src/main/java/com/bsth/repository/schedule/SchedulePlanInfoRepository.java
| ... | ... | @@ -9,7 +9,9 @@ import java.util.List; |
| 9 | 9 | import org.springframework.data.domain.Page; |
| 10 | 10 | import org.springframework.data.domain.Pageable; |
| 11 | 11 | import org.springframework.data.jpa.domain.Specification; |
| 12 | +import org.springframework.data.jpa.repository.Modifying; | |
| 12 | 13 | import org.springframework.data.jpa.repository.Query; |
| 14 | +import org.springframework.data.repository.query.Param; | |
| 13 | 15 | import org.springframework.stereotype.Repository; |
| 14 | 16 | |
| 15 | 17 | /** |
| ... | ... | @@ -23,4 +25,97 @@ public interface SchedulePlanInfoRepository extends BaseRepository<SchedulePlanI |
| 23 | 25 | |
| 24 | 26 | Long deleteByXlAndScheduleDateGreaterThanEqualAndScheduleDateLessThanEqual(Integer xlid, Date startDate, Date endDate); |
| 25 | 27 | |
| 28 | + | |
| 29 | + @Query(value = " select " + | |
| 30 | + "xl as xlId, " + | |
| 31 | + "xl_name as xlName, " + | |
| 32 | + "schedule_date as scheduleDate, " + | |
| 33 | + "lp_name as lpName, " + | |
| 34 | + "cl as clId, " + | |
| 35 | + "cl_zbh as clZbh, " + | |
| 36 | + "group_concat(distinct fcsj) ccsj, " + | |
| 37 | + "group_concat(distinct j) jsyId, " + | |
| 38 | + "group_concat(distinct j_gh) jsyGh, " + | |
| 39 | + "group_concat(distinct j_name) jsyName, " + | |
| 40 | + "group_concat(distinct s) spyId, " + | |
| 41 | + "group_concat(distinct s_gh) spyGh, " + | |
| 42 | + "group_concat(distinct s_name) spyName, " + | |
| 43 | + "max(create_date) as createDate " + | |
| 44 | + "from bsth_c_s_sp_info " + | |
| 45 | + "where bc_type = 'out' and " + | |
| 46 | + "xl = ?1 and " + | |
| 47 | + "schedule_date = ?2 " + | |
| 48 | + "group by xl_name, schedule_date, lp_name " + | |
| 49 | + "order by xl_name, schedule_date, lp ", nativeQuery = true) | |
| 50 | + List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate); | |
| 51 | + | |
| 52 | + @Modifying | |
| 53 | + @Query(value = "update " + | |
| 54 | + "SchedulePlanInfo scpinfo " + | |
| 55 | + "set scpinfo.cl = :p1, scpinfo.clZbh = :p2 " + | |
| 56 | + "where scpinfo.xl = :p3 and " + | |
| 57 | + "scpinfo.scheduleDate = :p4 and " + | |
| 58 | + "scpinfo.lpName = :p5 ") | |
| 59 | + int updateGroupInfo_type_1( | |
| 60 | + @Param("p1") Integer clid, | |
| 61 | + @Param("p2") String clZbh, | |
| 62 | + @Param("p3") Integer xlid, | |
| 63 | + @Param("p4") Date scheduleDate, | |
| 64 | + @Param("p5") String lpName); | |
| 65 | + | |
| 66 | + @Modifying | |
| 67 | + @Query(value = "update " + | |
| 68 | + "SchedulePlanInfo scpinfo " + | |
| 69 | + "set scpinfo.fcsj = :p1 " + | |
| 70 | + "where scpinfo.xl = :p2 and " + | |
| 71 | + "scpinfo.scheduleDate = :p3 and " + | |
| 72 | + "scpinfo.lpName = :p4 and " + | |
| 73 | + "scpinfo.fcsj = :p5 and " + | |
| 74 | + "scpinfo.bcType = :p6 ") | |
| 75 | + int updateGroupInfo_type_2_4( | |
| 76 | + @Param("p1") String fcsj, | |
| 77 | + @Param("p2") Integer xlid, | |
| 78 | + @Param("p3") Date scheduleDate, | |
| 79 | + @Param("p4") String lpName, | |
| 80 | + @Param("p5") String fcsj_src, | |
| 81 | + @Param("p6") String bcType); | |
| 82 | + | |
| 83 | + @Modifying | |
| 84 | + @Query(value = "update " + | |
| 85 | + "SchedulePlanInfo scpinfo " + | |
| 86 | + "set scpinfo.j = :p1, " + | |
| 87 | + "scpinfo.jGh = :p2, " + | |
| 88 | + "scpinfo.jName = :p3 " + | |
| 89 | + "where scpinfo.xl = :p4 and " + | |
| 90 | + "scpinfo.scheduleDate = :p5 and " + | |
| 91 | + "scpinfo.lpName = :p6 and " + | |
| 92 | + "scpinfo.j = :p7 ") | |
| 93 | + int updateGroupInfo_type_3_5_jsy( | |
| 94 | + @Param("p1") Integer jsyId, | |
| 95 | + @Param("p2") String jsyGh, | |
| 96 | + @Param("p3") String jsyName, | |
| 97 | + @Param("p4") Integer xlId, | |
| 98 | + @Param("p5") Date scheduleDate, | |
| 99 | + @Param("p6") String lpName, | |
| 100 | + @Param("p7") Integer jsyId_src); | |
| 101 | + | |
| 102 | + @Modifying | |
| 103 | + @Query(value = "update " + | |
| 104 | + "SchedulePlanInfo scpinfo " + | |
| 105 | + "set scpinfo.s = :p1, " + | |
| 106 | + "scpinfo.sGh = :p2, " + | |
| 107 | + "scpinfo.sName = :p3 " + | |
| 108 | + "where scpinfo.xl = :p4 and " + | |
| 109 | + "scpinfo.scheduleDate = :p5 and " + | |
| 110 | + "scpinfo.lpName = :p6 and " + | |
| 111 | + "scpinfo.s = :p7 ") | |
| 112 | + int updateGroupInfo_type_3_5_spy( | |
| 113 | + @Param("p1") Integer spyId, | |
| 114 | + @Param("p2") String spyGh, | |
| 115 | + @Param("p3") String spyName, | |
| 116 | + @Param("p4") Integer xlId, | |
| 117 | + @Param("p5") Date scheduleDate, | |
| 118 | + @Param("p6") String lpName, | |
| 119 | + @Param("p7") Integer spyId_src); | |
| 120 | + | |
| 26 | 121 | } | ... | ... |
src/main/java/com/bsth/repository/schedule/SchedulePlanRepository.java
| ... | ... | @@ -6,15 +6,8 @@ import org.springframework.data.domain.Page; |
| 6 | 6 | import org.springframework.data.domain.Pageable; |
| 7 | 7 | import org.springframework.data.jpa.domain.Specification; |
| 8 | 8 | import org.springframework.data.jpa.repository.EntityGraph; |
| 9 | -import org.springframework.data.jpa.repository.Query; | |
| 10 | -import org.springframework.data.repository.query.Param; | |
| 11 | 9 | import org.springframework.stereotype.Repository; |
| 12 | 10 | |
| 13 | -import javax.persistence.SqlResultSetMapping; | |
| 14 | -import java.util.Date; | |
| 15 | -import java.util.List; | |
| 16 | -import java.util.Map; | |
| 17 | - | |
| 18 | 11 | /** |
| 19 | 12 | * Created by xu on 16/6/16. |
| 20 | 13 | */ |
| ... | ... | @@ -24,37 +17,4 @@ public interface SchedulePlanRepository extends BaseRepository<SchedulePlan, Lon |
| 24 | 17 | @Override |
| 25 | 18 | Page<SchedulePlan> findAll(Specification<SchedulePlan> spec, Pageable pageable); |
| 26 | 19 | |
| 27 | - @Query(value = " select " + | |
| 28 | - "xl_name as xlName, " + | |
| 29 | - "schedule_date as scheduleDate, " + | |
| 30 | - "lp_name as lpName, " + | |
| 31 | - "cl_zbh as clZbh, " + | |
| 32 | - "group_concat(distinct fcsj) ccsj, " + | |
| 33 | - "group_concat(distinct j_gh) jsyGh, " + | |
| 34 | - "group_concat(distinct j_name) jsyName, " + | |
| 35 | - "group_concat(distinct s_gh) spyGh, " + | |
| 36 | - "group_concat(distinct s_name) spyName, " + | |
| 37 | - "max(create_date) as createDate " + | |
| 38 | - "from bsth_c_s_sp_info " + | |
| 39 | - "where bc_type = 'out' and " + | |
| 40 | - "xl = ?1 and " + | |
| 41 | - "schedule_date = ?2 " + | |
| 42 | - "group by xl_name, schedule_date, lp_name " + | |
| 43 | - "order by xl_name, schedule_date, lp ", nativeQuery = true) | |
| 44 | - List<Object[]> findGroupInfo(Integer xlid, Date scheduleDate); | |
| 45 | - | |
| 46 | - @Query(value = "update " + | |
| 47 | - "bsth_c_s_sp_info " + | |
| 48 | - "set cl = :p1, cl_zbh = :p2 " + | |
| 49 | - "where xl = :p3 and " + | |
| 50 | - "schedule_date = :p4 and " + | |
| 51 | - "lp_name = :p5 ", | |
| 52 | - nativeQuery = true) | |
| 53 | - int updateGroupInfo_clinfo( | |
| 54 | - @Param("p1") Integer clid, | |
| 55 | - @Param("p2") String clZbh, | |
| 56 | - @Param("p3") Integer xlid, | |
| 57 | - @Param("p4") Date scheduleDate, | |
| 58 | - @Param("p5") String lpName); | |
| 59 | - | |
| 60 | 20 | } | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoService.java
| ... | ... | @@ -2,9 +2,387 @@ package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | 4 | import com.bsth.service.BaseService; |
| 5 | +import org.joda.time.DateTime; | |
| 6 | + | |
| 7 | +import java.util.Date; | |
| 8 | +import java.util.List; | |
| 5 | 9 | |
| 6 | 10 | /** |
| 7 | 11 | * Created by xu on 16/6/16. |
| 8 | 12 | */ |
| 9 | 13 | public interface SchedulePlanInfoService extends BaseService<SchedulePlanInfo, Long> { |
| 14 | + /** | |
| 15 | + * 查找分组排班信息。 | |
| 16 | + * @param xlid 线路Id | |
| 17 | + * @param scheduleDate 排班日期 | |
| 18 | + * @return | |
| 19 | + */ | |
| 20 | + List<GroupInfo> findGroupInfo(Integer xlid, Date scheduleDate); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 更新分组信息。 | |
| 24 | + * type=1,替换车辆 | |
| 25 | + * type=2,修改出场班次1时间(首班车时间) | |
| 26 | + * type=3,替换分组人员(驾驶员1和售票员1) | |
| 27 | + * type=4,如果分班,修改出场班次2时间(分班后的第一个出场班次时间) | |
| 28 | + * type=5,如果分班,修改分组人员(驾驶员2和售票员2) | |
| 29 | + * @param groupInfoUpdate 分组更新信息,包含类型,更新前的信息,更新后的信息 | |
| 30 | + * @return | |
| 31 | + */ | |
| 32 | + int updateGroupInfo(GroupInfoUpdate groupInfoUpdate); | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 分组更新信息。 | |
| 36 | + */ | |
| 37 | + static class GroupInfoUpdate { | |
| 38 | + /** 类型 */ | |
| 39 | + private int type; | |
| 40 | + /** 原始分组值 */ | |
| 41 | + private GroupInfo src; | |
| 42 | + /** 更新分组值 */ | |
| 43 | + private GroupInfo update; | |
| 44 | + | |
| 45 | + public int getType() { | |
| 46 | + return type; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setType(int type) { | |
| 50 | + this.type = type; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public GroupInfo getSrc() { | |
| 54 | + return src; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void setSrc(GroupInfo src) { | |
| 58 | + this.src = src; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public GroupInfo getUpdate() { | |
| 62 | + return update; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setUpdate(GroupInfo update) { | |
| 66 | + this.update = update; | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 分组信息。 | |
| 72 | + */ | |
| 73 | + static class GroupInfo { | |
| 74 | + /** 线路Id */ | |
| 75 | + private Integer xlId; | |
| 76 | + /** 线路名称 */ | |
| 77 | + private String xlName; | |
| 78 | + /** 排班时间 */ | |
| 79 | + private Date scheduleDate; | |
| 80 | + /** 路牌名字 */ | |
| 81 | + private String lpName; | |
| 82 | + /** 车辆Id */ | |
| 83 | + private Integer clId; | |
| 84 | + /** 车辆自编号 */ | |
| 85 | + private String clZbh; | |
| 86 | + /** 出场班次1时间 */ | |
| 87 | + private String ccsj1; | |
| 88 | + /** 出场班次2时间 */ | |
| 89 | + private String ccsj2; | |
| 90 | + | |
| 91 | + /** 驾驶员1id */ | |
| 92 | + private Integer jsy1Id; | |
| 93 | + /** 驾驶员1工号 */ | |
| 94 | + private String jsy1Gh; | |
| 95 | + /** 驾驶员1姓名 */ | |
| 96 | + private String jsy1Name; | |
| 97 | + /** 驾驶员1id */ | |
| 98 | + private Integer jsy2Id; | |
| 99 | + /** 驾驶员1工号 */ | |
| 100 | + private String jsy2Gh; | |
| 101 | + /** 驾驶员1姓名 */ | |
| 102 | + private String jsy2Name; | |
| 103 | + | |
| 104 | + /** 售票员1id */ | |
| 105 | + private Integer spy1Id; | |
| 106 | + /** 售票员1工号 */ | |
| 107 | + private String spy1Gh; | |
| 108 | + /** 售票员1姓名 */ | |
| 109 | + private String spy1Name; | |
| 110 | + /** 售票员1id */ | |
| 111 | + private Integer spy2Id; | |
| 112 | + /** 售票员1工号 */ | |
| 113 | + private String spy2Gh; | |
| 114 | + /** 售票员1姓名 */ | |
| 115 | + private String spy2Name; | |
| 116 | + | |
| 117 | + /** 创建时间 */ | |
| 118 | + private Date createDate; | |
| 119 | + | |
| 120 | + public GroupInfo() {} | |
| 121 | + | |
| 122 | + public GroupInfo(Object[] datas) { | |
| 123 | + // 线路Id | |
| 124 | + this.xlId = Integer.valueOf(String.valueOf(datas[0])); | |
| 125 | + // 线路名称 | |
| 126 | + this.xlName = String.valueOf(datas[1]); | |
| 127 | + // 排班时间 | |
| 128 | + this.scheduleDate = new DateTime(datas[2]).toDate(); | |
| 129 | + // 路牌名字 | |
| 130 | + this.lpName = String.valueOf(datas[3]); | |
| 131 | + // 车辆id | |
| 132 | + this.clId = Integer.valueOf(String.valueOf(datas[4])); | |
| 133 | + // 车辆自编号 | |
| 134 | + this.clZbh = String.valueOf(datas[5]); | |
| 135 | + // 出场时间,如果有多个,需要分开 | |
| 136 | + Object ccsj = datas[6]; | |
| 137 | + if (ccsj != null) { | |
| 138 | + String[] ccsj_array = ((String) ccsj).split(","); | |
| 139 | + if (ccsj_array.length > 1) { | |
| 140 | + this.ccsj1 = String.valueOf(ccsj_array[0]); | |
| 141 | + this.ccsj2 = String.valueOf(ccsj_array[1]); | |
| 142 | + } else { | |
| 143 | + this.ccsj1 = String.valueOf(ccsj_array[0]); | |
| 144 | + } | |
| 145 | + } | |
| 146 | + // 驾驶员id,如果有多个,需要分开 | |
| 147 | + Object jsyId = datas[7]; | |
| 148 | + if (jsyId != null) { | |
| 149 | + String[] jsyId_array = ((String) jsyId).split(","); | |
| 150 | + if (jsyId_array.length > 1) { | |
| 151 | + this.jsy1Id = Integer.valueOf(String.valueOf(jsyId_array[0])); | |
| 152 | + this.jsy2Id = Integer.valueOf(String.valueOf(jsyId_array[1])); | |
| 153 | + } else { | |
| 154 | + this.jsy1Id = Integer.valueOf(String.valueOf(jsyId_array[0])); | |
| 155 | + } | |
| 156 | + } | |
| 157 | + // 驾驶员工号,如果有多个,需要分开 | |
| 158 | + Object jsyGh = datas[8]; | |
| 159 | + if (jsyGh != null) { | |
| 160 | + String[] jsyGh_array = ((String) jsyGh).split(","); | |
| 161 | + if (jsyGh_array.length > 1) { | |
| 162 | + this.jsy1Gh = String.valueOf(jsyGh_array[0]); | |
| 163 | + this.jsy2Gh = String.valueOf(jsyGh_array[1]); | |
| 164 | + } else { | |
| 165 | + this.jsy1Gh = String.valueOf(jsyGh_array[0]); | |
| 166 | + } | |
| 167 | + } | |
| 168 | + // 驾驶员名字,如果有多个,需要分开 | |
| 169 | + Object jsyName = datas[9]; | |
| 170 | + if (jsyName != null) { | |
| 171 | + String[] jsyName_array = ((String) jsyName).split(","); | |
| 172 | + if (jsyName_array.length > 1) { | |
| 173 | + this.jsy1Name = String.valueOf(jsyName_array[0]); | |
| 174 | + this.jsy2Name = String.valueOf(jsyName_array[1]); | |
| 175 | + } else { | |
| 176 | + this.jsy1Name = String.valueOf(jsyName_array[0]); | |
| 177 | + } | |
| 178 | + } | |
| 179 | + | |
| 180 | + // 售票员id,如果有多个,需要分开 | |
| 181 | + Object spyId = datas[10]; | |
| 182 | + if (spyId != null) { | |
| 183 | + String[] spyId_array = ((String) spyId).split(","); | |
| 184 | + if (spyId_array.length > 1) { | |
| 185 | + this.spy1Id = Integer.valueOf(String.valueOf(spyId_array[0])); | |
| 186 | + this.spy2Id = Integer.valueOf(String.valueOf(spyId_array[1])); | |
| 187 | + } else { | |
| 188 | + this.spy1Id = Integer.valueOf(String.valueOf(spyId_array[0])); | |
| 189 | + } | |
| 190 | + } | |
| 191 | + | |
| 192 | + // 售票员工号,如果有多个,需要分开 | |
| 193 | + Object spyGh = datas[11]; | |
| 194 | + if (spyGh != null) { | |
| 195 | + String[] spyGh_array = ((String) spyGh).split(","); | |
| 196 | + if (spyGh_array.length > 1) { | |
| 197 | + this.spy1Gh = String.valueOf(spyGh_array[0]); | |
| 198 | + this.spy2Gh = String.valueOf(spyGh_array[1]); | |
| 199 | + } else { | |
| 200 | + this.spy1Gh = String.valueOf(spyGh_array[0]); | |
| 201 | + } | |
| 202 | + } | |
| 203 | + // 售票员名字,如果有多个,需要分开 | |
| 204 | + Object spyName = datas[12]; | |
| 205 | + if (spyName != null) { | |
| 206 | + String[] spyName_array = ((String) spyName).split(","); | |
| 207 | + if (spyName_array.length > 1) { | |
| 208 | + this.spy1Name = String.valueOf(spyName_array[0]); | |
| 209 | + this.spy2Name = String.valueOf(spyName_array[1]); | |
| 210 | + } else { | |
| 211 | + this.spy1Name = String.valueOf(spyName_array[0]); | |
| 212 | + } | |
| 213 | + } | |
| 214 | + // 创建时间 | |
| 215 | + this.createDate = new DateTime(datas[13]).toDate(); | |
| 216 | + | |
| 217 | + // TODO:可能还有其他字段 | |
| 218 | + } | |
| 219 | + | |
| 220 | + public String getXlName() { | |
| 221 | + return xlName; | |
| 222 | + } | |
| 223 | + | |
| 224 | + public void setXlName(String xlName) { | |
| 225 | + this.xlName = xlName; | |
| 226 | + } | |
| 227 | + | |
| 228 | + public Date getScheduleDate() { | |
| 229 | + return scheduleDate; | |
| 230 | + } | |
| 231 | + | |
| 232 | + public void setScheduleDate(Date scheduleDate) { | |
| 233 | + this.scheduleDate = scheduleDate; | |
| 234 | + } | |
| 235 | + | |
| 236 | + public String getLpName() { | |
| 237 | + return lpName; | |
| 238 | + } | |
| 239 | + | |
| 240 | + public void setLpName(String lpName) { | |
| 241 | + this.lpName = lpName; | |
| 242 | + } | |
| 243 | + | |
| 244 | + public Integer getClId() { | |
| 245 | + return clId; | |
| 246 | + } | |
| 247 | + | |
| 248 | + public void setClId(Integer clId) { | |
| 249 | + this.clId = clId; | |
| 250 | + } | |
| 251 | + | |
| 252 | + public String getClZbh() { | |
| 253 | + return clZbh; | |
| 254 | + } | |
| 255 | + | |
| 256 | + public void setClZbh(String clZbh) { | |
| 257 | + this.clZbh = clZbh; | |
| 258 | + } | |
| 259 | + | |
| 260 | + public String getCcsj1() { | |
| 261 | + return ccsj1; | |
| 262 | + } | |
| 263 | + | |
| 264 | + public void setCcsj1(String ccsj1) { | |
| 265 | + this.ccsj1 = ccsj1; | |
| 266 | + } | |
| 267 | + | |
| 268 | + public String getCcsj2() { | |
| 269 | + return ccsj2; | |
| 270 | + } | |
| 271 | + | |
| 272 | + public void setCcsj2(String ccsj2) { | |
| 273 | + this.ccsj2 = ccsj2; | |
| 274 | + } | |
| 275 | + | |
| 276 | + public Integer getJsy1Id() { | |
| 277 | + return jsy1Id; | |
| 278 | + } | |
| 279 | + | |
| 280 | + public void setJsy1Id(Integer jsy1Id) { | |
| 281 | + this.jsy1Id = jsy1Id; | |
| 282 | + } | |
| 283 | + | |
| 284 | + public String getJsy1Gh() { | |
| 285 | + return jsy1Gh; | |
| 286 | + } | |
| 287 | + | |
| 288 | + public void setJsy1Gh(String jsy1Gh) { | |
| 289 | + this.jsy1Gh = jsy1Gh; | |
| 290 | + } | |
| 291 | + | |
| 292 | + public String getJsy1Name() { | |
| 293 | + return jsy1Name; | |
| 294 | + } | |
| 295 | + | |
| 296 | + public void setJsy1Name(String jsy1Name) { | |
| 297 | + this.jsy1Name = jsy1Name; | |
| 298 | + } | |
| 299 | + | |
| 300 | + public Integer getJsy2Id() { | |
| 301 | + return jsy2Id; | |
| 302 | + } | |
| 303 | + | |
| 304 | + public void setJsy2Id(Integer jsy2Id) { | |
| 305 | + this.jsy2Id = jsy2Id; | |
| 306 | + } | |
| 307 | + | |
| 308 | + public String getJsy2Gh() { | |
| 309 | + return jsy2Gh; | |
| 310 | + } | |
| 311 | + | |
| 312 | + public void setJsy2Gh(String jsy2Gh) { | |
| 313 | + this.jsy2Gh = jsy2Gh; | |
| 314 | + } | |
| 315 | + | |
| 316 | + public String getJsy2Name() { | |
| 317 | + return jsy2Name; | |
| 318 | + } | |
| 319 | + | |
| 320 | + public void setJsy2Name(String jsy2Name) { | |
| 321 | + this.jsy2Name = jsy2Name; | |
| 322 | + } | |
| 323 | + | |
| 324 | + public Integer getSpy1Id() { | |
| 325 | + return spy1Id; | |
| 326 | + } | |
| 327 | + | |
| 328 | + public void setSpy1Id(Integer spy1Id) { | |
| 329 | + this.spy1Id = spy1Id; | |
| 330 | + } | |
| 331 | + | |
| 332 | + public String getSpy1Gh() { | |
| 333 | + return spy1Gh; | |
| 334 | + } | |
| 335 | + | |
| 336 | + public void setSpy1Gh(String spy1Gh) { | |
| 337 | + this.spy1Gh = spy1Gh; | |
| 338 | + } | |
| 339 | + | |
| 340 | + public String getSpy1Name() { | |
| 341 | + return spy1Name; | |
| 342 | + } | |
| 343 | + | |
| 344 | + public void setSpy1Name(String spy1Name) { | |
| 345 | + this.spy1Name = spy1Name; | |
| 346 | + } | |
| 347 | + | |
| 348 | + public Integer getSpy2Id() { | |
| 349 | + return spy2Id; | |
| 350 | + } | |
| 351 | + | |
| 352 | + public void setSpy2Id(Integer spy2Id) { | |
| 353 | + this.spy2Id = spy2Id; | |
| 354 | + } | |
| 355 | + | |
| 356 | + public String getSpy2Gh() { | |
| 357 | + return spy2Gh; | |
| 358 | + } | |
| 359 | + | |
| 360 | + public void setSpy2Gh(String spy2Gh) { | |
| 361 | + this.spy2Gh = spy2Gh; | |
| 362 | + } | |
| 363 | + | |
| 364 | + public String getSpy2Name() { | |
| 365 | + return spy2Name; | |
| 366 | + } | |
| 367 | + | |
| 368 | + public void setSpy2Name(String spy2Name) { | |
| 369 | + this.spy2Name = spy2Name; | |
| 370 | + } | |
| 371 | + | |
| 372 | + public Date getCreateDate() { | |
| 373 | + return createDate; | |
| 374 | + } | |
| 375 | + | |
| 376 | + public void setCreateDate(Date createDate) { | |
| 377 | + this.createDate = createDate; | |
| 378 | + } | |
| 379 | + | |
| 380 | + public Integer getXlId() { | |
| 381 | + return xlId; | |
| 382 | + } | |
| 383 | + | |
| 384 | + public void setXlId(Integer xlId) { | |
| 385 | + this.xlId = xlId; | |
| 386 | + } | |
| 387 | + } | |
| 10 | 388 | } | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanInfoServiceImpl.java
| 1 | 1 | package com.bsth.service.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.schedule.SchedulePlanInfo; |
| 4 | +import com.bsth.repository.schedule.SchedulePlanInfoRepository; | |
| 4 | 5 | import com.bsth.service.impl.BaseServiceImpl; |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 5 | 7 | import org.springframework.stereotype.Service; |
| 8 | +import org.springframework.transaction.annotation.Transactional; | |
| 9 | + | |
| 10 | +import java.util.ArrayList; | |
| 11 | +import java.util.Date; | |
| 12 | +import java.util.List; | |
| 6 | 13 | |
| 7 | 14 | /** |
| 8 | 15 | * Created by xu on 16/6/16. |
| 9 | 16 | */ |
| 10 | 17 | @Service |
| 11 | 18 | public class SchedulePlanInfoServiceImpl extends BaseServiceImpl<SchedulePlanInfo, Long> implements SchedulePlanInfoService { |
| 19 | + @Autowired | |
| 20 | + private SchedulePlanInfoRepository schedulePlanInfoRepository; | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public List<GroupInfo> findGroupInfo(Integer xlid, Date scheduleDate) { | |
| 24 | + List<Object[]> groupInfos = schedulePlanInfoRepository.findGroupInfo(xlid, scheduleDate); | |
| 25 | + List<GroupInfo> groupInfoList = new ArrayList<>(); | |
| 26 | + for (Object[] groupInfo : groupInfos) { | |
| 27 | + groupInfoList.add(new GroupInfo(groupInfo)); | |
| 28 | + } | |
| 29 | + return groupInfoList; | |
| 30 | + } | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + @Transactional | |
| 34 | + public int updateGroupInfo(GroupInfoUpdate groupInfoUpdate) { | |
| 35 | + int type = groupInfoUpdate.getType(); | |
| 36 | + int result; | |
| 37 | + if (type == 1) { | |
| 38 | + // 换车 | |
| 39 | + if (groupInfoUpdate.getUpdate().getClId() != groupInfoUpdate.getSrc().getClId()) { | |
| 40 | + result = this.schedulePlanInfoRepository.updateGroupInfo_type_1( | |
| 41 | + groupInfoUpdate.getUpdate().getClId(), | |
| 42 | + groupInfoUpdate.getUpdate().getClZbh(), | |
| 43 | + groupInfoUpdate.getSrc().getXlId(), | |
| 44 | + groupInfoUpdate.getSrc().getScheduleDate(), | |
| 45 | + groupInfoUpdate.getSrc().getLpName() | |
| 46 | + ); | |
| 47 | + } | |
| 48 | + | |
| 49 | + } else if (type == 2) { | |
| 50 | + // 更改出场班次1的时间 | |
| 51 | + if (!groupInfoUpdate.getUpdate().getCcsj1().equals(groupInfoUpdate.getSrc().getCcsj1())) { | |
| 52 | + result = this.schedulePlanInfoRepository.updateGroupInfo_type_2_4( | |
| 53 | + groupInfoUpdate.getUpdate().getCcsj1(), | |
| 54 | + groupInfoUpdate.getSrc().getXlId(), | |
| 55 | + groupInfoUpdate.getUpdate().getScheduleDate(), | |
| 56 | + groupInfoUpdate.getSrc().getLpName(), | |
| 57 | + groupInfoUpdate.getSrc().getCcsj1(), | |
| 58 | + "out" | |
| 59 | + ); | |
| 60 | + } | |
| 61 | + | |
| 62 | + } else if (type == 3) { | |
| 63 | + // 更改驾驶员1 | |
| 64 | + if (groupInfoUpdate.getUpdate().getJsy1Id() != groupInfoUpdate.getSrc().getJsy1Id()) { | |
| 65 | + result = this.schedulePlanInfoRepository.updateGroupInfo_type_3_5_jsy( | |
| 66 | + groupInfoUpdate.getUpdate().getJsy1Id(), | |
| 67 | + groupInfoUpdate.getUpdate().getJsy1Gh(), | |
| 68 | + groupInfoUpdate.getUpdate().getJsy1Name(), | |
| 69 | + groupInfoUpdate.getSrc().getXlId(), | |
| 70 | + groupInfoUpdate.getSrc().getScheduleDate(), | |
| 71 | + groupInfoUpdate.getSrc().getLpName(), | |
| 72 | + groupInfoUpdate.getSrc().getJsy1Id() | |
| 73 | + ); | |
| 74 | + } | |
| 75 | + // 更改售票员1 | |
| 76 | + if (groupInfoUpdate.getUpdate().getSpy1Id() != groupInfoUpdate.getSrc().getSpy1Id()) { | |
| 77 | + result = this.schedulePlanInfoRepository.updateGroupInfo_type_3_5_spy( | |
| 78 | + groupInfoUpdate.getUpdate().getSpy1Id(), | |
| 79 | + groupInfoUpdate.getUpdate().getSpy1Gh(), | |
| 80 | + groupInfoUpdate.getUpdate().getSpy1Name(), | |
| 81 | + groupInfoUpdate.getSrc().getXlId(), | |
| 82 | + groupInfoUpdate.getSrc().getScheduleDate(), | |
| 83 | + groupInfoUpdate.getSrc().getLpName(), | |
| 84 | + groupInfoUpdate.getSrc().getSpy1Id() | |
| 85 | + ); | |
| 86 | + } | |
| 87 | + | |
| 88 | + } else if (type == 4) { | |
| 89 | + // 更改出场班次2的时间 | |
| 90 | + if (!groupInfoUpdate.getUpdate().getCcsj2().equals(groupInfoUpdate.getSrc().getCcsj2())) { | |
| 91 | + result = this.schedulePlanInfoRepository.updateGroupInfo_type_2_4( | |
| 92 | + groupInfoUpdate.getUpdate().getCcsj2(), | |
| 93 | + groupInfoUpdate.getSrc().getXlId(), | |
| 94 | + groupInfoUpdate.getUpdate().getScheduleDate(), | |
| 95 | + groupInfoUpdate.getSrc().getLpName(), | |
| 96 | + groupInfoUpdate.getSrc().getCcsj2(), | |
| 97 | + "out" | |
| 98 | + ); | |
| 99 | + } | |
| 100 | + | |
| 101 | + } else if (type == 5) { | |
| 102 | + // 更改驾驶员2 | |
| 103 | + if (groupInfoUpdate.getUpdate().getJsy2Id() != groupInfoUpdate.getSrc().getJsy2Id()) { | |
| 104 | + result = this.schedulePlanInfoRepository.updateGroupInfo_type_3_5_jsy( | |
| 105 | + groupInfoUpdate.getUpdate().getJsy2Id(), | |
| 106 | + groupInfoUpdate.getUpdate().getJsy2Gh(), | |
| 107 | + groupInfoUpdate.getUpdate().getJsy2Name(), | |
| 108 | + groupInfoUpdate.getSrc().getXlId(), | |
| 109 | + groupInfoUpdate.getSrc().getScheduleDate(), | |
| 110 | + groupInfoUpdate.getSrc().getLpName(), | |
| 111 | + groupInfoUpdate.getSrc().getJsy2Id() | |
| 112 | + ); | |
| 113 | + } | |
| 114 | + // 更改售票员2 | |
| 115 | + if (groupInfoUpdate.getUpdate().getSpy2Id() != groupInfoUpdate.getSrc().getSpy2Id()) { | |
| 116 | + result = this.schedulePlanInfoRepository.updateGroupInfo_type_3_5_spy( | |
| 117 | + groupInfoUpdate.getUpdate().getSpy2Id(), | |
| 118 | + groupInfoUpdate.getUpdate().getSpy2Gh(), | |
| 119 | + groupInfoUpdate.getUpdate().getSpy2Name(), | |
| 120 | + groupInfoUpdate.getSrc().getXlId(), | |
| 121 | + groupInfoUpdate.getSrc().getScheduleDate(), | |
| 122 | + groupInfoUpdate.getSrc().getLpName(), | |
| 123 | + groupInfoUpdate.getSrc().getSpy2Id() | |
| 124 | + ); | |
| 125 | + } | |
| 126 | + | |
| 127 | + } else { | |
| 128 | + throw new RuntimeException("未知的更新类型,type=" + type); | |
| 129 | + } | |
| 130 | + | |
| 131 | + return 0; | |
| 132 | + } | |
| 12 | 133 | } | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanService.java
| ... | ... | @@ -3,31 +3,13 @@ package com.bsth.service.schedule; |
| 3 | 3 | import com.bsth.entity.schedule.SchedulePlan; |
| 4 | 4 | import com.bsth.service.BaseService; |
| 5 | 5 | |
| 6 | -import java.util.Date; | |
| 7 | -import java.util.List; | |
| 8 | -import java.util.Map; | |
| 9 | - | |
| 10 | 6 | /** |
| 11 | 7 | * Created by xu on 16/6/16. |
| 12 | 8 | */ |
| 13 | 9 | public interface SchedulePlanService extends BaseService<SchedulePlan, Long> { |
| 14 | - | |
| 15 | - /** | |
| 16 | - * 查找分组排班信息。 | |
| 17 | - * @param xlid 线路Id | |
| 18 | - * @param scheduleDate 排班日期 | |
| 19 | - * @return | |
| 20 | - */ | |
| 21 | - List<Map<String, Object>> findGroupInfo(Integer xlid, Date scheduleDate); | |
| 22 | - | |
| 23 | 10 | /** |
| 24 | - * 更新分组排班信息。 | |
| 25 | - * @param clid 车辆id | |
| 26 | - * @param clZbh 车辆自编号 | |
| 27 | - * @param xlid 线路id | |
| 28 | - * @param scheduleDate 排班日期 | |
| 29 | - * @param lpName 路牌名字 | |
| 11 | + * 获取有明日排班的计划。 | |
| 30 | 12 | * @return |
| 31 | 13 | */ |
| 32 | - int updateGroupInfo_clinfo(Integer clid, String clZbh, Integer xlid, Date scheduleDate, String lpName); | |
| 14 | + SchedulePlan findSchedulePlanTommorw(); | |
| 33 | 15 | } | ... | ... |
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java
| ... | ... | @@ -12,6 +12,7 @@ import com.bsth.service.schedule.rules.shiftloop.ScheduleResults_output; |
| 12 | 12 | import com.bsth.service.schedule.rules.shiftloop.ScheduleRule_input; |
| 13 | 13 | import com.bsth.service.schedule.rules.strategy.IStrategy; |
| 14 | 14 | import com.google.common.collect.Multimap; |
| 15 | +import org.joda.time.DateTime; | |
| 15 | 16 | import org.kie.api.KieBase; |
| 16 | 17 | import org.kie.api.runtime.KieSession; |
| 17 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -122,90 +123,16 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> |
| 122 | 123 | } |
| 123 | 124 | |
| 124 | 125 | @Override |
| 125 | - public List<Map<String, Object>> findGroupInfo(Integer xlid, Date scheduleDate) { | |
| 126 | - List<Object[]> groupInfos = schedulePlanRepository.findGroupInfo(xlid, scheduleDate); | |
| 127 | - List<Map<String, Object>> ret = new ArrayList<>(); | |
| 128 | - for (Object[] datas : groupInfos) { | |
| 129 | - // TODO:貌似springdata没有优雅的方式把List<Object[]>转换成List<Map<String, Object>>方法, | |
| 130 | - // TODO:可能jpa有相关标注,以后找到,此方法就作废 | |
| 131 | - | |
| 132 | - Map<String, Object> map = new HashMap<>(); | |
| 133 | - | |
| 134 | - // 线路名称 | |
| 135 | - map.put("xlName", datas[0]); | |
| 136 | - // 排班时间 | |
| 137 | - map.put("scheduleDate", datas[1]); | |
| 138 | - // 路牌名字 | |
| 139 | - map.put("lpName", datas[2]); | |
| 140 | - // 车辆自编号 | |
| 141 | - map.put("clZbh", datas[3]); | |
| 142 | - // 出场时间,如果有多个,需要分开 | |
| 143 | - Object ccsj = datas[4]; | |
| 144 | - if (ccsj != null) { | |
| 145 | - String[] ccsj_array = ((String) ccsj).split(","); | |
| 146 | - if (ccsj_array.length > 1) { | |
| 147 | - map.put("ccsj1", ccsj_array[0]); | |
| 148 | - map.put("ccsj2", ccsj_array[1]); | |
| 149 | - } else { | |
| 150 | - map.put("ccsj1", ccsj_array[0]); | |
| 151 | - } | |
| 152 | - } | |
| 153 | - // 驾驶员工号,如果有多个,需要分开 | |
| 154 | - Object jsyGh = datas[5]; | |
| 155 | - if (jsyGh != null) { | |
| 156 | - String[] jsyGh_array = ((String) jsyGh).split(","); | |
| 157 | - if (jsyGh_array.length > 1) { | |
| 158 | - map.put("jsy1Gh", jsyGh_array[0]); | |
| 159 | - map.put("jsy2Gh", jsyGh_array[1]); | |
| 160 | - } else { | |
| 161 | - map.put("jsy1Gh", jsyGh_array[0]); | |
| 162 | - } | |
| 163 | - } | |
| 164 | - // 驾驶员名字,如果有多个,需要分开 | |
| 165 | - Object jsyName = datas[6]; | |
| 166 | - if (jsyName != null) { | |
| 167 | - String[] jsyName_array = ((String) jsyName).split(","); | |
| 168 | - if (jsyName_array.length > 1) { | |
| 169 | - map.put("jsy1Name", jsyName_array[0]); | |
| 170 | - map.put("jsy2Name", jsyName_array[1]); | |
| 171 | - } else { | |
| 172 | - map.put("jsy1Name", jsyName_array[0]); | |
| 173 | - } | |
| 174 | - } | |
| 175 | - // 售票员工号,如果有多个,需要分开 | |
| 176 | - Object spyGh = datas[7]; | |
| 177 | - if (spyGh != null) { | |
| 178 | - String[] spyGh_array = ((String) spyGh).split(","); | |
| 179 | - if (spyGh_array.length > 1) { | |
| 180 | - map.put("spy1Gh", spyGh_array[0]); | |
| 181 | - map.put("spy2Gh", spyGh_array[1]); | |
| 182 | - } else { | |
| 183 | - map.put("spy1Gh", spyGh_array[0]); | |
| 184 | - } | |
| 185 | - } | |
| 186 | - // 售票员名字,如果有多个,需要分开 | |
| 187 | - Object spyName = datas[8]; | |
| 188 | - if (spyName != null) { | |
| 189 | - String[] spyName_array = ((String) spyName).split(","); | |
| 190 | - if (spyName_array.length > 1) { | |
| 191 | - map.put("spy1Name", spyName_array[0]); | |
| 192 | - map.put("spy2Name", spyName_array[1]); | |
| 193 | - } else { | |
| 194 | - map.put("spy1Name", spyName_array[0]); | |
| 195 | - } | |
| 196 | - } | |
| 197 | - // 创建时间 | |
| 198 | - map.put("createDate", datas[9]); | |
| 199 | - | |
| 200 | - // TODO:可能还有其他字段 | |
| 201 | - | |
| 202 | - ret.add(map); | |
| 126 | + public SchedulePlan findSchedulePlanTommorw() { | |
| 127 | + DateTime today = new DateTime(new Date()); | |
| 128 | + DateTime tommorw = new DateTime(today.getYear(), today.getMonthOfYear(), today.getDayOfMonth(), 0, 0).plusDays(1); | |
| 129 | + Map<String, Object> param = new HashMap<>(); | |
| 130 | + param.put("scheduleFromTime_le", tommorw); | |
| 131 | + param.put("scheduleToTime_ge", tommorw); | |
| 132 | + Iterator<SchedulePlan> schedulePlanIterator = this.list(param).iterator(); | |
| 133 | + if (schedulePlanIterator.hasNext()) { | |
| 134 | + return schedulePlanIterator.next(); | |
| 203 | 135 | } |
| 204 | - return ret; | |
| 205 | - } | |
| 206 | - | |
| 207 | - @Override | |
| 208 | - public int updateGroupInfo_clinfo(Integer clid, String clZbh, Integer xlid, Date scheduleDate, String lpName) { | |
| 209 | - return schedulePlanRepository.updateGroupInfo_clinfo(clid, clZbh, xlid, scheduleDate, lpName); | |
| 136 | + return null; | |
| 210 | 137 | } |
| 211 | 138 | } | ... | ... |