Commit 3da8928417b2966fd6a49d3fa498a89eb53bae67

Authored by 徐烜
1 parent b63832f5

PSM-8

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&lt;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&lt;SchedulePlan, Long&gt; {
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&lt;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&lt;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&lt;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&lt;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&lt;SchedulePlan, Long&gt;
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 }
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-directive.js
... ... @@ -478,6 +478,37 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;$$SearchInfoService_g&#39;, [&#39;$resource&#39;, fun
478 478 isArray: true
479 479 }
480 480 }
  481 + ),
  482 + cci3: $resource(
  483 + '/cci/cars2',
  484 + {},
  485 + {
  486 + list: {
  487 + method: 'GET',
  488 + isArray: true
  489 + }
  490 + }
  491 +
  492 + ),
  493 + eci: $resource(
  494 + '/eci/jsy',
  495 + {},
  496 + {
  497 + list: {
  498 + method: 'GET',
  499 + isArray: true
  500 + }
  501 + }
  502 + ),
  503 + eci2: $resource(
  504 + '/eci/spy',
  505 + {},
  506 + {
  507 + list: {
  508 + method: 'GET',
  509 + isArray: true
  510 + }
  511 + }
481 512 )
482 513 }
483 514 }]);
... ... @@ -671,6 +702,8 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect2&quot;, [
671 702 * icname(必须):内部与之对应的字段名,如:icname=code
672 703 * dcname2(可选):其他需要赋值的model字段名2,如:dcname2=xl.name
673 704 * icname2(可选):内部与之对应的字段名2,如:icname2=name
  705 + * dcname3(可选):其他需要赋值的model字段名3,如:dcname2=xl.name
  706 + * icname3(可选):内部与之对应的字段名3,如:icname2=name
674 707 * icnames(必须):用于用于显示,以及简评处理的内部数据字段,如:icnames=name
675 708 * required(可选):是否要用required验证
676 709 * datatype(必须):业务数据类型,有字典类型,动态数据类型,暂时写的死点
... ... @@ -714,6 +747,9 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
714 747 var $icname_attr = tAttrs["icname"]; // 内部与之对应的字段名
715 748 var $dcname2_attr = tAttrs["dcname2"]; // 其他需要赋值的model字段名2
716 749 var $icname2_attr = tAttrs["icname2"]; // 内部与之对应的字段名2
  750 + var $dcname3_attr = tAttrs["dcname3"]; // 其他需要赋值的model字段名3
  751 + var $icname3_attr = tAttrs["icname3"]; // 内部与之对应的字段名3
  752 +
717 753 var $icname_s_attr = tAttrs["icnames"]; // 用于用于显示,以及简评处理的内部数据字段
718 754 var $datatype_attr = tAttrs["datatype"]; // 内部业务数据类型
719 755 var $required_attr = tAttrs["required"]; // 是否需要required验证
... ... @@ -769,6 +805,13 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
769 805 scope[ctrlAs].model[$dcname2_attr] = $item[$icname2_attr];
770 806 }
771 807 }
  808 + if ($dcname3_attr && $icname3_attr) {
  809 + if ($mlp_attr) {
  810 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = $item" + "." + $icname3_attr + ";");
  811 + } else {
  812 + scope[ctrlAs].model[$dcname3_attr] = $item[$icname3_attr];
  813 + }
  814 + }
772 815 };
773 816  
774 817 // 删除选中事件处理函数
... ... @@ -787,6 +830,13 @@ angular.module(&#39;ScheduleApp&#39;).directive(&quot;saSelect3&quot;, [
787 830 scope[ctrlAs].model[$dcname2_attr] = undefined;
788 831 }
789 832 }
  833 + if ($dcname3_attr) {
  834 + if ($mlp_attr) {
  835 + eval("scope[ctrlAs].model" + "." + $dcname3_attr + " = undefined;");
  836 + } else {
  837 + scope[ctrlAs].model[$dcname3_attr] = undefined;
  838 + }
  839 + }
