Commit 3ef833c60174e1a67e0b837f2ce1dd4e2217bca9
Merge branch 'master' of http://192.168.168.201:8888/panzhaov5/control_service_data_Interface
Showing
3 changed files
with
820 additions
and
143 deletions
src/main/java/com/bsth/CXFConfig.java
| 1 | -package com.bsth; | ||
| 2 | - | ||
| 3 | -import com.bsth.server_rs.AuthorizeInterceptor_IN; | ||
| 4 | -import com.bsth.server_rs.base_info.car.CarRestService; | ||
| 5 | -import com.bsth.server_rs.base_info.line.LineRestService; | ||
| 6 | -import com.bsth.server_rs.base_info.person.PersonRestService; | ||
| 7 | -import com.bsth.server_rs.base_info.section.LD_RoadSpeedRestService; | ||
| 8 | -import com.bsth.server_rs.base_info.section.LD_SectionRestService; | ||
| 9 | -import com.bsth.server_rs.base_info.station.StationRestService; | ||
| 10 | -import com.bsth.server_rs.directive.DirectiveRestService; | ||
| 11 | -import com.bsth.server_rs.electric.ElectricService; | ||
| 12 | -import com.bsth.server_rs.exception.AesExceptionMapper; | ||
| 13 | -import com.bsth.server_rs.gps.GpsRestService; | ||
| 14 | -import com.bsth.server_rs.logs.RealLogRestService; | ||
| 15 | -import com.bsth.server_rs.schedule.plan.SchedulePlanService; | ||
| 16 | -import com.bsth.server_rs.schedule.real.ScheduleRealService; | ||
| 17 | -import com.bsth.server_rs.schedule.real.StaffViewRealService; | ||
| 18 | -import com.bsth.server_ws.attendance.AttendanceServiceSoap; | ||
| 19 | -import com.bsth.server_ws.electric_oil.OilServiceSoap; | ||
| 20 | -import com.bsth.server_ws.park_station.CompanyServiceSoap; | ||
| 21 | -import com.bsth.server_ws.waybill.LD_ServiceSoap; | ||
| 22 | -import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; | ||
| 23 | -import org.apache.cxf.Bus; | ||
| 24 | -import org.apache.cxf.bus.spring.SpringBus; | ||
| 25 | -import org.apache.cxf.endpoint.Server; | ||
| 26 | -import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; | ||
| 27 | -import org.apache.cxf.jaxws.EndpointImpl; | ||
| 28 | -import org.apache.cxf.transport.servlet.CXFServlet; | ||
| 29 | -import org.springframework.beans.factory.annotation.Autowired; | ||
| 30 | -import org.springframework.boot.web.servlet.ServletRegistrationBean; | ||
| 31 | -import org.springframework.context.annotation.Bean; | ||
| 32 | -import org.springframework.context.annotation.Configuration; | ||
| 33 | -import org.springframework.core.Ordered; | ||
| 34 | - | ||
| 35 | -import javax.xml.ws.Endpoint; | ||
| 36 | -import java.util.Arrays; | ||
| 37 | - | ||
| 38 | -/** | ||
| 39 | - * Created by panzhao on 2017/3/9. | ||
| 40 | - */ | ||
| 41 | -@Configuration | ||
| 42 | -public class CXFConfig { | ||
| 43 | - | ||
| 44 | - @Bean(name = Bus.DEFAULT_BUS_ID) | ||
| 45 | - public SpringBus springBus() { | ||
| 46 | - return new SpringBus(); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - @Autowired | ||
| 50 | - CompanyServiceSoap companyServiceSoap; | ||
| 51 | - @Autowired | ||
| 52 | - LD_ServiceSoap ld_serviceSoap; | ||
| 53 | - @Autowired | ||
| 54 | - AttendanceServiceSoap attendanceServiceSoap; | ||
| 55 | - @Autowired | ||
| 56 | - OilServiceSoap oilServiceSoap; | ||
| 57 | - | ||
| 58 | - @Bean | ||
| 59 | - public Endpoint companyEndpoint() { | ||
| 60 | - EndpointImpl endpoint = new EndpointImpl(springBus(), companyServiceSoap); | ||
| 61 | - endpoint.publish("/CompanyService"); | ||
| 62 | - //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 63 | - return endpoint; | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - @Bean | ||
| 67 | - public Endpoint ldServiceEndpoint() { | ||
| 68 | - EndpointImpl endpoint = new EndpointImpl(springBus(), ld_serviceSoap); | ||
| 69 | - endpoint.publish("/LD_Service"); | ||
| 70 | - //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 71 | - return endpoint; | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - @Bean | ||
| 75 | - public Endpoint attendanceServiceEndpoint() { | ||
| 76 | - EndpointImpl endpoint = new EndpointImpl(springBus(), attendanceServiceSoap); | ||
| 77 | - endpoint.publish("/attendanceService"); | ||
| 78 | - //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 79 | - return endpoint; | ||
| 80 | - } | ||
| 81 | - | ||
| 82 | - @Bean | ||
| 83 | - public Endpoint electricServiceEndpoint() { | ||
| 84 | - EndpointImpl endpoint = new EndpointImpl(springBus(), oilServiceSoap); | ||
| 85 | - endpoint.publish("/oilServiceSoap"); | ||
| 86 | - //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 87 | - return endpoint; | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - @Autowired | ||
| 91 | - ScheduleRealService scheduleRealService; | ||
| 92 | - @Autowired | ||
| 93 | - StationRestService stationRestService; | ||
| 94 | - @Autowired | ||
| 95 | - LD_SectionRestService ldSectionRestService; | ||
| 96 | - @Autowired | ||
| 97 | - SchedulePlanService schedulePlanService; | ||
| 98 | - @Autowired | ||
| 99 | - RealLogRestService realLogRestService; | ||
| 100 | - @Autowired | ||
| 101 | - GpsRestService gpsRestService; | ||
| 102 | - @Autowired | ||
| 103 | - DirectiveRestService directiveRestService; | ||
| 104 | - @Autowired | ||
| 105 | - LD_RoadSpeedRestService ld_roadSpeedRestService; | ||
| 106 | - @Autowired | ||
| 107 | - ElectricService electricService; | ||
| 108 | - @Autowired | ||
| 109 | - StaffViewRealService staffViewRealService; | ||
| 110 | - | ||
| 111 | - @Bean | ||
| 112 | - public Server rsServer() { | ||
| 113 | - JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); | ||
| 114 | - endpoint.setBus(springBus()); | ||
| 115 | - endpoint.setAddress("/rest"); | ||
| 116 | - endpoint.setServiceBeans(Arrays.<Object>asList( | ||
| 117 | - new LineRestService(), | ||
| 118 | - new CarRestService(), | ||
| 119 | - new PersonRestService(), | ||
| 120 | - gpsRestService, | ||
| 121 | - scheduleRealService, | ||
| 122 | - stationRestService, | ||
| 123 | - ldSectionRestService, | ||
| 124 | - schedulePlanService, | ||
| 125 | - realLogRestService, | ||
| 126 | - directiveRestService, | ||
| 127 | - ld_roadSpeedRestService, | ||
| 128 | - electricService, | ||
| 129 | - staffViewRealService)); | ||
| 130 | - endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); | ||
| 131 | - //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); | ||
| 132 | - endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); | ||
| 133 | - return endpoint.create(); | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - @Bean | ||
| 137 | - public ServletRegistrationBean servletRegistrationBean() { | ||
| 138 | - ServletRegistrationBean bean = new ServletRegistrationBean(new CXFServlet(), "/webservice/*"); | ||
| 139 | - bean.setLoadOnStartup(0); | ||
| 140 | - bean.setOrder(Ordered.HIGHEST_PRECEDENCE); | ||
| 141 | - return bean; | ||
| 142 | - } | ||
| 143 | -} | 1 | +package com.bsth; |
| 2 | + | ||
| 3 | +import com.bsth.server_rs.AuthorizeInterceptor_IN; | ||
| 4 | +import com.bsth.server_rs.base_info.car.CarRestService; | ||
| 5 | +import com.bsth.server_rs.base_info.line.LineRestService; | ||
| 6 | +import com.bsth.server_rs.base_info.person.PersonRestService; | ||
| 7 | +import com.bsth.server_rs.base_info.section.LD_RoadSpeedRestService; | ||
| 8 | +import com.bsth.server_rs.base_info.section.LD_SectionRestService; | ||
| 9 | +import com.bsth.server_rs.base_info.station.StationRestService; | ||
| 10 | +import com.bsth.server_rs.bigdata.BigdateService; | ||
| 11 | +import com.bsth.server_rs.directive.DirectiveRestService; | ||
| 12 | +import com.bsth.server_rs.electric.ElectricService; | ||
| 13 | +import com.bsth.server_rs.exception.AesExceptionMapper; | ||
| 14 | +import com.bsth.server_rs.gps.GpsRestService; | ||
| 15 | +import com.bsth.server_rs.logs.RealLogRestService; | ||
| 16 | +import com.bsth.server_rs.schedule.plan.SchedulePlanService; | ||
| 17 | +import com.bsth.server_rs.schedule.real.ScheduleRealService; | ||
| 18 | +import com.bsth.server_rs.schedule.real.StaffViewRealService; | ||
| 19 | +import com.bsth.server_ws.attendance.AttendanceServiceSoap; | ||
| 20 | +import com.bsth.server_ws.electric_oil.OilServiceSoap; | ||
| 21 | +import com.bsth.server_ws.park_station.CompanyServiceSoap; | ||
| 22 | +import com.bsth.server_ws.waybill.LD_ServiceSoap; | ||
| 23 | +import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; | ||
| 24 | +import org.apache.cxf.Bus; | ||
| 25 | +import org.apache.cxf.bus.spring.SpringBus; | ||
| 26 | +import org.apache.cxf.endpoint.Server; | ||
| 27 | +import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; | ||
| 28 | +import org.apache.cxf.jaxws.EndpointImpl; | ||
| 29 | +import org.apache.cxf.transport.servlet.CXFServlet; | ||
| 30 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 31 | +import org.springframework.boot.web.servlet.ServletRegistrationBean; | ||
| 32 | +import org.springframework.context.annotation.Bean; | ||
| 33 | +import org.springframework.context.annotation.Configuration; | ||
| 34 | +import org.springframework.core.Ordered; | ||
| 35 | + | ||
| 36 | +import javax.xml.ws.Endpoint; | ||
| 37 | +import java.util.Arrays; | ||
| 38 | + | ||
| 39 | +/** | ||
| 40 | + * Created by panzhao on 2017/3/9. | ||
| 41 | + */ | ||
| 42 | +@Configuration | ||
| 43 | +public class CXFConfig { | ||
| 44 | + | ||
| 45 | + @Bean(name = Bus.DEFAULT_BUS_ID) | ||
| 46 | + public SpringBus springBus() { | ||
| 47 | + return new SpringBus(); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @Autowired | ||
| 51 | + CompanyServiceSoap companyServiceSoap; | ||
| 52 | + @Autowired | ||
| 53 | + LD_ServiceSoap ld_serviceSoap; | ||
| 54 | + @Autowired | ||
| 55 | + AttendanceServiceSoap attendanceServiceSoap; | ||
| 56 | + @Autowired | ||
| 57 | + OilServiceSoap oilServiceSoap; | ||
| 58 | + | ||
| 59 | + @Bean | ||
| 60 | + public Endpoint companyEndpoint() { | ||
| 61 | + EndpointImpl endpoint = new EndpointImpl(springBus(), companyServiceSoap); | ||
| 62 | + endpoint.publish("/CompanyService"); | ||
| 63 | + //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 64 | + return endpoint; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Bean | ||
| 68 | + public Endpoint ldServiceEndpoint() { | ||
| 69 | + EndpointImpl endpoint = new EndpointImpl(springBus(), ld_serviceSoap); | ||
| 70 | + endpoint.publish("/LD_Service"); | ||
| 71 | + //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 72 | + return endpoint; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Bean | ||
| 76 | + public Endpoint attendanceServiceEndpoint() { | ||
| 77 | + EndpointImpl endpoint = new EndpointImpl(springBus(), attendanceServiceSoap); | ||
| 78 | + endpoint.publish("/attendanceService"); | ||
| 79 | + //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 80 | + return endpoint; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Bean | ||
| 84 | + public Endpoint electricServiceEndpoint() { | ||
| 85 | + EndpointImpl endpoint = new EndpointImpl(springBus(), oilServiceSoap); | ||
| 86 | + endpoint.publish("/oilServiceSoap"); | ||
| 87 | + //endpoint.getInInterceptors().add(new AuthInterceptor()); | ||
| 88 | + return endpoint; | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @Autowired | ||
| 92 | + ScheduleRealService scheduleRealService; | ||
| 93 | + @Autowired | ||
| 94 | + StationRestService stationRestService; | ||
| 95 | + @Autowired | ||
| 96 | + LD_SectionRestService ldSectionRestService; | ||
| 97 | + @Autowired | ||
| 98 | + SchedulePlanService schedulePlanService; | ||
| 99 | + @Autowired | ||
| 100 | + RealLogRestService realLogRestService; | ||
| 101 | + @Autowired | ||
| 102 | + GpsRestService gpsRestService; | ||
| 103 | + @Autowired | ||
| 104 | + DirectiveRestService directiveRestService; | ||
| 105 | + @Autowired | ||
| 106 | + LD_RoadSpeedRestService ld_roadSpeedRestService; | ||
| 107 | + @Autowired | ||
| 108 | + ElectricService electricService; | ||
| 109 | + @Autowired | ||
| 110 | + BigdateService bigdateService; | ||
| 111 | + @Autowired | ||
| 112 | + StaffViewRealService staffViewRealService; | ||
| 113 | + | ||
| 114 | + @Bean | ||
| 115 | + public Server rsServer() { | ||
| 116 | + JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); | ||
| 117 | + endpoint.setBus(springBus()); | ||
| 118 | + endpoint.setAddress("/rest"); | ||
| 119 | + endpoint.setServiceBeans(Arrays.<Object>asList( | ||
| 120 | + new LineRestService(), | ||
| 121 | + new CarRestService(), | ||
| 122 | + new PersonRestService(), | ||
| 123 | + gpsRestService, | ||
| 124 | + scheduleRealService, | ||
| 125 | + stationRestService, | ||
| 126 | + ldSectionRestService, | ||
| 127 | + schedulePlanService, | ||
| 128 | + realLogRestService, | ||
| 129 | + directiveRestService, | ||
| 130 | + ld_roadSpeedRestService, | ||
| 131 | + electricService, | ||
| 132 | + staffViewRealService, | ||
| 133 | + bigdateService)); | ||
| 134 | + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); | ||
| 135 | + //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); | ||
| 136 | + endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); | ||
| 137 | + return endpoint.create(); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + @Bean | ||
| 141 | + public ServletRegistrationBean servletRegistrationBean() { | ||
| 142 | + ServletRegistrationBean bean = new ServletRegistrationBean(new CXFServlet(), "/webservice/*"); | ||
| 143 | + bean.setLoadOnStartup(0); | ||
| 144 | + bean.setOrder(Ordered.HIGHEST_PRECEDENCE); | ||
| 145 | + return bean; | ||
| 146 | + } | ||
| 147 | +} |
src/main/java/com/bsth/server_rs/bigdata/BigdateService.java
0 → 100644
| 1 | +package com.bsth.server_rs.bigdata; | ||
| 2 | + | ||
| 3 | +import java.sql.ResultSet; | ||
| 4 | +import java.sql.SQLException; | ||
| 5 | +import java.text.DecimalFormat; | ||
| 6 | +import java.util.HashMap; | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Map; | ||
| 9 | + | ||
| 10 | +import javax.ws.rs.GET; | ||
| 11 | +import javax.ws.rs.Path; | ||
| 12 | +import javax.ws.rs.PathParam; | ||
| 13 | +import javax.ws.rs.Produces; | ||
| 14 | +import javax.ws.rs.core.MediaType; | ||
| 15 | + | ||
| 16 | +import org.slf4j.Logger; | ||
| 17 | +import org.slf4j.LoggerFactory; | ||
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 19 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 20 | +import org.springframework.jdbc.core.RowMapper; | ||
| 21 | +import org.springframework.stereotype.Component; | ||
| 22 | + | ||
| 23 | +import com.alibaba.fastjson.JSONObject; | ||
| 24 | + | ||
| 25 | +@Component | ||
| 26 | +@Path("/bigdata") | ||
| 27 | +@Produces({MediaType.APPLICATION_JSON}) | ||
| 28 | +public class BigdateService { | ||
| 29 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 30 | + | ||
| 31 | + @Autowired | ||
| 32 | + JdbcTemplate jdbcTemplate; | ||
| 33 | + | ||
| 34 | + DecimalFormat df = new DecimalFormat("0.00"); | ||
| 35 | + | ||
| 36 | + /* | ||
| 37 | + * 线路接口开始 | ||
| 38 | + */ | ||
| 39 | + | ||
| 40 | + private static String getNature(String natureCode){ | ||
| 41 | + String natureName=""; | ||
| 42 | + if("lj".equals(natureCode)){ | ||
| 43 | + natureName="路救"; | ||
| 44 | + }else if("bc".equals(natureCode)){ | ||
| 45 | + natureName="备车"; | ||
| 46 | + }else if("dbc".equals(natureCode)){ | ||
| 47 | + natureName="定班车"; | ||
| 48 | + }else if("yxl".equals(natureCode)){ | ||
| 49 | + natureName="夜宵路"; | ||
| 50 | + }else if("cgxl".equals(natureCode)){ | ||
| 51 | + natureName="常规线路"; | ||
| 52 | + }else if("gjxl".equals(natureCode)){ | ||
| 53 | + natureName="过江线路"; | ||
| 54 | + }else if("csbs".equals(natureCode)){ | ||
| 55 | + natureName="穿梭巴士"; | ||
| 56 | + }else if("tyxl".equals(natureCode)){ | ||
| 57 | + natureName="特约线路"; | ||
| 58 | + }else if("cctxl".equals(natureCode)){ | ||
| 59 | + natureName="村村通线路"; | ||
| 60 | + }else if("qt".equals(natureCode)){ | ||
| 61 | + natureName="其他"; | ||
| 62 | + }else { | ||
| 63 | + natureName=""; | ||
| 64 | + } | ||
| 65 | + return natureName; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + private static String getGs(String gs){ | ||
| 69 | + String name=""; | ||
| 70 | + if("05".equals(gs)){ | ||
| 71 | + name="杨高公司"; | ||
| 72 | + }else if("22".equals(gs)){ | ||
| 73 | + name="金高公司"; | ||
| 74 | + }else if("26".equals(gs)){ | ||
| 75 | + name="南汇公司"; | ||
| 76 | + }else if("55".equals(gs)){ | ||
| 77 | + name="上南公司"; | ||
| 78 | + }else{ | ||
| 79 | + name=""; | ||
| 80 | + } | ||
| 81 | + return name; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + private static String getState(String carState){ | ||
| 85 | + if(carState.equals("1")){ | ||
| 86 | + return "在册未在用"; | ||
| 87 | + }else if(carState.equals("2")){ | ||
| 88 | + return "在册在用"; | ||
| 89 | + }else if(carState.equals("3")){ | ||
| 90 | + return "报废审核中"; | ||
| 91 | + }else if(carState.equals("4")){ | ||
| 92 | + return "报废待更新"; | ||
| 93 | + }else if(carState.equals("5")){ | ||
| 94 | + return "报废已更新"; | ||
| 95 | + }else{ | ||
| 96 | + return ""; | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + @GET | ||
| 100 | + @Path("/line/all") | ||
| 101 | + public List<Map<String, Object>> findLineAll(){ | ||
| 102 | + String sql="SELECT company,line_code,name,level,shanghai_linecode, nature from bsth_c_line where " | ||
| 103 | + + " shanghai_linecode is not null and shanghai_linecode !='' and destroy=0 and remove=0 "; | ||
| 104 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 105 | + new RowMapper<Map<String, Object>>(){ | ||
| 106 | + @Override | ||
| 107 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 108 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 109 | + m.put("company", rs.getString("company")); | ||
| 110 | + m.put("companyName", getGs(rs.getString("company"))); | ||
| 111 | + m.put("lineCode",rs.getString("line_code")); | ||
| 112 | + m.put("name", rs.getString("name")); | ||
| 113 | + m.put("level", rs.getString("level")); | ||
| 114 | + m.put("shanghaiLinecode", rs.getString("shanghai_linecode")); | ||
| 115 | + m.put("nature", getNature(rs.getString("nature"))); | ||
| 116 | + return m; | ||
| 117 | + } | ||
| 118 | + }); | ||
| 119 | + return list; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + | ||
| 123 | + @GET | ||
| 124 | + @Path("/line/company/{companyId}") | ||
| 125 | + public List<Map<String, Object>> findLineByCompany(@PathParam("companyId") String companyId) { | ||
| 126 | + String sql="SELECT company,line_code,name,level,shanghai_linecode, nature from bsth_c_line where " | ||
| 127 | + + " shanghai_linecode is not null and shanghai_linecode !='' and destroy=0 and remove=0 " | ||
| 128 | + + " and company = '"+companyId+"'"; | ||
| 129 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 130 | + new RowMapper<Map<String, Object>>(){ | ||
| 131 | + @Override | ||
| 132 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 133 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 134 | + m.put("company", rs.getString("company")); | ||
| 135 | + m.put("companyName", getGs(rs.getString("company"))); | ||
| 136 | + m.put("lineCode",rs.getString("line_code")); | ||
| 137 | + m.put("name", rs.getString("name")); | ||
| 138 | + m.put("level", rs.getString("level")); | ||
| 139 | + m.put("shanghaiLinecode", rs.getString("shanghai_linecode")); | ||
| 140 | + m.put("nature", getNature(rs.getString("nature"))); | ||
| 141 | + return m; | ||
| 142 | + } | ||
| 143 | + }); | ||
| 144 | + return list; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + @GET | ||
| 148 | + @Path("/line/{lineCode}") | ||
| 149 | + public List<Map<String, Object>> findLineByCode(@PathParam("lineCode") String lineCode) { | ||
| 150 | + String sql="SELECT company,line_code,name,level,shanghai_linecode, nature from bsth_c_line where " | ||
| 151 | + + " shanghai_linecode is not null and shanghai_linecode !='' and destroy=0 and remove=0 " | ||
| 152 | + + " and line_code = '"+lineCode+"'"; | ||
| 153 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 154 | + new RowMapper<Map<String, Object>>(){ | ||
| 155 | + @Override | ||
| 156 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 157 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 158 | + m.put("company", rs.getString("company")); | ||
| 159 | + m.put("companyName", getGs(rs.getString("company"))); | ||
| 160 | + m.put("lineCode",rs.getString("line_code")); | ||
| 161 | + m.put("name", rs.getString("name")); | ||
| 162 | + m.put("level", rs.getString("level")); | ||
| 163 | + m.put("shanghaiLinecode", rs.getString("shanghai_linecode")); | ||
| 164 | + m.put("nature", getNature(rs.getString("nature"))); | ||
| 165 | + return m; | ||
| 166 | + } | ||
| 167 | + }); | ||
| 168 | + return list; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + @GET | ||
| 172 | + @Path("/line/level/{level}") | ||
| 173 | + public List<Map<String, Object>> findLineByLevle(@PathParam("level") String level) { | ||
| 174 | + String sql="SELECT company,line_code,name,level,shanghai_linecode, nature from bsth_c_line where " | ||
| 175 | + + " shanghai_linecode is not null and shanghai_linecode !='' and destroy=0 and remove=0 " | ||
| 176 | + + " and level = '"+level+"'"; | ||
| 177 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 178 | + new RowMapper<Map<String, Object>>(){ | ||
| 179 | + @Override | ||
| 180 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 181 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 182 | + m.put("company", rs.getString("company")); | ||
| 183 | + m.put("companyName", getGs(rs.getString("company"))); | ||
| 184 | + m.put("lineCode",rs.getString("line_code")); | ||
| 185 | + m.put("name", rs.getString("name")); | ||
| 186 | + m.put("level", rs.getString("level")); | ||
| 187 | + m.put("shanghaiLinecode", rs.getString("shanghai_linecode")); | ||
| 188 | + m.put("nature", getNature(rs.getString("nature"))); | ||
| 189 | + return m; | ||
| 190 | + } | ||
| 191 | + }); | ||
| 192 | + return list; | ||
| 193 | + } | ||
| 194 | + /* | ||
| 195 | + * 线路接口结束 | ||
| 196 | + */ | ||
| 197 | + | ||
| 198 | + | ||
| 199 | + /* | ||
| 200 | + * 线路配车接口开始 | ||
| 201 | + */ | ||
| 202 | + @GET | ||
| 203 | + @Path("/lineCar/{type}/date/{date}") | ||
| 204 | + public List<Map<String, Object>> findLineCarByDate(@PathParam("type") String type,@PathParam("date") String date) { | ||
| 205 | + String sql=""; | ||
| 206 | + if(type.equals("all")){ | ||
| 207 | + sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhccz as jhcc,t.sjcc" | ||
| 208 | + + " from bsth_c_calc_count t where t.date='"+date+"'"; | ||
| 209 | + } | ||
| 210 | + if(type.equals("actual")){ | ||
| 211 | + sql="select t.date,t.gsdm,t.xl,t.xl_name,t.jhcc as jhcc,t.sjcc" | ||
| 212 | + + " from bsth_c_calc_count t where t.date='"+date+"'"; | ||
| 213 | + } | ||
| 214 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 215 | + new RowMapper<Map<String, Object>>(){ | ||
| 216 | + @Override | ||
| 217 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 218 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 219 | + m.put("date", rs.getString("date")); | ||
| 220 | + m.put("company", rs.getString("gsdm")); | ||
| 221 | + m.put("companyName", getGs(rs.getString("gsdm"))); | ||
| 222 | + m.put("lineCode",rs.getString("xl")); | ||
| 223 | + m.put("lineName", rs.getString("xl_name")); | ||
| 224 | + m.put("jhcc", rs.getString("jhcc")); | ||
| 225 | + m.put("sjcc", rs.getString("sjcc")); | ||
| 226 | + return m; | ||
| 227 | + } | ||
| 228 | + }); | ||
| 229 | + | ||
| 230 | + return list; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + | ||
| 234 | + @GET | ||
| 235 | + @Path("/lineCar/{type}/date/{date}/line/{line}") | ||
| 236 | + public List<Map<String, Object>> findLineCarByDateLine(@PathParam("type") String type,@PathParam("date") String date, | ||
| 237 | + @PathParam("line") String line) { | ||
| 238 | + String sql=""; | ||
| 239 | + if(type.equals("all")){ | ||
| 240 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhccz as jhcc,t.sjcc" | ||
| 241 | + + " from bsth_c_calc_count t where t.date='"+date+"'" | ||
| 242 | + + " and xl ='"+line+"'"; | ||
| 243 | + } | ||
| 244 | + if(type.equals("actual")){ | ||
| 245 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhcc as jhcc,t.sjcc" | ||
| 246 | + + " from bsth_c_calc_count t where t.date='"+date+"'" | ||
| 247 | + + " and xl ='"+line+"'"; | ||
| 248 | + | ||
| 249 | + } | ||
| 250 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 251 | + new RowMapper<Map<String, Object>>(){ | ||
| 252 | + @Override | ||
| 253 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 254 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 255 | + m.put("company", rs.getString("gsdm")); | ||
| 256 | + m.put("companyName", getGs(rs.getString("gsdm"))); | ||
| 257 | + m.put("lineCode",rs.getString("xl")); | ||
| 258 | + m.put("lineName", rs.getString("xl_name")); | ||
| 259 | + m.put("jhcc", rs.getString("jhcc")); | ||
| 260 | + m.put("sjcc", rs.getString("sjcc")); | ||
| 261 | + return m; | ||
| 262 | + } | ||
| 263 | + }); | ||
| 264 | + | ||
| 265 | + return list; | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + /* | ||
| 269 | + * 线路配车接口结束 | ||
| 270 | + */ | ||
| 271 | + | ||
| 272 | + /* | ||
| 273 | + * 线路班次接口开始 | ||
| 274 | + */ | ||
| 275 | + @GET | ||
| 276 | + @Path("/lineBc/{type}/date/{date}") | ||
| 277 | + public List<Map<String, Object>> findLineBcByDate(@PathParam("type") String type, | ||
| 278 | + @PathParam("date") String date) { | ||
| 279 | + String sql=""; | ||
| 280 | + if(type.equals("all")){ | ||
| 281 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhbcz as jhbc,t.jhgfbcsz as gfbcs," | ||
| 282 | + + " t.jhdgbcsz as dgbcs,t.sjbc,t.sjgfbcs,t.sjdgbcs from bsth_c_calc_count t " | ||
| 283 | + + " where t.date='"+date+"'"; | ||
| 284 | + } | ||
| 285 | + if(type.equals("actual")){ | ||
| 286 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhbc as jhbc,t.jhssgfbcs as gfbcs," | ||
| 287 | + + " t.jhssdgbcs as dgbcs, t.sjbc,t.sjgfbcs,t.sjdgbcs from bsth_c_calc_count t" | ||
| 288 | + + " where t.date='"+date+"'"; | ||
| 289 | + } | ||
| 290 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 291 | + new RowMapper<Map<String, Object>>(){ | ||
| 292 | + @Override | ||
| 293 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 294 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 295 | + m.put("company", rs.getString("gsdm")); | ||
| 296 | + m.put("companyName", getGs(rs.getString("gsdm"))); | ||
| 297 | + m.put("lineCode",rs.getString("xl")); | ||
| 298 | + m.put("lineName", rs.getString("xl_name")); | ||
| 299 | + m.put("jhbc", rs.getString("jhbc")); | ||
| 300 | + m.put("gfbcs", rs.getString("gfbcs")); | ||
| 301 | + m.put("dgbcs", rs.getString("dgbcs")); | ||
| 302 | + m.put("sjbc", rs.getString("sjbc")); | ||
| 303 | + m.put("sjgfbcs", rs.getString("sjgfbcs")); | ||
| 304 | + m.put("sjdgbcs", rs.getString("sjdgbcs")); | ||
| 305 | + return m; | ||
| 306 | + } | ||
| 307 | + }); | ||
| 308 | + return list; | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + | ||
| 312 | + @GET | ||
| 313 | + @Path("/lineBc/{type}/date/{date}/line/{line}") | ||
| 314 | + public List<Map<String, Object>> findLineBcByDateLine(@PathParam("type") String type, | ||
| 315 | + @PathParam("date") String date,@PathParam("line") String line) { | ||
| 316 | + String sql=""; | ||
| 317 | + if(type.equals("all")){ | ||
| 318 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhbcz as jhbc,t.jhgfbcsz as gfbcs," | ||
| 319 | + + " t.jhdgbcsz as dgbcs,t.sjbc,t.sjgfbcs,t.sjdgbcs from bsth_c_calc_count t " | ||
| 320 | + + " where t.date='"+date+"' and xl='"+line+"'"; | ||
| 321 | + } | ||
| 322 | + if(type.equals("actual")){ | ||
| 323 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhbc as jhbc,t.jhssgfbcs as gfbcs," | ||
| 324 | + + " t.jhssdgbcs as dgbcs,t.sjbc,t.sjgfbcs,t.sjdgbcs from bsth_c_calc_count t" | ||
| 325 | + + " where t.date='"+date+"' and xl='"+line+"'"; | ||
| 326 | + } | ||
| 327 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 328 | + new RowMapper<Map<String, Object>>(){ | ||
| 329 | + @Override | ||
| 330 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 331 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 332 | + m.put("company", rs.getString("gsdm")); | ||
| 333 | + m.put("companyName", getGs(rs.getString("gsdm"))); | ||
| 334 | + m.put("lineCode",rs.getString("xl")); | ||
| 335 | + m.put("lineName", rs.getString("xl_name")); | ||
| 336 | + m.put("jhbc", rs.getString("jhbc")); | ||
| 337 | + m.put("gfbcs", rs.getString("gfbcs")); | ||
| 338 | + m.put("dgbcs", rs.getString("dgbcs")); | ||
| 339 | + m.put("sjbc", rs.getString("sjbc")); | ||
| 340 | + m.put("sjgfbcs", rs.getString("sjgfbcs")); | ||
| 341 | + m.put("sjdgbcs", rs.getString("sjdgbcs")); | ||
| 342 | + return m; | ||
| 343 | + } | ||
| 344 | + }); | ||
| 345 | + return list; | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + /* | ||
| 349 | + * 线路班次接口结束 | ||
| 350 | + */ | ||
| 351 | + | ||
| 352 | + /* | ||
| 353 | + * 线路里程接口开始 | ||
| 354 | + */ | ||
| 355 | + | ||
| 356 | + @GET | ||
| 357 | + @Path("/lineLc/{type}/date/{date}") | ||
| 358 | + public List<Map<String, Object>> findLineLcByDate(@PathParam("type") String type, | ||
| 359 | + @PathParam("date") String date) { | ||
| 360 | + String sql=""; | ||
| 361 | + if(type.equals("all")){ | ||
| 362 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhzglz as jhzlc,t.jhyylcz as jhyylc," | ||
| 363 | + + " t.jhkslcz as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t" | ||
| 364 | + + " where t.date='"+date+"'"; | ||
| 365 | + } | ||
| 366 | + if(type.equals("actual")){ | ||
| 367 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhzgl as jhzlc,t.jhyylc as jhyylc," | ||
| 368 | + + " t.jhkslc as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t" | ||
| 369 | + + " where t.date='"+date+"'"; | ||
| 370 | + } | ||
| 371 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 372 | + new RowMapper<Map<String, Object>>(){ | ||
| 373 | + @Override | ||
| 374 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 375 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 376 | + m.put("company", rs.getString("gsdm")); | ||
| 377 | + m.put("companyName", getGs(rs.getString("gsdm"))); | ||
| 378 | + m.put("lineCode",rs.getString("xl")); | ||
| 379 | + m.put("lineName", rs.getString("xl_name")); | ||
| 380 | + m.put("jhzlc", rs.getString("jhzlc")); | ||
| 381 | + m.put("jhyylc", rs.getString("jhyylc")); | ||
| 382 | + m.put("jhkslc", rs.getString("jhkslc")); | ||
| 383 | + m.put("sjzlc", rs.getString("sjzlc")); | ||
| 384 | + m.put("sjyylc", rs.getString("sjyylc")); | ||
| 385 | + m.put("sjkslc", rs.getString("sjkslc")); | ||
| 386 | + if(Double.parseDouble(rs.getString("jhzlc"))>0){ | ||
| 387 | + double zlczxl=Double.parseDouble(rs.getString("sjzlc"))/Double.parseDouble(rs.getString("jhzlc")); | ||
| 388 | + m.put("zlczxl",df.format(zlczxl*100)+"%"); | ||
| 389 | + }else{ | ||
| 390 | + m.put("zlczxl","0.00%"); | ||
| 391 | + | ||
| 392 | + } | ||
| 393 | + if(Double.parseDouble(rs.getString("jhyylc"))>0){ | ||
| 394 | + double yylczxl=Double.parseDouble(rs.getString("sjyylc"))/Double.parseDouble(rs.getString("jhyylc")); | ||
| 395 | + m.put("yylczxl",df.format(yylczxl*100)+"%"); | ||
| 396 | + }else{ | ||
| 397 | + m.put("yylczxl","0.00%"); | ||
| 398 | + } | ||
| 399 | + return m; | ||
| 400 | + } | ||
| 401 | + }); | ||
| 402 | + return list; | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + | ||
| 406 | + @GET | ||
| 407 | + @Path("/lineLc/{type}/date/{date}/line/{line}") | ||
| 408 | + public List<Map<String, Object>> findLineLcByDateLine(@PathParam("type") String type, | ||
| 409 | + @PathParam("date") String date,@PathParam("line") String line) { | ||
| 410 | + String sql=""; | ||
| 411 | + if(type.equals("all")){ | ||
| 412 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhzglz as jhzlc,t.jhyylcz as jhyylc," | ||
| 413 | + + " t.jhkslcz as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t" | ||
| 414 | + + " where t.date='"+date+"' and xl ='"+line+"'"; | ||
| 415 | + } | ||
| 416 | + if(type.equals("actual")){ | ||
| 417 | + sql="select t.gsdm,t.xl,t.xl_name,t.jhzgl as jhzlc,t.jhyylc as jhyylc," | ||
| 418 | + + " t.jhkslc as jhkslc,t.sjzgl as sjzlc,t.sjyylc,t.sjkslc from bsth_c_calc_count t" | ||
| 419 | + + " where t.date='"+date+"' and xl ='"+line+"'"; | ||
| 420 | + } | ||
| 421 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | ||
| 422 | + new RowMapper<Map<String, Object>>(){ | ||
| 423 | + @Override | ||
| 424 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 425 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 426 | + m.put("company", rs.getString("gsdm")); | ||
| 427 | + m.put("companyName", getGs(rs.getString("gsdm"))); | ||
| 428 | + m.put("lineCode",rs.getString("xl")); | ||
| 429 | + m.put("lineName", rs.getString("xl_name")); | ||
| 430 | + m.put("jhzlc", rs.getString("jhzlc")); | ||
| 431 | + m.put("jhyylc", rs.getString("jhyylc")); | ||
| 432 | + m.put("jhkslc", rs.getString("jhkslc")); | ||
| 433 | + m.put("sjzlc", rs.getString("sjzlc")); | ||
| 434 | + m.put("sjyylc", rs.getString("sjyylc")); | ||
| 435 | + m.put("sjkslc", rs.getString("sjkslc")); | ||
| 436 | + if(Double.parseDouble(rs.getString("jhzlc"))>0){ | ||
| 437 | + double zlczxl=Double.parseDouble(rs.getString("sjzlc"))/Double.parseDouble(rs.getString("jhzlc")); | ||
| 438 | + m.put("zlczxl",df.format(zlczxl*100)+"%"); | ||
| 439 | + }else{ | ||
| 440 | + m.put("zlczxl","0.00%"); | ||
| 441 | + | ||
| 442 | + } | ||
| 443 | + if(Double.parseDouble(rs.getString("jhyylc"))>0){ | ||
| 444 | + double yylczxl=Double.parseDouble(rs.getString("sjyylc"))/Double.parseDouble(rs.getString("jhyylc")); | ||
| 445 | + m.put("yylczxl",df.format(yylczxl*100)+"%"); | ||
| 446 | + }else{ | ||
| 447 | + m.put("yylczxl","0.00%"); | ||
| 448 | + } | ||
| 449 | + return m; | ||
| 450 | + } | ||
| 451 | + }); | ||
| 452 | + return list; | ||
| 453 | + } | ||
| 454 | + /* | ||
| 455 | + * 线路里程接口结束 | ||
| 456 | + */ | ||
| 457 | + | ||
| 458 | + | ||
| 459 | + /* | ||
| 460 | + * 车辆数据接口开始 | ||
| 461 | + */ | ||
| 462 | + | ||
| 463 | + @GET | ||
| 464 | + @Path("/car/all") | ||
| 465 | + public List<Map<String, Object>> findCar() { | ||
| 466 | + String carStr= GetHttpInterface. | ||
| 467 | + getHttpInterface("http://222.66.0.204:8076/cars/getAllCarsInterface"); | ||
| 468 | + //车辆库资料资料 | ||
| 469 | + List<Map<String, Object>> clkList=(List<Map<String, Object>>) JSONObject.parse(carStr); | ||
| 470 | + //调度系统车辆资料 | ||
| 471 | + String carSql="select equipment_code, inside_code,supplier_name from bsth_c_cars"; | ||
| 472 | + List<Map<String, Object>> ddkList=jdbcTemplate.query(carSql, | ||
| 473 | + new RowMapper<Map<String, Object>>(){ | ||
| 474 | + @Override | ||
| 475 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 476 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 477 | + m.put("equipment_code", rs.getString("equipment_code")); | ||
| 478 | + m.put("insideCode", rs.getString("inside_code")); | ||
| 479 | + m.put("supplier_name",rs.getString("supplier_name")); | ||
| 480 | + return m; | ||
| 481 | + } | ||
| 482 | + }); | ||
| 483 | + for (int i = 0; i < clkList.size(); i++) { | ||
| 484 | + Map<String, Object> m1=clkList.get(i); | ||
| 485 | + String carCode=m1.get("car_code").toString(); | ||
| 486 | + m1.put("state_name", getState(m1.get("car_state")==null?"":m1.get("car_state").toString())); | ||
| 487 | + for (int j = 0; j < ddkList.size(); j++) { | ||
| 488 | + Map<String, Object> m2=ddkList.get(j); | ||
| 489 | + String insideCode=m2.get("insideCode").toString(); | ||
| 490 | + if(carCode.equals(insideCode)){ | ||
| 491 | + m1.put("equipment_code", m2.get("equipment_code")); | ||
| 492 | + m1.put("supplier_name", m2.get("supplier_name")); | ||
| 493 | + } | ||
| 494 | + | ||
| 495 | + } | ||
| 496 | + } | ||
| 497 | + return clkList; | ||
| 498 | + } | ||
| 499 | + | ||
| 500 | + | ||
| 501 | + @GET | ||
| 502 | + @Path("/car/company/{companyId}") | ||
| 503 | + public List<Map<String, Object>> findCarByCompany(@PathParam("companyId") String companyId) { | ||
| 504 | + String carStr= GetHttpInterface. | ||
| 505 | + getHttpInterface("http://222.66.0.204:8076/cars/getAllCarsInterface?company="+companyId); | ||
| 506 | + //车辆库资料资料 | ||
| 507 | + List<Map<String, Object>> clkList=(List<Map<String, Object>>) JSONObject.parse(carStr); | ||
| 508 | + //调度系统车辆资料 | ||
| 509 | + String carSql="select equipment_code, inside_code,supplier_name from bsth_c_cars where business_code='"+companyId+"'"; | ||
| 510 | + List<Map<String, Object>> ddkList=jdbcTemplate.query(carSql, | ||
| 511 | + new RowMapper<Map<String, Object>>(){ | ||
| 512 | + @Override | ||
| 513 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 514 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 515 | + m.put("equipment_code", rs.getString("equipment_code")); | ||
| 516 | + m.put("insideCode", rs.getString("inside_code")); | ||
| 517 | + m.put("supplier_name",rs.getString("supplier_name")); | ||
| 518 | + return m; | ||
| 519 | + } | ||
| 520 | + }); | ||
| 521 | + for (int i = 0; i < clkList.size(); i++) { | ||
| 522 | + Map<String, Object> m1=clkList.get(i); | ||
| 523 | + String carCode=m1.get("car_code").toString(); | ||
| 524 | + m1.put("state_name", getState(m1.get("car_state")==null?"":m1.get("car_state").toString())); | ||
| 525 | + for (int j = 0; j < ddkList.size(); j++) { | ||
| 526 | + Map<String, Object> m2=ddkList.get(j); | ||
| 527 | + String insideCode=m2.get("insideCode").toString(); | ||
| 528 | + if(carCode.equals(insideCode)){ | ||
| 529 | + m1.put("equipment_code", m2.get("equipment_code")); | ||
| 530 | + m1.put("supplier_name", m2.get("supplier_name")); | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + } | ||
| 534 | + } | ||
| 535 | + return clkList; | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + @GET | ||
| 539 | + @Path("/car/code/{carCode}") | ||
| 540 | + public List<Map<String, Object>> findCarByCode(@PathParam("carCode") String carCode) { | ||
| 541 | + String carStr= GetHttpInterface. | ||
| 542 | + getHttpInterface("http://222.66.0.204:8076/cars/getAllCarsInterface?car_code="+carCode); | ||
| 543 | + //车辆库资料资料 | ||
| 544 | + List<Map<String, Object>> clkList=(List<Map<String, Object>>) JSONObject.parse(carStr); | ||
| 545 | + //调度系统车辆资料 | ||
| 546 | + String carSql="select equipment_code, inside_code,supplier_name from bsth_c_cars where inside_code='"+carCode+"'"; | ||
| 547 | + List<Map<String, Object>> ddkList=jdbcTemplate.query(carSql, | ||
| 548 | + new RowMapper<Map<String, Object>>(){ | ||
| 549 | + @Override | ||
| 550 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 551 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 552 | + m.put("equipment_code", rs.getString("equipment_code")); | ||
| 553 | + m.put("insideCode", rs.getString("inside_code")); | ||
| 554 | + m.put("supplier_name",rs.getString("supplier_name")); | ||
| 555 | + return m; | ||
| 556 | + } | ||
| 557 | + }); | ||
| 558 | + | ||
| 559 | + for (int i = 0; i < clkList.size(); i++) { | ||
| 560 | + Map<String, Object> m1=clkList.get(i); | ||
| 561 | + String code=m1.get("car_code").toString().trim(); | ||
| 562 | + m1.put("state_name", getState(m1.get("car_state")==null?"":m1.get("car_state").toString())); | ||
| 563 | + for (int j = 0; j < ddkList.size(); j++) { | ||
| 564 | + Map<String, Object> m2=ddkList.get(j); | ||
| 565 | + String insideCode=m2.get("insideCode").toString().trim(); | ||
| 566 | + if(code.equals(insideCode)){ | ||
| 567 | + m1.put("equipment_code", m2.get("equipment_code")); | ||
| 568 | + m1.put("supplier_name", m2.get("supplier_name")); | ||
| 569 | + } | ||
| 570 | + | ||
| 571 | + } | ||
| 572 | + } | ||
| 573 | + return clkList; | ||
| 574 | + } | ||
| 575 | + /* | ||
| 576 | + * 车辆数据接口结束 | ||
| 577 | + */ | ||
| 578 | + | ||
| 579 | + /* | ||
| 580 | + * 事故数据接口开始 | ||
| 581 | + */ | ||
| 582 | + @GET | ||
| 583 | + @Path("/accident/startTime/{startTime}/endTime/{endTime}") | ||
| 584 | + public List<Map<String, Object>> findAccident(@PathParam("startTime") String startTime, | ||
| 585 | + @PathParam("endTime") String endTime) { | ||
| 586 | + String accidentAll= GetHttpInterface.getHttpInterface("http://180.168.57.114:9019/pdsafe/LineSms/getAccidentSubmitAll.do?" | ||
| 587 | + + "submitDateBegin="+startTime+"&submitDateEnd="+endTime); | ||
| 588 | + List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll); | ||
| 589 | + return list; | ||
| 590 | + } | ||
| 591 | + | ||
| 592 | + /* | ||
| 593 | + * 事故数据接口结束 | ||
| 594 | + */ | ||
| 595 | + | ||
| 596 | + /* | ||
| 597 | + *安全驾驶接口开始 | ||
| 598 | + */ | ||
| 599 | + @GET | ||
| 600 | + @Path("/safedriving/date/{date}") | ||
| 601 | + public List<Map<String, Object>> findSafedriving(@PathParam("date") String date) { | ||
| 602 | + String accidentAll= GetHttpInterface.getHttpInterface("http://180.166.5.82:9006/safedriving/safedrivingInterface?StarTime="+date); | ||
| 603 | + List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll); | ||
| 604 | + return list; | ||
| 605 | + } | ||
| 606 | + @GET | ||
| 607 | + @Path("/safedriving/date/{date}/line/{line}") | ||
| 608 | + public List<Map<String, Object>> findSafedrivingByLine(@PathParam("date") String date, | ||
| 609 | + @PathParam("line") String line) { | ||
| 610 | + String accidentAll= GetHttpInterface.getHttpInterface("http://180.166.5.82:9006/safedriving/safedrivingInterface?StarTime="+date | ||
| 611 | + +"&LineId="+line); | ||
| 612 | + List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(accidentAll); | ||
| 613 | + return list; | ||
| 614 | + } | ||
| 615 | + /* | ||
| 616 | + *安全驾驶接口结束 | ||
| 617 | + */ | ||
| 618 | +} |
src/main/java/com/bsth/server_rs/bigdata/GetHttpInterface.java
0 → 100644
| 1 | +package com.bsth.server_rs.bigdata; | ||
| 2 | + | ||
| 3 | +import java.io.BufferedReader; | ||
| 4 | +import java.io.InputStreamReader; | ||
| 5 | +import java.net.HttpURLConnection; | ||
| 6 | +import java.net.URL; | ||
| 7 | +import java.net.URLDecoder; | ||
| 8 | +import java.security.MessageDigest; | ||
| 9 | +import java.security.NoSuchAlgorithmException; | ||
| 10 | +import java.util.Date; | ||
| 11 | +import java.util.List; | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +import com.alibaba.fastjson.JSONObject; | ||
| 15 | + | ||
| 16 | +public class GetHttpInterface { | ||
| 17 | + // 调用http接口获取数据 | ||
| 18 | + public static String getHttpInterface(String path){ | ||
| 19 | + System.out.println("调用开始"); | ||
| 20 | + BufferedReader in = null; | ||
| 21 | + StringBuffer result = null; | ||
| 22 | + try { | ||
| 23 | + URL url = new URL(path); | ||
| 24 | + //打开和url之间的连接 | ||
| 25 | + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); | ||
| 26 | + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); | ||
| 27 | + connection.setRequestProperty("Charset", "utf-8"); | ||
| 28 | + connection.connect(); | ||
| 29 | + | ||
| 30 | + result = new StringBuffer(); | ||
| 31 | + //读取URL的响应 | ||
| 32 | + in = new BufferedReader(new InputStreamReader( | ||
| 33 | + connection.getInputStream())); | ||
| 34 | + String line; | ||
| 35 | + while ((line = in.readLine()) != null) { | ||
| 36 | + | ||
| 37 | + result.append(line); | ||
| 38 | + } | ||
| 39 | + // System.out.println(result.toString()); | ||
| 40 | + return result.toString(); | ||
| 41 | + } catch (Exception e) { | ||
| 42 | + e.printStackTrace(); | ||
| 43 | + }finally { | ||
| 44 | + try { | ||
| 45 | + if (in != null) { | ||
| 46 | + in.close(); | ||
| 47 | + } | ||
| 48 | + } catch (Exception e2) { | ||
| 49 | + e2.printStackTrace(); | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + return null; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | +} |