Commit 9d7933583897464ed063670c0a0e9553eba819ee
1 parent
66b2111f
全量事故接口使用营运日期去重,防止跨天烂班重复获取。
Showing
1 changed file
with
14 additions
and
2 deletions
src/main/java/com/bsth/server_rs/bigdata/BigdataService.java
| @@ -1332,7 +1332,7 @@ public class BigdataService { | @@ -1332,7 +1332,7 @@ public class BigdataService { | ||
| 1332 | @Path("/getScheduleAccident/startDate/{startDate}/endDate/{endDate}") | 1332 | @Path("/getScheduleAccident/startDate/{startDate}/endDate/{endDate}") |
| 1333 | public List<Map<String, Object>> getScheduleAccident(@PathParam("startDate") String startDate, | 1333 | public List<Map<String, Object>> getScheduleAccident(@PathParam("startDate") String startDate, |
| 1334 | @PathParam("endDate") String endDate) throws ParseException { | 1334 | @PathParam("endDate") String endDate) throws ParseException { |
| 1335 | - String sql="select gs_bm,fgs_bm,real_exec_date,fcsj,fcsj_actual,xl_name,j_gh,j_name,cl_zbh,car_plate,remarks " | 1335 | + String sql="select gs_bm,fgs_bm,schedule_date_str,real_exec_date,fcsj,fcsj_actual,xl_name,j_gh,j_name,cl_zbh,car_plate,remarks " |
| 1336 | + " from bsth_c_s_sp_info_real r left join bsth_c_cars c on r.cl_zbh = c.inside_code " | 1336 | + " from bsth_c_s_sp_info_real r left join bsth_c_cars c on r.cl_zbh = c.inside_code " |
| 1337 | + " where schedule_date_str >= ? and schedule_date_str <= ? " | 1337 | + " where schedule_date_str >= ? and schedule_date_str <= ? " |
| 1338 | + " and ((adjust_exps like '%肇事%' and status = '-1') " | 1338 | + " and ((adjust_exps like '%肇事%' and status = '-1') " |
| @@ -1342,7 +1342,7 @@ public class BigdataService { | @@ -1342,7 +1342,7 @@ public class BigdataService { | ||
| 1342 | + " or remarks like '%<肇事>%'))) " | 1342 | + " or remarks like '%<肇事>%'))) " |
| 1343 | + " order by real_exec_date, schedule_date_str, fcsj"; | 1343 | + " order by real_exec_date, schedule_date_str, fcsj"; |
| 1344 | 1344 | ||
| 1345 | - List<Map<String, Object>> list=(List<Map<String, Object>>) jdbcTemplate.query(sql, | 1345 | + List<Map<String, Object>> scheduleList=(List<Map<String, Object>>) jdbcTemplate.query(sql, |
| 1346 | new Object[] {startDate, endDate}, | 1346 | new Object[] {startDate, endDate}, |
| 1347 | new RowMapper<Map<String, Object>>(){ | 1347 | new RowMapper<Map<String, Object>>(){ |
| 1348 | @Override | 1348 | @Override |
| @@ -1350,6 +1350,7 @@ public class BigdataService { | @@ -1350,6 +1350,7 @@ public class BigdataService { | ||
| 1350 | Map<String, Object> m=new HashMap<String,Object>(); | 1350 | Map<String, Object> m=new HashMap<String,Object>(); |
| 1351 | m.put("gs_bm",rs.getString("gs_bm")); | 1351 | m.put("gs_bm",rs.getString("gs_bm")); |
| 1352 | m.put("fgs_bm",rs.getString("fgs_bm")); | 1352 | m.put("fgs_bm",rs.getString("fgs_bm")); |
| 1353 | + m.put("schedule_date_str",rs.getString("schedule_date_str")); | ||
| 1353 | m.put("real_exec_date",rs.getString("real_exec_date")); | 1354 | m.put("real_exec_date",rs.getString("real_exec_date")); |
| 1354 | m.put("fcsj", rs.getString("fcsj")); | 1355 | m.put("fcsj", rs.getString("fcsj")); |
| 1355 | m.put("fcsj_actual", rs.getString("fcsj_actual")); | 1356 | m.put("fcsj_actual", rs.getString("fcsj_actual")); |
| @@ -1363,6 +1364,17 @@ public class BigdataService { | @@ -1363,6 +1364,17 @@ public class BigdataService { | ||
| 1363 | } | 1364 | } |
| 1364 | }); | 1365 | }); |
| 1365 | 1366 | ||
| 1367 | + List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); | ||
| 1368 | + Set<String> tempSet = new HashSet<String>(); | ||
| 1369 | + for(Map<String, Object> m : scheduleList){ // 250312,3月8号有一条7号跨天的烂班,之前判断实际执行日期会重复获取。 | ||
| 1370 | + String key = m.get("schedule_date_str") + "/" + m.get("xl_name") | ||
| 1371 | + + "/" + m.get("j_gh") + "/" + m.get("j_name") | ||
| 1372 | + + "/" + m.get("cl_zbh") + "/" + m.get("car_plate"); | ||
| 1373 | + if(tempSet.add(key)){ | ||
| 1374 | + list.add(m); | ||
| 1375 | + } | ||
| 1376 | + } | ||
| 1377 | + | ||
| 1366 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | 1378 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| 1367 | Date d1 = sdf.parse(startDate); | 1379 | Date d1 = sdf.parse(startDate); |
| 1368 | Date d2 = sdf.parse(endDate); | 1380 | Date d2 = sdf.parse(endDate); |