790 840 };
791 841  
792 842 /**
... ...
src/main/resources/static/pages/scheduleApp/module/common/prj-common-globalservice.js
... ... @@ -390,13 +390,12 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanManageService_g&#39;, [&#39;$resource
390 390 }
391 391 }
392 392 ),
393   - groupinfo : $resource(
394   - '/spc/groupinfos/:xlid/:sdate',
  393 + tommorw: $resource(
  394 + '/spc/tommorw',
395 395 {},
396 396 {
397 397 list: {
398   - method: 'GET',
399   - isArray: true
  398 + method: 'GET'
400 399 }
401 400 }
402 401 )
... ... @@ -423,6 +422,25 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanInfoManageService_g&#39;, [&#39;$reso
423 422 method: 'POST'
424 423 }
425 424 }
  425 + ),
  426 + groupinfo : $resource(
  427 + '/spic/groupinfos/:xlid/:sdate',
  428 + {},
  429 + {
  430 + list: {
  431 + method: 'GET',
  432 + isArray: true
  433 + }
  434 + }
  435 + ),
  436 + updateGroupInfo : $resource(
  437 + '/spic/groupinfos/update',
  438 + {},
  439 + {
  440 + update: {
  441 + method: 'POST'
  442 + }
  443 + }
426 444 )
427 445 };
428 446 }]);
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/edit_report.html
... ... @@ -27,11 +27,11 @@
27 27 <div class="caption">
28 28 <i class="icon-equalizer font-red-sunglo"></i>
29 29  
30   - <span ng-if="ctrl.type == 1" class="caption-subject font-red-sunglo bold uppercase">表单1</span>
31   - <span ng-if="ctrl.type == 2" class="caption-subject font-red-sunglo bold uppercase">表单2</span>
32   - <span ng-if="ctrl.type == 3" class="caption-subject font-red-sunglo bold uppercase">表单3</span>
33   - <span ng-if="ctrl.type == 4" class="caption-subject font-red-sunglo bold uppercase">表单4</span>
34   - <span ng-if="ctrl.type == 5" class="caption-subject font-red-sunglo bold uppercase">表单5</span>
  30 + <span ng-if="ctrl.type == 1" class="caption-subject font-red-sunglo bold uppercase">换车,改变指定路牌的配置车辆,可以是其他线路的车辆(套跑)</span>
  31 + <span ng-if="ctrl.type == 2" class="caption-subject font-red-sunglo bold uppercase">更改出场班次时间,改变指定路牌的第一个首发班次时间(第一个出场班次)</span>
  32 + <span ng-if="ctrl.type == 3" class="caption-subject font-red-sunglo bold uppercase">更改人员配置,更改驾驶员、售票员</span>
  33 + <span ng-if="ctrl.type == 4" class="caption-subject font-red-sunglo bold uppercase">当前是分班,更改出场便次时间,改变指定路牌的分班后的第一个首发班次时间</span>
  34 + <span ng-if="ctrl.type == 5" class="caption-subject font-red-sunglo bold uppercase">当前是分班,更改分班后的人员配置,更改驾驶员、售票员</span>
35 35 </div>
36 36 </div>
37 37  
... ... @@ -45,113 +45,201 @@
45 45  
46 46 <!-- 其他信息放置在这里 -->
47 47 <div class="form-body">
48   - <div class="form-group has-success has-feedback">
49   - <label class="col-md-2 control-label">线路*:</label>
  48 + <div class="form-group">
  49 + <label class="col-md-2 control-label">线路:</label>
50 50 <div class="col-md-3">
51 51 <input type="text" class="form-control" name="xlName" ng-model="ctrl.groupInfo.xlName" readonly/>
52 52 </div>
53   - <!-- 隐藏块,显示验证信息 -->
54   - <div class="alert alert-danger well-sm" ng-show="myForm.xlName.$error.required">
55   - 线路必须选择
56   - </div>
57 53 </div>
58   - <div class="form-group has-success has-feedback">
59   - <label class="col-md-2 control-label">日期*:</label>
  54 + <div class="form-group">
  55 + <label class="col-md-2 control-label">日期:</label>
60 56 <div class="col-md-3">
61 57 <input type="text" class="form-control" name="scheduleDate" uib-datepicker-popup="yyyy年MM月dd日" ng-model="ctrl.groupInfo.scheduleDate" readonly/>
62 58 </div>
63   - <!-- 隐藏块,显示验证信息 -->
64   - <div class="alert alert-danger well-sm" ng-show="myForm.scheduleDate.$error.required">
65   - 日期不能为空
66   - </div>
67 59 </div>
68   - <div class="form-group has-success has-feedback">
69   - <label class="col-md-2 control-label">路牌*:</label>
  60 + <div class="form-group">
  61 + <label class="col-md-2 control-label">路牌:</label>
70 62 <div class="col-md-3">
71 63 <input type="text" class="form-control" name="lpName" ng-model="ctrl.groupInfo.lpName" readonly/>
72 64 </div>
73   - <!-- 隐藏块,显示验证信息 -->
74   - <div class="alert alert-danger well-sm" ng-show="myForm.lpName.$error.required">
75   - 路牌不能为空
76   - </div>
77 65 </div>
78 66  
79   -
80   -
81   -
82   - <div class="form-group has-success has-feedback">
83   - <label class="col-md-2 control-label">车辆*:</label>
  67 + <!-- 修改车辆 -->
  68 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 1">
  69 + <label class="col-md-2 control-label">车辆配置-修改前*:</label>
  70 + <div class="col-md-3">
  71 + <input type="text" class="form-control" name="cl_before" ng-model="ctrl.groupInfo_src.clZbh" readonly/>
  72 + </div>
  73 + </div>
  74 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 1">
  75 + <label class="col-md-2 control-label">车辆配置-修改后*:</label>
84 76 <div class="col-md-3">
85   - <sa-Select3 model="ctrl.busConfigForSave"
86   - name="cl"
  77 + <sa-Select3 model="ctrl.groupInfo"
  78 + name="cl_after"
87 79 placeholder="请输拼音..."
88   - dcvalue="{{ctrl.busConfigForSave.cl.id}}"
89   - dcname="cl.id"
  80 + dcvalue="{{ctrl.groupInfo.clId}}"
  81 + dcname="clId"
90 82 icname="id"
  83 + dcname2="clZbh"
  84 + icname2="insideCode"
91 85 icnames="insideCode"
92   - datatype="cl"
93   - dataassociate="true"
94   - dataparam="{{ {'businessCode_eq': ctrl.busConfigForSave.xl.company} | json }}"
95   - mlp="true"
  86 + datatype="cci3"
96 87 required >
97 88 </sa-Select3>
98 89 </div>
99 90 <!-- 隐藏块,显示验证信息 -->
100   - <div class="alert alert-danger well-sm" ng-show="myForm.cl.$error.required">
  91 + <div class="alert alert-danger well-sm" ng-show="myForm.cl_after.$error.required">
101 92 车辆必须选择
102 93 </div>
103 94 </div>
104 95  
105   - <div class="form-group has-success has-feedback">
106   - <label class="col-md-2 control-label">启用日期*:</label>
  96 + <!-- 修改出场班次时间1 -->
  97 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 2">
  98 + <label class="col-md-2 control-label">出场时间-修改前*:</label>
  99 + <div class="col-md-3">
  100 + <input type="text" class="form-control" name="ccsj_before" ng-model="ctrl.groupInfo_src.ccsj1" readonly/>
  101 + </div>
  102 + </div>
  103 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 2">
  104 + <label class="col-md-2 control-label">出场时间-修改后*;</label>
107 105 <div class="col-md-3">
108   - <div class="input-group">
109   - <input type="text" class="form-control"
110   - name="qyrq" placeholder="请选择启用日期..."
111   - uib-datepicker-popup="yyyy年MM月dd日"
112   - is-open="ctrl.qyrqOpen" required
113   - ng-model="ctrl.busConfigForSave.qyrq" readonly/>
114   - <span class="input-group-btn">
115   - <button type="button" class="btn btn-default" ng-click="ctrl.qyrq_open()">
116   - <i class="glyphicon glyphicon-calendar"></i>
117   - </button>
118   - </span>
119   - </div>
  106 + <input type="text" class="form-control" name="ccsj_after" ng-model="ctrl.groupInfo.ccsj1" ng-pattern="ctrl.time_regex"/>
120 107 </div>
121 108 <!-- 隐藏块,显示验证信息 -->
122   - <div class="alert alert-danger well-sm" ng-show="myForm.qyrq.$error.required">
123   - 启用日期必须选择
  109 + <div class="alert alert-danger well-sm" ng-show="myForm.ccsj_after.$error.pattern">
  110 + 时间格式错误,应该是格式hh:mm,如:06:39
124 111 </div>
125 112 </div>
126 113  
127   - <div class="form-group">
128   - <label class="col-md-2 control-label">终止日期:</label>
  114 + <!-- 修改第一组人员配置 -->
  115 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 3">
  116 + <label class="col-md-2 control-label">驾驶员-修改前*:</label>
  117 + <div class="col-md-3">
  118 + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.jsy1Name + '(' + ctrl.groupInfo_src.jsy1Gh + ')'" readonly/>
  119 + </div>
  120 + </div>
  121 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 3">
  122 + <label class="col-md-2 control-label">驾驶员-修改后*:</label>
  123 + <div class="col-md-3">
  124 + <sa-Select3 model="ctrl.groupInfo"
  125 + name="jsy"
  126 + placeholder="请输拼音..."
  127 + dcvalue="{{ctrl.groupInfo.jsy1Id}}"
  128 + dcname="jsy1Id"
  129 + icname="jsyId"
  130 + dcname2="jsy1Gh"
  131 + icname2="jsyGh"
  132 + dcname3="jsy1Name"
  133 + icname3="jsyName"
  134 + icnames="jsyName"
  135 + datatype="eci"
  136 + mlp="true"
  137 + required >
  138 + </sa-Select3>
  139 + </div>
  140 + <!-- 隐藏块,显示验证信息 -->
  141 + <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required">
  142 + 驾驶员必须选择
  143 + </div>
  144 + </div>
  145 + <div class="form-group" ng-if="ctrl.type == 3">
  146 + <label class="col-md-2 control-label">售票员-修改前:</label>
  147 + <div class="col-md-3">
  148 + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.spy1Name + '(' + ctrl.groupInfo_src.spy1Gh + ')'" readonly/>
  149 + </div>
  150 + </div>
  151 + <div class="form-group" ng-if="ctrl.type == 3">
  152 + <label class="col-md-2 control-label">售票员-修改后:</label>
129 153 <div class="col-md-3">
130   - <div class="input-group">
131   - <input type="text" class="form-control"
132   - name="zzrq" placeholder="请选择启用日期..."
133   - uib-datepicker-popup="yyyy年MM月dd日"
134   - is-open="ctrl.zzrqOpen"
135   - ng-model="ctrl.busConfigForSave.zzrq" readonly/>
136   - <span class="input-group-btn">
137   - <button type="button" class="btn btn-default" ng-click="ctrl.zzrq_open()">
138   - <i class="glyphicon glyphicon-calendar"></i>
139   - </button>
140   - </span>
141   - </div>
  154 + <sa-Select3 model="ctrl.groupInfo"
  155 + name="spy"
  156 + placeholder="请输拼音..."
  157 + dcvalue="{{ctrl.groupInfo.spy1Id}}"
  158 + dcname="spy1Id"
  159 + icname="spyId"
  160 + dcname2="spy1Gh"
  161 + icname2="spyGh"
  162 + dcname3="spy1Name"
  163 + icname3="spyName"
  164 + icnames="spyName"
  165 + datatype="eci2"
  166 + mlp="true">
  167 + </sa-Select3>
142 168 </div>
143 169 </div>
144 170  
  171 + <!-- 修改出场班次时间2 -->
  172 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 4">
  173 + <label class="col-md-2 control-label">出场时间-修改前*:</label>
  174 + <div class="col-md-3">
  175 + <input type="text" class="form-control" name="ccsj_before" ng-model="ctrl.groupInfo_src.ccsj2" readonly/>
  176 + </div>
  177 + </div>
  178 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 4">
  179 + <label class="col-md-2 control-label">出场时间-修改后*;</label>
  180 + <div class="col-md-3">
  181 + <input type="text" class="form-control" name="ccsj_after" ng-model="ctrl.groupInfo.ccsj2" ng-pattern="ctrl.time_regex"/>
  182 + </div>
  183 + <!-- 隐藏块,显示验证信息 -->
  184 + <div class="alert alert-danger well-sm" ng-show="myForm.ccsj_after.$error.pattern">
  185 + 时间格式错误,应该是格式hh:mm,如:06:39
  186 + </div>
  187 + </div>
145 188  
146   - <div class="form-group has-success has-feedback">
147   - <label class="col-md-2 control-label">停车场*:</label>
  189 + <!-- 修改第二组人员配置 -->
  190 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 5">
  191 + <label class="col-md-2 control-label">驾驶员-修改前*:</label>
148 192 <div class="col-md-3">
149   - <input type="text" class="form-control" name="tcd" ng-model="ctrl.busConfigForSave.tcd" required
150   - placeholder="请输入停车场"/>
  193 + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.jsy2Name + '(' + ctrl.groupInfo_src.jsy2Gh + ')'" readonly/>
  194 + </div>
  195 + </div>
  196 + <div class="form-group has-success has-feedback" ng-if="ctrl.type == 5">
  197 + <label class="col-md-2 control-label">驾驶员-修改后*:</label>
  198 + <div class="col-md-3">
  199 + <sa-Select3 model="ctrl.groupInfo"
  200 + name="jsy"
  201 + placeholder="请输拼音..."
  202 + dcvalue="{{ctrl.groupInfo.jsy2Id}}"
  203 + dcname="jsy2Id"
  204 + icname="jsyId"
  205 + dcname2="jsy2Gh"
  206 + icname2="jsyGh"
  207 + dcname3="jsy2Name"
  208 + icname3="jsyName"
  209 + icnames="jsyName"
  210 + datatype="eci"
  211 + mlp="true"
  212 + required >
  213 + </sa-Select3>
151 214 </div>
152 215 <!-- 隐藏块,显示验证信息 -->
153   - <div class="alert alert-danger well-sm" ng-show="myForm.tcd.$error.required">
154   - 停车场必须填写
  216 + <div class="alert alert-danger well-sm" ng-show="myForm.jsy.$error.required">
  217 + 驾驶员必须选择
  218 + </div>
  219 + </div>
  220 + <div class="form-group" ng-if="ctrl.type == 5">
  221 + <label class="col-md-2 control-label">售票员-修改前:</label>
  222 + <div class="col-md-3">
  223 + <input type="text" class="form-control" name="jsy_before" ng-value="ctrl.groupInfo_src.spy2Name + '(' + ctrl.groupInfo_src.spy2Gh + ')'" readonly/>
  224 + </div>
  225 + </div>
  226 + <div class="form-group" ng-if="ctrl.type == 5">
  227 + <label class="col-md-2 control-label">售票员-修改后:</label>
  228 + <div class="col-md-3">
  229 + <sa-Select3 model="ctrl.groupInfo"
  230 + name="spy"
  231 + placeholder="请输拼音..."
  232 + dcvalue="{{ctrl.groupInfo.spy2Id}}"
  233 + dcname="spy2Id"
  234 + icname="spyId"
  235 + dcname2="spy2Gh"
  236 + icname2="spyGh"
  237 + dcname3="spy2Name"
  238 + icname3="spyName"
  239 + icnames="spyName"
  240 + datatype="eci2"
  241 + mlp="true">
  242 + </sa-Select3>
155 243 </div>
156 244 </div>
157 245  
... ... @@ -160,13 +248,12 @@
160 248  
161 249 </div>
162 250  
163   - <!-- TODO:!myForm.$valid 在这里有点问题,改用以下方法验证 -->
164 251 <div class="form-actions">
165 252 <div class="row">
166 253 <div class="col-md-offset-3 col-md-4">
167 254 <button type="submit" class="btn green"
168 255 ng-disabled="!myForm.$valid"><i class="fa fa-check"></i> 提交</button>
169   - <a type="button" class="btn default" ui-sref="busConfig" ><i class="fa fa-times"></i> 取消</a>
  256 + <a type="button" class="btn default" ui-sref="schedulePlanReportManage" ><i class="fa fa-times"></i> 取消</a>
170 257 </div>
171 258 </div>
172 259 </div>
... ...
src/main/resources/static/pages/scheduleApp/module/core/schedulePlanManage/schedulePlanReportManage.js
1 1 // 调度值勤日报管理 service controller 等写在一起
2 2 // TODO:使用的global服务需要修正
3   -angular.module('ScheduleApp').factory('SchedulePlanReportManageService', ['SchedulePlanManageService_g', function(service) {
  3 +angular.module('ScheduleApp').factory('SchedulePlanReportManageService', [
  4 + 'SchedulePlanInfoManageService_g', 'SchedulePlanManageService_g',
  5 + function(service, service2) {
4 6 /** 当前的查询条件信息 */
5 7 var currentSearchCondition = {};
6 8  
... ... @@ -56,6 +58,17 @@ angular.module(&#39;ScheduleApp&#39;).factory(&#39;SchedulePlanReportManageService&#39;, [&#39;Sched
56 58 */
57 59 saveDetail: function(obj) {
58 60 return service.save(obj).$promise;
  61 + },
  62 + /**
  63 + * 更新分组信息。
  64 + * @param obj
  65 + * @returns {*|Function|promise|n}
  66 + */
  67 + updateDetail: function(obj) {
  68 + return service.updateGroupInfo.update(obj).$promise;
  69 + },
  70 + tommorwPlan: function() {
  71 + return service2.tommorw.list().$promise;
59 72 }
60 73 };
61 74  
... ... @@ -88,16 +101,6 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;SchedulePlanReportManageListCtrl&#39;, [
88 101 self.scheduleDateOpen = true;
89 102 };
90 103  
91   - // 初始创建的时候,获取一次列表数据
92   - schedulePlanReportManageService.getPage().then(
93   - function(result) {
94   - self.pageInfo.infos = result;
95   - },
96   - function(result) {
97   - alert("出错啦!");
98   - }
99   - );
100   -
101 104 // 翻页的时候调用
102 105 self.pageChanaged = function() {
103 106 schedulePlanReportManageService.getPage().then(
... ... @@ -145,7 +148,26 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;SchedulePlanReportManageListCtrl&#39;, [
145 148 type: type,
146 149 groupInfo: groupInfo
147 150 });
148   - }
  151 + };
  152 +
  153 +
  154 + // 初始创建的时候,获取一次列表数据
  155 + schedulePlanReportManageService.tommorwPlan().then(
  156 + function(result) {
  157 + self.searchCondition().xlid = result.xl.id;
  158 + var dd = new Date();
  159 + dd.setHours(0);
  160 + dd.setMinutes(0);
  161 + dd.setSeconds(0);
  162 + dd.setMilliseconds(0);
  163 + dd.setTime(dd.getTime() + 24 * 3600 * 1000);
  164 + self.searchCondition().sdate = dd;
  165 + self.pageChanaged();
  166 + },
  167 + function(result) {
  168 + self.pageChanaged();
  169 + }
  170 + );
