Commit 424002afe0f2fb14dfd980c5eeeb6f2404441392

Authored by 娄高锋
1 parent f9d47b4e

修正线路公里审计的预统计方法更新历史线路时会报错的问题;路单月报年报计算与查询统一使用rqStr字段;

src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
... ... @@ -1366,11 +1366,15 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl<CalcWaybill, Integer
1366 1366  
1367 1367 try {
1368 1368  
1369   - String gsSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = '"+date+"'";
1370   - if(line.trim().length() > 0)
1371   - gsSql += " and xl_bm = '"+line+"'";
  1369 + List<String> objList = new ArrayList<String>();
  1370 + objList.add(date);
  1371 + String gsSql="select gs_bm, fgs_bm from bsth_c_s_sp_info_real where schedule_date_str = ?";
  1372 + if(line.trim().length() > 0){
  1373 + gsSql += " and xl_bm = ?";
  1374 + objList.add(line);
  1375 + }
1372 1376 gsSql += " group by gs_bm, fgs_bm";
1373   - List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
  1377 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, objList.toArray(), new RowMapper<Map<String, String>>() {
1374 1378 @Override
1375 1379 public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
1376 1380 Map<String, String> m = new HashMap<String, String>();
... ... @@ -1485,12 +1489,16 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1485 1489  
1486 1490 try {
1487 1491  
  1492 + List<String> objList = new ArrayList<String>();
  1493 + objList.add(date);
1488 1494 String gsSql="select gs_bm, max(gs_name) gs_name, fgs_bm from bsth_c_s_sp_info_real"
1489   - + " where schedule_date_str = '"+date+"'";
1490   - if(line.trim().length() > 0)
1491   - gsSql += " and xl_bm = '"+line+"'";
  1495 + + " where schedule_date_str = ?";
  1496 + if(line.trim().length() > 0){
  1497 + gsSql += " and xl_bm = ?";
  1498 + objList.add(line);
  1499 + }
1492 1500 gsSql += " group by gs_bm, fgs_bm";
1493   - List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, new RowMapper<Map<String, String>>() {
  1501 + List<Map<String, String>> gsList=jdbcTemplate.query(gsSql, objList.toArray(), new RowMapper<Map<String, String>>() {
1494 1502 @Override
1495 1503 public Map<String, String> mapRow(ResultSet arg0, int arg1) throws SQLException {
1496 1504 Map<String, String> m = new HashMap<String, String>();
... ... @@ -1500,7 +1508,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1500 1508 return m;
1501 1509 }});
1502 1510  
1503   - List<Line> xlList = lineRepository.findAllService();
  1511 + List<Line> xlList = lineRepository.findAll();
1504 1512 for(Line l : xlList){
1505 1513 xlmap.put(l.getName(), l.getLineCode());
1506 1514 }
... ... @@ -1523,7 +1531,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1523 1531 c.setGsName(tempMap.get("gsName").toString());
1524 1532 c.setFgsdm(map.get("fgsdm").toString());
1525 1533 c.setFgsName(m.get("fgs").toString());
1526   - c.setXl(xlmap.get(m.get("xlName").toString()).toString());
  1534 + if(m.containsKey("xlBm")){
  1535 + c.setXl(m.get("xlBm").toString());
  1536 + } else {
  1537 + c.setXl(xlmap.get(m.get("xlName").toString()).toString());
  1538 + }
1527 1539 c.setXlName(m.get("xlName").toString());
1528 1540 c.setNbbm(m.get("nbbm").toString());
1529 1541 c.setjGh(m.get("jGh").toString());
... ... @@ -1907,6 +1919,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
1907 1919 return temp;
1908 1920 }
1909 1921  
  1922 + //240820重写,之前的写的太复杂了改多错多,新方法在下面:calcDetailMonthlyNew
1910 1923 @Override
1911 1924 public List<List<String>> calcDetailMonthly(Map<String, Object> map) {
1912 1925 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
... ... @@ -2012,7 +2025,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2012 2025 }
2013 2026 }
2014 2027  
2015   - System.out.println(new Date());
2016 2028 int flag = 0;
2017 2029 if("jsy".equals(statisticalObj)){
2018 2030 flag = 1;
... ... @@ -2032,13 +2044,11 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2032 2044 // List类转换
2033 2045 final List<CalcWaybillDetail> listNew = JSONArray.parseArray(JSON.toJSONString(list), CalcWaybillDetail.class);
2034 2046  
2035   - System.out.println(new Date());
2036 2047 if(flag != 2)
2037 2048 try {
2038 2049 //查询出没有路单的加油充电,插入到上面查询的结果集中汇总计算。
2039 2050 List<Ylb> ylbNotSchedule = calcRepository.ylbNotSchedule(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, destroy, line);
2040 2051 List<Dlb> dlbNotSchedule = calcRepository.dlbNotSchedule(dateFormat.parse(startDate), dateFormat.parse(endDate), gsdm, fgsdm, destroy, line);
2041   - System.out.println(new Date());
2042 2052 for(Ylb y : ylbNotSchedule){
2043 2053 Date ylbrq = y.getRq();
2044 2054 String ylbxl = y.getXlbm();
... ... @@ -2281,7 +2291,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2281 2291 } catch (Exception e) {
2282 2292 // TODO: handle exception
2283 2293 }
2284   - System.out.println(new Date());
2285 2294  
2286 2295 if(listNew.size() <= 0){
2287 2296 return resList;
... ... @@ -2748,7 +2757,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
2748 2757 // listEnd.add(df.format(allNum)+"/"+df.format(all));
2749 2758 listEnd.add(df.format(all));
2750 2759 resList.add(listEnd);
2751   - System.out.println(new Date());
2752 2760  
2753 2761 return resList;
2754 2762 }
... ... @@ -3057,9 +3065,9 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
3057 3065  
3058 3066 String dd = "";
3059 3067 if("m".equals(timeType)){
3060   - dd = dateFormat.format(cw.getRq());
  3068 + dd = cw.getRqStr();
3061 3069 } else if("y".equals(timeType)){
3062   - dd = dateFormatMon.format(cw.getRq());
  3070 + dd = cw.getRqStr().substring(0, 7);
3063 3071 }
3064 3072 if(temp.containsKey(dd)){
3065 3073 if("".equals(temp.get(dd))){
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -2897,6 +2897,7 @@ public class ReportServiceImpl implements ReportService{
2897 2897 map.put("fgs", "");
2898 2898 }else{
2899 2899 map.put("xlName", list.get(0).getXlName());
  2900 + map.put("xlBm", list.get(0).getXlBm());
2900 2901 map.put("gsBm", list.get(0).getGsBm());
2901 2902 map.put("fgsBm", list.get(0).getFgsBm());
2902 2903 map.put("gs", list.get(0).getGsName());
... ... @@ -3391,6 +3392,7 @@ public class ReportServiceImpl implements ReportService{
3391 3392 }
3392 3393 newMap.put("fgs", BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
3393 3394 newMap.put("xlName", BasicData.lineCode2NameMap.get(xl_bm));
  3395 + newMap.put("xlBm", xl_bm);
3394 3396 newMap.put("jGh", jGh);
3395 3397 newMap.put("jName", jName);
3396 3398 newMap.put("sGh",sGh);
... ...