Commit 2f136edbe204c08c7ec52b757ca4d32ac7677813

Authored by 潘钊
2 parents 4fcdfd42 73bb0961

Merge branch 'qingpu' of http://222.66.0.204:8800/panzhaov5/bsth_control

into qingpu

# Conflicts:
#	src/main/java/com/bsth/service/schedule/rules/strategy/IStrategy.java
#	src/main/java/com/bsth/service/schedule/rules/strategy/IStrategyImpl.java
src/main/java/com/bsth/service/schedule/rules/strategy/IStrategy.java
1 -package com.bsth.service.schedule.rules.strategy;  
2 -  
3 -import com.bsth.entity.Line;  
4 -import com.bsth.entity.schedule.CarConfigInfo;  
5 -import com.bsth.entity.schedule.EmployeeConfigInfo;  
6 -import com.bsth.entity.schedule.TTInfo;  
7 -import com.bsth.entity.schedule.TTInfoDetail;  
8 -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;  
9 -import com.google.common.collect.Multimap;  
10 -  
11 -import java.util.Date;  
12 -import java.util.List;  
13 -import java.util.Map;  
14 -  
15 -/**  
16 - * 获取数据的策略。  
17 - */  
18 -public interface IStrategy {  
19 -  
20 - /**  
21 - * 获取线路信息。  
22 - * @param xlId 线路id  
23 - * @return  
24 - */  
25 - Line getLine(Integer xlId);  
26 -  
27 - /**  
28 - * 获取指定线路下,可用的时刻表。  
29 - * @param xlId 线路id  
30 - * @return 时刻表  
31 - */  
32 - List<TTInfo> getTTInfo(Integer xlId);  
33 -  
34 - /**  
35 - * 获取指定线路的时刻表的明细。  
36 - * @param xlId 线路id  
37 - * @return  
38 - */  
39 - List<TTInfoDetail> getTTInfoDetail(Integer xlId);  
40 -  
41 - /**  
42 - * 获取指定线路下,可用的排班规则。  
43 - * @param xlId  
44 - * @return  
45 - */  
46 - Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId);  
47 -  
48 - /**  
49 - * 获取指定线路下,日期与路牌与时刻明细对应的Map。  
50 - * @param xlId 线路id  
51 - * @param fromDate 开始日期  
52 - * @param toDate 结束日期  
53 - * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value  
54 - */  
55 - Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(Integer xlId, Date fromDate, Date toDate);  
56 -  
57 - /**  
58 - * 获取指定线路下,车辆配置与车辆信息对应的Map。  
59 - * @param xlId 线路id  
60 - * @return 车辆配置id为key,具体车辆配置信息为value。  
61 - */  
62 - Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId);  
63 -  
64 - /**  
65 - * 获取指定线路下,人员配置与人员对应的Map。  
66 - * @param xlId 线路id  
67 - * @return 人员配置id为key,具体人员配置信息为value。  
68 - */  
69 - Map<Long, EmployeeConfigInfo> getEmployeeConfigMaps(Integer xlId);  
70 -} 1 +package com.bsth.service.schedule.rules.strategy;
  2 +
  3 +import com.bsth.entity.Line;
  4 +import com.bsth.entity.schedule.CarConfigInfo;
  5 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  6 +import com.bsth.entity.schedule.TTInfo;
  7 +import com.bsth.entity.schedule.TTInfoDetail;
  8 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  9 +import com.google.common.collect.Multimap;
  10 +
  11 +import java.util.Date;
  12 +import java.util.List;
  13 +import java.util.Map;
  14 +
  15 +/**
  16 + * 获取数据的策略。
  17 + */
  18 +public interface IStrategy {
  19 +
  20 + /**
  21 + * 获取线路信息。
  22 + * @param xlId 线路id
  23 + * @return
  24 + */
  25 + Line getLine(Integer xlId);
  26 +
  27 + /**
  28 + * 获取指定线路下,可用的时刻表。
  29 + * @param xlId 线路id
  30 + * @return 时刻表
  31 + */
  32 + List<TTInfo> getTTInfo(Integer xlId);
  33 +
  34 + /**
  35 + * 获取指定线路的时刻表的明细。
  36 + * @param xlId 线路id
  37 + * @return
  38 + */
  39 + List<TTInfoDetail> getTTInfoDetail(Integer xlId);
  40 +
  41 + /**
  42 + * 获取指定线路下,可用的排班规则。
  43 + * @param xlId
  44 + * @return
  45 + */
  46 + Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId);
  47 +
  48 + /**
  49 + * 获取指定线路下,日期与路牌与时刻明细对应的Map。
  50 + * @param xlId 线路id
  51 + * @param fromDate 开始日期
  52 + * @param toDate 结束日期
  53 + * @return 路牌id为key,时刻明细 Collection<TTInfoDetail> 为value
  54 + */
  55 + Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(Integer xlId, Date fromDate, Date toDate);
  56 +
  57 + /**
  58 + * 获取指定线路下,车辆配置与车辆信息对应的Map。
  59 + * @param xlId 线路id
  60 + * @return 车辆配置id为key,具体车辆配置信息为value。
  61 + */
  62 + Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId);
  63 +
  64 + /**
  65 + * 获取指定线路下,人员配置与人员对应的Map。
  66 + * @param xlId 线路id
  67 + * @return 人员配置id为key,具体人员配置信息为value。
  68 + */
  69 + Map<Long, EmployeeConfigInfo> getEmployeeConfigMaps(Integer xlId);
  70 +}
