Commit 26e852f540ac2400cc857e39781644178cf8c1c0
Merge remote-tracking branch 'origin/master'
Showing
2 changed files
with
1531 additions
and
200 deletions
src/main/java/com/bsth/server_rs/bigdata/BigdataService.java
| ... | ... | @@ -1282,4 +1282,42 @@ public class BigdataService { |
| 1282 | 1282 | return list; |
| 1283 | 1283 | } |
| 1284 | 1284 | |
| 1285 | + /** | |
| 1286 | + * 给安全系统的接口,实际排班中的肇事烂班班次(用作事故登记) | |
| 1287 | + * @param starDate | |
| 1288 | + * @param endDate | |
| 1289 | + * @return | |
| 1290 | + */ | |
| 1291 | + @GET | |
| 1292 | + @Path("/getScheduleZs/starDate/{starDate}/endDate/{endDate}") | |
| 1293 | + public List<Map<String, Object>> getScheduleZs(@PathParam("starDate") String starDate, | |
| 1294 | + @PathParam("endDate") String endDate) { | |
| 1295 | + String sql="select gs_bm,fgs_bm,real_exec_date,fcsj,fcsj_actual,xl_name,j_gh,j_name,cl_zbh,car_plate,remarks " | |
| 1296 | + + " from bsth_c_s_sp_info_real r left join bsth_c_cars c on r.cl_zbh = c.inside_code " | |
| 1297 | + + " where schedule_date_str>='"+starDate+"' and schedule_date_str<= '"+endDate+"' " | |
| 1298 | + + " and adjust_exps like '%肇事%' " | |
| 1299 | + + " order by real_exec_date, schedule_date_str, fcsj"; | |
| 1300 | + | |
| 1301 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 1302 | + new RowMapper<Map<String, Object>>(){ | |
| 1303 | + @Override | |
| 1304 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1305 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1306 | + m.put("gs_bm",rs.getString("gs_bm")); | |
| 1307 | + m.put("fgs_bm",rs.getString("fgs_bm")); | |
| 1308 | + m.put("real_exec_date",rs.getString("real_exec_date")); | |
| 1309 | + m.put("fcsj", rs.getString("fcsj")); | |
| 1310 | + m.put("fcsj_actual", rs.getString("fcsj_actual")); | |
| 1311 | + m.put("xl_name", rs.getString("xl_name")); | |
| 1312 | + m.put("j_gh", rs.getString("j_gh")); | |
| 1313 | + m.put("j_name", rs.getString("j_name")); | |
| 1314 | + m.put("cl_zbh", rs.getString("cl_zbh")); | |
| 1315 | + m.put("car_plate", rs.getString("car_plate")); | |
| 1316 | + m.put("remarks", rs.getString("remarks")); | |
| 1317 | + return m; | |
| 1318 | + } | |
| 1319 | + }); | |
| 1320 | + return list; | |
| 1321 | + } | |
| 1322 | + | |
| 1285 | 1323 | } | ... | ... |
src/main/java/com/bsth/server_rs/bigdata/BigscreenService.java
| ... | ... | @@ -16,6 +16,7 @@ import java.util.Set; |
| 16 | 16 | |
| 17 | 17 | import javax.ws.rs.GET; |
| 18 | 18 | import javax.ws.rs.Path; |
| 19 | +import javax.ws.rs.PathParam; | |
| 19 | 20 | import javax.ws.rs.Produces; |
| 20 | 21 | import javax.ws.rs.core.MediaType; |
| 21 | 22 | |
| ... | ... | @@ -46,7 +47,7 @@ public class BigscreenService { |
| 46 | 47 | @Autowired |
| 47 | 48 | ScheduleRealInfoRepository scheduleRealInfoRepository; |
| 48 | 49 | |
| 49 | - DecimalFormat df = new DecimalFormat("0.00"); | |
| 50 | + DecimalFormat df = new DecimalFormat("0.###"); | |
| 50 | 51 | |
| 51 | 52 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 52 | 53 | |
| ... | ... | @@ -151,6 +152,9 @@ public class BigscreenService { |
| 151 | 152 | return map; |
| 152 | 153 | } |
| 153 | 154 | |
| 155 | + /**给大屏的线路数、班次、里程汇总接口 | |
| 156 | + * | |
| 157 | + */ | |
| 154 | 158 | @GET |
| 155 | 159 | @Path("/selectData/getBigScreen") |
| 156 | 160 | public JSONObject getBigScreen(){ |
| ... | ... | @@ -248,6 +252,26 @@ public class BigscreenService { |
| 248 | 252 | } |
| 249 | 253 | |
| 250 | 254 | |
| 255 | + String cardSignSql="select xl_bm,xl_name,schedule_date_str,bcs,qks,rkgzs,ckgzs" | |
| 256 | + + " from card_signing " | |
| 257 | + + " where schedule_date_str >= '"+date2+"' and schedule_date_str <= '"+date+"'"; | |
| 258 | + List<Map<String, Object>> cardSignList=jdbcTemplate.query(cardSignSql, | |
| 259 | + new RowMapper<Map<String, Object>>(){ | |
| 260 | + @Override | |
| 261 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 262 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 263 | + m.put("lineCode",rs.getString("xl_bm")); | |
| 264 | + m.put("lineName", rs.getString("xl_name")); | |
| 265 | + m.put("date", rs.getString("schedule_date_str")); | |
| 266 | + m.put("bcs", rs.getString("bcs")); | |
| 267 | + m.put("qks", rs.getString("qks")); | |
| 268 | + m.put("rkgzs", rs.getString("rkgzs")); | |
| 269 | + m.put("ckgzs", rs.getString("ckgzs")); | |
| 270 | + return m; | |
| 271 | + } | |
| 272 | + }); | |
| 273 | + | |
| 274 | + | |
| 251 | 275 | String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz," |
| 252 | 276 | + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," |
| 253 | 277 | + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," |
| ... | ... | @@ -317,11 +341,12 @@ public class BigscreenService { |
| 317 | 341 | List<Map<String, Object>> smList = createMap("首末班发车准点率", dates); |
| 318 | 342 | List<Map<String, Object>> qqList = createMap("起讫站发车准点率", dates); |
| 319 | 343 | List<Map<String, Object>> gpList = createMap("挂牌线路发车准点率", dates); |
| 344 | + List<Map<String, Object>> qkList = createMap("签卡率", dates); | |
| 320 | 345 | |
| 321 | 346 | long sjbcs_z = 0l;//实时总班次 |
| 322 | 347 | BigDecimal yygl_z = new BigDecimal(0);//实时总营运里程 |
| 323 | 348 | long jhcc = 0, sjcc = 0, jhbc = 0, sjbc = 0, jhsmbc = 0, sjsmbc = 0, |
| 324 | - jhqqbc = 0, sjqqzd = 0, jhgpqqbc = 0, sjgpqqzd = 0; | |
| 349 | + jhqqbc = 0, sjqqzd = 0, jhgpqqbc = 0, sjgpqqzd = 0, bcs_qk = 0, qks = 0; | |
| 325 | 350 | |
| 326 | 351 | for(Map<String, Object> t : list){ |
| 327 | 352 | if(yyLine.contains(t.get("lineCode").toString())){ |
| ... | ... | @@ -396,12 +421,26 @@ public class BigscreenService { |
| 396 | 421 | } |
| 397 | 422 | } |
| 398 | 423 | |
| 424 | + for(Map<String, Object> t : cardSignList){ | |
| 425 | + if(yyLine.contains(t.get("lineCode").toString())){ | |
| 426 | + String d = t.get("date").toString(); | |
| 427 | + if(date.equals(d)){ | |
| 428 | + bcs_qk += Long.valueOf(t.get("bcs").toString()); | |
| 429 | + qks += Long.valueOf(t.get("qks").toString()); | |
| 430 | + } | |
| 431 | + Map<String, Object> qkMap = qkList.get(datesMap.get(d)); | |
| 432 | + qkMap.put("jh", Long.valueOf(qkMap.get("jh").toString()) + Long.valueOf(t.get("bcs").toString())); | |
| 433 | + qkMap.put("sj", Long.valueOf(qkMap.get("sj").toString()) + Long.valueOf(t.get("qks").toString())); | |
| 434 | + } | |
| 435 | + } | |
| 436 | + | |
| 399 | 437 | List<Map<String, Object>> zxlList = new ArrayList<Map<String, Object>>(); |
| 400 | 438 | zxlList.addAll(ccList); |
| 401 | 439 | zxlList.addAll(bcList); |
| 402 | 440 | zxlList.addAll(smList); |
| 403 | 441 | zxlList.addAll(qqList); |
| 404 | 442 | zxlList.addAll(gpList); |
| 443 | + zxlList.addAll(qkList); | |
| 405 | 444 | |
| 406 | 445 | List<Map<String, Object>> detailsList = new ArrayList<Map<String, Object>>(); |
| 407 | 446 | detailsList.addAll(bcDetail); |
| ... | ... | @@ -526,11 +565,13 @@ public class BigscreenService { |
| 526 | 565 | 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); |
| 527 | 566 | resMap.put("bczxl", jhbc>0?new BigDecimal(sjbc).divide(new BigDecimal(jhbc), |
| 528 | 567 | 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); |
| 529 | - resMap.put("smbzdl", jhbc>0?new BigDecimal(sjsmbc).divide(new BigDecimal(jhsmbc), | |
| 568 | + resMap.put("smbzdl", jhsmbc>0?new BigDecimal(sjsmbc).divide(new BigDecimal(jhsmbc), | |
| 530 | 569 | 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); |
| 531 | - resMap.put("qqzzdl", jhbc>0?new BigDecimal(sjqqzd).divide(new BigDecimal(jhqqbc), | |
| 570 | + resMap.put("qqzzdl", jhqqbc>0?new BigDecimal(sjqqzd).divide(new BigDecimal(jhqqbc), | |
| 532 | 571 | 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); |
| 533 | - resMap.put("gpzdl", jhbc>0?new BigDecimal(sjgpqqzd).divide(new BigDecimal(jhgpqqbc), | |
| 572 | + resMap.put("gpzdl", jhgpqqbc>0?new BigDecimal(sjgpqqzd).divide(new BigDecimal(jhgpqqbc), | |
| 573 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 574 | + resMap.put("qkl", bcs_qk>0?new BigDecimal(qks).divide(new BigDecimal(bcs_qk), | |
| 534 | 575 | 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); |
| 535 | 576 | |
| 536 | 577 | resMap.put("ratioList", zxlList); |
| ... | ... | @@ -542,18 +583,21 @@ public class BigscreenService { |
| 542 | 583 | return JSON.parseObject(JSON.toJSONString(resMap)); |
| 543 | 584 | } |
| 544 | 585 | |
| 586 | + /**给大屏的线路数、班次、里程汇总接口 | |
| 587 | + * 按直属公司查询 | |
| 588 | + */ | |
| 545 | 589 | @GET |
| 546 | - @Path("/selectData/attendance") | |
| 547 | - public JSONObject attendance(){ | |
| 590 | + @Path("/selectData/getBigScreen/{gsdm}") | |
| 591 | + public JSONObject getBigScreen(@PathParam("gsdm") String gsdm){ | |
| 548 | 592 | Map<String, Object> resMap = new HashMap<String, Object>(); |
| 549 | 593 | |
| 550 | - int day = 7;//天数 | |
| 594 | + int day = 8;//天数 | |
| 551 | 595 | |
| 552 | 596 | Date dd = new Date(); |
| 553 | 597 | String date = sd.format(dd); //yyyy-MM-dd 当天 |
| 554 | 598 | Date dd2 = new Date(); |
| 555 | 599 | dd2.setTime(dd.getTime() - ((long)(day-1))*1000*60*60*24); |
| 556 | - String date2 = sd.format(dd2); //yyyy-MM-dd 6天前(加上当天就是取7天数据) | |
| 600 | + String date2 = sd.format(dd2); //yyyy-MM-dd 7天前(加上当天就是取8天数据) | |
| 557 | 601 | |
| 558 | 602 | String[] dates = new String[day]; |
| 559 | 603 | Map<String, Integer> datesMap = new HashMap<String, Integer>(); |
| ... | ... | @@ -566,232 +610,1473 @@ public class BigscreenService { |
| 566 | 610 | datesMap.put(format, i); |
| 567 | 611 | } |
| 568 | 612 | |
| 569 | - | |
| 570 | - String yyxlSql="SELECT line_code from bsth_c_line " | |
| 571 | - + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | |
| 572 | - List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql, | |
| 613 | + String gpLineSql = "select * from bsth_c_line_plate"; | |
| 614 | + List<Map<String, Object>> gpLineList=jdbcTemplate.query(gpLineSql, | |
| 573 | 615 | new RowMapper<Map<String, Object>>(){ |
| 574 | 616 | @Override |
| 575 | 617 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 576 | 618 | Map<String, Object> m=new HashMap<String,Object>(); |
| 619 | + m.put("lineName", rs.getString("line_name")); | |
| 577 | 620 | m.put("lineCode", rs.getString("line_code")); |
| 578 | 621 | return m; |
| 579 | 622 | } |
| 580 | 623 | }); |
| 581 | - Set<String> yyLine = new HashSet<String>(); | |
| 582 | - for(Map<String, Object> t : yyxlList){ | |
| 583 | - if(t.get("lineCode") != null){ | |
| 584 | - yyLine.add(t.get("lineCode").toString()); | |
| 585 | - } | |
| 586 | - } | |
| 587 | - | |
| 588 | - | |
| 589 | - List<Map<String, Object>> attList = new ArrayList<Map<String, Object>>(); | |
| 590 | - List<Map<String, Object>> lackList = new ArrayList<Map<String, Object>>(); | |
| 591 | 624 | |
| 592 | - for(int i = 0; i < dates.length; i++){ | |
| 593 | - Set<String> jhSet = new HashSet<String>(); | |
| 594 | - Set<String> sjSet = new HashSet<String>(); | |
| 595 | - List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(dates[i]); | |
| 596 | - List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 597 | - for(ScheduleRealInfo s : findAll){ | |
| 598 | - if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 | |
| 599 | - if(!isInOut(s)){ | |
| 600 | - Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 601 | - if (cts != null && cts.size() > 0) { | |
| 602 | - list_s.add(s); | |
| 603 | - } else { | |
| 604 | - if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 605 | - list_s.add(s); | |
| 606 | - } | |
| 607 | - } | |
| 608 | - | |
| 609 | - if(!s.isSflj() && !s.isCcService()){ | |
| 610 | - jhSet.add(s.getjGh() + "/" + s.getjName()); | |
| 611 | - } | |
| 612 | - } | |
| 613 | - } | |
| 614 | - } | |
| 615 | - | |
| 616 | - for(ScheduleRealInfo s : list_s){ | |
| 617 | - if(!(s.getStatus() == -1)){ | |
| 618 | - sjSet.add(s.getjGh() + "/" + s.getjName()); | |
| 619 | - } | |
| 620 | - | |
| 621 | - if (s.isSflj()){ | |
| 622 | - continue; | |
| 623 | - } | |
| 624 | - Set<ChildTaskPlan> cts; | |
| 625 | - cts = s.getcTasks(); | |
| 626 | - //有子任务 | |
| 627 | - if (cts != null && cts.size() > 0) { | |
| 628 | - for(ChildTaskPlan c : cts){ | |
| 629 | - if(c.getCcId()==null){ | |
| 630 | - if(c.getMileageType().equals("service")){ | |
| 631 | - if(c.isDestroy() && (c.getDestroyReason()==null? "" : c.getDestroyReason()).equals("缺人")){ | |
| 632 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 633 | - m.put("gsName", s.getGsName()); | |
| 634 | - m.put("lineName", s.getXlName()); | |
| 635 | - m.put("driverName", s.getjName()); | |
| 636 | - m.put("date", s.getRealExecDate()); | |
| 637 | - m.put("time", c.getStartDate()); | |
| 638 | - if(c.getRemarks() != null && c.getRemarks().trim().length() > 0){ | |
| 639 | - m.put("explain", c.getRemarks()); | |
| 640 | - } else { | |
| 641 | - m.put("explain", s.getRemarks()!=null?s.getRemarks():""); | |
| 642 | - } | |
| 643 | - lackList.add(m); | |
| 644 | - } | |
| 645 | - } | |
| 646 | - } | |
| 647 | - } | |
| 648 | - } | |
| 649 | - //主任务烂班 | |
| 650 | - else if(s.getStatus() == -1 && !s.isCcService()){ | |
| 651 | - if(s.getAdjustExps().equals("缺人")){ | |
| 652 | - Map<String, Object> m = new HashMap<String, Object>(); | |
| 653 | - m.put("gsName", s.getGsName()); | |
| 654 | - m.put("lineName", s.getXlName()); | |
| 655 | - m.put("driverName", s.getjName()); | |
| 656 | - m.put("date", s.getRealExecDate()); | |
| 657 | - m.put("time", s.getFcsj()); | |
| 658 | - m.put("explain", s.getRemarks()!=null?s.getRemarks():""); | |
| 659 | - lackList.add(m); | |
| 660 | - } | |
| 661 | - } | |
| 662 | - } | |
| 663 | - | |
| 664 | - Map<String, Object> att = new HashMap<String, Object>(); | |
| 665 | - att.put("date", dates[i]); | |
| 666 | - att.put("jh", jhSet.size()); | |
| 667 | - att.put("sj", sjSet.size()); | |
| 668 | - attList.add(att); | |
| 625 | + Set<String> gpSet = new HashSet<String>(); | |
| 626 | + for(Map<String, Object> t : gpLineList){ | |
| 627 | + if(t.get("lineCode") != null && t.get("lineCode").toString().trim().length() > 0){ | |
| 628 | + gpSet.add(t.get("lineCode").toString().trim()); | |
| 629 | + } | |
| 669 | 630 | } |
| 670 | 631 | |
| 671 | - String gpLineSql = "select p.company_code, count(1) jsy" | |
| 672 | - + " from (select e.jsy from bsth_c_s_ecinfo e" | |
| 673 | - + " where e.is_cancel = 0 group by e.jsy) a" | |
| 674 | - + " left join bsth_c_personnel p on a.jsy = p.id" | |
| 675 | - + " group by p.company_code"; | |
| 676 | - List<Map<String, Object>> ecList=jdbcTemplate.query(gpLineSql, | |
| 632 | + String lineSql="SELECT b.start_opt,a.company,a.line_code,a.name,a.level," | |
| 633 | + + " a.shanghai_linecode, a.nature from " | |
| 634 | + + " bsth_c_line a left join bsth_c_line_config b " | |
| 635 | + + " on a.id=b.line where " | |
| 636 | + + " a.shanghai_linecode is not null and a.shanghai_linecode !='' and a.destroy=0 " | |
| 637 | + + " and a.remove=0 and a.nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | |
| 638 | + List<Map<String, Object>> lineList=jdbcTemplate.query(lineSql, | |
| 677 | 639 | new RowMapper<Map<String, Object>>(){ |
| 678 | 640 | @Override |
| 679 | - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 641 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 680 | 642 | Map<String, Object> m=new HashMap<String,Object>(); |
| 681 | - m.put("company", rs.getString("company_code")); | |
| 682 | - m.put("jsy", rs.getString("jsy")); | |
| 643 | + m.put("state", rs.getString("start_opt")); | |
| 644 | + m.put("company", rs.getString("company")); | |
| 645 | + m.put("companyName", getGs(rs.getString("company"))); | |
| 646 | + m.put("lineCode",rs.getString("line_code")); | |
| 647 | + m.put("name", rs.getString("name")); | |
| 648 | + m.put("level", rs.getString("level")); | |
| 649 | + m.put("shanghaiLinecode", rs.getString("shanghai_linecode")); | |
| 650 | + m.put("nature", getNature(rs.getString("nature"))); | |
| 683 | 651 | return m; |
| 684 | 652 | } |
| 685 | 653 | }); |
| 686 | 654 | |
| 687 | - List<Map<String, Object>> jsyList = new ArrayList<Map<String, Object>>(); | |
| 688 | - Map<String, Object> ygMap = new HashMap<String, Object>(); | |
| 689 | - ygMap.put("company", "杨高"); | |
| 690 | - ygMap.put("jsy", "0"); | |
| 691 | - Map<String, Object> snMap = new HashMap<String, Object>(); | |
| 692 | - snMap.put("company", "上南"); | |
| 693 | - snMap.put("jsy", "0"); | |
| 694 | - Map<String, Object> jgMap = new HashMap<String, Object>(); | |
| 695 | - jgMap.put("company", "金高"); | |
| 696 | - jgMap.put("jsy", "0"); | |
| 697 | - Map<String, Object> nhMap = new HashMap<String, Object>(); | |
| 698 | - nhMap.put("company", "南汇"); | |
| 699 | - nhMap.put("jsy", "0"); | |
| 700 | - for(Map<String, Object> m : ecList){ //顺序:杨高,上南,金高,南汇 | |
| 701 | - if("05".equals(m.get("company").toString())){ | |
| 702 | -// m.put("company", "杨高"); | |
| 703 | - ygMap.put("jsy", m.get("jsy").toString()); | |
| 704 | - } | |
| 705 | - if("55".equals(m.get("company").toString())){ | |
| 706 | -// m.put("company", "上南"); | |
| 707 | - snMap.put("jsy", m.get("jsy").toString()); | |
| 708 | - } | |
| 709 | - if("22".equals(m.get("company").toString())){ | |
| 710 | -// m.put("company", "金高"); | |
| 711 | - jgMap.put("jsy", m.get("jsy").toString()); | |
| 712 | - } | |
| 713 | - if("26".equals(m.get("company").toString())){ | |
| 714 | -// m.put("company", "南汇"); | |
| 715 | - nhMap.put("jsy", m.get("jsy").toString()); | |
| 655 | + int level1 = 0, level2 = 0, lineCount = 0; | |
| 656 | + for(Map<String, Object> t : lineList){ | |
| 657 | + if(t.containsKey("company") && t.get("company").toString().trim().equals(gsdm)){ | |
| 658 | + ++lineCount; | |
| 659 | + if(t.get("level") != null){ | |
| 660 | + if("1".equals(t.get("level").toString())){ | |
| 661 | + ++level1; | |
| 662 | + } else if("2".equals(t.get("level").toString())){ | |
| 663 | + ++level2; | |
| 664 | + } | |
| 665 | + } | |
| 716 | 666 | } |
| 717 | 667 | } |
| 718 | - jsyList.add(ygMap); | |
| 719 | - jsyList.add(snMap); | |
| 720 | - jsyList.add(jgMap); | |
| 721 | - jsyList.add(nhMap); | |
| 722 | 668 | |
| 723 | - String xlSql = "select a.jsy, b.spy, c.cl from" | |
| 724 | - + " (select count(1) jsy from (select a.jsy from bsth_c_s_ecinfo a where a.is_cancel = 0 and a.spy is not null and a.jsy is not null group by jsy) a) a" | |
| 725 | - + " LEFT JOIN" | |
| 726 | - + " (select count(1) spy from (select b.spy from bsth_c_s_ecinfo b where b.is_cancel = 0 and b.spy is not null group by spy) b) b" | |
| 727 | - + " on 1=1" | |
| 728 | - + " LEFT JOIN" | |
| 729 | - + " (select count(1) cl from (select c.cl from bsth_c_s_ccinfo c where c.is_cancel = 0 and c.cl is not null and c.xl in(select e.xl from bsth_c_s_ecinfo e where e.is_cancel = 0 and e.spy is not null) group by c.cl) c) c" | |
| 730 | - + " on 1=1"; | |
| 731 | - List<Map<String, Object>> xlConfigList=jdbcTemplate.query(xlSql, | |
| 669 | + | |
| 670 | + String yyxlSql="SELECT line_code from bsth_c_line " | |
| 671 | + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | |
| 672 | + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql, | |
| 732 | 673 | new RowMapper<Map<String, Object>>(){ |
| 733 | 674 | @Override |
| 734 | - public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 675 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 735 | 676 | Map<String, Object> m=new HashMap<String,Object>(); |
| 736 | - m.put("jsy", rs.getString("jsy")); | |
| 737 | - m.put("spy", rs.getString("spy")); | |
| 738 | - m.put("cl", rs.getString("cl")); | |
| 677 | + m.put("lineCode", rs.getString("line_code")); | |
| 739 | 678 | return m; |
| 740 | 679 | } |
| 741 | 680 | }); |
| 742 | - long jsy = 0l, spy = 0l, cl = 0l; | |
| 743 | - for(Map<String, Object> t : xlConfigList){ | |
| 744 | - if(t.get("jsy") != null){ | |
| 745 | - jsy += Long.valueOf(t.get("jsy").toString()); | |
| 746 | - } | |
| 747 | - if(t.get("spy") != null){ | |
| 748 | - spy += Long.valueOf(t.get("spy").toString()); | |
| 749 | - } | |
| 750 | - if(t.get("cl") != null){ | |
| 751 | - cl += Long.valueOf(t.get("cl").toString()); | |
| 681 | + Set<String> yyLine = new HashSet<String>(); | |
| 682 | + for(Map<String, Object> t : yyxlList){ | |
| 683 | + if(t.get("lineCode") != null){ | |
| 684 | + yyLine.add(t.get("lineCode").toString()); | |
| 752 | 685 | } |
| 753 | 686 | } |
| 754 | 687 | |
| 755 | - resMap.put("jsyList", jsyList); | |
| 756 | - resMap.put("attList", attList); | |
| 757 | - resMap.put("lackList", lackList); | |
| 758 | - resMap.put("salesmanJsy", jsy); | |
| 759 | - resMap.put("salesmanSpy", spy); | |
| 760 | - resMap.put("salesmanCl", cl); | |
| 761 | 688 | |
| 762 | - return JSON.parseObject(JSON.toJSONString(resMap)); | |
| 763 | - } | |
| 764 | - | |
| 765 | - @GET | |
| 766 | - @Path("/selectData/getReport") | |
| 767 | - public List<Map<String, Object>> getReport(){ | |
| 768 | - String sql="SELECT ID,REPORT_TYPE,REPORT_GS,REPORT_FGS,REPORT_GSNAME,REPORT_FGSNAME," | |
| 769 | - + " REPORT_DATE,REPORT_BBR,REPORT_XL,REPORT_XLNAME,REPORT_STATION,REPORT_DWSBBM," | |
| 770 | - + " REPORT_DWSBSJ,REPORT_YWSJ,REPORT_SMBWD,REPORT_DJGSJ,REPORT_DJGYY,REPORT_TFSJ," | |
| 771 | - + " REPORT_YXSJ,REPORT_YXBC,REPORT_TZCS,REPORT_SGBH,REPORT_ZBH,REPORT_PZH,REPORT_JSY," | |
| 772 | - + " REPORT_SGSJ,REPORT_SGDD,REPORT_XSFX,REPORT_SGDX,REPORT_DXPZH,REPORT_SGGK," | |
| 773 | - + " REPORT_SSRS,REPORT_SWRS,REPORT_BGR,REPORT_BGRDH,REPORT_BZ,REPORT_ROAD,STATUS," | |
| 774 | - + " CREATE_BY,CREATE_DATE,UPDATE_BY,UPDATE_DATE" | |
| 775 | - + " from bsth_t_report "; | |
| 776 | - List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 689 | + String cardSignSql="select xl_bm,xl_name,schedule_date_str,bcs,qks,rkgzs,ckgzs" | |
| 690 | + + " from card_signing " | |
| 691 | + + " where schedule_date_str >= '"+date2+"' and schedule_date_str <= '"+date+"'" | |
| 692 | + + " and gs_bm = '"+gsdm+"'"; | |
| 693 | + List<Map<String, Object>> cardSignList=jdbcTemplate.query(cardSignSql, | |
| 777 | 694 | new RowMapper<Map<String, Object>>(){ |
| 778 | 695 | @Override |
| 779 | 696 | public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { |
| 780 | 697 | Map<String, Object> m=new HashMap<String,Object>(); |
| 781 | - m.put("ID", rs.getString("ID")); | |
| 782 | - m.put("REPORT_TYPE", rs.getString("REPORT_TYPE")); | |
| 783 | - m.put("REPORT_GS", rs.getString("REPORT_GS")); | |
| 784 | - m.put("REPORT_FGS",rs.getString("REPORT_FGS")); | |
| 785 | - m.put("REPORT_GSNAME",rs.getString("REPORT_GSNAME")); | |
| 786 | - m.put("REPORT_FGSNAME",rs.getString("REPORT_FGSNAME")); | |
| 787 | - m.put("REPORT_DATE",rs.getString("REPORT_DATE")); | |
| 788 | - m.put("REPORT_BBR",rs.getString("REPORT_BBR")); | |
| 789 | - m.put("REPORT_XL",rs.getString("REPORT_XL")); | |
| 790 | - m.put("REPORT_XLNAME",rs.getString("REPORT_XLNAME")); | |
| 791 | - m.put("REPORT_STATION",rs.getString("REPORT_STATION")); | |
| 792 | - m.put("REPORT_DWSBBM",rs.getString("REPORT_DWSBBM")); | |
| 793 | - m.put("REPORT_DWSBSJ",rs.getString("REPORT_DWSBSJ")); | |
| 794 | - m.put("REPORT_YWSJ",rs.getString("REPORT_YWSJ")); | |
| 698 | + m.put("lineCode",rs.getString("xl_bm")); | |
| 699 | + m.put("lineName", rs.getString("xl_name")); | |
| 700 | + m.put("date", rs.getString("schedule_date_str")); | |
| 701 | + m.put("bcs", rs.getString("bcs")); | |
| 702 | + m.put("qks", rs.getString("qks")); | |
| 703 | + m.put("rkgzs", rs.getString("rkgzs")); | |
| 704 | + m.put("ckgzs", rs.getString("ckgzs")); | |
| 705 | + return m; | |
| 706 | + } | |
| 707 | + }); | |
| 708 | + | |
| 709 | + | |
| 710 | + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz," | |
| 711 | + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," | |
| 712 | + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," | |
| 713 | + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," | |
| 714 | + + " jhszfcs,sjszfczds,szfczdl,create_date" | |
| 715 | + + " from bsth_c_calc_count " | |
| 716 | + + " where date >= '"+date2+"' and date <= '"+date+"' and gsdm = '"+gsdm+"'"; | |
| 717 | + | |
| 718 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 719 | + new RowMapper<Map<String, Object>>(){ | |
| 720 | + @Override | |
| 721 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 722 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 723 | + m.put("lineCode",rs.getString("xl")); | |
| 724 | + m.put("lineName", rs.getString("xl_name")); | |
| 725 | + m.put("date", rs.getString("date")); | |
| 726 | + | |
| 727 | + m.put("jhbc", rs.getString("jhbc")); | |
| 728 | + m.put("sjbc", rs.getString("sjbc")); | |
| 729 | + m.put("bczxl", rs.getString("bczxl")); | |
| 730 | + m.put("jhbcz", rs.getString("jhbcz")); | |
| 731 | + | |
| 732 | + m.put("jhcc", rs.getString("jhcc")); | |
| 733 | + m.put("sjcc", rs.getString("sjcc")); | |
| 734 | + m.put("ccl", rs.getString("ccl")); | |
| 735 | + m.put("jhccz", rs.getString("jhccz")); | |
| 736 | + | |
| 737 | + m.put("jhyylc", rs.getString("jhyylc")); | |
| 738 | + m.put("sjyylc", rs.getString("sjyylc")); | |
| 739 | + m.put("jhyylcz", rs.getString("jhyylcz")); | |
| 740 | + m.put("jhkslc", rs.getString("jhkslc")); | |
| 741 | + m.put("sjkslc", rs.getString("sjkslc")); | |
| 742 | + m.put("jhkslcz", rs.getString("jhkslcz")); | |
| 743 | + | |
| 744 | + m.put("jhgfbcs", rs.getString("jhssgfbcs")); | |
| 745 | + m.put("sjgfbcs", rs.getString("sjgfbcs")); | |
| 746 | + m.put("jhgfbcsz", rs.getString("jhgfbcsz")); | |
| 747 | + m.put("jhdgbcs", rs.getString("jhssdgbcs")); | |
| 748 | + m.put("sjdgbcs", rs.getString("sjdgbcs")); | |
| 749 | + m.put("jhdgbcsz", rs.getString("jhdgbcsz")); | |
| 750 | + | |
| 751 | + m.put("jhsmbcs", rs.getString("jhsmbcs")); | |
| 752 | + m.put("sjsmbczds", rs.getString("sjsmbczds")); | |
| 753 | + m.put("smbczdl", rs.getString("smbczdl")); | |
| 754 | + m.put("jhsmbcsz", rs.getString("jhsmbcsz")); | |
| 755 | + m.put("sjsmbczdsz", rs.getString("sjsmbczdsz")); | |
| 756 | + m.put("smbczdlz", rs.getString("smbczdlz")); | |
| 757 | + | |
| 758 | + m.put("jhszfcs", rs.getString("jhszfcs")); | |
| 759 | + m.put("sjszfczds", rs.getString("sjszfczds")); | |
| 760 | + m.put("szfczdl", rs.getString("szfczdl")); | |
| 761 | + | |
| 762 | + Date date = new Date(); | |
| 763 | + date.setTime(rs.getTimestamp("create_date").getTime()); | |
| 764 | + m.put("createDate", sdf.format(date)); | |
| 765 | + return m; | |
| 766 | + } | |
| 767 | + }); | |
| 768 | + | |
| 769 | + List<Map<String, Object>> bcDetail = new ArrayList<Map<String,Object>>(); | |
| 770 | + List<Map<String, Object>> smDetail = new ArrayList<Map<String,Object>>(); | |
| 771 | + List<Map<String, Object>> qqDetail = new ArrayList<Map<String,Object>>(); | |
| 772 | + List<Map<String, Object>> gpDetail = new ArrayList<Map<String,Object>>(); | |
| 773 | + | |
| 774 | + List<Map<String, Object>> ccList = createMap("计划出车率", dates); | |
| 775 | + List<Map<String, Object>> bcList = createMap("计划班次执行率", dates); | |
| 776 | + List<Map<String, Object>> smList = createMap("首末班发车准点率", dates); | |
| 777 | + List<Map<String, Object>> qqList = createMap("起讫站发车准点率", dates); | |
| 778 | + List<Map<String, Object>> gpList = createMap("挂牌线路发车准点率", dates); | |
| 779 | + List<Map<String, Object>> qkList = createMap("签卡率", dates); | |
| 780 | + | |
| 781 | + long sjbcs_z = 0l;//实时总班次 | |
| 782 | + BigDecimal yygl_z = new BigDecimal(0);//实时总营运里程 | |
| 783 | + long jhcc = 0, sjcc = 0, jhbc = 0, sjbc = 0, jhsmbc = 0, sjsmbc = 0, | |
| 784 | + jhqqbc = 0, sjqqzd = 0, jhgpqqbc = 0, sjgpqqzd = 0, bcs_qk = 0, qks = 0; | |
| 785 | + | |
| 786 | + for(Map<String, Object> t : list){ | |
| 787 | + if(yyLine.contains(t.get("lineCode").toString())){ | |
| 788 | + String d = t.get("date").toString(); | |
| 789 | + if(date.equals(d)){ | |
| 790 | + sjbcs_z += Long.valueOf(t.get("sjbc").toString()); | |
| 791 | + yygl_z = yygl_z.add(new BigDecimal(t.get("sjyylc").toString())); | |
| 792 | + | |
| 793 | + jhcc += Long.valueOf(t.get("jhccz").toString()); | |
| 794 | + sjcc += Long.valueOf(t.get("sjcc").toString()); | |
| 795 | + jhbc += Long.valueOf(t.get("jhbc").toString()); | |
| 796 | + sjbc += Long.valueOf(t.get("sjbc").toString()); | |
| 797 | + jhsmbc += Long.valueOf(t.get("jhsmbcs").toString()); | |
| 798 | + sjsmbc += Long.valueOf(t.get("sjsmbczds").toString()); | |
| 799 | + jhqqbc += Long.valueOf(t.get("jhszfcs").toString()); | |
| 800 | + sjqqzd += Long.valueOf(t.get("sjszfczds").toString()); | |
| 801 | + if(gpSet.contains(t.get("lineCode").toString())){ | |
| 802 | + jhgpqqbc += Long.valueOf(t.get("jhszfcs").toString()); | |
| 803 | + sjgpqqzd += Long.valueOf(t.get("sjszfczds").toString()); | |
| 804 | + } | |
| 805 | + | |
| 806 | + Map<String, Object> bc = new HashMap<String, Object>(); | |
| 807 | + bc.put("type", "班次执行详情"); | |
| 808 | + bc.put("lineName", t.get("lineName").toString()); | |
| 809 | + bc.put("jh", t.get("jhbc").toString()); | |
| 810 | + bc.put("sj", t.get("sjbc").toString()); | |
| 811 | + bcDetail.add(bc); | |
| 812 | + | |
| 813 | + Map<String, Object> sm = new HashMap<String, Object>(); | |
| 814 | + sm.put("type", "首站发车详情"); | |
| 815 | + sm.put("lineName", t.get("lineName").toString()); | |
| 816 | + sm.put("jh", t.get("jhsmbcs").toString()); | |
| 817 | + sm.put("sj", t.get("sjsmbczds").toString()); | |
| 818 | + smDetail.add(sm); | |
| 819 | + | |
| 820 | + Map<String, Object> qq = new HashMap<String, Object>(); | |
| 821 | + qq.put("type", "起讫站发车准点详情"); | |
| 822 | + qq.put("lineName", t.get("lineName").toString()); | |
| 823 | + qq.put("jh", t.get("jhszfcs").toString()); | |
| 824 | + qq.put("sj", t.get("sjszfczds").toString()); | |
| 825 | + qqDetail.add(qq); | |
| 826 | + | |
| 827 | + if(gpSet.contains(t.get("lineCode").toString())){ | |
| 828 | + Map<String, Object> gp = new HashMap<String, Object>(); | |
| 829 | + gp.put("type", "挂牌线路发车准点详情"); | |
| 830 | + gp.put("lineName", t.get("lineName").toString()); | |
| 831 | + gp.put("jh", t.get("jhszfcs").toString()); | |
| 832 | + gp.put("sj", t.get("sjszfczds").toString()); | |
| 833 | + gpDetail.add(gp); | |
| 834 | + } | |
| 835 | + } | |
| 836 | + | |
| 837 | + Map<String, Object> ccMap = ccList.get(datesMap.get(d)); | |
| 838 | + Map<String, Object> bcMap = bcList.get(datesMap.get(d)); | |
| 839 | + Map<String, Object> smMap = smList.get(datesMap.get(d)); | |
| 840 | + Map<String, Object> qqMap = qqList.get(datesMap.get(d)); | |
| 841 | + Map<String, Object> gpMap = gpList.get(datesMap.get(d)); | |
| 842 | + | |
| 843 | + ccMap.put("jh", Long.valueOf(ccMap.get("jh").toString()) + Long.valueOf(t.get("jhccz").toString())); | |
| 844 | + ccMap.put("sj", Long.valueOf(ccMap.get("sj").toString()) + Long.valueOf(t.get("sjcc").toString())); | |
| 845 | + bcMap.put("jh", Long.valueOf(bcMap.get("jh").toString()) + Long.valueOf(t.get("jhbc").toString())); | |
| 846 | + bcMap.put("sj", Long.valueOf(bcMap.get("sj").toString()) + Long.valueOf(t.get("sjbc").toString())); | |
| 847 | + smMap.put("jh", Long.valueOf(smMap.get("jh").toString()) + Long.valueOf(t.get("jhsmbcs").toString())); | |
| 848 | + smMap.put("sj", Long.valueOf(smMap.get("sj").toString()) + Long.valueOf(t.get("sjsmbczds").toString())); | |
| 849 | + qqMap.put("jh", Long.valueOf(qqMap.get("jh").toString()) + Long.valueOf(t.get("jhszfcs").toString())); | |
| 850 | + qqMap.put("sj", Long.valueOf(qqMap.get("sj").toString()) + Long.valueOf(t.get("sjszfczds").toString())); | |
| 851 | + if(gpSet.contains(t.get("lineCode").toString())){ | |
| 852 | + gpMap.put("jh", Long.valueOf(gpMap.get("jh").toString()) + Long.valueOf(t.get("jhszfcs").toString())); | |
| 853 | + gpMap.put("sj", Long.valueOf(gpMap.get("sj").toString()) + Long.valueOf(t.get("sjszfczds").toString())); | |
| 854 | + } | |
| 855 | + | |
| 856 | + } | |
| 857 | + } | |
| 858 | + | |
| 859 | + for(Map<String, Object> t : cardSignList){ | |
| 860 | + if(yyLine.contains(t.get("lineCode").toString())){ | |
| 861 | + String d = t.get("date").toString(); | |
| 862 | + if(date.equals(d)){ | |
| 863 | + bcs_qk += Long.valueOf(t.get("bcs").toString()); | |
| 864 | + qks += Long.valueOf(t.get("qks").toString()); | |
| 865 | + } | |
| 866 | + Map<String, Object> qkMap = qkList.get(datesMap.get(d)); | |
| 867 | + qkMap.put("jh", Long.valueOf(qkMap.get("jh").toString()) + Long.valueOf(t.get("bcs").toString())); | |
| 868 | + qkMap.put("sj", Long.valueOf(qkMap.get("sj").toString()) + Long.valueOf(t.get("qks").toString())); | |
| 869 | + } | |
| 870 | + } | |
| 871 | + | |
| 872 | + List<Map<String, Object>> zxlList = new ArrayList<Map<String, Object>>(); | |
| 873 | + zxlList.addAll(ccList); | |
| 874 | + zxlList.addAll(bcList); | |
| 875 | + zxlList.addAll(smList); | |
| 876 | + zxlList.addAll(qqList); | |
| 877 | + zxlList.addAll(gpList); | |
| 878 | + zxlList.addAll(qkList); | |
| 879 | + | |
| 880 | + List<Map<String, Object>> detailsList = new ArrayList<Map<String, Object>>(); | |
| 881 | + detailsList.addAll(bcDetail); | |
| 882 | + detailsList.addAll(smDetail); | |
| 883 | + detailsList.addAll(qqDetail); | |
| 884 | + detailsList.addAll(gpDetail); | |
| 885 | + | |
| 886 | + for(Map<String, Object> t : zxlList){ | |
| 887 | + if(t.get("jh") != null && Long.valueOf(t.get("jh").toString()).longValue() > 0l){ | |
| 888 | + t.put("ratio", new BigDecimal(t.get("sj").toString()).divide(new BigDecimal(t.get("jh").toString()), | |
| 889 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue()); | |
| 890 | + } else { | |
| 891 | + t.put("ratio", "0"); | |
| 892 | + } | |
| 893 | + } | |
| 894 | + | |
| 895 | + List<Map<String, Object>> glList = new ArrayList<Map<String, Object>>(); | |
| 896 | + | |
| 897 | + Date dd1 = new Date(); | |
| 898 | + dd1.setTime(dd.getTime() - 1l*1000*60*60*24); | |
| 899 | + String date1 = sd.format(dd1); //前一天 | |
| 900 | + List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(date1); | |
| 901 | + List<ScheduleRealInfo> listSche = new ArrayList<ScheduleRealInfo>(); | |
| 902 | + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 903 | + for(ScheduleRealInfo s : findAll){ | |
| 904 | + if(s.getGsBm() != null && s.getGsBm().trim().equals(gsdm)){ | |
| 905 | + if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 | |
| 906 | + listSche.add(s); | |
| 907 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 908 | + if (cts != null && cts.size() > 0) { | |
| 909 | + list_s.add(s); | |
| 910 | + } else { | |
| 911 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 912 | + list_s.add(s); | |
| 913 | + } | |
| 914 | + } | |
| 915 | + } | |
| 916 | + } | |
| 917 | + } | |
| 918 | + double jhyygl = culateJhgl(listSche);//计划营运公里 | |
| 919 | + double jhjccgl = culateJhJccgl(listSche); | |
| 920 | + double jhzgl = Arith.add(jhyygl, jhjccgl); | |
| 921 | + double sjgl = culateSjgl(list_s);//实际营运公里(不含临加) | |
| 922 | + double sjljgl = culateLjgl(listSche);//实际临加公里 | |
| 923 | + double sjyygl = Arith.add(sjgl, sjljgl);//实际营运公里 | |
| 924 | + double sjjccgl = culateJccgl(list_s); | |
| 925 | + double sjksgl = culateKsgl(list_s); | |
| 926 | + double zksgl = Arith.add(sjjccgl, sjksgl); | |
| 927 | + double sjzgl = Arith.add(sjyygl, zksgl);//实际总公里 | |
| 928 | + double lz = culateCJLC(listSche, "路阻"); | |
| 929 | + double dm = culateCJLC(listSche, "吊慢"); | |
| 930 | + double gz = culateCJLC(listSche, "故障"); | |
| 931 | + double jf = culateCJLC(listSche, "纠纷"); | |
| 932 | + double zs = culateCJLC(listSche, "肇事"); | |
| 933 | + double qr = culateCJLC(listSche, "缺人"); | |
| 934 | + double qc = culateCJLC(listSche, "缺车"); | |
| 935 | + double qrqc = Arith.add(qr, qc);//缺人缺车 | |
| 936 | + double kx = culateCJLC(listSche, "客稀"); | |
| 937 | + double qh = culateCJLC(listSche, "气候"); | |
| 938 | + double yw = culateCJLC(listSche, "援外"); | |
| 939 | + double lb_pc = culateCJLC(listSche, "配车"); | |
| 940 | + double lb_by = culateCJLC(listSche, "保养"); | |
| 941 | + double lb_cj = culateCJLC(listSche, "抽减"); | |
| 942 | + double lb_qt = culateCJLC(listSche, "其他"); | |
| 943 | + double qt = Arith.add(Arith.add(lb_pc, lb_by), Arith.add(lb_cj, lb_qt));//其他 | |
| 944 | + | |
| 945 | + Map<String, Object> jhzglMap = new HashMap<String, Object>(); | |
| 946 | + jhzglMap.put("name", "计划总公里"); | |
| 947 | + jhzglMap.put("value", jhzgl); | |
| 948 | + glList.add(jhzglMap); | |
| 949 | + Map<String, Object> sjzglMap = new HashMap<String, Object>(); | |
| 950 | + sjzglMap.put("name", "实际总公里"); | |
| 951 | + sjzglMap.put("value", sjzgl); | |
| 952 | + glList.add(sjzglMap); | |
| 953 | + Map<String, Object> lzMap = new HashMap<String, Object>(); | |
| 954 | + lzMap.put("name", "路阻"); | |
| 955 | + lzMap.put("value", lz); | |
| 956 | + glList.add(lzMap); | |
| 957 | + Map<String, Object> dmMap = new HashMap<String, Object>(); | |
| 958 | + dmMap.put("name", "吊慢"); | |
| 959 | + dmMap.put("value", dm); | |
| 960 | + glList.add(dmMap); | |
| 961 | + Map<String, Object> gzMap = new HashMap<String, Object>(); | |
| 962 | + gzMap.put("name", "故障"); | |
| 963 | + gzMap.put("value", gz); | |
| 964 | + glList.add(gzMap); | |
| 965 | + Map<String, Object> jfMap = new HashMap<String, Object>(); | |
| 966 | + jfMap.put("name", "纠纷"); | |
| 967 | + jfMap.put("value", jf); | |
| 968 | + glList.add(jfMap); | |
| 969 | + Map<String, Object> zsMap = new HashMap<String, Object>(); | |
| 970 | + zsMap.put("name", "肇事"); | |
| 971 | + zsMap.put("value", zs); | |
| 972 | + glList.add(zsMap); | |
| 973 | + Map<String, Object> qrqcMap = new HashMap<String, Object>(); | |
| 974 | + qrqcMap.put("name", "缺人缺车"); | |
| 975 | + qrqcMap.put("value", qrqc); | |
| 976 | + glList.add(qrqcMap); | |
| 977 | + Map<String, Object> kxMap = new HashMap<String, Object>(); | |
| 978 | + kxMap.put("name", "客稀"); | |
| 979 | + kxMap.put("value", kx); | |
| 980 | + glList.add(kxMap); | |
| 981 | + Map<String, Object> qhMap = new HashMap<String, Object>(); | |
| 982 | + qhMap.put("name", "气候"); | |
| 983 | + qhMap.put("value", qh); | |
| 984 | + glList.add(qhMap); | |
| 985 | + Map<String, Object> ywMap = new HashMap<String, Object>(); | |
| 986 | + ywMap.put("name", "援外"); | |
| 987 | + ywMap.put("value", yw); | |
| 988 | + glList.add(ywMap); | |
| 989 | + Map<String, Object> qtMap = new HashMap<String, Object>(); | |
| 990 | + qtMap.put("name", "其他"); | |
| 991 | + qtMap.put("value", qt); | |
| 992 | + glList.add(qtMap); | |
| 993 | + | |
| 994 | + | |
| 995 | + resMap.put("lineCount", lineCount); | |
| 996 | + resMap.put("level1Count", level1); | |
| 997 | + resMap.put("level2Count", level2); | |
| 998 | + resMap.put("sjbcs", sjbcs_z); | |
| 999 | + resMap.put("sjlcs", yygl_z.doubleValue()); | |
| 1000 | + | |
| 1001 | + resMap.put("ccl", jhcc>0?new BigDecimal(sjcc).divide(new BigDecimal(jhcc), | |
| 1002 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1003 | + resMap.put("bczxl", jhbc>0?new BigDecimal(sjbc).divide(new BigDecimal(jhbc), | |
| 1004 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1005 | + resMap.put("smbzdl", jhsmbc>0?new BigDecimal(sjsmbc).divide(new BigDecimal(jhsmbc), | |
| 1006 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1007 | + resMap.put("qqzzdl", jhqqbc>0?new BigDecimal(sjqqzd).divide(new BigDecimal(jhqqbc), | |
| 1008 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1009 | + resMap.put("gpzdl", jhgpqqbc>0?new BigDecimal(sjgpqqzd).divide(new BigDecimal(jhgpqqbc), | |
| 1010 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1011 | + resMap.put("qkl", bcs_qk>0?new BigDecimal(qks).divide(new BigDecimal(bcs_qk), | |
| 1012 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1013 | + | |
| 1014 | + resMap.put("ratioList", zxlList); | |
| 1015 | + | |
| 1016 | + resMap.put("detailsList", detailsList); | |
| 1017 | + | |
| 1018 | + resMap.put("mileageList", glList); | |
| 1019 | + | |
| 1020 | + return JSON.parseObject(JSON.toJSONString(resMap)); | |
| 1021 | + } | |
| 1022 | + | |
| 1023 | + @GET | |
| 1024 | + @Path("/selectData/attendance") | |
| 1025 | + public JSONObject attendance(){ | |
| 1026 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 1027 | + | |
| 1028 | + int day = 7;//天数 | |
| 1029 | + | |
| 1030 | + Date dd = new Date(); | |
| 1031 | + String date = sd.format(dd); //yyyy-MM-dd 当天 | |
| 1032 | + Date dd2 = new Date(); | |
| 1033 | + dd2.setTime(dd.getTime() - ((long)(day-1))*1000*60*60*24); | |
| 1034 | + String date2 = sd.format(dd2); //yyyy-MM-dd 6天前(加上当天就是取7天数据) | |
| 1035 | + | |
| 1036 | + String[] dates = new String[day]; | |
| 1037 | + Map<String, Integer> datesMap = new HashMap<String, Integer>(); | |
| 1038 | + | |
| 1039 | + for(int i = 0; i < day; i++){ | |
| 1040 | + Date tempDate = new Date(); | |
| 1041 | + tempDate.setTime(dd2.getTime() + ((long)i)*1000*60*60*24); | |
| 1042 | + String format = sd.format(tempDate); | |
| 1043 | + dates[i] = format; | |
| 1044 | + datesMap.put(format, i); | |
| 1045 | + } | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + String yyxlSql="SELECT line_code from bsth_c_line " | |
| 1049 | + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | |
| 1050 | + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql, | |
| 1051 | + new RowMapper<Map<String, Object>>(){ | |
| 1052 | + @Override | |
| 1053 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1054 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1055 | + m.put("lineCode", rs.getString("line_code")); | |
| 1056 | + return m; | |
| 1057 | + } | |
| 1058 | + }); | |
| 1059 | + Set<String> yyLine = new HashSet<String>(); | |
| 1060 | + for(Map<String, Object> t : yyxlList){ | |
| 1061 | + if(t.get("lineCode") != null){ | |
| 1062 | + yyLine.add(t.get("lineCode").toString()); | |
| 1063 | + } | |
| 1064 | + } | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + List<Map<String, Object>> attList = new ArrayList<Map<String, Object>>(); | |
| 1068 | + List<Map<String, Object>> lackList = new ArrayList<Map<String, Object>>(); | |
| 1069 | + | |
| 1070 | + for(int i = 0; i < dates.length; i++){ | |
| 1071 | + Set<String> jhSet = new HashSet<String>(); | |
| 1072 | + Set<String> sjSet = new HashSet<String>(); | |
| 1073 | + List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(dates[i]); | |
| 1074 | + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 1075 | + for(ScheduleRealInfo s : findAll){ | |
| 1076 | + if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 | |
| 1077 | + if(!isInOut(s)){ | |
| 1078 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 1079 | + if (cts != null && cts.size() > 0) { | |
| 1080 | + list_s.add(s); | |
| 1081 | + } else { | |
| 1082 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 1083 | + list_s.add(s); | |
| 1084 | + } | |
| 1085 | + } | |
| 1086 | + | |
| 1087 | + if(!s.isSflj() && !s.isCcService()){ | |
| 1088 | + jhSet.add(s.getjGh() + "/" + s.getjName()); | |
| 1089 | + } | |
| 1090 | + } | |
| 1091 | + } | |
| 1092 | + } | |
| 1093 | + | |
| 1094 | + for(ScheduleRealInfo s : list_s){ | |
| 1095 | + if(!(s.getStatus() == -1)){ | |
| 1096 | + sjSet.add(s.getjGh() + "/" + s.getjName()); | |
| 1097 | + } | |
| 1098 | + | |
| 1099 | + if (s.isSflj()){ | |
| 1100 | + continue; | |
| 1101 | + } | |
| 1102 | + Set<ChildTaskPlan> cts; | |
| 1103 | + cts = s.getcTasks(); | |
| 1104 | + //有子任务 | |
| 1105 | + if (cts != null && cts.size() > 0) { | |
| 1106 | + for(ChildTaskPlan c : cts){ | |
| 1107 | + if(c.getCcId()==null){ | |
| 1108 | + if(c.getMileageType().equals("service")){ | |
| 1109 | + if(c.isDestroy() && (c.getDestroyReason()==null? "" : c.getDestroyReason()).equals("缺人")){ | |
| 1110 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 1111 | + m.put("gsName", s.getGsName()); | |
| 1112 | + m.put("lineName", s.getXlName()); | |
| 1113 | + m.put("driverName", s.getjName()); | |
| 1114 | + m.put("date", s.getRealExecDate()); | |
| 1115 | + m.put("time", c.getStartDate()); | |
| 1116 | + if(c.getRemarks() != null && c.getRemarks().trim().length() > 0){ | |
| 1117 | + m.put("explain", c.getRemarks()); | |
| 1118 | + } else { | |
| 1119 | + m.put("explain", s.getRemarks()!=null?s.getRemarks():""); | |
| 1120 | + } | |
| 1121 | + lackList.add(m); | |
| 1122 | + } | |
| 1123 | + } | |
| 1124 | + } | |
| 1125 | + } | |
| 1126 | + } | |
| 1127 | + //主任务烂班 | |
| 1128 | + else if(s.getStatus() == -1 && !s.isCcService()){ | |
| 1129 | + if(s.getAdjustExps().equals("缺人")){ | |
| 1130 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 1131 | + m.put("gsName", s.getGsName()); | |
| 1132 | + m.put("lineName", s.getXlName()); | |
| 1133 | + m.put("driverName", s.getjName()); | |
| 1134 | + m.put("date", s.getRealExecDate()); | |
| 1135 | + m.put("time", s.getFcsj()); | |
| 1136 | + m.put("explain", s.getRemarks()!=null?s.getRemarks():""); | |
| 1137 | + lackList.add(m); | |
| 1138 | + } | |
| 1139 | + } | |
| 1140 | + } | |
| 1141 | + | |
| 1142 | + Map<String, Object> att = new HashMap<String, Object>(); | |
| 1143 | + att.put("date", dates[i]); | |
| 1144 | + att.put("jh", jhSet.size()); | |
| 1145 | + att.put("sj", sjSet.size()); | |
| 1146 | + attList.add(att); | |
| 1147 | + } | |
| 1148 | + | |
| 1149 | + String gpLineSql = "select p.company_code, count(1) jsy" | |
| 1150 | + + " from (select e.jsy from bsth_c_s_ecinfo e" | |
| 1151 | + + " where e.is_cancel = 0 group by e.jsy) a" | |
| 1152 | + + " left join bsth_c_personnel p on a.jsy = p.id" | |
| 1153 | + + " group by p.company_code"; | |
| 1154 | + List<Map<String, Object>> ecList=jdbcTemplate.query(gpLineSql, | |
| 1155 | + new RowMapper<Map<String, Object>>(){ | |
| 1156 | + @Override | |
| 1157 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1158 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1159 | + m.put("company", rs.getString("company_code")); | |
| 1160 | + m.put("jsy", rs.getString("jsy")); | |
| 1161 | + return m; | |
| 1162 | + } | |
| 1163 | + }); | |
| 1164 | + | |
| 1165 | + List<Map<String, Object>> jsyList = new ArrayList<Map<String, Object>>(); | |
| 1166 | + Map<String, Object> ygMap = new HashMap<String, Object>(); | |
| 1167 | + ygMap.put("company", "杨高"); | |
| 1168 | + ygMap.put("jsy", "0"); | |
| 1169 | + Map<String, Object> snMap = new HashMap<String, Object>(); | |
| 1170 | + snMap.put("company", "上南"); | |
| 1171 | + snMap.put("jsy", "0"); | |
| 1172 | + Map<String, Object> jgMap = new HashMap<String, Object>(); | |
| 1173 | + jgMap.put("company", "金高"); | |
| 1174 | + jgMap.put("jsy", "0"); | |
| 1175 | + Map<String, Object> nhMap = new HashMap<String, Object>(); | |
| 1176 | + nhMap.put("company", "南汇"); | |
| 1177 | + nhMap.put("jsy", "0"); | |
| 1178 | + for(Map<String, Object> m : ecList){ //顺序:杨高,上南,金高,南汇 | |
| 1179 | + if("05".equals(m.get("company").toString())){ | |
| 1180 | +// m.put("company", "杨高"); | |
| 1181 | + ygMap.put("jsy", m.get("jsy").toString()); | |
| 1182 | + } | |
| 1183 | + if("55".equals(m.get("company").toString())){ | |
| 1184 | +// m.put("company", "上南"); | |
| 1185 | + snMap.put("jsy", m.get("jsy").toString()); | |
| 1186 | + } | |
| 1187 | + if("22".equals(m.get("company").toString())){ | |
| 1188 | +// m.put("company", "金高"); | |
| 1189 | + jgMap.put("jsy", m.get("jsy").toString()); | |
| 1190 | + } | |
| 1191 | + if("26".equals(m.get("company").toString())){ | |
| 1192 | +// m.put("company", "南汇"); | |
| 1193 | + nhMap.put("jsy", m.get("jsy").toString()); | |
| 1194 | + } | |
| 1195 | + } | |
| 1196 | + jsyList.add(ygMap); | |
| 1197 | + jsyList.add(snMap); | |
| 1198 | + jsyList.add(jgMap); | |
| 1199 | + jsyList.add(nhMap); | |
| 1200 | + | |
| 1201 | + String xlSql = "select a.jsy, b.spy, c.cl from" | |
| 1202 | + + " (select count(1) jsy from (select a.jsy from bsth_c_s_ecinfo a where a.is_cancel = 0 and a.spy is not null and a.jsy is not null group by jsy) a) a" | |
| 1203 | + + " LEFT JOIN" | |
| 1204 | + + " (select count(1) spy from (select b.spy from bsth_c_s_ecinfo b where b.is_cancel = 0 and b.spy is not null group by spy) b) b" | |
| 1205 | + + " on 1=1" | |
| 1206 | + + " LEFT JOIN" | |
| 1207 | + + " (select count(1) cl from (select c.cl from bsth_c_s_ccinfo c where c.is_cancel = 0 and c.cl is not null and c.xl in(select e.xl from bsth_c_s_ecinfo e where e.is_cancel = 0 and e.spy is not null) group by c.cl) c) c" | |
| 1208 | + + " on 1=1"; | |
| 1209 | + List<Map<String, Object>> xlConfigList=jdbcTemplate.query(xlSql, | |
| 1210 | + new RowMapper<Map<String, Object>>(){ | |
| 1211 | + @Override | |
| 1212 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1213 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1214 | + m.put("jsy", rs.getString("jsy")); | |
| 1215 | + m.put("spy", rs.getString("spy")); | |
| 1216 | + m.put("cl", rs.getString("cl")); | |
| 1217 | + return m; | |
| 1218 | + } | |
| 1219 | + }); | |
| 1220 | + long jsy = 0l, spy = 0l, cl = 0l; | |
| 1221 | + for(Map<String, Object> t : xlConfigList){ | |
| 1222 | + if(t.get("jsy") != null){ | |
| 1223 | + jsy += Long.valueOf(t.get("jsy").toString()); | |
| 1224 | + } | |
| 1225 | + if(t.get("spy") != null){ | |
| 1226 | + spy += Long.valueOf(t.get("spy").toString()); | |
| 1227 | + } | |
| 1228 | + if(t.get("cl") != null){ | |
| 1229 | + cl += Long.valueOf(t.get("cl").toString()); | |
| 1230 | + } | |
| 1231 | + } | |
| 1232 | + | |
| 1233 | + resMap.put("jsyList", jsyList); | |
| 1234 | + resMap.put("attList", attList); | |
| 1235 | + resMap.put("lackList", lackList); | |
| 1236 | + resMap.put("salesmanJsy", jsy); | |
| 1237 | + resMap.put("salesmanSpy", spy); | |
| 1238 | + resMap.put("salesmanCl", cl); | |
| 1239 | + | |
| 1240 | + return JSON.parseObject(JSON.toJSONString(resMap)); | |
| 1241 | + } | |
| 1242 | + | |
| 1243 | + @GET | |
| 1244 | + @Path("/selectData/attendance/{gsdm}") | |
| 1245 | + public JSONObject attendance(@PathParam("gsdm") String gsdm){ | |
| 1246 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 1247 | + | |
| 1248 | + int day = 7;//天数 | |
| 1249 | + | |
| 1250 | + Date dd = new Date(); | |
| 1251 | + String date = sd.format(dd); //yyyy-MM-dd 当天 | |
| 1252 | + Date dd2 = new Date(); | |
| 1253 | + dd2.setTime(dd.getTime() - ((long)(day-1))*1000*60*60*24); | |
| 1254 | + String date2 = sd.format(dd2); //yyyy-MM-dd 6天前(加上当天就是取7天数据) | |
| 1255 | + | |
| 1256 | + String[] dates = new String[day]; | |
| 1257 | + Map<String, Integer> datesMap = new HashMap<String, Integer>(); | |
| 1258 | + | |
| 1259 | + for(int i = 0; i < day; i++){ | |
| 1260 | + Date tempDate = new Date(); | |
| 1261 | + tempDate.setTime(dd2.getTime() + ((long)i)*1000*60*60*24); | |
| 1262 | + String format = sd.format(tempDate); | |
| 1263 | + dates[i] = format; | |
| 1264 | + datesMap.put(format, i); | |
| 1265 | + } | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + String yyxlSql="SELECT line_code from bsth_c_line " | |
| 1269 | + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | |
| 1270 | + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql, | |
| 1271 | + new RowMapper<Map<String, Object>>(){ | |
| 1272 | + @Override | |
| 1273 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1274 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1275 | + m.put("lineCode", rs.getString("line_code")); | |
| 1276 | + return m; | |
| 1277 | + } | |
| 1278 | + }); | |
| 1279 | + Set<String> yyLine = new HashSet<String>(); | |
| 1280 | + for(Map<String, Object> t : yyxlList){ | |
| 1281 | + if(t.get("lineCode") != null){ | |
| 1282 | + yyLine.add(t.get("lineCode").toString()); | |
| 1283 | + } | |
| 1284 | + } | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + List<Map<String, Object>> attList = new ArrayList<Map<String, Object>>(); | |
| 1288 | + List<Map<String, Object>> lackList = new ArrayList<Map<String, Object>>(); | |
| 1289 | + | |
| 1290 | + for(int i = 0; i < dates.length; i++){ | |
| 1291 | + Set<String> jhSet = new HashSet<String>(); | |
| 1292 | + Set<String> sjSet = new HashSet<String>(); | |
| 1293 | + List<ScheduleRealInfo> findAll = scheduleRealInfoRepository.findAll(dates[i]); | |
| 1294 | + List<ScheduleRealInfo> list_s = new ArrayList<ScheduleRealInfo>(); | |
| 1295 | + for(ScheduleRealInfo s : findAll){ | |
| 1296 | + if(s.getGsBm() != null && s.getGsBm().equals(gsdm)){//直属公司 | |
| 1297 | + if(s.getXlBm() != null && yyLine.contains(s.getXlBm())){//营运线路 | |
| 1298 | + if(!isInOut(s)){ | |
| 1299 | + Set<ChildTaskPlan> cts = s.getcTasks(); | |
| 1300 | + if (cts != null && cts.size() > 0) { | |
| 1301 | + list_s.add(s); | |
| 1302 | + } else { | |
| 1303 | + if (s.getZdsjActual() != null && s.getFcsjActual() != null) { | |
| 1304 | + list_s.add(s); | |
| 1305 | + } | |
| 1306 | + } | |
| 1307 | + | |
| 1308 | + if(!s.isSflj() && !s.isCcService()){ | |
| 1309 | + jhSet.add(s.getjGh() + "/" + s.getjName()); | |
| 1310 | + } | |
| 1311 | + } | |
| 1312 | + } | |
| 1313 | + } | |
| 1314 | + } | |
| 1315 | + | |
| 1316 | + for(ScheduleRealInfo s : list_s){ | |
| 1317 | + if(!(s.getStatus() == -1)){ | |
| 1318 | + sjSet.add(s.getjGh() + "/" + s.getjName()); | |
| 1319 | + } | |
| 1320 | + | |
| 1321 | + if (s.isSflj()){ | |
| 1322 | + continue; | |
| 1323 | + } | |
| 1324 | + Set<ChildTaskPlan> cts; | |
| 1325 | + cts = s.getcTasks(); | |
| 1326 | + //有子任务 | |
| 1327 | + if (cts != null && cts.size() > 0) { | |
| 1328 | + for(ChildTaskPlan c : cts){ | |
| 1329 | + if(c.getCcId()==null){ | |
| 1330 | + if(c.getMileageType().equals("service")){ | |
| 1331 | + if(c.isDestroy() && (c.getDestroyReason()==null? "" : c.getDestroyReason()).equals("缺人")){ | |
| 1332 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 1333 | + m.put("gsName", s.getGsName()); | |
| 1334 | + m.put("lineName", s.getXlName()); | |
| 1335 | + m.put("driverName", s.getjName()); | |
| 1336 | + m.put("date", s.getRealExecDate()); | |
| 1337 | + m.put("time", c.getStartDate()); | |
| 1338 | + if(c.getRemarks() != null && c.getRemarks().trim().length() > 0){ | |
| 1339 | + m.put("explain", c.getRemarks()); | |
| 1340 | + } else { | |
| 1341 | + m.put("explain", s.getRemarks()!=null?s.getRemarks():""); | |
| 1342 | + } | |
| 1343 | + lackList.add(m); | |
| 1344 | + } | |
| 1345 | + } | |
| 1346 | + } | |
| 1347 | + } | |
| 1348 | + } | |
| 1349 | + //主任务烂班 | |
| 1350 | + else if(s.getStatus() == -1 && !s.isCcService()){ | |
| 1351 | + if(s.getAdjustExps().equals("缺人")){ | |
| 1352 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 1353 | + m.put("gsName", s.getGsName()); | |
| 1354 | + m.put("lineName", s.getXlName()); | |
| 1355 | + m.put("driverName", s.getjName()); | |
| 1356 | + m.put("date", s.getRealExecDate()); | |
| 1357 | + m.put("time", s.getFcsj()); | |
| 1358 | + m.put("explain", s.getRemarks()!=null?s.getRemarks():""); | |
| 1359 | + lackList.add(m); | |
| 1360 | + } | |
| 1361 | + } | |
| 1362 | + } | |
| 1363 | + | |
| 1364 | + Map<String, Object> att = new HashMap<String, Object>(); | |
| 1365 | + att.put("date", dates[i]); | |
| 1366 | + att.put("jh", jhSet.size()); | |
| 1367 | + att.put("sj", sjSet.size()); | |
| 1368 | + attList.add(att); | |
| 1369 | + } | |
| 1370 | + | |
| 1371 | + String gpLineSql = "select p.branche_company_code, b.business_name, count(1) jsy" | |
| 1372 | + + " from (select e.jsy from bsth_c_s_ecinfo e" | |
| 1373 | + + " where e.is_cancel = 0 group by e.jsy) a" | |
| 1374 | + + " left join bsth_c_personnel p on a.jsy = p.id" | |
| 1375 | + + " left join bsth_c_business b on p.company_code = b.up_code" | |
| 1376 | + + " and p.branche_company_code = b.business_code" | |
| 1377 | + + " where p.company_code = '"+gsdm+"'" | |
| 1378 | + + " group by p.branche_company_code, b.business_name" | |
| 1379 | + + " order by p.branche_company_code"; | |
| 1380 | + List<Map<String, Object>> ecList=jdbcTemplate.query(gpLineSql, | |
| 1381 | + new RowMapper<Map<String, Object>>(){ | |
| 1382 | + @Override | |
| 1383 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1384 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1385 | + m.put("company", rs.getString("branche_company_code")); | |
| 1386 | + m.put("companyName", rs.getString("business_name")); | |
| 1387 | + m.put("jsy", rs.getString("jsy")); | |
| 1388 | + return m; | |
| 1389 | + } | |
| 1390 | + }); | |
| 1391 | + | |
| 1392 | + List<Integer> keyList = new ArrayList<Integer>(); | |
| 1393 | + Map<Integer, Map<String, Object>> keyMap = new HashMap<Integer, Map<String, Object>>(); | |
| 1394 | + List<Map<String, Object>> jsyList = new ArrayList<Map<String, Object>>(); | |
| 1395 | + for(Map<String, Object> m : ecList){ | |
| 1396 | + if(m.get("company") != null && m.get("company").toString().trim().length() > 0){ | |
| 1397 | + Integer i = Integer.valueOf(m.get("company").toString().trim()); | |
| 1398 | + if(!keyMap.containsKey(i)){ | |
| 1399 | + Map<String, Object> temp = new HashMap<String, Object>(); | |
| 1400 | + temp.put("company", m.get("companyName").toString()); | |
| 1401 | + temp.put("jsy", m.get("jsy").toString()); | |
| 1402 | + keyMap.put(i, temp); | |
| 1403 | + keyList.add(i); | |
| 1404 | + jsyList.add(temp); | |
| 1405 | + } | |
| 1406 | + } | |
| 1407 | + } | |
| 1408 | + | |
| 1409 | + String xlSql = "select a.jsy, b.spy, c.cl from" | |
| 1410 | + + " (select count(1) jsy from (select a.jsy from bsth_c_s_ecinfo a" | |
| 1411 | + + " left join bsth_c_personnel p on a.jsy=p.id where a.is_cancel = 0" | |
| 1412 | + + " and a.spy is not null and a.jsy is not null" | |
| 1413 | + + " and p.company_code = '"+gsdm+"'" | |
| 1414 | + + " group by jsy) a) a" | |
| 1415 | + + " LEFT JOIN" | |
| 1416 | + + " (select count(1) spy from (select b.spy from bsth_c_s_ecinfo b" | |
| 1417 | + + " left join bsth_c_personnel p on b.spy=p.id where b.is_cancel = 0" | |
| 1418 | + + " and b.spy is not null and p.company_code = '"+gsdm+"'" | |
| 1419 | + + " group by spy) b) b" | |
| 1420 | + + " on 1=1" | |
| 1421 | + + " LEFT JOIN" | |
| 1422 | + + " (select count(1) cl from (select c.cl from bsth_c_s_ccinfo c" | |
| 1423 | + + " left join bsth_c_cars car on c.cl=car.id where c.is_cancel = 0" | |
| 1424 | + + " and c.cl is not null and car.business_code = '"+gsdm+"'" | |
| 1425 | + + " and c.xl in(select e.xl from bsth_c_s_ecinfo e" | |
| 1426 | + + " where e.is_cancel = 0 and e.spy is not null) group by c.cl) c) c" | |
| 1427 | + + " on 1=1"; | |
| 1428 | + List<Map<String, Object>> xlConfigList=jdbcTemplate.query(xlSql, | |
| 1429 | + new RowMapper<Map<String, Object>>(){ | |
| 1430 | + @Override | |
| 1431 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1432 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1433 | + m.put("jsy", rs.getString("jsy")); | |
| 1434 | + m.put("spy", rs.getString("spy")); | |
| 1435 | + m.put("cl", rs.getString("cl")); | |
| 1436 | + return m; | |
| 1437 | + } | |
| 1438 | + }); | |
| 1439 | + long jsy = 0l, spy = 0l, cl = 0l; | |
| 1440 | + for(Map<String, Object> t : xlConfigList){ | |
| 1441 | + if(t.get("jsy") != null){ | |
| 1442 | + jsy += Long.valueOf(t.get("jsy").toString()); | |
| 1443 | + } | |
| 1444 | + if(t.get("spy") != null){ | |
| 1445 | + spy += Long.valueOf(t.get("spy").toString()); | |
| 1446 | + } | |
| 1447 | + if(t.get("cl") != null){ | |
| 1448 | + cl += Long.valueOf(t.get("cl").toString()); | |
| 1449 | + } | |
| 1450 | + } | |
| 1451 | + | |
| 1452 | + resMap.put("jsyList", jsyList); | |
| 1453 | + resMap.put("attList", attList); | |
| 1454 | + resMap.put("lackList", lackList); | |
| 1455 | + resMap.put("salesmanJsy", jsy); | |
| 1456 | + resMap.put("salesmanSpy", spy); | |
| 1457 | + resMap.put("salesmanCl", cl); | |
| 1458 | + | |
| 1459 | + return JSON.parseObject(JSON.toJSONString(resMap)); | |
| 1460 | + } | |
| 1461 | + | |
| 1462 | + /** 按月份查询统计指标 */ | |
| 1463 | + @GET | |
| 1464 | + @Path("/selectData/getMonthly/{month}") | |
| 1465 | + public JSONObject getMonthly(@PathParam("month") String month){ | |
| 1466 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 1467 | + | |
| 1468 | + String gpLineSql = "select * from bsth_c_line_plate"; | |
| 1469 | + List<Map<String, Object>> gpLineList=jdbcTemplate.query(gpLineSql, | |
| 1470 | + new RowMapper<Map<String, Object>>(){ | |
| 1471 | + @Override | |
| 1472 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1473 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1474 | + m.put("lineName", rs.getString("line_name")); | |
| 1475 | + m.put("lineCode", rs.getString("line_code")); | |
| 1476 | + return m; | |
| 1477 | + } | |
| 1478 | + }); | |
| 1479 | + | |
| 1480 | + Set<String> gpSet = new HashSet<String>(); | |
| 1481 | + for(Map<String, Object> t : gpLineList){ | |
| 1482 | + if(t.get("lineCode") != null && t.get("lineCode").toString().trim().length() > 0){ | |
| 1483 | + gpSet.add(t.get("lineCode").toString().trim()); | |
| 1484 | + } | |
| 1485 | + } | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + String yyxlSql="SELECT line_code from bsth_c_line " | |
| 1489 | + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | |
| 1490 | + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql, | |
| 1491 | + new RowMapper<Map<String, Object>>(){ | |
| 1492 | + @Override | |
| 1493 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1494 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1495 | + m.put("lineCode", rs.getString("line_code")); | |
| 1496 | + return m; | |
| 1497 | + } | |
| 1498 | + }); | |
| 1499 | + Set<String> yyLine = new HashSet<String>(); | |
| 1500 | + for(Map<String, Object> t : yyxlList){ | |
| 1501 | + if(t.get("lineCode") != null){ | |
| 1502 | + yyLine.add(t.get("lineCode").toString()); | |
| 1503 | + } | |
| 1504 | + } | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz," | |
| 1508 | + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," | |
| 1509 | + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," | |
| 1510 | + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," | |
| 1511 | + + " jhszfcs,sjszfczds,szfczdl,jhzgl,sjzgl,create_date" | |
| 1512 | + + " from bsth_c_calc_count " | |
| 1513 | + + " where date like '%"+month+"%'"; | |
| 1514 | + | |
| 1515 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 1516 | + new RowMapper<Map<String, Object>>(){ | |
| 1517 | + @Override | |
| 1518 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1519 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1520 | + m.put("lineCode",rs.getString("xl")); | |
| 1521 | + m.put("lineName", rs.getString("xl_name")); | |
| 1522 | + m.put("date", rs.getString("date")); | |
| 1523 | + | |
| 1524 | + m.put("jhbc", rs.getString("jhbc")); | |
| 1525 | + m.put("sjbc", rs.getString("sjbc")); | |
| 1526 | + m.put("bczxl", rs.getString("bczxl")); | |
| 1527 | + m.put("jhbcz", rs.getString("jhbcz")); | |
| 1528 | + | |
| 1529 | + m.put("jhcc", rs.getString("jhcc")); | |
| 1530 | + m.put("sjcc", rs.getString("sjcc")); | |
| 1531 | + m.put("ccl", rs.getString("ccl")); | |
| 1532 | + m.put("jhccz", rs.getString("jhccz")); | |
| 1533 | + | |
| 1534 | + m.put("jhyylc", rs.getString("jhyylc")); | |
| 1535 | + m.put("sjyylc", rs.getString("sjyylc")); | |
| 1536 | + m.put("jhyylcz", rs.getString("jhyylcz")); | |
| 1537 | + m.put("jhkslc", rs.getString("jhkslc")); | |
| 1538 | + m.put("sjkslc", rs.getString("sjkslc")); | |
| 1539 | + m.put("jhkslcz", rs.getString("jhkslcz")); | |
| 1540 | + | |
| 1541 | + m.put("jhgfbcs", rs.getString("jhssgfbcs")); | |
| 1542 | + m.put("sjgfbcs", rs.getString("sjgfbcs")); | |
| 1543 | + m.put("jhgfbcsz", rs.getString("jhgfbcsz")); | |
| 1544 | + m.put("jhdgbcs", rs.getString("jhssdgbcs")); | |
| 1545 | + m.put("sjdgbcs", rs.getString("sjdgbcs")); | |
| 1546 | + m.put("jhdgbcsz", rs.getString("jhdgbcsz")); | |
| 1547 | + | |
| 1548 | + m.put("jhsmbcs", rs.getString("jhsmbcs")); | |
| 1549 | + m.put("sjsmbczds", rs.getString("sjsmbczds")); | |
| 1550 | + m.put("smbczdl", rs.getString("smbczdl")); | |
| 1551 | + m.put("jhsmbcsz", rs.getString("jhsmbcsz")); | |
| 1552 | + m.put("sjsmbczdsz", rs.getString("sjsmbczdsz")); | |
| 1553 | + m.put("smbczdlz", rs.getString("smbczdlz")); | |
| 1554 | + | |
| 1555 | + m.put("jhszfcs", rs.getString("jhszfcs")); | |
| 1556 | + m.put("sjszfczds", rs.getString("sjszfczds")); | |
| 1557 | + m.put("szfczdl", rs.getString("szfczdl")); | |
| 1558 | + | |
| 1559 | + m.put("jhzgl", rs.getString("jhzgl")); | |
| 1560 | + m.put("sjzgl", rs.getString("sjzgl")); | |
| 1561 | + | |
| 1562 | + Date date = new Date(); | |
| 1563 | + date.setTime(rs.getTimestamp("create_date").getTime()); | |
| 1564 | + m.put("createDate", sdf.format(date)); | |
| 1565 | + return m; | |
| 1566 | + } | |
| 1567 | + }); | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + BigDecimal jhzgl = new BigDecimal(0), sjzgl = new BigDecimal(0);// | |
| 1571 | + long jhcc = 0, sjcc = 0, jhbc = 0, sjbc = 0, jhsmbc = 0, sjsmbc = 0, | |
| 1572 | + jhqqbc = 0, sjqqzd = 0, jhgpqqbc = 0, sjgpqqzd = 0; | |
| 1573 | + | |
| 1574 | + for(Map<String, Object> t : list){ | |
| 1575 | + if(yyLine.contains(t.get("lineCode").toString())){ | |
| 1576 | + | |
| 1577 | + jhzgl = jhzgl.add(new BigDecimal(t.get("jhzgl").toString())); | |
| 1578 | + sjzgl = sjzgl.add(new BigDecimal(t.get("sjzgl").toString())); | |
| 1579 | + | |
| 1580 | + jhcc += Long.valueOf(t.get("jhccz").toString()); | |
| 1581 | + sjcc += Long.valueOf(t.get("sjcc").toString()); | |
| 1582 | + jhbc += Long.valueOf(t.get("jhbc").toString()); | |
| 1583 | + sjbc += Long.valueOf(t.get("sjbc").toString()); | |
| 1584 | + jhsmbc += Long.valueOf(t.get("jhsmbcs").toString()); | |
| 1585 | + sjsmbc += Long.valueOf(t.get("sjsmbczds").toString()); | |
| 1586 | + jhqqbc += Long.valueOf(t.get("jhszfcs").toString()); | |
| 1587 | + sjqqzd += Long.valueOf(t.get("sjszfczds").toString()); | |
| 1588 | + if(gpSet.contains(t.get("lineCode").toString())){ | |
| 1589 | + jhgpqqbc += Long.valueOf(t.get("jhszfcs").toString()); | |
| 1590 | + sjgpqqzd += Long.valueOf(t.get("sjszfczds").toString()); | |
| 1591 | + } | |
| 1592 | + | |
| 1593 | + } | |
| 1594 | + } | |
| 1595 | + | |
| 1596 | + resMap.put("date", month); | |
| 1597 | + | |
| 1598 | + resMap.put("jhzgl", df.format(jhzgl)); | |
| 1599 | + resMap.put("sjzgl", df.format(sjzgl)); | |
| 1600 | + resMap.put("jhcc", jhcc); | |
| 1601 | + resMap.put("sjcc", sjcc); | |
| 1602 | + resMap.put("jhbc", jhbc); | |
| 1603 | + resMap.put("sjbc", sjbc); | |
| 1604 | + resMap.put("jhsm", jhsmbc); | |
| 1605 | + resMap.put("sjsm", sjsmbc); | |
| 1606 | + resMap.put("jhqq", jhqqbc); | |
| 1607 | + resMap.put("sjqq", sjqqzd); | |
| 1608 | + resMap.put("jhgp", jhgpqqbc); | |
| 1609 | + resMap.put("sjgp", sjgpqqzd); | |
| 1610 | + | |
| 1611 | + resMap.put("glzxl", jhzgl.doubleValue()>0?sjzgl.divide(jhzgl, | |
| 1612 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1613 | + resMap.put("ccl", jhcc>0?new BigDecimal(sjcc).divide(new BigDecimal(jhcc), | |
| 1614 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1615 | + resMap.put("bczxl", jhbc>0?new BigDecimal(sjbc).divide(new BigDecimal(jhbc), | |
| 1616 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1617 | + resMap.put("smbzdl", jhbc>0?new BigDecimal(sjsmbc).divide(new BigDecimal(jhsmbc), | |
| 1618 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1619 | + resMap.put("qqzzdl", jhbc>0?new BigDecimal(sjqqzd).divide(new BigDecimal(jhqqbc), | |
| 1620 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1621 | + resMap.put("gpzdl", jhbc>0?new BigDecimal(sjgpqqzd).divide(new BigDecimal(jhgpqqbc), | |
| 1622 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1623 | + | |
| 1624 | + return JSON.parseObject(JSON.toJSONString(resMap)); | |
| 1625 | + } | |
| 1626 | + | |
| 1627 | + /** 按月份查询直属公司统计指标 */ | |
| 1628 | + @GET | |
| 1629 | + @Path("/selectData/getMonthly/{gsdm}/{month}") | |
| 1630 | + public JSONObject getMonthly(@PathParam("gsdm") String gsdm, @PathParam("month") String month){ | |
| 1631 | + Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 1632 | + | |
| 1633 | + String gpLineSql = "select * from bsth_c_line_plate"; | |
| 1634 | + List<Map<String, Object>> gpLineList=jdbcTemplate.query(gpLineSql, | |
| 1635 | + new RowMapper<Map<String, Object>>(){ | |
| 1636 | + @Override | |
| 1637 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1638 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1639 | + m.put("lineName", rs.getString("line_name")); | |
| 1640 | + m.put("lineCode", rs.getString("line_code")); | |
| 1641 | + return m; | |
| 1642 | + } | |
| 1643 | + }); | |
| 1644 | + | |
| 1645 | + Set<String> gpSet = new HashSet<String>(); | |
| 1646 | + for(Map<String, Object> t : gpLineList){ | |
| 1647 | + if(t.get("lineCode") != null && t.get("lineCode").toString().trim().length() > 0){ | |
| 1648 | + gpSet.add(t.get("lineCode").toString().trim()); | |
| 1649 | + } | |
| 1650 | + } | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + String yyxlSql="SELECT line_code from bsth_c_line " | |
| 1654 | + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | |
| 1655 | + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql, | |
| 1656 | + new RowMapper<Map<String, Object>>(){ | |
| 1657 | + @Override | |
| 1658 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1659 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1660 | + m.put("lineCode", rs.getString("line_code")); | |
| 1661 | + return m; | |
| 1662 | + } | |
| 1663 | + }); | |
| 1664 | + Set<String> yyLine = new HashSet<String>(); | |
| 1665 | + for(Map<String, Object> t : yyxlList){ | |
| 1666 | + if(t.get("lineCode") != null){ | |
| 1667 | + yyLine.add(t.get("lineCode").toString()); | |
| 1668 | + } | |
| 1669 | + } | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz," | |
| 1673 | + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," | |
| 1674 | + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," | |
| 1675 | + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," | |
| 1676 | + + " jhszfcs,sjszfczds,szfczdl,jhzgl,sjzgl,create_date" | |
| 1677 | + + " from bsth_c_calc_count " | |
| 1678 | + + " where gsdm = '"+gsdm+"' and date like '%"+month+"%'"; | |
| 1679 | + | |
| 1680 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 1681 | + new RowMapper<Map<String, Object>>(){ | |
| 1682 | + @Override | |
| 1683 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1684 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1685 | + m.put("lineCode",rs.getString("xl")); | |
| 1686 | + m.put("lineName", rs.getString("xl_name")); | |
| 1687 | + m.put("date", rs.getString("date")); | |
| 1688 | + | |
| 1689 | + m.put("jhbc", rs.getString("jhbc")); | |
| 1690 | + m.put("sjbc", rs.getString("sjbc")); | |
| 1691 | + m.put("bczxl", rs.getString("bczxl")); | |
| 1692 | + m.put("jhbcz", rs.getString("jhbcz")); | |
| 1693 | + | |
| 1694 | + m.put("jhcc", rs.getString("jhcc")); | |
| 1695 | + m.put("sjcc", rs.getString("sjcc")); | |
| 1696 | + m.put("ccl", rs.getString("ccl")); | |
| 1697 | + m.put("jhccz", rs.getString("jhccz")); | |
| 1698 | + | |
| 1699 | + m.put("jhyylc", rs.getString("jhyylc")); | |
| 1700 | + m.put("sjyylc", rs.getString("sjyylc")); | |
| 1701 | + m.put("jhyylcz", rs.getString("jhyylcz")); | |
| 1702 | + m.put("jhkslc", rs.getString("jhkslc")); | |
| 1703 | + m.put("sjkslc", rs.getString("sjkslc")); | |
| 1704 | + m.put("jhkslcz", rs.getString("jhkslcz")); | |
| 1705 | + | |
| 1706 | + m.put("jhgfbcs", rs.getString("jhssgfbcs")); | |
| 1707 | + m.put("sjgfbcs", rs.getString("sjgfbcs")); | |
| 1708 | + m.put("jhgfbcsz", rs.getString("jhgfbcsz")); | |
| 1709 | + m.put("jhdgbcs", rs.getString("jhssdgbcs")); | |
| 1710 | + m.put("sjdgbcs", rs.getString("sjdgbcs")); | |
| 1711 | + m.put("jhdgbcsz", rs.getString("jhdgbcsz")); | |
| 1712 | + | |
| 1713 | + m.put("jhsmbcs", rs.getString("jhsmbcs")); | |
| 1714 | + m.put("sjsmbczds", rs.getString("sjsmbczds")); | |
| 1715 | + m.put("smbczdl", rs.getString("smbczdl")); | |
| 1716 | + m.put("jhsmbcsz", rs.getString("jhsmbcsz")); | |
| 1717 | + m.put("sjsmbczdsz", rs.getString("sjsmbczdsz")); | |
| 1718 | + m.put("smbczdlz", rs.getString("smbczdlz")); | |
| 1719 | + | |
| 1720 | + m.put("jhszfcs", rs.getString("jhszfcs")); | |
| 1721 | + m.put("sjszfczds", rs.getString("sjszfczds")); | |
| 1722 | + m.put("szfczdl", rs.getString("szfczdl")); | |
| 1723 | + | |
| 1724 | + m.put("jhzgl", rs.getString("jhzgl")); | |
| 1725 | + m.put("sjzgl", rs.getString("sjzgl")); | |
| 1726 | + | |
| 1727 | + Date date = new Date(); | |
| 1728 | + date.setTime(rs.getTimestamp("create_date").getTime()); | |
| 1729 | + m.put("createDate", sdf.format(date)); | |
| 1730 | + return m; | |
| 1731 | + } | |
| 1732 | + }); | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + BigDecimal jhzgl = new BigDecimal(0), sjzgl = new BigDecimal(0);// | |
| 1736 | + long jhcc = 0, sjcc = 0, jhbc = 0, sjbc = 0, jhsmbc = 0, sjsmbc = 0, | |
| 1737 | + jhqqbc = 0, sjqqzd = 0, jhgpqqbc = 0, sjgpqqzd = 0; | |
| 1738 | + | |
| 1739 | + for(Map<String, Object> t : list){ | |
| 1740 | + if(yyLine.contains(t.get("lineCode").toString())){ | |
| 1741 | + | |
| 1742 | + jhzgl = jhzgl.add(new BigDecimal(t.get("jhzgl").toString())); | |
| 1743 | + sjzgl = sjzgl.add(new BigDecimal(t.get("sjzgl").toString())); | |
| 1744 | + | |
| 1745 | + jhcc += Long.valueOf(t.get("jhccz").toString()); | |
| 1746 | + sjcc += Long.valueOf(t.get("sjcc").toString()); | |
| 1747 | + jhbc += Long.valueOf(t.get("jhbc").toString()); | |
| 1748 | + sjbc += Long.valueOf(t.get("sjbc").toString()); | |
| 1749 | + jhsmbc += Long.valueOf(t.get("jhsmbcs").toString()); | |
| 1750 | + sjsmbc += Long.valueOf(t.get("sjsmbczds").toString()); | |
| 1751 | + jhqqbc += Long.valueOf(t.get("jhszfcs").toString()); | |
| 1752 | + sjqqzd += Long.valueOf(t.get("sjszfczds").toString()); | |
| 1753 | + if(gpSet.contains(t.get("lineCode").toString())){ | |
| 1754 | + jhgpqqbc += Long.valueOf(t.get("jhszfcs").toString()); | |
| 1755 | + sjgpqqzd += Long.valueOf(t.get("sjszfczds").toString()); | |
| 1756 | + } | |
| 1757 | + | |
| 1758 | + } | |
| 1759 | + } | |
| 1760 | + | |
| 1761 | + resMap.put("date", month); | |
| 1762 | + | |
| 1763 | + resMap.put("jhzgl", df.format(jhzgl)); | |
| 1764 | + resMap.put("sjzgl", df.format(sjzgl)); | |
| 1765 | + resMap.put("jhcc", jhcc); | |
| 1766 | + resMap.put("sjcc", sjcc); | |
| 1767 | + resMap.put("jhbc", jhbc); | |
| 1768 | + resMap.put("sjbc", sjbc); | |
| 1769 | + resMap.put("jhsm", jhsmbc); | |
| 1770 | + resMap.put("sjsm", sjsmbc); | |
| 1771 | + resMap.put("jhqq", jhqqbc); | |
| 1772 | + resMap.put("sjqq", sjqqzd); | |
| 1773 | + resMap.put("jhgp", jhgpqqbc); | |
| 1774 | + resMap.put("sjgp", sjgpqqzd); | |
| 1775 | + | |
| 1776 | + resMap.put("glzxl", jhzgl.doubleValue()>0?sjzgl.divide(jhzgl, | |
| 1777 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1778 | + resMap.put("ccl", jhcc>0?new BigDecimal(sjcc).divide(new BigDecimal(jhcc), | |
| 1779 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1780 | + resMap.put("bczxl", jhbc>0?new BigDecimal(sjbc).divide(new BigDecimal(jhbc), | |
| 1781 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1782 | + resMap.put("smbzdl", jhsmbc>0?new BigDecimal(sjsmbc).divide(new BigDecimal(jhsmbc), | |
| 1783 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1784 | + resMap.put("qqzzdl", jhqqbc>0?new BigDecimal(sjqqzd).divide(new BigDecimal(jhqqbc), | |
| 1785 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1786 | + resMap.put("gpzdl", jhgpqqbc>0?new BigDecimal(sjgpqqzd).divide(new BigDecimal(jhgpqqbc), | |
| 1787 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 1788 | + | |
| 1789 | + return JSON.parseObject(JSON.toJSONString(resMap)); | |
| 1790 | + } | |
| 1791 | + | |
| 1792 | + /** 按日期查询四家直属公司统计指标 */ | |
| 1793 | + @GET | |
| 1794 | + @Path("/selectData/getCompanyData/{date}") | |
| 1795 | + public List<Map<String, Object>> getCompanyData(@PathParam("date") String date){ | |
| 1796 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 1797 | + | |
| 1798 | +// String date = sd.format(new Date()); | |
| 1799 | + | |
| 1800 | + String gpLineSql = "select * from bsth_c_line_plate"; | |
| 1801 | + List<Map<String, Object>> gpLineList=jdbcTemplate.query(gpLineSql, | |
| 1802 | + new RowMapper<Map<String, Object>>(){ | |
| 1803 | + @Override | |
| 1804 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1805 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1806 | + m.put("lineName", rs.getString("line_name")); | |
| 1807 | + m.put("lineCode", rs.getString("line_code")); | |
| 1808 | + return m; | |
| 1809 | + } | |
| 1810 | + }); | |
| 1811 | + | |
| 1812 | + Set<String> gpSet = new HashSet<String>(); | |
| 1813 | + for(Map<String, Object> t : gpLineList){ | |
| 1814 | + if(t.get("lineCode") != null && t.get("lineCode").toString().trim().length() > 0){ | |
| 1815 | + gpSet.add(t.get("lineCode").toString().trim()); | |
| 1816 | + } | |
| 1817 | + } | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + String yyxlSql="SELECT line_code from bsth_c_line " | |
| 1821 | + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | |
| 1822 | + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql, | |
| 1823 | + new RowMapper<Map<String, Object>>(){ | |
| 1824 | + @Override | |
| 1825 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1826 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1827 | + m.put("lineCode", rs.getString("line_code")); | |
| 1828 | + return m; | |
| 1829 | + } | |
| 1830 | + }); | |
| 1831 | + Set<String> yyLine = new HashSet<String>(); | |
| 1832 | + for(Map<String, Object> t : yyxlList){ | |
| 1833 | + if(t.get("lineCode") != null){ | |
| 1834 | + yyLine.add(t.get("lineCode").toString()); | |
| 1835 | + } | |
| 1836 | + } | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + String gsSql="SELECT business_name, business_code from bsth_c_business "; | |
| 1840 | + List<Map<String, Object>> gsList=jdbcTemplate.query(gsSql, | |
| 1841 | + new RowMapper<Map<String, Object>>(){ | |
| 1842 | + @Override | |
| 1843 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1844 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1845 | + m.put("name", rs.getString("business_name")!=null?rs.getString("business_name"):""); | |
| 1846 | + m.put("code", rs.getString("business_code")!=null?rs.getString("business_code"):""); | |
| 1847 | + return m; | |
| 1848 | + } | |
| 1849 | + }); | |
| 1850 | + final Map<String, String> gsMap = new HashMap<String, String>(); | |
| 1851 | + for(Map<String, Object> t : gsList){ | |
| 1852 | + if(t.get("code") != null && t.get("name") != null){ | |
| 1853 | + gsMap.put(t.get("code").toString(), t.get("name").toString().substring(0, 2)); | |
| 1854 | + } | |
| 1855 | + } | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + String sql="select gsdm,xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl,jhccz," | |
| 1859 | + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," | |
| 1860 | + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," | |
| 1861 | + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," | |
| 1862 | + + " jhszfcs,sjszfczds,szfczdl,jhzgl,sjzgl,create_date" | |
| 1863 | + + " from bsth_c_calc_count " | |
| 1864 | + + " where date = '"+date+"'"; | |
| 1865 | + | |
| 1866 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 1867 | + new RowMapper<Map<String, Object>>(){ | |
| 1868 | + @Override | |
| 1869 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1870 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1871 | + m.put("gs",rs.getString("gsdm")!=null?gsMap.get(rs.getString("gsdm")):""); | |
| 1872 | + m.put("lineCode",rs.getString("xl")); | |
| 1873 | + m.put("lineName", rs.getString("xl_name")); | |
| 1874 | + m.put("date", rs.getString("date")); | |
| 1875 | + | |
| 1876 | + m.put("jhbc", rs.getString("jhbc")); | |
| 1877 | + m.put("sjbc", rs.getString("sjbc")); | |
| 1878 | + m.put("bczxl", rs.getString("bczxl")); | |
| 1879 | + m.put("jhbcz", rs.getString("jhbcz")); | |
| 1880 | + | |
| 1881 | + m.put("jhcc", rs.getString("jhcc")); | |
| 1882 | + m.put("sjcc", rs.getString("sjcc")); | |
| 1883 | + m.put("ccl", rs.getString("ccl")); | |
| 1884 | + m.put("jhccz", rs.getString("jhccz")); | |
| 1885 | + | |
| 1886 | + m.put("jhyylc", rs.getString("jhyylc")); | |
| 1887 | + m.put("sjyylc", rs.getString("sjyylc")); | |
| 1888 | + m.put("jhyylcz", rs.getString("jhyylcz")); | |
| 1889 | + m.put("jhkslc", rs.getString("jhkslc")); | |
| 1890 | + m.put("sjkslc", rs.getString("sjkslc")); | |
| 1891 | + m.put("jhkslcz", rs.getString("jhkslcz")); | |
| 1892 | + | |
| 1893 | + m.put("jhgfbcs", rs.getString("jhssgfbcs")); | |
| 1894 | + m.put("sjgfbcs", rs.getString("sjgfbcs")); | |
| 1895 | + m.put("jhgfbcsz", rs.getString("jhgfbcsz")); | |
| 1896 | + m.put("jhdgbcs", rs.getString("jhssdgbcs")); | |
| 1897 | + m.put("sjdgbcs", rs.getString("sjdgbcs")); | |
| 1898 | + m.put("jhdgbcsz", rs.getString("jhdgbcsz")); | |
| 1899 | + | |
| 1900 | + m.put("jhsmbcs", rs.getString("jhsmbcs")); | |
| 1901 | + m.put("sjsmbczds", rs.getString("sjsmbczds")); | |
| 1902 | + m.put("smbczdl", rs.getString("smbczdl")); | |
| 1903 | + m.put("jhsmbcsz", rs.getString("jhsmbcsz")); | |
| 1904 | + m.put("sjsmbczdsz", rs.getString("sjsmbczdsz")); | |
| 1905 | + m.put("smbczdlz", rs.getString("smbczdlz")); | |
| 1906 | + | |
| 1907 | + m.put("jhszfcs", rs.getString("jhszfcs")); | |
| 1908 | + m.put("sjszfczds", rs.getString("sjszfczds")); | |
| 1909 | + m.put("szfczdl", rs.getString("szfczdl")); | |
| 1910 | + | |
| 1911 | + m.put("jhzgl", rs.getString("jhzgl")); | |
| 1912 | + m.put("sjzgl", rs.getString("sjzgl")); | |
| 1913 | + | |
| 1914 | + Date date = new Date(); | |
| 1915 | + date.setTime(rs.getTimestamp("create_date").getTime()); | |
| 1916 | + m.put("createDate", sdf.format(date)); | |
| 1917 | + return m; | |
| 1918 | + } | |
| 1919 | + }); | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + String cardSignSql="select gs_bm,xl_bm,xl_name,schedule_date_str,bcs,qks,rkgzs,ckgzs" | |
| 1923 | + + " from card_signing " | |
| 1924 | + + " where schedule_date_str = '"+date+"'"; | |
| 1925 | + List<Map<String, Object>> cardSignList=jdbcTemplate.query(cardSignSql, | |
| 1926 | + new RowMapper<Map<String, Object>>(){ | |
| 1927 | + @Override | |
| 1928 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 1929 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 1930 | + m.put("gs",rs.getString("gs_bm")!=null?gsMap.get(rs.getString("gs_bm")):""); | |
| 1931 | + m.put("lineCode",rs.getString("xl_bm")); | |
| 1932 | + m.put("lineName", rs.getString("xl_name")); | |
| 1933 | + m.put("date", rs.getString("schedule_date_str")); | |
| 1934 | + m.put("bcs", rs.getString("bcs")); | |
| 1935 | + m.put("qks", rs.getString("qks")); | |
| 1936 | + m.put("rkgzs", rs.getString("rkgzs")); | |
| 1937 | + m.put("ckgzs", rs.getString("ckgzs")); | |
| 1938 | + return m; | |
| 1939 | + } | |
| 1940 | + }); | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + Map<String, Integer> sortMap = new HashMap<String, Integer>(); | |
| 1944 | + sortMap.put("杨高", 0); | |
| 1945 | + sortMap.put("上南", 1); | |
| 1946 | + sortMap.put("金高", 2); | |
| 1947 | + sortMap.put("南汇", 3); | |
| 1948 | + sortMap.put("浦交", 4); | |
| 1949 | + Map<String, Object> ygMap = new HashMap<String, Object>(); | |
| 1950 | + ygMap.put("gs", "杨高"); | |
| 1951 | + resList.add(ygMap); | |
| 1952 | + Map<String, Object> snMap = new HashMap<String, Object>(); | |
| 1953 | + snMap.put("gs", "上南"); | |
| 1954 | + resList.add(snMap); | |
| 1955 | + Map<String, Object> jgMap = new HashMap<String, Object>(); | |
| 1956 | + jgMap.put("gs", "金高"); | |
| 1957 | + resList.add(jgMap); | |
| 1958 | + Map<String, Object> nhMap = new HashMap<String, Object>(); | |
| 1959 | + nhMap.put("gs", "南汇"); | |
| 1960 | + resList.add(nhMap); | |
| 1961 | + Map<String, Object> pjMap = new HashMap<String, Object>(); | |
| 1962 | + pjMap.put("gs", "浦交"); | |
| 1963 | + resList.add(pjMap); | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + for(Map<String, Object> t : list){ | |
| 1967 | + if(yyLine.contains(t.get("lineCode").toString())){ | |
| 1968 | + if(sortMap.get(t.get("gs")) != null){ | |
| 1969 | + Map<String, Object> m = resList.get(sortMap.get(t.get("gs"))); | |
| 1970 | + mapPut(m, "jhcc", t.get("jhccz").toString()); | |
| 1971 | + mapPut(m, "sjcc", t.get("sjcc").toString()); | |
| 1972 | + mapPut(m, "jhbc", t.get("jhbc").toString()); | |
| 1973 | + mapPut(m, "sjbc", t.get("sjbc").toString()); | |
| 1974 | + mapPut(m, "jhsmbc", t.get("jhsmbcs").toString()); | |
| 1975 | + mapPut(m, "sjsmbc", t.get("sjsmbczds").toString()); | |
| 1976 | + mapPut(m, "jhqqbc", t.get("jhszfcs").toString()); | |
| 1977 | + mapPut(m, "sjqqzd", t.get("sjszfczds").toString()); | |
| 1978 | + if(gpSet.contains(t.get("lineCode").toString())){ | |
| 1979 | + mapPut(m, "jhgpqqbc", t.get("jhszfcs").toString()); | |
| 1980 | + mapPut(m, "sjgpqqzd", t.get("sjszfczds").toString()); | |
| 1981 | + } | |
| 1982 | + mapPut(m, "jhzgl", t.get("jhzgl").toString()); | |
| 1983 | + mapPut(m, "sjzgl", t.get("sjzgl").toString()); | |
| 1984 | + } | |
| 1985 | + | |
| 1986 | + mapPut(pjMap, "jhcc", t.get("jhccz").toString()); | |
| 1987 | + mapPut(pjMap, "sjcc", t.get("sjcc").toString()); | |
| 1988 | + mapPut(pjMap, "jhbc", t.get("jhbc").toString()); | |
| 1989 | + mapPut(pjMap, "sjbc", t.get("sjbc").toString()); | |
| 1990 | + mapPut(pjMap, "jhsmbc", t.get("jhsmbcs").toString()); | |
| 1991 | + mapPut(pjMap, "sjsmbc", t.get("sjsmbczds").toString()); | |
| 1992 | + mapPut(pjMap, "jhqqbc", t.get("jhszfcs").toString()); | |
| 1993 | + mapPut(pjMap, "sjqqzd", t.get("sjszfczds").toString()); | |
| 1994 | + if(gpSet.contains(t.get("lineCode").toString())){ | |
| 1995 | + mapPut(pjMap, "jhgpqqbc", t.get("jhszfcs").toString()); | |
| 1996 | + mapPut(pjMap, "sjgpqqzd", t.get("sjszfczds").toString()); | |
| 1997 | + } | |
| 1998 | + mapPut(pjMap, "jhzgl", t.get("jhzgl").toString()); | |
| 1999 | + mapPut(pjMap, "sjzgl", t.get("sjzgl").toString()); | |
| 2000 | + } | |
| 2001 | + } | |
| 2002 | + | |
| 2003 | + for(Map<String, Object> t : cardSignList){ | |
| 2004 | + if(yyLine.contains(t.get("lineCode").toString())){ | |
| 2005 | + if(sortMap.get(t.get("gs")) != null){ | |
| 2006 | + Map<String, Object> m = resList.get(sortMap.get(t.get("gs"))); | |
| 2007 | + mapPut(m, "bcs", t.get("bcs").toString()); | |
| 2008 | + mapPut(m, "qks", t.get("qks").toString()); | |
| 2009 | +// mapPut(m, "rkgzs", t.get("rkgzs").toString()); | |
| 2010 | +// mapPut(m, "ckgzs", t.get("ckgzs").toString()); | |
| 2011 | + } | |
| 2012 | + | |
| 2013 | + mapPut(pjMap, "bcs", t.get("bcs").toString()); | |
| 2014 | + mapPut(pjMap, "qks", t.get("qks").toString()); | |
| 2015 | +// mapPut(pjMap, "rkgzs", t.get("rkgzs").toString()); | |
| 2016 | +// mapPut(pjMap, "ckgzs", t.get("ckgzs").toString()); | |
| 2017 | + } | |
| 2018 | + } | |
| 2019 | + | |
| 2020 | + for(Map<String, Object> m : resList){ | |
| 2021 | + m.put("date", date); | |
| 2022 | + | |
| 2023 | + m.put("glzxl", new BigDecimal(m.get("jhzgl").toString()).doubleValue()>0? | |
| 2024 | + new BigDecimal(m.get("sjzgl").toString()).divide(new BigDecimal(m.get("jhzgl").toString()), | |
| 2025 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 2026 | + m.put("ccl", new BigDecimal(m.get("jhcc").toString()).doubleValue()>0? | |
| 2027 | + new BigDecimal(m.get("sjcc").toString()).divide(new BigDecimal(m.get("jhcc").toString()), | |
| 2028 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 2029 | + m.put("bczxl", new BigDecimal(m.get("jhbc").toString()).doubleValue()>0? | |
| 2030 | + new BigDecimal(m.get("sjbc").toString()).divide(new BigDecimal(m.get("jhbc").toString()), | |
| 2031 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 2032 | + m.put("smbzdl", new BigDecimal(m.get("jhsmbc").toString()).doubleValue()>0? | |
| 2033 | + new BigDecimal(m.get("sjsmbc").toString()).divide(new BigDecimal(m.get("jhsmbc").toString()), | |
| 2034 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 2035 | + m.put("qqzzdl", new BigDecimal(m.get("jhqqbc").toString()).doubleValue()>0? | |
| 2036 | + new BigDecimal(m.get("sjqqzd").toString()).divide(new BigDecimal(m.get("jhqqbc").toString()), | |
| 2037 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 2038 | + m.put("gpzdl", new BigDecimal(m.get("jhgpqqbc").toString()).doubleValue()>0? | |
| 2039 | + new BigDecimal(m.get("sjgpqqzd").toString()).divide(new BigDecimal(m.get("jhgpqqbc").toString()), | |
| 2040 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 2041 | + m.put("qkl", new BigDecimal(m.get("bcs").toString()).doubleValue()>0? | |
| 2042 | + new BigDecimal(m.get("qks").toString()).divide(new BigDecimal(m.get("bcs").toString()), | |
| 2043 | + 4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).doubleValue():"0"); | |
| 2044 | + } | |
| 2045 | + | |
| 2046 | + return resList; | |
| 2047 | + } | |
| 2048 | + | |
| 2049 | + /** 报备登记查询接口 */ | |
| 2050 | + @GET | |
| 2051 | + @Path("/selectData/getReport") | |
| 2052 | + public List<Map<String, Object>> getReport(){ | |
| 2053 | + String sql="SELECT ID,REPORT_TYPE,REPORT_GS,REPORT_FGS,REPORT_GSNAME,REPORT_FGSNAME," | |
| 2054 | + + " REPORT_DATE,REPORT_BBR,REPORT_XL,REPORT_XLNAME,REPORT_STATION,REPORT_DWSBBM," | |
| 2055 | + + " REPORT_DWSBSJ,REPORT_YWSJ,REPORT_SMBWD,REPORT_DJGSJ,REPORT_DJGYY,REPORT_TFSJ," | |
| 2056 | + + " REPORT_YXSJ,REPORT_YXBC,REPORT_TZCS,REPORT_SGBH,REPORT_ZBH,REPORT_PZH,REPORT_JSY," | |
| 2057 | + + " REPORT_SGSJ,REPORT_SGDD,REPORT_XSFX,REPORT_SGDX,REPORT_DXPZH,REPORT_SGGK," | |
| 2058 | + + " REPORT_SSRS,REPORT_SWRS,REPORT_BGR,REPORT_BGRDH,REPORT_BZ,REPORT_ROAD,STATUS," | |
| 2059 | + + " CREATE_BY,CREATE_DATE,UPDATE_BY,UPDATE_DATE" | |
| 2060 | + + " from bsth_t_report "; | |
| 2061 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, | |
| 2062 | + new RowMapper<Map<String, Object>>(){ | |
| 2063 | + @Override | |
| 2064 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 2065 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 2066 | + m.put("ID", rs.getString("ID")); | |
| 2067 | + m.put("REPORT_TYPE", rs.getString("REPORT_TYPE")); | |
| 2068 | + m.put("REPORT_GS", rs.getString("REPORT_GS")); | |
| 2069 | + m.put("REPORT_FGS",rs.getString("REPORT_FGS")); | |
| 2070 | + m.put("REPORT_GSNAME",rs.getString("REPORT_GSNAME")); | |
| 2071 | + m.put("REPORT_FGSNAME",rs.getString("REPORT_FGSNAME")); | |
| 2072 | + m.put("REPORT_DATE",rs.getString("REPORT_DATE")); | |
| 2073 | + m.put("REPORT_BBR",rs.getString("REPORT_BBR")); | |
| 2074 | + m.put("REPORT_XL",rs.getString("REPORT_XL")); | |
| 2075 | + m.put("REPORT_XLNAME",rs.getString("REPORT_XLNAME")); | |
| 2076 | + m.put("REPORT_STATION",rs.getString("REPORT_STATION")); | |
| 2077 | + m.put("REPORT_DWSBBM",rs.getString("REPORT_DWSBBM")); | |
| 2078 | + m.put("REPORT_DWSBSJ",rs.getString("REPORT_DWSBSJ")); | |
| 2079 | + m.put("REPORT_YWSJ",rs.getString("REPORT_YWSJ")); | |
| 795 | 2080 | m.put("REPORT_SMBWD",rs.getString("REPORT_SMBWD")); |
| 796 | 2081 | m.put("REPORT_DJGSJ",rs.getString("REPORT_DJGSJ")); |
| 797 | 2082 | m.put("REPORT_DJGYY",rs.getString("REPORT_DJGYY")); |
| ... | ... | @@ -843,6 +2128,14 @@ public class BigscreenService { |
| 843 | 2128 | return mapList; |
| 844 | 2129 | } |
| 845 | 2130 | |
| 2131 | + public void mapPut(Map<String, Object> m, String key, Object value){ | |
| 2132 | + if(m.get(key) != null){ | |
| 2133 | + m.put(key, new BigDecimal(m.get(key).toString()).add(new BigDecimal(value.toString()))); | |
| 2134 | + } else { | |
| 2135 | + m.put(key, value); | |
| 2136 | + } | |
| 2137 | + } | |
| 2138 | + | |
| 846 | 2139 | /**计划营运公里*/ |
| 847 | 2140 | public double culateJhgl(List<ScheduleRealInfo> lists) { |
| 848 | 2141 | // TODO Auto-generated method stub | ... | ... |