Commit 543c40f02d3ed197aef87858613533ab3115e0af
1 parent
8f316979
新增公司内部需要调用的数据接口:基础班次里程数据接口,指标率数据接口
Showing
2 changed files
with
83 additions
and
6 deletions
src/main/java/com/bsth/CXFConfig.java
| 1 | 1 | package com.bsth; |
| 2 | 2 | |
| 3 | + | |
| 3 | 4 | import com.bsth.server_rs.AuthorizeInterceptor_IN; |
| 4 | 5 | import com.bsth.server_rs.base_info.car.CarRestService; |
| 5 | 6 | import com.bsth.server_rs.base_info.line.LineRestService; |
| ... | ... | @@ -7,7 +8,7 @@ import com.bsth.server_rs.base_info.person.PersonRestService; |
| 7 | 8 | import com.bsth.server_rs.base_info.section.LD_RoadSpeedRestService; |
| 8 | 9 | import com.bsth.server_rs.base_info.section.LD_SectionRestService; |
| 9 | 10 | import com.bsth.server_rs.base_info.station.StationRestService; |
| 10 | -import com.bsth.server_rs.bigdata.BigdateService; | |
| 11 | +import com.bsth.server_rs.bigdata.BigdataService; | |
| 11 | 12 | import com.bsth.server_rs.directive.DirectiveRestService; |
| 12 | 13 | import com.bsth.server_rs.electric.ElectricService; |
| 13 | 14 | import com.bsth.server_rs.exception.AesExceptionMapper; |
| ... | ... | @@ -110,7 +111,7 @@ public class CXFConfig { |
| 110 | 111 | @Autowired |
| 111 | 112 | ElectricService electricService; |
| 112 | 113 | @Autowired |
| 113 | - BigdateService bigdateService; | |
| 114 | + BigdataService bigdataService; | |
| 114 | 115 | @Autowired |
| 115 | 116 | StaffViewRealService staffViewRealService; |
| 116 | 117 | |
| ... | ... | @@ -134,7 +135,7 @@ public class CXFConfig { |
| 134 | 135 | ld_roadSpeedRestService, |
| 135 | 136 | electricService, |
| 136 | 137 | staffViewRealService, |
| 137 | - bigdateService)); | |
| 138 | + bigdataService)); | |
| 138 | 139 | endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(), new AesExceptionMapper())); |
| 139 | 140 | //endpoint.setFeatures(Arrays.asList(new Swagger2Feature())); |
| 140 | 141 | endpoint.getInInterceptors().add(new AuthorizeInterceptor_IN()); | ... | ... |
src/main/java/com/bsth/server_rs/bigdata/BigdateService.java renamed to src/main/java/com/bsth/server_rs/bigdata/BigdataService.java
| ... | ... | @@ -28,7 +28,7 @@ import com.alibaba.fastjson.JSONObject; |
| 28 | 28 | @Component |
| 29 | 29 | @Path("/bigdata") |
| 30 | 30 | @Produces({MediaType.APPLICATION_JSON}) |
| 31 | -public class BigdateService { | |
| 31 | +public class BigdataService { | |
| 32 | 32 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 33 | 33 | |
| 34 | 34 | @Autowired |
| ... | ... | @@ -833,8 +833,7 @@ public class BigdateService { |
| 833 | 833 | @GET |
| 834 | 834 | @Path("/car/all") |
| 835 | 835 | public List<Map<String, Object>> findCar() { |
| 836 | - String carStr= GetHttpInterface. | |
| 837 | - getHttpInterface("http://180.166.5.82:8076/cars/getAllCarsInterface"); | |
| 836 | + String carStr= GetHttpInterface.getHttpInterface("http://180.166.5.82:8076/cars/getAllCarsInterface"); | |
| 838 | 837 | //车辆库资料资料 |
| 839 | 838 | List<Map<String, Object>> clkList=(List<Map<String, Object>>) JSONObject.parse(carStr); |
| 840 | 839 | //调度系统车辆资料 |
| ... | ... | @@ -992,6 +991,8 @@ public class BigdateService { |
| 992 | 991 | /** |
| 993 | 992 | * 闵行线路班次里程 |
| 994 | 993 | * |
| 994 | + * | |
| 995 | + * | |
| 995 | 996 | */ |
| 996 | 997 | |
| 997 | 998 | @GET |
| ... | ... | @@ -1136,4 +1137,79 @@ public class BigdateService { |
| 1136 | 1137 | }); |
| 1137 | 1138 | return list; |
| 1138 | 1139 | } |
| 1140 | + | |
| 1141 | + | |
| 1142 | + /** | |
| 1143 | + *公司内部使用数据 | |
| 1144 | + * | |
| 1145 | + *班次里程基础数据接口 | |
| 1146 | + */ | |
| 1147 | + @GET | |
| 1148 | + @Path("/basicData/starDate/{starDate}/endDate/{endDate}/line/{line}") | |
| 1149 | + public List<Map<String, Object>> basicData(@PathParam("starDate") String starDate, | |
| 1150 | + @PathParam("endDate") String endDate,@PathParam("line") String line) { | |
| 1151 | + String sql="select gsdm,fgsdm,xl,xl_name,date,jhbc,sjbc," | |
| 1152 | + + " jhyylc,sjyylc,jhkslc,sjkslc,jhgfbcsz,sjgfbcs,jhdgbcsz," | |
| 1153 | + + " sjdgbcs from bsth_c_calc_count " | |
| 1154 | + + " where date>='"+starDate+"' and date<= '"+endDate+"'"; | |
| 1155 | + if(!line.equals("all")){ | |
| 1156 | + sql +=" and xl='"+line+"'"; | |
| 1157 | + } | |
| 1158 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 1159 | + new RowMapper<Map<String, Object>>(){ | |
| 1160 | + @Override | |
| 1161 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1162 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1163 | + m.put("gsdm",rs.getString("gsdm")); | |
| 1164 | + m.put("fgsdm",rs.getString("fgsdm")); | |
| 1165 | + m.put("lineCode",rs.getString("xl")); | |
| 1166 | + m.put("lineName", rs.getString("xl_name")); | |
| 1167 | + m.put("date", rs.getString("date")); | |
| 1168 | + m.put("jhbc", rs.getString("jhbc")); | |
| 1169 | + m.put("sjbc", rs.getString("sjbc")); | |
| 1170 | + m.put("jhyylc", rs.getString("jhyylc")); | |
| 1171 | + m.put("sjyylc", rs.getString("sjyylc")); | |
| 1172 | + m.put("jhkslc", rs.getString("jhkslc")); | |
| 1173 | + m.put("sjkslc", rs.getString("sjkslc")); | |
| 1174 | + m.put("jhgfbcs", rs.getString("jhgfbcsz")); | |
| 1175 | + m.put("sjgfbcs", rs.getString("sjgfbcs")); | |
| 1176 | + m.put("jhdgbcs", rs.getString("jhdgbcsz")); | |
| 1177 | + m.put("sjdgbcs", rs.getString("sjdgbcs")); | |
| 1178 | + return m; | |
| 1179 | + } | |
| 1180 | + }); | |
| 1181 | + return list; | |
| 1182 | + } | |
| 1183 | + | |
| 1184 | + @GET | |
| 1185 | + @Path("/targetData/starDate/{starDate}/endDate/{endDate}/line/{line}") | |
| 1186 | + public List<Map<String, Object>> targetData(@PathParam("starDate") String starDate, | |
| 1187 | + @PathParam("endDate") String endDate,@PathParam("line") String line) { | |
| 1188 | + String sql="select gsdm,fgsdm,date,xl,xl_name,szfczdl,smbfczdl," | |
| 1189 | + + " round(if(ifnull(sjcczgf/jhcczgf,0)>1,1,ifnull(sjcczgf/jhcczgf,0)),3) * 100 as zgfccl , " | |
| 1190 | + + " round(if(ifnull(sjcc/jhcc,0)>1,1,ifnull(sjcc/jhcc,0)),3) * 100 as ccl from bsth_c_calc_sheet " | |
| 1191 | + + " where date>='"+starDate+"' and date<= '"+endDate+"'"; | |
| 1192 | + if(!line.equals("all")){ | |
| 1193 | + sql +=" and xl='"+line+"'"; | |
| 1194 | + } | |
| 1195 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 1196 | + new RowMapper<Map<String, Object>>(){ | |
| 1197 | + @Override | |
| 1198 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1199 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1200 | + m.put("gsdm",rs.getString("gsdm")); | |
| 1201 | + m.put("fgsdm",rs.getString("fgsdm")); | |
| 1202 | + m.put("lineCode",rs.getString("xl")); | |
| 1203 | + m.put("lineName", rs.getString("xl_name")); | |
| 1204 | + m.put("date", rs.getString("date")); | |
| 1205 | + m.put("szfczdl", rs.getString("szfczdl")); | |
| 1206 | + m.put("smbfczdl", rs.getString("smbfczdl")); | |
| 1207 | + m.put("zgfccl", rs.getString("zgfccl")); | |
| 1208 | + m.put("ccl", rs.getString("ccl")); | |
| 1209 | + return m; | |
| 1210 | + } | |
| 1211 | + }); | |
| 1212 | + return list; | |
| 1213 | + } | |
| 1214 | + | |
| 1139 | 1215 | } | ... | ... |