src/main/java/com/bsth/service/schedule/rules/strategy/IStrategyImpl.java
1 -package com.bsth.service.schedule.rules.strategy;  
2 -  
3 -import com.bsth.entity.Line;  
4 -import com.bsth.entity.schedule.CarConfigInfo;  
5 -import com.bsth.entity.schedule.EmployeeConfigInfo;  
6 -import com.bsth.entity.schedule.TTInfo;  
7 -import com.bsth.entity.schedule.TTInfoDetail;  
8 -import com.bsth.entity.schedule.rule.ScheduleRule1Flat;  
9 -import com.bsth.service.LineService;  
10 -import com.bsth.service.schedule.*;  
11 -import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input;  
12 -import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;  
13 -import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;  
14 -import com.bsth.service.schedule.rules.ttinfo.TTInfo_input;  
15 -import com.google.common.collect.ArrayListMultimap;  
16 -import com.google.common.collect.Multimap;  
17 -import org.joda.time.DateTime;  
18 -import org.kie.api.KieBase;  
19 -import org.kie.api.runtime.KieSession;  
20 -import org.slf4j.Logger;  
21 -import org.slf4j.LoggerFactory;  
22 -import org.springframework.beans.factory.annotation.Autowired;  
23 -import org.springframework.stereotype.Service;  
24 -  
25 -import java.util.*;  
26 -  
27 -/**  
28 - * Created by xu on 16/7/10.  
29 - */  
30 -@Service  
31 -public class IStrategyImpl implements IStrategy {  
32 - @Autowired  
33 - private TTInfoService ttInfoService;  
34 - @Autowired  
35 - private CarConfigInfoService carConfigInfoService;  
36 - @Autowired  
37 - private EmployeeConfigInfoService employeeConfigInfoService;  
38 - @Autowired  
39 - private TTInfoDetailService ttInfoDetailService;  
40 - @Autowired  
41 - private LineService lineService;  
42 - @Autowired  
43 - private ScheduleRule1FlatService scheduleRule1FlatService;  
44 -  
45 - /** 日志记录器 */  
46 - private Logger logger = LoggerFactory.getLogger(IStrategyImpl.class);  
47 -  
48 - @Autowired  
49 - private KieBase kieBase;  
50 -  
51 - @Override  
52 - public Line getLine(Integer xlId) {  
53 - Line xl = lineService.findById(xlId); // 查找线路具体信息  
54 - return xl;  
55 - }  
56 -  
57 - @Override  
58 - public List<TTInfo> getTTInfo(Integer xlId) {  
59 - // 查询参数  
60 - Map<String, Object> param = new HashMap<>();  
61 - param.put("xl.id_eq", xlId); // 线路Id  
62 - param.put("isCancel_eq", false); // 作废的过滤掉  
63 - Iterator<TTInfo> ttInfoIterator = ttInfoService.list(param).iterator();  
64 - if (!ttInfoIterator.hasNext()) {  
65 - throw new RuntimeException("线路id=" + xlId + " 没有时刻表!");  
66 - }  
67 - List<TTInfo> ttInfos = new ArrayList<>();  
68 - while (ttInfoIterator.hasNext()) {  
69 - TTInfo ttInfo = ttInfoIterator.next();  
70 - ttInfos.add(ttInfo);  
71 - }  
72 - return ttInfos;  
73 - }  
74 -  
75 - @Override  
76 - public List<TTInfoDetail> getTTInfoDetail(Integer xlId) {  
77 - List<TTInfoDetail> ttInfoDetails = new ArrayList<>();  
78 -  
79 - List<TTInfo> ttInfos = getTTInfo(xlId);  
80 - Map<String, Object> param = new HashMap<>();  
81 - for (TTInfo ttInfo : ttInfos) {  
82 - param.clear();  
83 - param.put("ttinfo.id_eq", ttInfo.getId());  
84 - Iterator<TTInfoDetail> ttInfoDetailIterator = ttInfoDetailService.list(param).iterator();  
85 - while (ttInfoDetailIterator.hasNext()) {  
86 - ttInfoDetails.add(ttInfoDetailIterator.next());  
87 - }  
88 - }  
89 -  
90 - return ttInfoDetails;  
91 - }  
92 -  
93 - @Override  
94 - public Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId) {  
95 - Map<String, Object> param = new HashMap<>(); // 查询参数  
96 - Line xl = lineService.findById(xlId); // 查找线路具体信息  
97 - param.clear();  
98 - param.put("xl.id_eq", xl.getId());  
99 - Iterable<ScheduleRule1Flat> scheduleRule1FlatIterable = scheduleRule1FlatService.list(param);  
100 - if (!scheduleRule1FlatIterable.iterator().hasNext())  
101 - throw new RuntimeException("线路:" + xl.getName() + " 没有配置规则!");  
102 -  
103 - return scheduleRule1FlatIterable;  
104 - }  
105 -  
106 - @Override  
107 - public Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(  
108 - Integer xlId, Date fromDate, Date toDate) {  
109 - // 获取线路的所有时刻表  
110 - List<TTInfo> ttInfos = getTTInfo(xlId);  
111 -  
112 - // 执行规则,判定每天使用的时刻表  
113 - KieSession session = kieBase.newKieSession();  
114 -  
115 - session.setGlobal("log", logger);  
116 - TTInfoResults_output ttInfoResults_output = new TTInfoResults_output();  
117 - session.setGlobal("results", ttInfoResults_output);  
118 -  
119 - TTInfoCalcuParam_input ttInfoCalcuParam_input = new TTInfoCalcuParam_input(  
120 - new DateTime(fromDate), new DateTime(toDate), String.valueOf(xlId));  
121 - session.insert(ttInfoCalcuParam_input);  
122 - for (TTInfo ttInfo : ttInfos) {  
123 - TTInfo_input ttInfo_input = new TTInfo_input(ttInfo);  
124 - session.insert(ttInfo_input);  
125 - }  
126 -  
127 - session.fireAllRules();  
128 - session.dispose();  
129 -  
130 - // 获取ttinfoDetail  
131 - List<TTInfoDetail> ttInfoDetails = getTTInfoDetail(xlId);  
132 -  
133 - // 规则输出结果  
134 - Multimap<DateTime, TTInfoResult_output> outputMultimap =  
135 - ttInfoResults_output.getResults().get(String.valueOf(xlId));  
136 - // return结果输出  
137 - Map<Date, Multimap<Long, TTInfoDetail>> ttInfoDetailMultimap = new HashMap<>();  
138 -  
139 - Map<String, Object> param = new HashMap<>();  
140 - for (DateTime dateTime : outputMultimap.keySet()) {  
141 - Collection<TTInfoResult_output> ttInfoResult_outputs = outputMultimap.get(dateTime);  
142 - // 如果有多个,使用第一个  
143 - Iterator<TTInfoResult_output> ttInfoResult_outputIterator = ttInfoResult_outputs.iterator();  
144 - if (ttInfoResult_outputIterator.hasNext()) {  
145 - // 同一天,多张时刻表只取第一张  
146 - TTInfoResult_output ttInfoResult_output = ttInfoResult_outputIterator.next();  
147 - // 查找时刻表明细  
148 - Multimap<Long, TTInfoDetail> ttinfodetailMap2 = ArrayListMultimap.create();  
149 - for (TTInfoDetail ttInfoDetail : ttInfoDetails) {  
150 - if (ttInfoDetail.getTtinfo().getId() == Long.valueOf(ttInfoResult_output.getTtInfoId())) {  
151 - ttinfodetailMap2.put(ttInfoDetail.getLp().getId(), ttInfoDetail);  
152 - }  
153 - }  
154 -  
155 - ttInfoDetailMultimap.put(dateTime.toDate(), ttinfodetailMap2);  
156 - }  
157 - }  
158 -  
159 - return ttInfoDetailMultimap;  
160 - }  
161 -  
162 - @Override  
163 - public Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId) {  
164 - // 查询参数  
165 - Map<String, Object> param = new HashMap<>();  
166 - param.put("xl.id_eq", xlId);  
167 - Iterable<CarConfigInfo> carConfigInfoIterable = carConfigInfoService.list(param);  
168 - Iterator<CarConfigInfo> carConfigInfoIterator = carConfigInfoIterable.iterator();  
169 - if (!carConfigInfoIterator.hasNext())  
170 - throw new RuntimeException("线路id=" + xlId + ",下没有车辆配置信息!");  
171 -  
172 - Map<Long, CarConfigInfo> carConfigInfoMap = new HashMap<>();  
173 - while (carConfigInfoIterator.hasNext()) {  
174 - CarConfigInfo carConfigInfo = carConfigInfoIterator.next();  
175 - carConfigInfoMap.put(carConfigInfo.getId(), carConfigInfo);  
176 - }  
177 - return carConfigInfoMap;  
178 - }  
179 -  
180 - @Override  
181 - public Map<Long, EmployeeConfigInfo> getEmployeeConfigMaps(Integer xlId) {  
182 - // 查询参数  
183 - Map<String, Object> param = new HashMap<>();  
184 - param.put("xl.id_eq", xlId);  
185 - Iterable<EmployeeConfigInfo> employeeConfigInfoIterable = employeeConfigInfoService.list(param);  
186 - Iterator<EmployeeConfigInfo> employeeConfigInfoIterator = employeeConfigInfoIterable.iterator();  
187 - if (!employeeConfigInfoIterator.hasNext())  
188 - throw new RuntimeException("线路id=" + xlId + ",下没有人员配置信息!");  
189 -  
190 - Map<Long, EmployeeConfigInfo> employeeConfigInfoMap = new HashMap<>();  
191 - while (employeeConfigInfoIterator.hasNext()) {  
192 - EmployeeConfigInfo employeeConfigInfo = employeeConfigInfoIterator.next();  
193 - employeeConfigInfoMap.put(employeeConfigInfo.getId(), employeeConfigInfo);  
194 - }  
195 - return employeeConfigInfoMap;  
196 - }  
197 -} 1 +package com.bsth.service.schedule.rules.strategy;
  2 +
  3 +import com.bsth.entity.Line;
  4 +import com.bsth.entity.schedule.CarConfigInfo;
  5 +import com.bsth.entity.schedule.EmployeeConfigInfo;
  6 +import com.bsth.entity.schedule.TTInfo;
  7 +import com.bsth.entity.schedule.TTInfoDetail;
  8 +import com.bsth.entity.schedule.rule.ScheduleRule1Flat;
  9 +import com.bsth.service.LineService;
  10 +import com.bsth.service.schedule.*;
  11 +import com.bsth.service.schedule.rules.ttinfo.TTInfoCalcuParam_input;
  12 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResult_output;
  13 +import com.bsth.service.schedule.rules.ttinfo.TTInfoResults_output;
  14 +import com.bsth.service.schedule.rules.ttinfo.TTInfo_input;
  15 +import com.google.common.collect.ArrayListMultimap;
  16 +import com.google.common.collect.Multimap;
  17 +import org.joda.time.DateTime;
  18 +import org.kie.api.KieBase;
  19 +import org.kie.api.runtime.KieSession;
  20 +import org.slf4j.Logger;
  21 +import org.slf4j.LoggerFactory;
  22 +import org.springframework.beans.factory.annotation.Autowired;
  23 +import org.springframework.stereotype.Service;
  24 +
  25 +import java.util.*;
  26 +
  27 +/**
  28 + * Created by xu on 16/7/10.
  29 + */
  30 +@Service
  31 +public class IStrategyImpl implements IStrategy {
  32 + @Autowired
  33 + private TTInfoService ttInfoService;
  34 + @Autowired
  35 + private CarConfigInfoService carConfigInfoService;
  36 + @Autowired
  37 + private EmployeeConfigInfoService employeeConfigInfoService;
  38 + @Autowired
  39 + private TTInfoDetailService ttInfoDetailService;
  40 + @Autowired
  41 + private LineService lineService;
  42 + @Autowired
  43 + private ScheduleRule1FlatService scheduleRule1FlatService;
  44 +
  45 + /** 日志记录器 */
  46 + private Logger logger = LoggerFactory.getLogger(IStrategyImpl.class);
  47 +
  48 + @Autowired
  49 + private KieBase kieBase;
  50 +
  51 + @Override
  52 + public Line getLine(Integer xlId) {
  53 + Line xl = lineService.findById(xlId); // 查找线路具体信息
  54 + return xl;
  55 + }
  56 +
  57 + @Override
  58 + public List<TTInfo> getTTInfo(Integer xlId) {
  59 + // 查询参数
  60 + Map<String, Object> param = new HashMap<>();
  61 + param.put("xl.id_eq", xlId); // 线路Id
  62 + param.put("isCancel_eq", false); // 作废的过滤掉
  63 + Iterator<TTInfo> ttInfoIterator = ttInfoService.list(param).iterator();
  64 + if (!ttInfoIterator.hasNext()) {
  65 + throw new RuntimeException("线路id=" + xlId + " 没有时刻表!");
  66 + }
  67 + List<TTInfo> ttInfos = new ArrayList<>();
  68 + while (ttInfoIterator.hasNext()) {
  69 + TTInfo ttInfo = ttInfoIterator.next();
  70 + ttInfos.add(ttInfo);
  71 + }
  72 + return ttInfos;
  73 + }
  74 +
  75 + @Override
  76 + public List<TTInfoDetail> getTTInfoDetail(Integer xlId) {
  77 + List<TTInfoDetail> ttInfoDetails = new ArrayList<>();
  78 +
  79 + List<TTInfo> ttInfos = getTTInfo(xlId);
  80 + Map<String, Object> param = new HashMap<>();
  81 + for (TTInfo ttInfo : ttInfos) {
  82 + param.clear();
  83 + param.put("ttinfo.id_eq", ttInfo.getId());
  84 + Iterator<TTInfoDetail> ttInfoDetailIterator = ttInfoDetailService.list(param).iterator();
  85 + while (ttInfoDetailIterator.hasNext()) {
  86 + ttInfoDetails.add(ttInfoDetailIterator.next());
  87 + }
  88 + }
  89 +
  90 + return ttInfoDetails;
  91 + }
  92 +
  93 + @Override
  94 + public Iterable<ScheduleRule1Flat> getScheduleRule(Integer xlId) {
  95 + Map<String, Object> param = new HashMap<>(); // 查询参数
  96 + Line xl = lineService.findById(xlId); // 查找线路具体信息
  97 + param.clear();
  98 + param.put("xl.id_eq", xl.getId());
  99 + Iterable<ScheduleRule1Flat> scheduleRule1FlatIterable = scheduleRule1FlatService.list(param);
  100 + if (!scheduleRule1FlatIterable.iterator().hasNext())
  101 + throw new RuntimeException("线路:" + xl.getName() + " 没有配置规则!");
  102 +
  103 + return scheduleRule1FlatIterable;
  104 + }
  105 +
  106 + @Override
  107 + public Map<Date, Multimap<Long, TTInfoDetail>> getGuideboardXlTTInfoDetailMaps(
  108 + Integer xlId, Date fromDate, Date toDate) {
  109 + // 获取线路的所有时刻表
  110 + List<TTInfo> ttInfos = getTTInfo(xlId);
  111 +
  112 + // 执行规则,判定每天使用的时刻表
  113 + KieSession session = kieBase.newKieSession();
  114 +
  115 + session.setGlobal("log", logger);
  116 + TTInfoResults_output ttInfoResults_output = new TTInfoResults_output();
  117 + session.setGlobal("results", ttInfoResults_output);
  118 +
  119 + TTInfoCalcuParam_input ttInfoCalcuParam_input = new TTInfoCalcuParam_input(
  120 + new DateTime(fromDate), new DateTime(toDate), String.valueOf(xlId));
  121 + session.insert(ttInfoCalcuParam_input);
  122 + for (TTInfo ttInfo : ttInfos) {
  123 + TTInfo_input ttInfo_input = new TTInfo_input(ttInfo);
  124 + session.insert(ttInfo_input);
  125 + }
  126 +
  127 + session.fireAllRules();
  128 + session.dispose();
  129 +
  130 + // 获取ttinfoDetail
  131 + List<TTInfoDetail> ttInfoDetails = getTTInfoDetail(xlId);
  132 +
  133 + // 规则输出结果
  134 + Multimap<DateTime, TTInfoResult_output> outputMultimap =
  135 + ttInfoResults_output.getResults().get(String.valueOf(xlId));
  136 + // return结果输出
  137 + Map<Date, Multimap<Long, TTInfoDetail>> ttInfoDetailMultimap = new HashMap<>();
  138 +
  139 + Map<String, Object> param = new HashMap<>();
  140 + for (DateTime dateTime : outputMultimap.keySet()) {
  141 + Collection<TTInfoResult_output> ttInfoResult_outputs = outputMultimap.get(dateTime);
  142 + // 如果有多个,使用第一个
  143 + Iterator<TTInfoResult_output> ttInfoResult_outputIterator = ttInfoResult_outputs.iterator();
  144 + if (ttInfoResult_outputIterator.hasNext()) {
  145 + // 同一天,多张时刻表只取第一张
  146 + TTInfoResult_output ttInfoResult_output = ttInfoResult_outputIterator.next();
  147 + // 查找时刻表明细
  148 + Multimap<Long, TTInfoDetail> ttinfodetailMap2 = ArrayListMultimap.create();
  149 + for (TTInfoDetail ttInfoDetail : ttInfoDetails) {
  150 + if (ttInfoDetail.getTtinfo().getId() == Long.valueOf(ttInfoResult_output.getTtInfoId())) {
  151 + ttinfodetailMap2.put(ttInfoDetail.getLp().getId(), ttInfoDetail);
  152 + }
  153 + }
  154 +
  155 + ttInfoDetailMultimap.put(dateTime.toDate(), ttinfodetailMap2);
  156 + }
  157 + }
  158 +
  159 + return ttInfoDetailMultimap;
  160 + }
  161 +
  162 + @Override
  163 + public Map<Long, CarConfigInfo> getCarConfigMaps(Integer xlId) {
  164 + // 查询参数
  165 + Map<String, Object> param = new HashMap<>();
  166 + param.put("xl.id_eq", xlId);
  167 + Iterable<CarConfigInfo> carConfigInfoIterable = carConfigInfoService.list(param);
  168 + Iterator<CarConfigInfo> carConfigInfoIterator = carConfigInfoIterable.iterator();
  169 + if (!carConfigInfoIterator.hasNext())
  170 + throw new RuntimeException("线路id=" + xlId + ",下没有车辆配置信息!");
  171 +
  172 + Map<Long, CarConfigInfo> carConfigInfoMap = new HashMap<>();
  173 + while (carConfigInfoIterator.hasNext()) {
  174 + CarConfigInfo carConfigInfo = carConfigInfoIterator.next();
  175 + carConfigInfoMap.put(carConfigInfo.getId(), carConfigInfo);
  176 + }
  177 + return carConfigInfoMap;
  178 + }
  179 +
  180 + @Override
  181 + public Map<Long, EmployeeConfigInfo> getEmployeeConfigMaps(Integer xlId) {
  182 + // 查询参数
  183 + Map<String, Object> param = new HashMap<>();
  184 + param.put("xl.id_eq", xlId);
  185 + Iterable<EmployeeConfigInfo> employeeConfigInfoIterable = employeeConfigInfoService.list(param);
  186 + Iterator<EmployeeConfigInfo> employeeConfigInfoIterator = employeeConfigInfoIterable.iterator();
  187 + if (!employeeConfigInfoIterator.hasNext())
  188 + throw new RuntimeException("线路id=" + xlId + ",下没有人员配置信息!");
  189 +
  190 + Map<Long, EmployeeConfigInfo> employeeConfigInfoMap = new HashMap<>();
  191 + while (employeeConfigInfoIterator.hasNext()) {
  192 + EmployeeConfigInfo employeeConfigInfo = employeeConfigInfoIterator.next();
  193 + employeeConfigInfoMap.put(employeeConfigInfo.getId(), employeeConfigInfo);
  194 + }
  195 + return employeeConfigInfoMap;
  196 + }
  197 +}
