Commit ce2c5420a1955f2d4da71ba07b70ce27cc4475d3
1 parent
a4467a3b
1.加入信息发布准确率接口,index.html名称变更(防漏扫)
Showing
6 changed files
with
666 additions
and
176 deletions
src/main/java/com/bsth/CXFConfig.java
| 1 | -package com.bsth; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -import com.bsth.server_rs.AuthorizeInterceptor_IN; | ||
| 5 | -import com.bsth.server_rs.base_info.car.CarRestService; | ||
| 6 | -import com.bsth.server_rs.base_info.carpark.CarparkRestService; | ||
| 7 | -import com.bsth.server_rs.base_info.line.LineRestService; | ||
| 8 | -import com.bsth.server_rs.base_info.person.PersonRestService; | ||
| 9 | -import com.bsth.server_rs.base_info.section.LD_RoadSpeedRestService; | ||
| 10 | -import com.bsth.server_rs.base_info.section.LD_SectionRestService; | ||
| 11 | -import com.bsth.server_rs.base_info.station.StationRestService; | ||
| 12 | -import com.bsth.server_rs.bigdata.BigdataService; | ||
| 13 | -import com.bsth.server_rs.bigdata.BigscreenService; | ||
| 14 | -import com.bsth.server_rs.departure.DepartureRestService; | ||
| 15 | -import com.bsth.server_rs.destroy.DestroyDetailRestService; | ||
| 16 | -import com.bsth.server_rs.directive.DirectiveRestService; | ||
| 17 | -import com.bsth.server_rs.dks.DksRestService; | ||
| 18 | -import com.bsth.server_rs.electric.ElectricService; | ||
| 19 | -import com.bsth.server_rs.exception.AesExceptionMapper; | ||
| 20 | -import com.bsth.server_rs.gps.GpsRestService; | ||
| 21 | -import com.bsth.server_rs.logs.RealLogRestService; | ||
| 22 | -import com.bsth.server_rs.rate.RateService; | ||
| 23 | -import com.bsth.server_rs.schedule.plan.SchedulePlanService; | ||
| 24 | -import com.bsth.server_rs.schedule.real.ScheduleRealService; | ||
| 25 | -import com.bsth.server_rs.schedule.real.StaffViewRealService; | ||
| 26 | -import com.bsth.server_rs.waybill.WaybillRestService; | ||
| 27 | -import com.bsth.server_ws.attendance.AttendanceServiceSoap; | ||
| 28 | -import com.bsth.server_ws.electric_oil.OilServiceSoap; | ||
| 29 | -import com.bsth.server_ws.park_station.CompanyServiceSoap; | ||
| 30 | -import com.bsth.server_ws.waybill.LD_ServiceSoap; | ||
| 31 | -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; | ||
| 32 | -import org.apache.cxf.Bus; | ||
| 33 | -import org.apache.cxf.bus.spring.SpringBus; | ||
| 34 | -import org.apache.cxf.endpoint.Server; | ||
| 35 | -import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; | ||
| 36 | -import org.apache.cxf.jaxws.EndpointImpl; | ||
| 37 | -import org.apache.cxf.transport.servlet.CXFServlet; | ||
| 38 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 39 | -import org.springframework.boot.web.servlet.ServletRegistrationBean; | ||
| 40 | -import org.springframework.context.annotation.Bean; | ||
| 41 | -import org.springframework.context.annotation.Configuration; | ||
| 42 | -import org.springframework.core.Ordered; | ||
| 43 | - | ||
| 44 | -import javax.xml.ws.Endpoint; | ||
| 45 | -import java.util.Arrays; | ||
| 46 | - | ||
| 47 | -/** | ||
| 48 | - * Created by panzhao on 2017/3/9. | ||
| 49 | - */ | ||
| 50 | -@Configuration | ||
| 51 | -public class CXFConfig { | ||
| 52 | - | ||
| 53 | - @Bean(name = Bus.DEFAULT_BUS_ID) | ||
| 54 | - public SpringBus springBus() { | ||
| 55 | - return new SpringBus(); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - @Autowired | ||
| 59 | - CompanyServiceSoap companyServiceSoap; | ||
| 60 | - @Autowired | ||
| 61 | - LD_ServiceSoap ld_serviceSoap; | ||
| 62 | - @Autowired | ||
| 63 | - AttendanceServiceSoap attendanceServiceSoap; | ||
| 64 | - @Autowired | ||
| 65 | - OilServiceSoap oilServiceSoap; | ||
| 66 | - | ||
| 67 | - @Bean | ||
| 68 | - public Endpoint companyEndpoint() { | ||
| 69 | - EndpointImpl endpoint = new EndpointImpl(springBus(), companyServiceSoap); | ||
| 70 | - endpoint.publish("/CompanyService"); | ||
| 71 | - //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 72 | - return endpoint; | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - @Bean | ||
| 76 | - public Endpoint ldServiceEndpoint() { | ||
| 77 | - EndpointImpl endpoint = new EndpointImpl(springBus(), ld_serviceSoap); | ||
| 78 | - endpoint.publish("/LD_Service"); | ||
| 79 | - //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 80 | - return endpoint; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - @Bean | ||
| 84 | - public Endpoint attendanceServiceEndpoint() { | ||
| 85 | - EndpointImpl endpoint = new EndpointImpl(springBus(), attendanceServiceSoap); | ||
| 86 | - endpoint.publish("/attendanceService"); | ||
| 87 | - //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 88 | - return endpoint; | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - @Bean | ||
| 92 | - public Endpoint electricServiceEndpoint() { | ||
| 93 | - EndpointImpl endpoint = new EndpointImpl(springBus(), oilServiceSoap); | ||
| 94 | - endpoint.publish("/oilServiceSoap"); | ||
| 95 | - //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 96 | - return endpoint; | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - @Autowired | ||
| 100 | - ScheduleRealService scheduleRealService; | ||
| 101 | - @Autowired | ||
| 102 | - StationRestService stationRestService; | ||
| 103 | - @Autowired | ||
| 104 | - LD_SectionRestService ldSectionRestService; | ||
| 105 | - @Autowired | ||
| 106 | - SchedulePlanService schedulePlanService; | ||
| 107 | - @Autowired | ||
| 108 | - RealLogRestService realLogRestService; | ||
| 109 | - @Autowired | ||
| 110 | - GpsRestService gpsRestService; | ||
| 111 | - @Autowired | ||
| 112 | - WaybillRestService waybillRestService; | ||
| 113 | - @Autowired | ||
| 114 | - DirectiveRestService directiveRestService; | ||
| 115 | - @Autowired | ||
| 116 | - LD_RoadSpeedRestService ld_roadSpeedRestService; | ||
| 117 | - @Autowired | ||
| 118 | - ElectricService electricService; | ||
| 119 | - @Autowired | ||
| 120 | - BigdataService bigdataService; | ||
| 121 | - @Autowired | ||
| 122 | - BigscreenService bigscreenService; | ||
| 123 | - @Autowired | ||
| 124 | - StaffViewRealService staffViewRealService; | ||
| 125 | - @Autowired | ||
| 126 | - RateService rateService; | ||
| 127 | - @Autowired | ||
| 128 | - private DestroyDetailRestService destroyDetailRestService; | ||
| 129 | - @Autowired | ||
| 130 | - private CarparkRestService carparkRestService; | ||
| 131 | - @Autowired | ||
| 132 | - private DepartureRestService departureRestService; | ||
| 133 | - @Autowired | ||
| 134 | - private DksRestService dksRestService; | ||
| 135 | - | ||
| 136 | - @Bean | ||
| 137 | - public Server rsServer() { | ||
| 138 | - JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); | ||
| 139 | - endpoint.setBus(springBus()); | ||
| 140 | - endpoint.setAddress("/rest"); | ||
| 141 | - endpoint.setServiceBeans(Arrays.<Object>asList( | ||
| 142 | - new LineRestService(), | ||
| 143 | - new CarRestService(), | ||
| 144 | - new PersonRestService(), | ||
| 145 | - gpsRestService, | ||
| 146 | - waybillRestService, | ||
| 147 | - scheduleRealService, | ||
| 148 | - stationRestService, | ||
| 149 | - ldSectionRestService, | ||
| 150 | - schedulePlanService, | ||
| 151 | - realLogRestService, | ||
| 152 | - directiveRestService, | ||
| 153 | - ld_roadSpeedRestService, | ||
| 154 | - electricService, | ||
| 155 | - staffViewRealService, | ||
| 156 | - bigdataService, | ||
| 157 | - bigscreenService, | ||
| 158 | - rateService, | ||
| 159 | - destroyDetailRestService, | ||
| 160 | - carparkRestService, | ||
| 161 | - departureRestService, | ||
| 162 | - dksRestService)); | ||
| 163 | - endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); | ||
| 164 | - //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); | ||
| 165 | - endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); | ||
| 166 | - return endpoint.create(); | ||
| 167 | - } | ||
| 168 | - | ||
| 169 | - @Bean | ||
| 170 | - public ServletRegistrationBean servletRegistrationBean() { | ||
| 171 | - ServletRegistrationBean bean = new ServletRegistrationBean(new CXFServlet(), "/webservice/*"); | ||
| 172 | - bean.setLoadOnStartup(0); | ||
| 173 | - bean.setOrder(Ordered.HIGHEST_PRECEDENCE); | ||
| 174 | - return bean; | ||
| 175 | - } | ||
| 176 | -} | 1 | +package com.bsth; |
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.bsth.server_rs.AuthorizeInterceptor_IN; | ||
| 5 | +import com.bsth.server_rs.base_info.car.CarRestService; | ||
| 6 | +import com.bsth.server_rs.base_info.carpark.CarparkRestService; | ||
| 7 | +import com.bsth.server_rs.base_info.line.LineRestService; | ||
| 8 | +import com.bsth.server_rs.base_info.person.PersonRestService; | ||
| 9 | +import com.bsth.server_rs.base_info.section.LD_RoadSpeedRestService; | ||
| 10 | +import com.bsth.server_rs.base_info.section.LD_SectionRestService; | ||
| 11 | +import com.bsth.server_rs.base_info.station.StationRestService; | ||
| 12 | +import com.bsth.server_rs.bigdata.BigdataService; | ||
| 13 | +import com.bsth.server_rs.bigdata.BigscreenService; | ||
| 14 | +import com.bsth.server_rs.departure.DepartureRestService; | ||
| 15 | +import com.bsth.server_rs.destroy.DestroyDetailRestService; | ||
| 16 | +import com.bsth.server_rs.directive.DirectiveRestService; | ||
| 17 | +import com.bsth.server_rs.dks.DksRestService; | ||
| 18 | +import com.bsth.server_rs.electric.ElectricService; | ||
| 19 | +import com.bsth.server_rs.exception.AesExceptionMapper; | ||
| 20 | +import com.bsth.server_rs.gps.GpsRestService; | ||
| 21 | +import com.bsth.server_rs.info_publish.XxfbRestService; | ||
| 22 | +import com.bsth.server_rs.logs.RealLogRestService; | ||
| 23 | +import com.bsth.server_rs.rate.RateService; | ||
| 24 | +import com.bsth.server_rs.schedule.plan.SchedulePlanService; | ||
| 25 | +import com.bsth.server_rs.schedule.real.ScheduleRealService; | ||
| 26 | +import com.bsth.server_rs.schedule.real.StaffViewRealService; | ||
| 27 | +import com.bsth.server_rs.waybill.WaybillRestService; | ||
| 28 | +import com.bsth.server_ws.attendance.AttendanceServiceSoap; | ||
| 29 | +import com.bsth.server_ws.electric_oil.OilServiceSoap; | ||
| 30 | +import com.bsth.server_ws.park_station.CompanyServiceSoap; | ||
| 31 | +import com.bsth.server_ws.waybill.LD_ServiceSoap; | ||
| 32 | +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; | ||
| 33 | +import org.apache.cxf.Bus; | ||
| 34 | +import org.apache.cxf.bus.spring.SpringBus; | ||
| 35 | +import org.apache.cxf.endpoint.Server; | ||
| 36 | +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; | ||
| 37 | +import org.apache.cxf.jaxws.EndpointImpl; | ||
| 38 | +import org.apache.cxf.transport.servlet.CXFServlet; | ||
| 39 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 40 | +import org.springframework.boot.web.servlet.ServletRegistrationBean; | ||
| 41 | +import org.springframework.context.annotation.Bean; | ||
| 42 | +import org.springframework.context.annotation.Configuration; | ||
| 43 | +import org.springframework.core.Ordered; | ||
| 44 | + | ||
| 45 | +import javax.xml.ws.Endpoint; | ||
| 46 | +import java.util.Arrays; | ||
| 47 | + | ||
| 48 | +/** | ||
| 49 | + * Created by panzhao on 2017/3/9. | ||
| 50 | + */ | ||
| 51 | +@Configuration | ||
| 52 | +public class CXFConfig { | ||
| 53 | + | ||
| 54 | + @Bean(name = Bus.DEFAULT_BUS_ID) | ||
| 55 | + public SpringBus springBus() { | ||
| 56 | + return new SpringBus(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Autowired | ||
| 60 | + CompanyServiceSoap companyServiceSoap; | ||
| 61 | + @Autowired | ||
| 62 | + LD_ServiceSoap ld_serviceSoap; | ||
| 63 | + @Autowired | ||
| 64 | + AttendanceServiceSoap attendanceServiceSoap; | ||
| 65 | + @Autowired | ||
| 66 | + OilServiceSoap oilServiceSoap; | ||
| 67 | + | ||
| 68 | + @Bean | ||
| 69 | + public Endpoint companyEndpoint() { | ||
| 70 | + EndpointImpl endpoint = new EndpointImpl(springBus(), companyServiceSoap); | ||
| 71 | + endpoint.publish("/CompanyService"); | ||
| 72 | + //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 73 | + return endpoint; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @Bean | ||
| 77 | + public Endpoint ldServiceEndpoint() { | ||
| 78 | + EndpointImpl endpoint = new EndpointImpl(springBus(), ld_serviceSoap); | ||
| 79 | + endpoint.publish("/LD_Service"); | ||
| 80 | + //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 81 | + return endpoint; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @Bean | ||
| 85 | + public Endpoint attendanceServiceEndpoint() { | ||
| 86 | + EndpointImpl endpoint = new EndpointImpl(springBus(), attendanceServiceSoap); | ||
| 87 | + endpoint.publish("/attendanceService"); | ||
| 88 | + //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 89 | + return endpoint; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + @Bean | ||
| 93 | + public Endpoint electricServiceEndpoint() { | ||
| 94 | + EndpointImpl endpoint = new EndpointImpl(springBus(), oilServiceSoap); | ||
| 95 | + endpoint.publish("/oilServiceSoap"); | ||
| 96 | + //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 97 | + return endpoint; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Autowired | ||
| 101 | + ScheduleRealService scheduleRealService; | ||
| 102 | + @Autowired | ||
| 103 | + StationRestService stationRestService; | ||
| 104 | + @Autowired | ||
| 105 | + LD_SectionRestService ldSectionRestService; | ||
| 106 | + @Autowired | ||
| 107 | + SchedulePlanService schedulePlanService; | ||
| 108 | + @Autowired | ||
| 109 | + RealLogRestService realLogRestService; | ||
| 110 | + @Autowired | ||
| 111 | + GpsRestService gpsRestService; | ||
| 112 | + @Autowired | ||
| 113 | + WaybillRestService waybillRestService; | ||
| 114 | + @Autowired | ||
| 115 | + DirectiveRestService directiveRestService; | ||
| 116 | + @Autowired | ||
| 117 | + LD_RoadSpeedRestService ld_roadSpeedRestService; | ||
| 118 | + @Autowired | ||
| 119 | + ElectricService electricService; | ||
| 120 | + @Autowired | ||
| 121 | + BigdataService bigdataService; | ||
| 122 | + @Autowired | ||
| 123 | + BigscreenService bigscreenService; | ||
| 124 | + @Autowired | ||
| 125 | + StaffViewRealService staffViewRealService; | ||
| 126 | + @Autowired | ||
| 127 | + RateService rateService; | ||
| 128 | + @Autowired | ||
| 129 | + private DestroyDetailRestService destroyDetailRestService; | ||
| 130 | + @Autowired | ||
| 131 | + private CarparkRestService carparkRestService; | ||
| 132 | + @Autowired | ||
| 133 | + private DepartureRestService departureRestService; | ||
| 134 | + @Autowired | ||
| 135 | + private DksRestService dksRestService; | ||
| 136 | + @Autowired | ||
| 137 | + private XxfbRestService xxfbRestService; | ||
| 138 | + | ||
| 139 | + @Bean | ||
| 140 | + public Server rsServer() { | ||
| 141 | + JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); | ||
| 142 | + endpoint.setBus(springBus()); | ||
| 143 | + endpoint.setAddress("/rest"); | ||
| 144 | + endpoint.setServiceBeans(Arrays.<Object>asList( | ||
| 145 | + new LineRestService(), | ||
| 146 | + new CarRestService(), | ||
| 147 | + new PersonRestService(), | ||
| 148 | + gpsRestService, | ||
| 149 | + waybillRestService, | ||
| 150 | + scheduleRealService, | ||
| 151 | + stationRestService, | ||
| 152 | + ldSectionRestService, | ||
| 153 | + schedulePlanService, | ||
| 154 | + realLogRestService, | ||
| 155 | + directiveRestService, | ||
| 156 | + ld_roadSpeedRestService, | ||
| 157 | + electricService, | ||
| 158 | + staffViewRealService, | ||
| 159 | + bigdataService, | ||
| 160 | + bigscreenService, | ||
| 161 | + rateService, | ||
| 162 | + destroyDetailRestService, | ||
| 163 | + carparkRestService, | ||
| 164 | + departureRestService, | ||
| 165 | + dksRestService, | ||
| 166 | + xxfbRestService)); | ||
| 167 | + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); | ||
| 168 | + //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); | ||
| 169 | + endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); | ||
| 170 | + return endpoint.create(); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + @Bean | ||
| 174 | + public ServletRegistrationBean servletRegistrationBean() { | ||
| 175 | + ServletRegistrationBean bean = new ServletRegistrationBean(new CXFServlet(), "/webservice/*"); | ||
| 176 | + bean.setLoadOnStartup(0); | ||
| 177 | + bean.setOrder(Ordered.HIGHEST_PRECEDENCE); | ||
| 178 | + return bean; | ||
| 179 | + } | ||
| 180 | +} |
src/main/java/com/bsth/server_rs/info_publish/Accuracy.java
0 → 100644
| 1 | +package com.bsth.server_rs.info_publish; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | + | ||
| 5 | +public class Accuracy { | ||
| 6 | + | ||
| 7 | + private int rq; | ||
| 8 | + | ||
| 9 | + private String lineCode; | ||
| 10 | + | ||
| 11 | + private String lineName; | ||
| 12 | + | ||
| 13 | + @JsonIgnore | ||
| 14 | + private int zfbs; | ||
| 15 | + | ||
| 16 | + @JsonIgnore | ||
| 17 | + private int jdzqs; | ||
| 18 | + | ||
| 19 | + @JsonIgnore | ||
| 20 | + private int xdzqs; | ||
| 21 | + | ||
| 22 | + private double jdzql; | ||
| 23 | + | ||
| 24 | + private double xdzql; | ||
| 25 | + | ||
| 26 | + public int getRq() { | ||
| 27 | + return rq; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + public void setRq(int rq) { | ||
| 31 | + this.rq = rq; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public String getLineCode() { | ||
| 35 | + return lineCode; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setLineCode(String lineCode) { | ||
| 39 | + this.lineCode = lineCode; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public String getLineName() { | ||
| 43 | + return lineName; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void setLineName(String lineName) { | ||
| 47 | + this.lineName = lineName; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public int getZfbs() { | ||
| 51 | + return zfbs; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public void setZfbs(int zfbs) { | ||
| 55 | + this.zfbs = zfbs; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public int getJdzqs() { | ||
| 59 | + return jdzqs; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + public void setJdzqs(int jdzqs) { | ||
| 63 | + this.jdzqs = jdzqs; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public int getXdzqs() { | ||
| 67 | + return xdzqs; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + public void setXdzqs(int xdzqs) { | ||
| 71 | + this.xdzqs = xdzqs; | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + public double getJdzql() { | ||
| 75 | + return jdzql; | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public void setJdzql(double jdzql) { | ||
| 79 | + this.jdzql = jdzql; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public double getXdzql() { | ||
| 83 | + return xdzql; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public void setXdzql(double xdzql) { | ||
| 87 | + this.xdzql = xdzql; | ||
| 88 | + } | ||
| 89 | +} |
src/main/java/com/bsth/server_rs/info_publish/XxfbRestService.java
0 → 100644
| 1 | +package com.bsth.server_rs.info_publish; | ||
| 2 | + | ||
| 3 | +import com.bsth.entity.DutyEmployee; | ||
| 4 | +import com.bsth.entity.ScheduleRealInfo; | ||
| 5 | +import com.bsth.util.DBUtils_Xxfb; | ||
| 6 | +import com.google.common.collect.ArrayListMultimap; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.jdbc.core.BeanPropertyRowMapper; | ||
| 10 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 11 | +import org.springframework.stereotype.Component; | ||
| 12 | + | ||
| 13 | +import javax.ws.rs.GET; | ||
| 14 | +import javax.ws.rs.Path; | ||
| 15 | +import javax.ws.rs.PathParam; | ||
| 16 | +import javax.ws.rs.Produces; | ||
| 17 | +import javax.ws.rs.core.MediaType; | ||
| 18 | +import java.util.*; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * @author Hill. | ||
| 22 | + */ | ||
| 23 | +@Component | ||
| 24 | +@Path("/xxfb") | ||
| 25 | +@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) | ||
| 26 | +public class XxfbRestService { | ||
| 27 | + | ||
| 28 | + private static Logger logger = LoggerFactory.getLogger(XxfbRestService.class); | ||
| 29 | + | ||
| 30 | + @GET | ||
| 31 | + @Path("/{rq}/{lineCode}") | ||
| 32 | + public Map<String, Object> waybill(@PathParam("rq") int rq, @PathParam("lineCode") String lineCode) { | ||
| 33 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 34 | + map.put("errCode", "0"); | ||
| 35 | + try { | ||
| 36 | + JdbcTemplate jdbcTemplate = DBUtils_Xxfb.getJdbcTemplate(); | ||
| 37 | + List<Accuracy> accuracies = jdbcTemplate.query("select * from bsth_h_accuracy where rq = ? and line_code = ? order by rq, line_code", new Object[] { rq, lineCode }, BeanPropertyRowMapper.newInstance(Accuracy.class)); | ||
| 38 | + map.put("data", accuracies); | ||
| 39 | + } catch (Exception e) { | ||
| 40 | + logger.error("", e); | ||
| 41 | + map.put("errCode", 1); | ||
| 42 | + map.put("errMsg", "服务器出现异常!"); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + return map; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @GET | ||
| 49 | + @Path("/{rq}") | ||
| 50 | + public Map<String, Object> waybill(@PathParam("rq") int rq) { | ||
| 51 | + Map<String, Object> map = new HashMap<String, Object>(); | ||
| 52 | + map.put("errCode", "0"); | ||
| 53 | + try { | ||
| 54 | + JdbcTemplate jdbcTemplate = DBUtils_Xxfb.getJdbcTemplate(); | ||
| 55 | + List<Accuracy> accuracies = jdbcTemplate.query("select * from bsth_h_accuracy where rq = ? order by rq, line_code", new Object[] { rq }, BeanPropertyRowMapper.newInstance(Accuracy.class)); | ||
| 56 | + map.put("data", accuracies); | ||
| 57 | + } catch (Exception e) { | ||
| 58 | + logger.error("", e); | ||
| 59 | + map.put("errCode", 1); | ||
| 60 | + map.put("errMsg", "服务器出现异常!"); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + return map; | ||
| 64 | + } | ||
| 65 | +} |
src/main/java/com/bsth/util/DBUtils_Xxfb.java
0 → 100644
| 1 | +package com.bsth.util; | ||
| 2 | + | ||
| 3 | +import com.mchange.v2.c3p0.DataSources; | ||
| 4 | +import org.apache.log4j.Logger; | ||
| 5 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 6 | + | ||
| 7 | +import javax.sql.DataSource; | ||
| 8 | +import java.io.FileNotFoundException; | ||
| 9 | +import java.io.IOException; | ||
| 10 | +import java.sql.Connection; | ||
| 11 | +import java.sql.ResultSet; | ||
| 12 | +import java.sql.SQLException; | ||
| 13 | +import java.sql.Statement; | ||
| 14 | +import java.util.HashMap; | ||
| 15 | +import java.util.Map; | ||
| 16 | +import java.util.Properties; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 网关ms库连接池 | ||
| 20 | + * @author PanZhao | ||
| 21 | + * | ||
| 22 | + */ | ||
| 23 | +//@Component | ||
| 24 | +public class DBUtils_Xxfb { | ||
| 25 | + | ||
| 26 | + private static String url = null; | ||
| 27 | + | ||
| 28 | + private static String username = null; | ||
| 29 | + | ||
| 30 | + private static String pwd = null; | ||
| 31 | + | ||
| 32 | + private static DataSource ds_pooled; | ||
| 33 | + | ||
| 34 | + static Logger logger = Logger.getLogger(DBUtils_Xxfb.class); | ||
| 35 | + | ||
| 36 | + private static JdbcTemplate jdbcTemplate; | ||
| 37 | + | ||
| 38 | + static { | ||
| 39 | + Properties env = new Properties(); | ||
| 40 | + | ||
| 41 | + try { | ||
| 42 | + env.load(DBUtils_Xxfb.class.getClassLoader().getResourceAsStream("xxfb-jdbc.properties")); | ||
| 43 | + // 1. 加载驱动类 | ||
| 44 | + Class.forName(env.getProperty("xxfb.mysql.driver")); | ||
| 45 | + | ||
| 46 | + url = env.getProperty("xxfb.mysql.url"); | ||
| 47 | + username = env.getProperty("xxfb.mysql.username"); | ||
| 48 | + pwd = env.getProperty("xxfb.mysql.password"); | ||
| 49 | + | ||
| 50 | + // 设置连接数据库的配置信息 | ||
| 51 | + DataSource ds_unpooled = DataSources.unpooledDataSource(url, | ||
| 52 | + username, pwd); | ||
| 53 | + | ||
| 54 | + Map<String, Object> pool_conf = new HashMap<String, Object>(); | ||
| 55 | + // 设置最大连接数 | ||
| 56 | + pool_conf.put("maxPoolSize", 10); | ||
| 57 | + | ||
| 58 | + pool_conf.put("testConnectionOnCheckout", false); | ||
| 59 | + //异步检测连接的有效性 | ||
| 60 | + pool_conf.put("testConnectionOnCheckin", true); | ||
| 61 | + //30秒检测一次 | ||
| 62 | + pool_conf.put("idleConnectionTestPeriod", 30); | ||
| 63 | + ds_pooled = DataSources.pooledDataSource(ds_unpooled, pool_conf); | ||
| 64 | + jdbcTemplate = new JdbcTemplate(ds_unpooled); | ||
| 65 | + } catch (FileNotFoundException e) { | ||
| 66 | + logger.error(e.toString()); | ||
| 67 | + e.printStackTrace(); | ||
| 68 | + } catch (IOException e) { | ||
| 69 | + logger.error(e.toString()); | ||
| 70 | + e.printStackTrace(); | ||
| 71 | + } catch (ClassNotFoundException e) { | ||
| 72 | + logger.error(e.toString()); | ||
| 73 | + e.printStackTrace(); | ||
| 74 | + } catch (SQLException e) { | ||
| 75 | + logger.error(e.toString()); | ||
| 76 | + e.printStackTrace(); | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * 获取连接对象 | ||
| 82 | + */ | ||
| 83 | + public static Connection getConnection() throws SQLException { | ||
| 84 | + return ds_pooled.getConnection(); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * 释放连接池资源 | ||
| 89 | + */ | ||
| 90 | + public static void clearup() { | ||
| 91 | + if (ds_pooled != null) { | ||
| 92 | + try { | ||
| 93 | + DataSources.destroy(ds_pooled); | ||
| 94 | + } catch (SQLException e) { | ||
| 95 | + logger.error(e.toString()); | ||
| 96 | + e.printStackTrace(); | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + /** | ||
| 102 | + * 资源关闭 | ||
| 103 | + * | ||
| 104 | + * @param rs | ||
| 105 | + * @param stmt | ||
| 106 | + * @param conn | ||
| 107 | + */ | ||
| 108 | + public static void close(ResultSet rs, Statement stmt, Connection conn) { | ||
| 109 | + if (rs != null) { | ||
| 110 | + try { | ||
| 111 | + rs.close(); | ||
| 112 | + } catch (SQLException e) { | ||
| 113 | + logger.error(e.toString()); | ||
| 114 | + e.printStackTrace(); | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + if (stmt != null) { | ||
| 119 | + try { | ||
| 120 | + stmt.close(); | ||
| 121 | + } catch (SQLException e) { | ||
| 122 | + logger.error(e.toString()); | ||
| 123 | + e.printStackTrace(); | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + if (conn != null) { | ||
| 128 | + try { | ||
| 129 | + conn.close(); | ||
| 130 | + } catch (SQLException e) { | ||
| 131 | + logger.error(e.toString()); | ||
| 132 | + e.printStackTrace(); | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public static DataSource getDataSource(){ | ||
| 138 | + return ds_pooled; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public static JdbcTemplate getJdbcTemplate() { | ||
| 142 | + return jdbcTemplate; | ||
| 143 | + } | ||
| 144 | +} |
src/main/resources/static/38876A3F404F7051776B6717C83B581B.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html> | ||
| 3 | +<head> | ||
| 4 | +<title>调度系统营运数据接口</title> | ||
| 5 | +<meta charset="utf-8"> | ||
| 6 | +<meta http-equiv="Expires" content="0"> | ||
| 7 | +<meta http-equiv="Pragma" content="no-cache"> | ||
| 8 | +<meta http-equiv="Cache-control" content="no-cache"> | ||
| 9 | +<meta http-equiv="Cache" content="no-cache"> | ||
| 10 | +<link rel="stylesheet" | ||
| 11 | + href="http://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css"> | ||
| 12 | +<link rel="stylesheet" href="/simple_switch/simple.switch.three.css"> | ||
| 13 | +<style> | ||
| 14 | +.table-wrap { | ||
| 15 | + height: 500px; | ||
| 16 | + overflow: auto; | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +#line2SysListTable .Switch_FlatRadius .SwitchLine:before { | ||
| 20 | + content: "老系统"; | ||
| 21 | +} | ||
| 22 | + | ||
| 23 | +#line2SysListTable .Switch_FlatRadius .SwitchLine:after { | ||
| 24 | + content: "新系统"; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +#line2SysListTable .Switch_FlatRadius { | ||
| 28 | + width: 118px; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +#line2SysListTable .Switch_FlatRadius .SwitchButton { | ||
| 32 | + width: 52px; | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | +#line2SysListTable .Switch_FlatRadius .SwitchButton:before { | ||
| 36 | + left: 18px; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +#line2SysListTable .Switch_FlatRadius .SwitchButton:after { | ||
| 40 | + left: 30px; | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +#line2SysListTable .Switch_FlatRadius.On .SwitchButton { | ||
| 44 | + left: 60px; | ||
| 45 | +} | ||
| 46 | +</style> | ||
| 47 | +</head> | ||
| 48 | + | ||
| 49 | +<body> | ||
| 50 | + | ||
| 51 | + <div class="row" style="margin: 15px;"> | ||
| 52 | + <div class="col-md-12 well"> | ||
| 53 | + <h4> | ||
| 54 | + Available SOAP services: <a href="/webservice" target="_blank">/webservice</a> | ||
| 55 | + </h4> | ||
| 56 | + <h4> | ||
| 57 | + WSDL: <a href="/webservice/CompanyService?wsdl" target="_blank">/webservice/CompanyService?wsdl</a> | ||
| 58 | + </h4> | ||
| 59 | + </div> | ||
| 60 | + | ||
| 61 | + <div class="col-lg-4 col-md-6 col-sm-12"> | ||
| 62 | + <div class="bs-example" | ||
| 63 | + data-example-id="panel-without-body-with-table"> | ||
| 64 | + <div class="panel panel-default"> | ||
| 65 | + <!-- Default panel contents --> | ||
| 66 | + <div class="panel-heading">线路清单</div> | ||
| 67 | + <div class="panel-body"> | ||
| 68 | + <p style="color: #ff2727;">屏蔽新老系统的底层数据差异,对外提供统一的数据输出</p> | ||
| 69 | + <p>1、使用员工号查询数据时,系统将参考 “线路人员配置” 以确定人员所在线路。</p> | ||
| 70 | + <p>2、使用公司编码查询数据时,系统将参考 “线路基础信息” 里的公司编码。</p> | ||
| 71 | + </div> | ||
| 72 | + <div class="table-wrap"> | ||
| 73 | + <table class="table" id="line2SysListTable"> | ||
| 74 | + <thead> | ||
| 75 | + <tr> | ||
| 76 | + <th>线路编码</th> | ||
| 77 | + <th>线路名称</th> | ||
| 78 | + <th>数据来源</th> | ||
| 79 | + </tr> | ||
| 80 | + </thead> | ||
| 81 | + <tbody> | ||
| 82 | + </tbody> | ||
| 83 | + </table> | ||
| 84 | + </div> | ||
| 85 | + </div> | ||
| 86 | + </div> | ||
| 87 | + </div> | ||
| 88 | + | ||
| 89 | + <div class="col-lg-8 col-md-6 col-sm-12"> | ||
| 90 | + <div class="bs-example"> | ||
| 91 | + <div class="panel panel-default"> | ||
| 92 | + <div class="panel-heading">接口调试工具</div> | ||
| 93 | + <div style="padding: 15px; margin-top: 15px;"> | ||
| 94 | + <form class="form-inline"> | ||
| 95 | + <div class="form-group"> | ||
| 96 | + <label>函数</label> <select class="form-control"> | ||
| 97 | + <option value="returnCCInfo">returnCCInfo(获取出场班次信息)</option> | ||
| 98 | + <option value="returnJCInfo">returnJCInfo(获取进场班次信息)</option> | ||
| 99 | + </select> | ||
| 100 | + </div> | ||
| 101 | + | ||
| 102 | + <div class="form-group"> | ||
| 103 | + <label>公司编码</label> <select class="form-control"> | ||
| 104 | + <option value="55">55(上南)</option> | ||
| 105 | + <option value="22">22(金高)</option> | ||
| 106 | + <option value="05">05(杨高)</option> | ||
| 107 | + <option value="26">26(南汇)</option> | ||
| 108 | + </select> | ||
| 109 | + </div> | ||
| 110 | + | ||
| 111 | + <div class="form-group"> | ||
| 112 | + <label>日期</label> <input type="date" class="form-control" | ||
| 113 | + style="width: 150px;" required> | ||
| 114 | + </div> | ||
| 115 | + <button type="submit" class="btn btn-primary">获取数据</button> | ||
| 116 | + | ||
| 117 | + <textarea class="form-control" rows="25" | ||
| 118 | + style="width: 100%; margin-top: 25px;"></textarea> | ||
| 119 | + </form> | ||
| 120 | + | ||
| 121 | + </div> | ||
| 122 | + </div> | ||
| 123 | + </div> | ||
| 124 | + </div> | ||
| 125 | + </div> | ||
| 126 | + | ||
| 127 | + <script id="line2sys-table-list-temp" type="text/html"> | ||
| 128 | + {{each list as obj i}} | ||
| 129 | + <tr data-id="{{obj.lineCode}}" data-name="{{obj.lineName}}" {{if obj.new}}class="warning" {{/if}} > | ||
| 130 | + <td>{{obj.lineCode}}</td> | ||
| 131 | + <td>{{obj.lineName}}</td> | ||
| 132 | + <td> | ||
| 133 | + <input type="checkbox" {{if obj.new}}checked{{/if}} /> | ||
| 134 | + </td> | ||
| 135 | + </tr> | ||
| 136 | + {{/each}} | ||
| 137 | +</script> | ||
| 138 | + | ||
| 139 | + <script src="http://apps.bdimg.com/libs/jquery/1.8.3/jquery.min.js"></script> | ||
| 140 | + <script | ||
| 141 | + src="http://apps.bdimg.com/libs/bootstrap/3.2.0/js/bootstrap.min.js"></script> | ||
| 142 | + <script src="/assets/js/template.js"></script> | ||
| 143 | + <script src="/simple_switch/simple.switch.min.js"></script> | ||
| 144 | + | ||
| 145 | + <script> | ||
| 146 | + | ||
| 147 | + //线路清单 | ||
| 148 | + !function () { | ||
| 149 | + var f = arguments.callee; | ||
| 150 | +/* $.get('/line2System/all', function (list) { | ||
| 151 | + list.sort(function (a, b) { | ||
| 152 | + return b.new - a.new; | ||
| 153 | + }); | ||
| 154 | + var htmlStr = template('line2sys-table-list-temp', {list: list}); | ||
| 155 | + $('#line2SysListTable tbody').html(htmlStr); | ||
| 156 | + | ||
| 157 | + $('input[type=checkbox]').simpleSwitch({ | ||
| 158 | + "theme": "FlatRadius" | ||
| 159 | + }); | ||
| 160 | + | ||
| 161 | + $('input[type=checkbox]').on('change', function () { | ||
| 162 | + var $tr = $(this).parents('tr'); | ||
| 163 | + var data = { | ||
| 164 | + lineCode: $tr.data('id'), | ||
| 165 | + lineName: $tr.data('name'), | ||
| 166 | + new: this.checked | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + $.post('/line2System/update', data, function (rs) { | ||
| 170 | + var $tr = $('#line2SysListTable tr[data-id=' + rs.lineCode + ']'); | ||
| 171 | + $tr.attr('class', rs.new ? 'warning' : ''); | ||
| 172 | + }); | ||
| 173 | + }); | ||
| 174 | + });*/ | ||
| 175 | + }(); | ||
| 176 | + | ||
| 177 | +</script> | ||
| 178 | +</body> | ||
| 179 | +</html> | ||
| 0 | \ No newline at end of file | 180 | \ No newline at end of file |
src/main/resources/xxfb-jdbc.properties
0 → 100644
| 1 | +#xxfb.mysql.driver= com.mysql.jdbc.Driver | ||
| 2 | +#xxfb.mysql.url= jdbc:mysql://127.0.0.1:3306/ms?useUnicode=true&characterEncoding=utf-8 | ||
| 3 | +#xxfb.mysql.username= root | ||
| 4 | +#xxfb.mysql.password= panzhao | ||
| 5 | + | ||
| 6 | +xxfb.mysql.driver= com.mysql.jdbc.Driver | ||
| 7 | +xxfb.mysql.url= jdbc:mysql://10.10.150.113/info_publish?useUnicode=true&characterEncoding=utf-8 | ||
| 8 | +xxfb.mysql.username= root | ||
| 9 | +xxfb.mysql.password= Aa123456 | ||
| 0 | \ No newline at end of file | 10 | \ No newline at end of file |