Commit 6ce26eb8e46d34fc12b008628fc8e8d1a42ae199
1 parent
8084303a
1.zyl接口加入电量信息
Showing
8 changed files
with
14 additions
and
99 deletions
src/main/java/com/bsth/CXFConfig.java
| ... | ... | @@ -15,6 +15,7 @@ import com.bsth.server_rs.exception.AesExceptionMapper; |
| 15 | 15 | import com.bsth.server_rs.gps.GpsRestService; |
| 16 | 16 | import com.bsth.server_rs.schedule.SchedulePlanService; |
| 17 | 17 | import com.bsth.server_rs.schedule.ScheduleRealService; |
| 18 | +import com.bsth.server_rs.schedule.ScheduleTimeService; | |
| 18 | 19 | import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; |
| 19 | 20 | import org.apache.cxf.Bus; |
| 20 | 21 | import org.apache.cxf.bus.spring.SpringBus; |
| ... | ... | @@ -58,6 +59,8 @@ public class CXFConfig { |
| 58 | 59 | private DestroyDetailRestService destroyDetailRestService; |
| 59 | 60 | @Autowired |
| 60 | 61 | private CarparkRestService carparkRestService; |
| 62 | + @Autowired | |
| 63 | + private ScheduleTimeService scheduleTimeService; | |
| 61 | 64 | |
| 62 | 65 | @Bean |
| 63 | 66 | public Server rsServer() { |
| ... | ... | @@ -76,7 +79,8 @@ public class CXFConfig { |
| 76 | 79 | directiveRestService, |
| 77 | 80 | ld_roadSpeedRestService, |
| 78 | 81 | destroyDetailRestService, |
| 79 | - carparkRestService)); | |
| 82 | + carparkRestService, | |
| 83 | + scheduleTimeService)); | |
| 80 | 84 | endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); |
| 81 | 85 | endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); |
| 82 | 86 | return endpoint.create(); | ... | ... |
src/main/java/com/bsth/server_rs/base_info/car/CarRestService.java
| ... | ... | @@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; |
| 14 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 15 | import org.springframework.jdbc.core.BatchPreparedStatementSetter; |
| 16 | 16 | import org.springframework.jdbc.core.JdbcTemplate; |
| 17 | +import org.springframework.stereotype.Component; | |
| 17 | 18 | |
| 18 | 19 | import javax.ws.rs.*; |
| 19 | 20 | import javax.ws.rs.core.MediaType; |
| ... | ... | @@ -26,6 +27,7 @@ import java.util.Map; |
| 26 | 27 | /** |
| 27 | 28 | * Created by panzhao on 2017/3/30. |
| 28 | 29 | */ |
| 30 | +@Component | |
| 29 | 31 | @Path("/vehicle") |
| 30 | 32 | @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) |
| 31 | 33 | public class CarRestService { | ... | ... |
src/main/java/com/bsth/server_rs/base_info/line/LineRestService.java
| ... | ... | @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; |
| 10 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | 11 | import org.springframework.jdbc.core.BatchPreparedStatementSetter; |
| 12 | 12 | import org.springframework.jdbc.core.JdbcTemplate; |
| 13 | +import org.springframework.stereotype.Component; | |
| 13 | 14 | |
| 14 | 15 | import javax.ws.rs.*; |
| 15 | 16 | import javax.ws.rs.core.MediaType; |
| ... | ... | @@ -21,6 +22,7 @@ import java.util.*; |
| 21 | 22 | * 线路 Rest Service |
| 22 | 23 | * Created by panzhao on 2017/3/27. |
| 23 | 24 | */ |
| 25 | +@Component | |
| 24 | 26 | @Path("/line") |
| 25 | 27 | @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) |
| 26 | 28 | public class LineRestService { | ... | ... |
src/main/java/com/bsth/server_rs/base_info/person/PersonRestService.java
| ... | ... | @@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory; |
| 14 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | 15 | import org.springframework.jdbc.core.BatchPreparedStatementSetter; |
| 16 | 16 | import org.springframework.jdbc.core.JdbcTemplate; |
| 17 | +import org.springframework.stereotype.Component; | |
| 17 | 18 | |
| 18 | 19 | import javax.ws.rs.*; |
| 19 | 20 | import javax.ws.rs.core.MediaType; |
| ... | ... | @@ -26,6 +27,7 @@ import java.util.Map; |
| 26 | 27 | /** |
| 27 | 28 | * Created by panzhao on 2017/3/28. |
| 28 | 29 | */ |
| 30 | +@Component | |
| 29 | 31 | @Path("/employee") |
| 30 | 32 | @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) |
| 31 | 33 | public class PersonRestService { | ... | ... |
src/main/java/com/bsth/server_rs/destroy/DestroyDetailRestService.java deleted
100644 → 0
| 1 | -package com.bsth.server_rs.destroy; | |
| 2 | - | |
| 3 | -import com.bsth.entity.DestroySituation; | |
| 4 | -import com.bsth.entity.ScheduleRealInfo; | |
| 5 | -import com.bsth.repository.DestroySituationRepository; | |
| 6 | -import com.bsth.repository.ScheduleRealInfoRepository; | |
| 7 | -import com.bsth.server_rs.base_info.car.Car; | |
| 8 | -import com.bsth.server_rs.base_info.car.buffer.CarBufferData; | |
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | -import org.springframework.stereotype.Component; | |
| 11 | - | |
| 12 | -import javax.ws.rs.GET; | |
| 13 | -import javax.ws.rs.Path; | |
| 14 | -import javax.ws.rs.PathParam; | |
| 15 | -import javax.ws.rs.Produces; | |
| 16 | -import javax.ws.rs.core.MediaType; | |
| 17 | -import java.util.ArrayList; | |
| 18 | -import java.util.HashMap; | |
| 19 | -import java.util.List; | |
| 20 | -import java.util.Map; | |
| 21 | - | |
| 22 | -/** | |
| 23 | - * @author hill | |
| 24 | - * @date | |
| 25 | - */ | |
| 26 | -@Component | |
| 27 | -@Path("/destroy") | |
| 28 | -@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) | |
| 29 | -public class DestroyDetailRestService { | |
| 30 | - | |
| 31 | - @Autowired | |
| 32 | - private DestroySituationRepository destroySituationRepository; | |
| 33 | - | |
| 34 | - @Autowired | |
| 35 | - private ScheduleRealInfoRepository scheduleRealInfoRepository; | |
| 36 | - | |
| 37 | - private static Map<String, String> COMPANY_CODE2NAME; | |
| 38 | - | |
| 39 | - static { | |
| 40 | - COMPANY_CODE2NAME = new HashMap<>(); | |
| 41 | - COMPANY_CODE2NAME.put("55", "上南公司"); | |
| 42 | - COMPANY_CODE2NAME.put("22", "金高公司"); | |
| 43 | - COMPANY_CODE2NAME.put("05", "杨高公司"); | |
| 44 | - COMPANY_CODE2NAME.put("26", "南汇公司"); | |
| 45 | - COMPANY_CODE2NAME.put("05_1", "川沙分公司"); | |
| 46 | - COMPANY_CODE2NAME.put("05_6", "周浦分公司"); | |
| 47 | - COMPANY_CODE2NAME.put("05_2", "金桥分公司"); | |
| 48 | - COMPANY_CODE2NAME.put("05_3", "芦潮港分公司"); | |
| 49 | - COMPANY_CODE2NAME.put("05_5", "杨高分公司"); | |
| 50 | - COMPANY_CODE2NAME.put("22_5", "一分公司"); | |
| 51 | - COMPANY_CODE2NAME.put("22_1", "四分公司"); | |
| 52 | - COMPANY_CODE2NAME.put("22_3", "三分公司"); | |
| 53 | - COMPANY_CODE2NAME.put("22_2", "二分公司"); | |
| 54 | - COMPANY_CODE2NAME.put("26_2", "南汇二分"); | |
| 55 | - COMPANY_CODE2NAME.put("26_5", "南汇公司"); | |
| 56 | - COMPANY_CODE2NAME.put("26_1", "南汇一分"); | |
| 57 | - COMPANY_CODE2NAME.put("26_6", "南汇六分"); | |
| 58 | - COMPANY_CODE2NAME.put("26_3", "南汇三分"); | |
| 59 | - COMPANY_CODE2NAME.put("26_7", "南汇五分"); | |
| 60 | - COMPANY_CODE2NAME.put("26_4", "南汇维修公司"); | |
| 61 | - COMPANY_CODE2NAME.put("55_2", "上南三分公司"); | |
| 62 | - COMPANY_CODE2NAME.put("55_3", "上南六分公司"); | |
| 63 | - COMPANY_CODE2NAME.put("55_1", "上南二分公司"); | |
| 64 | - COMPANY_CODE2NAME.put("55_4", "上南一分公司"); | |
| 65 | - } | |
| 66 | - | |
| 67 | - @GET | |
| 68 | - @Path("/accident/{rq}") | |
| 69 | - public List<Map<String, Object>> waybill(@PathParam("rq") String rq) { | |
| 70 | - List<Map<String, Object>> result = new ArrayList<>(); | |
| 71 | - | |
| 72 | - for (DestroySituation destroySituation : destroySituationRepository.findByDateAndReason(rq, "肇事")) { | |
| 73 | - Map<String, Object> map = new HashMap<>(); | |
| 74 | - String nbbm = destroySituation.getNbbm(), ids = destroySituation.getIdsStr(); | |
| 75 | - String gsBm = destroySituation.getGsBm(), fgsBm = destroySituation.getFgsBm(); | |
| 76 | - Car car = CarBufferData.findOne(nbbm); | |
| 77 | - ScheduleRealInfo scheduleRealInfo = scheduleRealInfoRepository.findOne(Long.parseLong(ids.split(",")[0])); | |
| 78 | - | |
| 79 | - map.put("company", COMPANY_CODE2NAME.get(gsBm)); | |
| 80 | - map.put("branch", COMPANY_CODE2NAME.get(gsBm + "_" + fgsBm)); | |
| 81 | - map.put("line", destroySituation.getLineName()); | |
| 82 | - map.put("plate", car.getCarPlate()); | |
| 83 | - map.put("incode", nbbm); | |
| 84 | - map.put("driver", destroySituation.getjGh()); | |
| 85 | - map.put("direction", scheduleRealInfo == null ? "" : (scheduleRealInfo.getQdzName() + "->" + scheduleRealInfo.getZdzName())); | |
| 86 | - map.put("remark", destroySituation.getRemark()); | |
| 87 | - result.add(map); | |
| 88 | - } | |
| 89 | - | |
| 90 | - return result; | |
| 91 | - } | |
| 92 | -} |
src/main/java/com/bsth/server_rs/schedule/SchedulePlanService.java
| ... | ... | @@ -2,8 +2,6 @@ package com.bsth.server_rs.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.ScheduleRealInfo; |
| 4 | 4 | import com.bsth.server_rs.gps.buffer.BasicDataBuffer; |
| 5 | -import com.bsth.server_rs.gps.buffer.GpsRealDataBuffer; | |
| 6 | -import com.bsth.server_rs.gps.entity.GpsEntity; | |
| 7 | 5 | import com.fasterxml.jackson.core.JsonProcessingException; |
| 8 | 6 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 9 | 7 | import org.slf4j.Logger; |
| ... | ... | @@ -13,7 +11,9 @@ import org.springframework.jdbc.core.BatchPreparedStatementSetter; |
| 13 | 11 | import org.springframework.jdbc.core.JdbcTemplate; |
| 14 | 12 | import org.springframework.stereotype.Component; |
| 15 | 13 | |
| 16 | -import javax.ws.rs.*; | |
| 14 | +import javax.ws.rs.POST; | |
| 15 | +import javax.ws.rs.Path; | |
| 16 | +import javax.ws.rs.Produces; | |
| 17 | 17 | import javax.ws.rs.core.MediaType; |
| 18 | 18 | import java.sql.PreparedStatement; |
| 19 | 19 | import java.sql.SQLException; | ... | ... |
src/main/java/com/bsth/server_rs/schedule/ScheduleRealService.java
| 1 | 1 | package com.bsth.server_rs.schedule; |
| 2 | 2 | |
| 3 | 3 | import com.bsth.entity.ScheduleExec; |
| 4 | -import com.bsth.entity.ScheduleRealInfo; | |
| 5 | 4 | import com.bsth.server_rs.gps.buffer.BasicDataBuffer; |
| 6 | 5 | import com.fasterxml.jackson.core.JsonProcessingException; |
| 7 | 6 | import com.fasterxml.jackson.databind.ObjectMapper; | ... | ... |
src/main/java/com/bsth/server_rs/schedule/ScheduleTimeService.java
| 1 | 1 | package com.bsth.server_rs.schedule; |
| 2 | 2 | |
| 3 | -import com.bsth.entity.ScheduleRealInfo; | |
| 4 | 3 | import com.bsth.entity.TimeTable; |
| 5 | 4 | import com.bsth.entity.TimeTableDetail; |
| 6 | -import com.bsth.server_rs.gps.buffer.BasicDataBuffer; | |
| 7 | 5 | import com.fasterxml.jackson.core.JsonProcessingException; |
| 8 | 6 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 9 | 7 | import org.slf4j.Logger; | ... | ... |