Commit dd8abac865b393db45bca5c05f7d23c51026a4fa

Authored by 王通
1 parent 130ef664

1.external加入路单数据

src/main/java/com/bsth/server_rs/dks/BxRestService.java
1 package com.bsth.server_rs.dks; 1 package com.bsth.server_rs.dks;
2 2
  3 +import com.bsth.entity.ScheduleRealInfo;
  4 +import com.bsth.redis.ScheduleRedisService;
  5 +import com.bsth.repository.ScheduleRealInfoRepository;
3 import com.bsth.server_rs.AuthorizeInterceptor_IN; 6 import com.bsth.server_rs.AuthorizeInterceptor_IN;
4 import com.bsth.server_rs.base_info.car.Car; 7 import com.bsth.server_rs.base_info.car.Car;
5 import com.bsth.server_rs.base_info.car.buffer.CarBufferData; 8 import com.bsth.server_rs.base_info.car.buffer.CarBufferData;
@@ -16,8 +19,12 @@ import com.bsth.server_rs.gps.buffer.GpsRealDataBuffer; @@ -16,8 +19,12 @@ import com.bsth.server_rs.gps.buffer.GpsRealDataBuffer;
16 import com.bsth.server_rs.gps.dao.HistoryGpsDao; 19 import com.bsth.server_rs.gps.dao.HistoryGpsDao;
17 import com.bsth.server_rs.gps.entity.GpsEntity; 20 import com.bsth.server_rs.gps.entity.GpsEntity;
18 import com.bsth.server_rs.gps.entity.HistoryArrivalEntity; 21 import com.bsth.server_rs.gps.entity.HistoryArrivalEntity;
  22 +import com.bsth.server_rs.schedule.dto.ScheduleRealInfoDTO_JK;
19 import com.bsth.util.ThreadLocalUtils; 23 import com.bsth.util.ThreadLocalUtils;
20 import org.apache.commons.lang3.StringUtils; 24 import org.apache.commons.lang3.StringUtils;
  25 +import org.joda.time.DateTime;
  26 +import org.joda.time.format.DateTimeFormat;
  27 +import org.joda.time.format.DateTimeFormatter;
21 import org.slf4j.Logger; 28 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory; 29 import org.slf4j.LoggerFactory;
23 import org.springframework.beans.factory.annotation.Autowired; 30 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,6 +54,12 @@ public class BxRestService { @@ -47,6 +54,12 @@ public class BxRestService {
47 @Autowired 54 @Autowired
48 private AuthorizeInterceptor_IN authorizeInterceptorIn; 55 private AuthorizeInterceptor_IN authorizeInterceptorIn;
49 56
  57 + @Autowired
  58 + private ScheduleRealInfoRepository scheduleRealInfoRepository;
  59 +
  60 + @Autowired
  61 + private ScheduleRedisService scheduleRedisService;
  62 +
50 @GET 63 @GET
51 @Path("/line") 64 @Path("/line")
52 public List<Map<String, Object>> findAllLine() { 65 public List<Map<String, Object>> findAllLine() {
@@ -282,6 +295,26 @@ public class BxRestService { @@ -282,6 +295,26 @@ public class BxRestService {
282 } 295 }
283 296
284 @GET 297 @GET
  298 + @Path("/waybill/{company}/{rq}")
  299 + public List<ScheduleRealInfoDTO_JK> sch_jk(@PathParam("company") String company, @PathParam("rq") String rq) {
  300 + DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyyMMdd");
  301 + DateTime dateTime = fmt.parseDateTime(rq);
  302 + if (!dateTime.isBefore(DateTime.now().withTimeAtStartOfDay())) {
  303 + return new ArrayList<>();
  304 + }
  305 + List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.findByDateAndCompany(dateTime.toString("yyyy-MM-dd"), company);
  306 + scheduleRedisService.calcTime(scheduleRealInfos);
  307 + List<ScheduleRealInfoDTO_JK> result = ScheduleRealInfoDTO_JK.getMultiInstance(scheduleRealInfos);
  308 + for (ScheduleRealInfoDTO_JK jk : result) {
  309 + if (jk.getZdsjActualTime() == null) {
  310 + jk.setZdsjActualTime(jk.getZdsjT());
  311 + }
  312 + }
  313 +
  314 + return result;
  315 + }
  316 +
  317 + @GET
285 @Path("/limits/reload") 318 @Path("/limits/reload")
286 public void reload() { 319 public void reload() {
287 String password = ThreadLocalUtils.getPassword(); 320 String password = ThreadLocalUtils.getPassword();