149 171  
150 172 }
151 173 ]);
... ... @@ -161,13 +183,36 @@ angular.module(&#39;ScheduleApp&#39;).controller(&#39;SchedulePlanReportManageFormCtrl&#39;, [
161 183 var type_src = $stateParams.type;
162 184 var groupInfo_src = $stateParams.groupInfo;
163 185  
  186 + // 时间正则表达式(格式hh:mm,如:06:39)
  187 + self.time_regex = /^(([0-1]\d)|(2[0-4])):[0-5]\d$/;
  188 +
164 189 // 欲修改的groupInfo值
  190 + self.groupInfo_src = groupInfo_src;
165 191 self.groupInfo = {};
166 192 self.type = type_src;
167 193 angular.copy(groupInfo_src, self.groupInfo);
168 194  
169   -
170   -
  195 + // 提交方法
  196 + self.submit = function() {
  197 + var param = {
  198 + type: self.type,
  199 + src: self.groupInfo_src,
  200 + update: self.groupInfo
  201 + };
  202 + schedulePlanReportManageService.updateDetail(param).then(
  203 + function(result) {
  204 + if (result.status == 'SUCCESS') {
  205 + alert("保存成功!");
  206 + $state.go("schedulePlanReportManage");
  207 + } else {
  208 + alert("保存异常!");
  209 + }
  210 + },
  211 + function(result) {
  212 + alert("出错啦!");
  213 + }
  214 + );
  215 + }
171 216  
172 217 }
173 218 ]);
... ...