Commit b9939f3cd00d1bb71e3575a3cce3d2095851097a
1 parent
b1952d3e
update
Showing
5 changed files
with
99 additions
and
26 deletions
src/main/java/com/bsth/service/schedule/SchedulePlanServiceImpl.java
| ... | ... | @@ -41,16 +41,9 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> |
| 41 | 41 | @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) |
| 42 | 42 | @Override |
| 43 | 43 | public Map<String, Object> save(SchedulePlan schedulePlan) { |
| 44 | - // 查询参数 | |
| 45 | - Map<String, Object> param = new HashMap<>(); | |
| 46 | - | |
| 47 | - // 1、查出指定线路的所有规则 | |
| 48 | - Line xl = lineService.findById(schedulePlan.getXl().getId()); // 查找线路具体信息 | |
| 49 | - param.clear(); | |
| 50 | - param.put("xl.id_eq", xl.getId()); | |
| 51 | - Iterable<ScheduleRule1Flat> scheduleRule1FlatIterable = scheduleRule1FlatService.list(param); | |
| 52 | - if (!scheduleRule1FlatIterable.iterator().hasNext()) | |
| 53 | - throw new RuntimeException("线路:" + xl.getName() + " 没有配置规则!"); | |
| 44 | + // 1-1、查找线路具体信息 | |
| 45 | + Line xl = strategy.getLine(schedulePlan.getXl().getId()); | |
| 46 | + // 1-2、查出指定线路的所有规则 | |
| 54 | 47 | TTInfo ttInfo = strategy.getTTInfo(xl.getId()); // 时刻表id |
| 55 | 48 | schedulePlan.setTtInfo(ttInfo); // 关联的时刻表 |
| 56 | 49 | |
| ... | ... | @@ -59,7 +52,7 @@ public class SchedulePlanServiceImpl extends BaseServiceImpl<SchedulePlan, Long> |
| 59 | 52 | ScheduleCalcuParam_input scheduleCalcuParam_input = new ScheduleCalcuParam_input(schedulePlan); |
| 60 | 53 | // 每个规则对应的输入参数 |
| 61 | 54 | List<ScheduleRule_input> scheduleRule_inputs = new ArrayList<>(); |
| 62 | - Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = scheduleRule1FlatIterable.iterator(); | |
| 55 | + Iterator<ScheduleRule1Flat> scheduleRule1FlatIterator = strategy.getScheduleRule(xl.getId()).iterator(); | |
| 63 | 56 | while (scheduleRule1FlatIterator.hasNext()) { |
| 64 | 57 | ScheduleRule1Flat scheduleRule1Flat_temp = scheduleRule1FlatIterator.next(); |
| 65 | 58 | ScheduleRule_input scheduleRule_input = new ScheduleRule_input(scheduleRule1Flat_temp); | ... | ... |
src/main/java/com/bsth/service/schedule/rules/strategy/IStrategy.java
| 1 | 1 | package com.bsth.service.schedule.rules.strategy; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Line; | |
| 3 | 4 | import com.bsth.entity.schedule.CarConfigInfo; |
| 4 | 5 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 5 | 6 | import com.bsth.entity.schedule.TTInfo; |
| 6 | 7 | import com.bsth.entity.schedule.TTInfoDetail; |
| 8 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | |
| 7 | 9 | import com.google.common.collect.Multimap; |
| 8 | 10 | |
| 9 | 11 | import java.util.Map; |
| ... | ... | @@ -14,28 +16,42 @@ import java.util.Map; |
| 14 | 16 | public interface IStrategy { |
| 15 | 17 | |
| 16 | 18 | /** |
| 17 | - * 查找指定线路下,可用的时刻表; | |
| 19 | + * 获取线路信息。 | |
| 20 | + * @param xlId 线路id | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + Line getLine(Integer xlId); | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 获取指定线路下,可用的时刻表。 | |
| 18 | 27 | * @param xlId 线路id |
| 19 | 28 | * @return 时刻表 |
| 20 | 29 | */ |
| 21 | 30 | TTInfo getTTInfo(Integer xlId); |
| 22 | 31 | |
| 23 | 32 | /** |
| 24 | - * 查找指定线路下,路牌与时刻明细对应的Map。 | |
| 33 | + * 获取指定线路下,可用的排班规则。 | |
| 34 | + * @param xlId | |
| 35 | + * @return | |
| 36 | + */ | |
| 37 | + Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId); | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 获取指定线路下,路牌与时刻明细对应的Map。 | |
| 25 | 41 | * @param xlId 线路id |
| 26 | 42 | * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value |
| 27 | 43 | */ |
| 28 | 44 | Multimap<Long, TTInfoDetail> getGuideboardXlTTInfoDetailMaps(Integer xlId); |
| 29 | 45 | |
| 30 | 46 | /** |
| 31 | - * 查找指定线路下,车辆配置与车辆信息对应的Map。 | |
| 47 | + * 获取指定线路下,车辆配置与车辆信息对应的Map。 | |
| 32 | 48 | * @param xlId 线路id |
| 33 | 49 | * @return 车辆配置id为key,具体车辆配置信息为value。 |
| 34 | 50 | */ |
| 35 | 51 | Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId); |
| 36 | 52 | |
| 37 | 53 | /** |
| 38 | - * 查找指定线路下,人员配置与人员对应的Map。 | |
| 54 | + * 获取指定线路下,人员配置与人员对应的Map。 | |
| 39 | 55 | * @param xlId 线路id |
| 40 | 56 | * @return 人员配置id为key,具体人员配置信息为value。 |
| 41 | 57 | */ | ... | ... |
src/main/java/com/bsth/service/schedule/rules/strategy/IStrategyImpl.java
| 1 | 1 | package com.bsth.service.schedule.rules.strategy; |
| 2 | 2 | |
| 3 | +import com.bsth.entity.Line; | |
| 3 | 4 | import com.bsth.entity.schedule.CarConfigInfo; |
| 4 | 5 | import com.bsth.entity.schedule.EmployeeConfigInfo; |
| 5 | 6 | import com.bsth.entity.schedule.TTInfo; |
| 6 | 7 | import com.bsth.entity.schedule.TTInfoDetail; |
| 7 | -import com.bsth.service.schedule.CarConfigInfoService; | |
| 8 | -import com.bsth.service.schedule.EmployeeConfigInfoService; | |
| 9 | -import com.bsth.service.schedule.TTInfoDetailService; | |
| 10 | -import com.bsth.service.schedule.TTInfoService; | |
| 8 | +import com.bsth.entity.schedule.rule.ScheduleRule1Flat; | |
| 9 | +import com.bsth.service.LineService; | |
| 10 | +import com.bsth.service.schedule.*; | |
| 11 | 11 | import com.google.common.collect.ArrayListMultimap; |
| 12 | 12 | import com.google.common.collect.Multimap; |
| 13 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -30,12 +30,22 @@ public class IStrategyImpl implements IStrategy { |
| 30 | 30 | private EmployeeConfigInfoService employeeConfigInfoService; |
| 31 | 31 | @Autowired |
| 32 | 32 | private TTInfoDetailService ttInfoDetailService; |
| 33 | + @Autowired | |
| 34 | + private LineService lineService; | |
| 35 | + @Autowired | |
| 36 | + private ScheduleRule1FlatService scheduleRule1FlatService; | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public Line getLine(Integer xlId) { | |
| 40 | + Line xl = lineService.findById(xlId); // 查找线路具体信息 | |
| 41 | + return xl; | |
| 42 | + } | |
| 33 | 43 | |
| 34 | 44 | @Override |
| 35 | 45 | public TTInfo getTTInfo(Integer xlId) { |
| 36 | 46 | // TODO:本来要使用规则判定到底使用哪张时刻表,这里选用第一张 |
| 37 | - // 查询参数 | |
| 38 | - Map<String, Object> param = new HashMap<>(); | |
| 47 | + Map<String, Object> param = new HashMap<>(); // 查询参数 | |
| 48 | + param.clear(); | |
| 39 | 49 | param.put("xl.id_eq", xlId); // 线路id |
| 40 | 50 | param.put("isCancel_eq", false); // 没有作废 |
| 41 | 51 | param.put("isEnableDisTemplate_eq", true); // 是否启用 |
| ... | ... | @@ -47,6 +57,19 @@ public class IStrategyImpl implements IStrategy { |
| 47 | 57 | } |
| 48 | 58 | |
| 49 | 59 | @Override |
| 60 | + public Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId) { | |
| 61 | + Map<String, Object> param = new HashMap<>(); // 查询参数 | |
| 62 | + Line xl = lineService.findById(xlId); // 查找线路具体信息 | |
| 63 | + param.clear(); | |
| 64 | + param.put("xl.id_eq", xl.getId()); | |
| 65 | + Iterable<ScheduleRule1Flat> scheduleRule1FlatIterable = scheduleRule1FlatService.list(param); | |
| 66 | + if (!scheduleRule1FlatIterable.iterator().hasNext()) | |
| 67 | + throw new RuntimeException("线路:" + xl.getName() + " 没有配置规则!"); | |
| 68 | + | |
| 69 | + return scheduleRule1FlatIterable; | |
| 70 | + } | |
| 71 | + | |
| 72 | + @Override | |
| 50 | 73 | public Multimap<Long, TTInfoDetail> getGuideboardXlTTInfoDetailMaps(Integer xlId) { |
| 51 | 74 | TTInfo ttInfo = getTTInfo(xlId); |
| 52 | 75 | // 查询参数 | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/detail_info.html
| ... | ... | @@ -119,21 +119,38 @@ |
| 119 | 119 | </li> |
| 120 | 120 | <li class="divider"></li> |
| 121 | 121 | <li> |
| 122 | - <a href="javascript:" class="tool-action" ng-click="ctrl.changeDirect(cell)"> | |
| 122 | + <a href="javascript:" class="tool-action" ng-click="ctrl.changeDirect(cell, 0)"> | |
| 123 | 123 | <i class="fa fa-file-excel-o"></i> |
| 124 | - 设置反向 | |
| 124 | + 设为上行 | |
| 125 | + <i class="fa fa-arrow-up" aria-hidden="true"></i> | |
| 126 | + </a> | |
| 127 | + </li> | |
| 128 | + <li> | |
| 129 | + <a href="javascript:" class="tool-action" ng-click="ctrl.changeDirect(cell, 1)"> | |
| 130 | + <i class="fa fa-file-excel-o"></i> | |
| 131 | + 设为下行 | |
| 132 | + <i class="fa fa-arrow-down" aria-hidden="true"></i> | |
| 125 | 133 | </a> |
| 126 | 134 | </li> |
| 127 | 135 | <li> |
| 128 | 136 | <a href="javascript:" class="tool-action" ng-click="ctrl.changeFB(cell, true)"> |
| 129 | 137 | <i class="fa fa-file-excel-o"></i> |
| 130 | 138 | 设置分班 |
| 139 | + <i class="fa fa-adjust" aria-hidden="true"></i> | |
| 131 | 140 | </a> |
| 132 | 141 | </li> |
| 133 | 142 | <li> |
| 134 | 143 | <a href="javascript:" class="tool-action" ng-click="ctrl.changeFB(cell, false)"> |
| 135 | 144 | <i class="fa fa-file-excel-o"></i> |
| 136 | 145 | 取消分班 |
| 146 | + <i class="fa fa-adjust" aria-hidden="true"></i> | |
| 147 | + </a> | |
| 148 | + </li> | |
| 149 | + <li> | |
| 150 | + <a href="javascript:" class="tool-action" ng-click="ctrl.changeBCType(cell, 'region')"> | |
| 151 | + <i class="fa fa-file-excel-o"></i> | |
| 152 | + 设为区间 | |
| 153 | + <i class="fa fa-circle-o-notch" aria-hidden="true"></i> | |
| 137 | 154 | </a> |
| 138 | 155 | </li> |
| 139 | 156 | ... | ... |
src/main/resources/static/pages/scheduleApp/module/core/timeTableManage/timeTableDetailManage.js
| ... | ... | @@ -70,13 +70,13 @@ angular.module('ScheduleApp').controller('TimeTableDetailManageCtrl', ['TimeTabl |
| 70 | 70 | * 反向操作。 |
| 71 | 71 | * @param cell 明细信息 |
| 72 | 72 | */ |
| 73 | - self.changeDirect = function(detailInfo) { | |
| 73 | + self.changeDirect = function(detailInfo, xldir) { | |
| 74 | 74 | timeTableDetailManageService.getDetail(detailInfo.ttdid).then( |
| 75 | 75 | function(result) { |
| 76 | - result.xlDir = result.xlDir == "0" ? "1" : "0"; | |
| 76 | + result.xlDir = xldir; | |
| 77 | 77 | timeTableDetailManageService.saveDetail(result).then( |
| 78 | 78 | function(result) { |
| 79 | - detailInfo.xldir = detailInfo.xldir == "0" ? "1" : "0"; | |
| 79 | + detailInfo.xldir = xldir; | |
| 80 | 80 | }, |
| 81 | 81 | function(result) { |
| 82 | 82 | alert("出错啦!"); |
| ... | ... | @@ -113,6 +113,30 @@ angular.module('ScheduleApp').controller('TimeTableDetailManageCtrl', ['TimeTabl |
| 113 | 113 | ); |
| 114 | 114 | }; |
| 115 | 115 | |
| 116 | + /** | |
| 117 | + * 改变便次类型。 | |
| 118 | + * @param detailInfo 明细信息 | |
| 119 | + * @param type 班次类型 | |
| 120 | + */ | |
| 121 | + self.changeBCType = function(detailInfo, type) { | |
| 122 | + timeTableDetailManageService.getDetail(detailInfo.ttdid).then( | |
| 123 | + function(result) { | |
| 124 | + result.bcType = type; | |
| 125 | + timeTableDetailManageService.saveDetail(result).then( | |
| 126 | + function(result) { | |
| 127 | + detailInfo.bc_type = type; | |
| 128 | + }, | |
| 129 | + function(result) { | |
| 130 | + alert("出错啦!"); | |
| 131 | + } | |
| 132 | + ); | |
| 133 | + }, | |
| 134 | + function(result) { | |
| 135 | + alert("出错啦!"); | |
| 136 | + } | |
| 137 | + ); | |
| 138 | + }; | |
| 139 | + | |
| 116 | 140 | }]); |
| 117 | 141 | |
| 118 | 142 | angular.module('ScheduleApp').controller('TimeTableDetailManageFormCtrl', ['TimeTableDetailManageService', '$stateParams', '$state', function(timeTableDetailManageService, $stateParams, $state) { | ... | ... |