src/main/resources/application.properties
1 spring.profiles: dev,prod 1 spring.profiles: dev,prod
2 -spring.profiles.active: prod 2 +spring.profiles.active: dev
3 3
4 spring.view.suffix=.html 4 spring.view.suffix=.html
5 server.session-timeout=-1 5 server.session-timeout=-1
src/main/resources/datatools/config-prod.properties
@@ -4,13 +4,13 @@ @@ -4,13 +4,13 @@
4 datatools.kettle_properties=/datatools/kettle.properties 4 datatools.kettle_properties=/datatools/kettle.properties
5 # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正) 5 # 2、ktr文件通用配置变量(数据库连接,根据不同的环境需要修正)
6 #数据库ip地址 6 #数据库ip地址
7 -datatools.kvars_dbip=192.168.168.171 7 +datatools.kvars_dbip=192.168.40.82
8 #数据库用户名 8 #数据库用户名
9 datatools.kvars_dbuname=root 9 datatools.kvars_dbuname=root
10 #数据库密码 10 #数据库密码
11 -datatools.kvars_dbpwd=root2jsp 11 +datatools.kvars_dbpwd=123456
12 #数据库库名 12 #数据库库名
13 -datatools.kvars_dbdname=control 13 +datatools.kvars_dbdname=qp_control
14 14
15 # 3、上传数据配置信息 15 # 3、上传数据配置信息
16 # 上传文件目录配置(根据不同的环境需要修正) 16 # 上传文件目录配置(根据不同的环境需要修正)