Commit c5ed71bdb0b67f8baa1c1994f36176bb14e913a2

Authored by ljq
1 parent b35edf95

增加单条线路的实际排班接口

src/main/java/com/bsth/CXFConfig.java
@@ -22,7 +22,6 @@ import com.bsth.server_rs.gps.GpsRestService; @@ -22,7 +22,6 @@ import com.bsth.server_rs.gps.GpsRestService;
22 import com.bsth.server_rs.info_publish.XxfbRestService; 22 import com.bsth.server_rs.info_publish.XxfbRestService;
23 import com.bsth.server_rs.logs.RealLogRestService; 23 import com.bsth.server_rs.logs.RealLogRestService;
24 import com.bsth.server_rs.man_hours.ManHoursRestService; 24 import com.bsth.server_rs.man_hours.ManHoursRestService;
25 -import com.bsth.server_rs.qh_data.QhSchService;  
26 import com.bsth.server_rs.rate.RateService; 25 import com.bsth.server_rs.rate.RateService;
27 import com.bsth.server_rs.schedule.plan.SchedulePlanService; 26 import com.bsth.server_rs.schedule.plan.SchedulePlanService;
28 import com.bsth.server_rs.schedule.real.ScheduleRealService; 27 import com.bsth.server_rs.schedule.real.ScheduleRealService;
@@ -140,9 +139,6 @@ public class CXFConfig { @@ -140,9 +139,6 @@ public class CXFConfig {
140 private XxfbRestService xxfbRestService; 139 private XxfbRestService xxfbRestService;
141 @Autowired 140 @Autowired
142 private ManHoursRestService manHoursRestService; 141 private ManHoursRestService manHoursRestService;
143 - @Autowired  
144 - private QhSchService qhSchService;  
145 -  
146 142
147 @Autowired 143 @Autowired
148 private BxRestService bxRestService; 144 private BxRestService bxRestService;
@@ -152,7 +148,8 @@ public class CXFConfig { @@ -152,7 +148,8 @@ public class CXFConfig {
152 JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); 148 JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
153 endpoint.setBus(springBus()); 149 endpoint.setBus(springBus());
154 endpoint.setAddress("/rest"); 150 endpoint.setAddress("/rest");
155 - endpoint.setServiceBeans(Arrays.<Object>asList( new LineRestService(), 151 + endpoint.setServiceBeans(Arrays.<Object>asList(
  152 + new LineRestService(),
156 new CarRestService(), 153 new CarRestService(),
157 new PersonRestService(), 154 new PersonRestService(),
158 gpsRestService, 155 gpsRestService,
@@ -175,8 +172,7 @@ public class CXFConfig { @@ -175,8 +172,7 @@ public class CXFConfig {
175 dksRestService, 172 dksRestService,
176 xxfbRestService, 173 xxfbRestService,
177 manHoursRestService, 174 manHoursRestService,
178 - bxRestService,  
179 - qhSchService)); 175 + bxRestService));
180 endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); 176 endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper()));
181 //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); 177 //endpoint.setFeatures(Arrays.asList(new Swagger2Feature()));
182 endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); 178 endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN());
src/main/java/com/bsth/server_rs/qh_data/QhSchService.java deleted 100644 → 0
1 -package com.bsth.server_rs.qh_data;  
2 -  
3 -  
4 -import com.bsth.redis.PlanScheduleRedisService;  
5 -import com.bsth.redis.ScheduleRedisService;  
6 -import com.bsth.redis.util.DateUtils;  
7 -import com.bsth.server_rs.base_info.car.Car;  
8 -import com.bsth.server_rs.base_info.car.buffer.CarBufferData;  
9 -import com.bsth.server_rs.base_info.line.Line;  
10 -import com.bsth.server_rs.base_info.line.buffer.LineBufferData;  
11 -import com.bsth.server_rs.base_info.station.buffer.StationBufferData;  
12 -import com.bsth.server_rs.base_info.station.entity.StationRotue;  
13 -import com.bsth.server_rs.info_publish.Accuracy;  
14 -import com.bsth.server_rs.schedule.dto.PlanScheduleDTO_JK;  
15 -import com.bsth.server_rs.schedule.dto.ScheduleRealInfoDTO_JK;  
16 -import com.bsth.util.DBUtils_Xxfb;  
17 -import org.springframework.beans.factory.annotation.Autowired;  
18 -import org.springframework.jdbc.core.BeanPropertyRowMapper;  
19 -import org.springframework.jdbc.core.JdbcTemplate;  
20 -import org.springframework.jdbc.core.RowMapper;  
21 -import org.springframework.stereotype.Component;  
22 -  
23 -import javax.ws.rs.GET;  
24 -import javax.ws.rs.Path;  
25 -import javax.ws.rs.PathParam;  
26 -import javax.ws.rs.Produces;  
27 -import javax.ws.rs.core.MediaType;  
28 -import java.sql.ResultSet;  
29 -import java.sql.SQLException;  
30 -import java.util.*;  
31 -  
32 -/**  
33 - * 与清华团队对接的接口 班次类型  
34 - */  
35 -@Component  
36 -@Path("/snt")  
37 -@Produces({MediaType.APPLICATION_JSON})  
38 -public class QhSchService {  
39 - @Autowired  
40 - PlanScheduleRedisService redisService;  
41 -  
42 - @Autowired  
43 - ScheduleRedisService redisServiceReal;  
44 -  
45 - @Autowired  
46 - JdbcTemplate jdbcTemplate;  
47 - //未来7天计划排班的接口  
48 - @GET  
49 - @Path("/sch_jh/{company}")  
50 - public Map<String,List<PlanScheduleDTO_JK>> find_JK(@PathParam("company") String company){  
51 - List<PlanScheduleDTO_JK> all = new ArrayList<>();  
52 - Map m = new HashMap<>();  
53 - List<Line> lines = LineBufferData.findByCompany(company);  
54 - //获取后7天日期分别获取  
55 - ArrayList<String> datelist = DateUtils.contextLoads();  
56 - for(Line line : lines){  
57 - //取一天的  
58 - for (String rq:datelist) {  
59 - all.addAll(PlanScheduleDTO_JK.getMultiInstance(redisService.read(rq, line.getLineCode())));  
60 - m.put(line.getLineCode()+"_"+rq ,all);  
61 - }  
62 - }  
63 - return m;  
64 - }  
65 -  
66 - //当天的实际排班  
67 - @GET  
68 - @Path("/sch_jk/{company}/{rq}")  
69 - public List<ScheduleRealInfo_JK> find_JK(@PathParam("company") String company, @PathParam("rq") String rq) {  
70 - List<ScheduleRealInfo_JK> all = new ArrayList<>();  
71 -  
72 - List<Line> lines = LineBufferData.findByCompany(company);  
73 - for (Line line : lines) {  
74 - all.addAll(ScheduleRealInfo_JK.getMultiInstance(redisServiceReal.read(rq, line.getLineCode())));  
75 - }  
76 - return all;  
77 - }  
78 -  
79 - //区域  
80 - @GET  
81 - @Path("/qx_line")  
82 - public List<Map> qxLine() {  
83 -  
84 - List<Map> xl = new ArrayList<>();  
85 - String sql ="select line,region from bsth_c_region_line_car group by region,line";  
86 - List<Map<String, Object>> LineList = jdbcTemplate.query(sql,new RowMapper<Map<String, Object>>(){  
87 - @Override  
88 - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {  
89 - Map<String, Object> m=new HashMap<String,Object>();  
90 - m.put("line", rs.getString("line"));  
91 - m.put("region", rs.getString("region"));  
92 - return m;  
93 - }  
94 - });  
95 - for(Map m :LineList){  
96 - Map<String, Collection<StationRotue>> t =StationBufferData.findRouteByLineCoderegion(m.get("line").toString(),m.get("region").toString());  
97 - xl.add(t);  
98 - }  
99 -  
100 -  
101 - return xl;  
102 - }  
103 -  
104 - //区域  
105 - @GET  
106 - @Path("/qx_Car")  
107 - public List<Map> qxCar() {  
108 - List<Map> xl = new ArrayList<>();  
109 - String sql ="select line,cl_zbh,region from bsth_c_region_line_car";  
110 - List<Map<String, Object>> LineList = jdbcTemplate.query(sql,new RowMapper<Map<String, Object>>(){  
111 - @Override  
112 - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException {  
113 - Map<String, Object> m=new HashMap<String,Object>();  
114 - m.put("line", rs.getString("line"));  
115 - m.put("clZbh", rs.getString("cl_zbh"));  
116 - m.put("region", rs.getString("region"));  
117 - return m;  
118 - }  
119 - });  
120 -  
121 - for(Map m :LineList){  
122 - Map map = new HashMap();  
123 - Car car = CarBufferData.findOne(m.get("clZbh").toString());  
124 - map.put(m.get("line")+ "_" +m.get("region"),car);  
125 - xl.add(map);  
126 - }  
127 - return xl;  
128 - }  
129 -  
130 -  
131 -}  
src/main/java/com/bsth/server_rs/qh_data/ScheduleRealInfo_JK.java deleted 100644 → 0
1 -package com.bsth.server_rs.qh_data;  
2 -  
3 -import com.bsth.entity.ChildTaskPlan;  
4 -import com.bsth.entity.ScheduleRealInfo;  
5 -  
6 -import javax.xml.bind.annotation.XmlRootElement;  
7 -import java.io.Serializable;  
8 -import java.util.*;  
9 -  
10 -/**  
11 - * 输出给监控平台的实际排班  
12 - * Created by panzhao on 2017/8/30.  
13 - */  
14 -@XmlRootElement  
15 -public class ScheduleRealInfo_JK implements Serializable {  
16 -  
17 - public static List<ScheduleRealInfo_JK> getMultiInstance(List<ScheduleRealInfo> list) {  
18 -  
19 - List<ScheduleRealInfo_JK> rs = new ArrayList<>();  
20 -  
21 - if(list == null || list.size()==0)  
22 - return rs;  
23 - Collections.sort(list, new Comparator<ScheduleRealInfo>() {  
24 - @Override  
25 - public int compare(ScheduleRealInfo o1, ScheduleRealInfo o2) {  
26 - return o1.getFcsj().compareTo(o2.getFcsj());  
27 - }  
28 - });  
29 -  
30 - for (ScheduleRealInfo sch : list) {  
31 - rs.add(new ScheduleRealInfo_JK(sch));  
32 - }  
33 - return rs;  
34 - }  
35 -  
36 - ScheduleRealInfo_JK() {  
37 - }  
38 -  
39 - ScheduleRealInfo_JK(ScheduleRealInfo sch) {  
40 - this.id = sch.getId();  
41 - this.scheduleDate = sch.getScheduleDateStr();  
42 - this.lineName = sch.getXlName();  
43 - this.lineCode = sch.getXlBm();  
44 - this.lpName = sch.getLpName();  
45 - this.nbbm = sch.getClZbh();  
46 - this.jsy = sch.getjGh() + "/" + sch.getjName();  
47 - this.spy = sch.getsGh() + "/" + sch.getsName();  
48 - this.upDown = Integer.parseInt(sch.getXlDir());  
49 - this.qdzCode = sch.getQdzCode();  
50 - this.qdzName = sch.getQdzName();  
51 - this.zdzCode = sch.getZdzCode();  
52 - this.zdzName = sch.getZdzName();  
53 - this.fcsjT = sch.getFcsjT();  
54 - this.dfsjT = sch.getDfsjT();  
55 - this.zdsjT = sch.getZdsjT();  
56 - this.fcsjActualTime = sch.getFcsjActualTime();  
57 - this.zdsjActualTime = sch.getZdsjActualTime();  
58 - this.jhlc = sch.getJhlc();  
59 - this.jhlcOrig = sch.getJhlcOrig();  
60 - this.bcsj = sch.getBcsj();  
61 - //this.bcType = sch.getBcType();  
62 - //this.status = sch.getStatus();  
63 - this.adjustExps = sch.getAdjustExps();  
64 - //this.sflj = sch.isSflj();  
65 - this.remarks = sch.getRemarks();  
66 - //this.cTasks = sch.getcTasks();  
67 - this.updateDate = sch.getUpdateDate().getTime();  
68 - }  
69 -  
70 - private Long id;  
71 -  
72 - private String scheduleDate;  
73 -  
74 - /**  
75 - * 线路名称  
76 - */  
77 - private String lineName;  
78 - /**  
79 - * 线路编码  
80 - */  
81 - private String lineCode;  
82 -  
83 - /**  
84 - * 路牌名称  
85 - */  
86 - private String lpName;  
87 -  
88 - /**  
89 - * 车辆自编号  
90 - */  
91 - private String nbbm;  
92 -  
93 - /**  
94 - * 驾驶员工号/名称  
95 - */  
96 - private String jsy;  
97 - /**  
98 - * 售票员工号/名称  
99 - */  
100 - private String spy;  
101 -  
102 - /**  
103 - * 线路方向  
104 - */  
105 - private Integer upDown;  
106 - /**  
107 - * 起点站code  
108 - */  
109 - private String qdzCode;  
110 - /**  
111 - * 起点站名字  
112 - */  
113 - private String qdzName;  
114 -  
115 - /**  
116 - * 终点站code  
117 - */  
118 - private String zdzCode;  
119 - /**  
120 - * 终点站名字  
121 - */  
122 - private String zdzName;  
123 -  
124 - /**  
125 - * 计划发车时间戳  
126 - */  
127 - private Long fcsjT;  
128 - /**  
129 - * 待发时间戳  
130 - */  
131 - private Long dfsjT;  
132 - /**  
133 - * 计划终点时间戳  
134 - */  
135 - private Long zdsjT;  
136 -  
137 - /**  
138 - * 实际发车时间戳  
139 - */  
140 - private Long fcsjActualTime;  
141 - /**  
142 - * 实际终点时间戳  
143 - */  
144 - private Long zdsjActualTime;  
145 -  
146 - /**  
147 - * 实际计划里程  
148 - */  
149 - private Double jhlc;  
150 -  
151 - /**  
152 - * 计划里程  
153 - */  
154 - private Double jhlcOrig;  
155 -  
156 - /**  
157 - * 班次历时  
158 - */  
159 - private Integer bcsj;  
160 -  
161 - /**  
162 - * 班次类型 TODO:正常班次、出场、进场、加油、区间班次、放空班次、放大站班次、两点间空驶  
163 - */  
164 - private String bcType;  
165 -  
166 -  
167 - /**  
168 - * 班次状态 0 未执行 1 正在执行 2 已执行 -1 已烂班  
169 - */  
170 - private int status;  
171 -  
172 - private String adjustExps;  
173 -  
174 - /**  
175 - * 是否是临加班次  
176 - */  
177 - private boolean sflj;  
178 -  
179 - /**  
180 - * 备注  
181 - */  
182 - private String remarks;  
183 -  
184 - private Double oilConsum;  
185 - private Double elecConsum;  
186 - private Double h2Consum;  
187 - private Long updateDate;  
188 -  
189 - /**  
190 - * 子任务  
191 - */  
192 - private Set<ChildTaskPlan> cTasks;  
193 -  
194 - public Long getId() {  
195 - return id;  
196 - }  
197 -  
198 - public void setId(Long id) {  
199 - this.id = id;  
200 - }  
201 -  
202 - public String getScheduleDate() {  
203 - return scheduleDate;  
204 - }  
205 -  
206 - public void setScheduleDate(String scheduleDate) {  
207 - this.scheduleDate = scheduleDate;  
208 - }  
209 -  
210 - public String getLineName() {  
211 - return lineName;  
212 - }  
213 -  
214 - public void setLineName(String lineName) {  
215 - this.lineName = lineName;  
216 - }  
217 -  
218 - public String getLineCode() {  
219 - return lineCode;  
220 - }  
221 -  
222 - public void setLineCode(String lineCode) {  
223 - this.lineCode = lineCode;  
224 - }  
225 -  
226 - public String getLpName() {  
227 - return lpName;  
228 - }  
229 -  
230 - public void setLpName(String lpName) {  
231 - this.lpName = lpName;  
232 - }  
233 -  
234 - public String getNbbm() {  
235 - return nbbm;  
236 - }  
237 -  
238 - public void setNbbm(String nbbm) {  
239 - this.nbbm = nbbm;  
240 - }  
241 -  
242 - public String getJsy() {  
243 - return jsy;  
244 - }  
245 -  
246 - public void setJsy(String jsy) {  
247 - this.jsy = jsy;  
248 - }  
249 -  
250 - public String getSpy() {  
251 - return spy;  
252 - }  
253 -  
254 - public void setSpy(String spy) {  
255 - this.spy = spy;  
256 - }  
257 -  
258 - public String getQdzCode() {  
259 - return qdzCode;  
260 - }  
261 -  
262 - public void setQdzCode(String qdzCode) {  
263 - this.qdzCode = qdzCode;  
264 - }  
265 -  
266 - public String getQdzName() {  
267 - return qdzName;  
268 - }  
269 -  
270 - public void setQdzName(String qdzName) {  
271 - this.qdzName = qdzName;  
272 - }  
273 -  
274 - public String getZdzCode() {  
275 - return zdzCode;  
276 - }  
277 -  
278 - public void setZdzCode(String zdzCode) {  
279 - this.zdzCode = zdzCode;  
280 - }  
281 -  
282 - public String getZdzName() {  
283 - return zdzName;  
284 - }  
285 -  
286 - public void setZdzName(String zdzName) {  
287 - this.zdzName = zdzName;  
288 - }  
289 -  
290 - public Long getFcsjT() {  
291 - return fcsjT;  
292 - }  
293 -  
294 - public void setFcsjT(Long fcsjT) {  
295 - this.fcsjT = fcsjT;  
296 - }  
297 -  
298 - public Long getDfsjT() {  
299 - return dfsjT;  
300 - }  
301 -  
302 - public void setDfsjT(Long dfsjT) {  
303 - this.dfsjT = dfsjT;  
304 - }  
305 -  
306 - public Long getZdsjT() {  
307 - return zdsjT;  
308 - }  
309 -  
310 - public void setZdsjT(Long zdsjT) {  
311 - this.zdsjT = zdsjT;  
312 - }  
313 -  
314 - public Long getFcsjActualTime() {  
315 - return fcsjActualTime;  
316 - }  
317 -  
318 - public void setFcsjActualTime(Long fcsjActualTime) {  
319 - this.fcsjActualTime = fcsjActualTime;  
320 - }  
321 -  
322 - public Long getZdsjActualTime() {  
323 - return zdsjActualTime;  
324 - }  
325 -  
326 - public void setZdsjActualTime(Long zdsjActualTime) {  
327 - this.zdsjActualTime = zdsjActualTime;  
328 - }  
329 -  
330 - public Double getJhlc() {  
331 - return jhlc;  
332 - }  
333 -  
334 - public void setJhlc(Double jhlc) {  
335 - this.jhlc = jhlc;  
336 - }  
337 -  
338 - public Double getJhlcOrig() {  
339 - return jhlcOrig;  
340 - }  
341 -  
342 - public void setJhlcOrig(Double jhlcOrig) {  
343 - this.jhlcOrig = jhlcOrig;  
344 - }  
345 -  
346 - public Integer getBcsj() {  
347 - return bcsj;  
348 - }  
349 -  
350 - public void setBcsj(Integer bcsj) {  
351 - this.bcsj = bcsj;  
352 - }  
353 -  
354 - public String getBcType() {  
355 - return bcType;  
356 - }  
357 -  
358 - public void setBcType(String bcType) {  
359 - this.bcType = bcType;  
360 - }  
361 -  
362 - public int getStatus() {  
363 - return status;  
364 - }  
365 -  
366 - public void setStatus(int status) {  
367 - this.status = status;  
368 - }  
369 -  
370 - public String getAdjustExps() {  
371 - return adjustExps;  
372 - }  
373 -  
374 - public void setAdjustExps(String adjustExps) {  
375 - this.adjustExps = adjustExps;  
376 - }  
377 -  
378 - public boolean isSflj() {  
379 - return sflj;  
380 - }  
381 -  
382 - public void setSflj(boolean sflj) {  
383 - this.sflj = sflj;  
384 - }  
385 -  
386 - public String getRemarks() {  
387 - return remarks;  
388 - }  
389 -  
390 - public void setRemarks(String remarks) {  
391 - this.remarks = remarks;  
392 - }  
393 -  
394 - public Set<ChildTaskPlan> getcTasks() {  
395 - return cTasks;  
396 - }  
397 -  
398 - public void setcTasks(Set<ChildTaskPlan> cTasks) {  
399 - this.cTasks = cTasks;  
400 - }  
401 -  
402 - public Integer getUpDown() {  
403 - return upDown;  
404 - }  
405 -  
406 - public void setUpDown(Integer upDown) {  
407 - this.upDown = upDown;  
408 - }  
409 -  
410 - public Double getOilConsum() {  
411 - return oilConsum;  
412 - }  
413 -  
414 - public void setOilConsum(Double oilConsum) {  
415 - this.oilConsum = oilConsum;  
416 - }  
417 -  
418 - public Double getElecConsum() {  
419 - return elecConsum;  
420 - }  
421 -  
422 - public void setElecConsum(Double elecConsum) {  
423 - this.elecConsum = elecConsum;  
424 - }  
425 -  
426 - public Double getH2Consum() {  
427 - return h2Consum;  
428 - }  
429 -  
430 - public void setH2Consum(Double h2Consum) {  
431 - this.h2Consum = h2Consum;  
432 - }  
433 -  
434 - public Long getUpdateDate() {  
435 - return updateDate;  
436 - }  
437 -  
438 - public void setUpdateDate(Long updateDate) {  
439 - this.updateDate = updateDate;  
440 - }  
441 -}  
src/main/java/com/bsth/server_rs/schedule/plan/SchedulePlanService.java
@@ -53,6 +53,21 @@ public class SchedulePlanService { @@ -53,6 +53,21 @@ public class SchedulePlanService {
53 } 53 }
54 54
55 @GET 55 @GET
  56 + @Path("/sch_jk_line/{company}/{rq}/{lineCode}")
  57 + public List<PlanScheduleDTO_JK> find_JK_line(@PathParam("company") String company, @PathParam("rq") String rq, @PathParam("lineCode") String lineCode){
  58 + List<PlanScheduleDTO_JK> all = new ArrayList<>();
  59 +
  60 + List<Line> lines = LineBufferData.findByCompany(company);
  61 + for(Line line : lines){
  62 + if(line.getLineCode().equals(lineCode)){
  63 + all.addAll(PlanScheduleDTO_JK.getMultiInstance(redisService.read(rq, line.getLineCode())));
  64 + }
  65 + }
  66 + return all;
  67 + }
  68 +
  69 +
  70 + @GET
56 @Path("/ycqts/{company}/{month}") 71 @Path("/ycqts/{company}/{month}")
57 public List<AttendancePlanMonth> count_ycqts(@PathParam("company") String company,@PathParam("month") String month){ 72 public List<AttendancePlanMonth> count_ycqts(@PathParam("company") String company,@PathParam("month") String month){
58 try { 73 try {