Commit efa7a44eaee2bd12c566dfa4cb6522f09849b17e
1 parent
dacda227
行车路单 无实发不显示
Showing
9 changed files
with
321 additions
and
80 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -369,8 +369,35 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | @RequestMapping(value="/statisticsDailyTj") |
| 372 | - public List<Map<String,Object>> statisticsDailyTj(@RequestParam String gsdm,@RequestParam String fgsdm, @RequestParam String line, @RequestParam String date, | |
| 373 | - @RequestParam String date2,@RequestParam String xlName, @RequestParam String type){ | |
| 372 | + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ | |
| 373 | + String gsdm=""; | |
| 374 | + if(map.get("gsdm")!=null){ | |
| 375 | + gsdm=map.get("gsdm").toString(); | |
| 376 | + } | |
| 377 | + String fgsdm=""; | |
| 378 | + if(map.get("fgsdm")!=null){ | |
| 379 | + fgsdm=map.get("fgsdm").toString(); | |
| 380 | + } | |
| 381 | + String line=""; | |
| 382 | + if(map.get("line")!=null){ | |
| 383 | + line=map.get("line").toString(); | |
| 384 | + } | |
| 385 | + String date=""; | |
| 386 | + if(map.get("date")!=null){ | |
| 387 | + date=map.get("date").toString(); | |
| 388 | + } | |
| 389 | + String date2=""; | |
| 390 | + if(map.get("date2")!=null){ | |
| 391 | + date2=map.get("date2").toString(); | |
| 392 | + } | |
| 393 | + String xlName=""; | |
| 394 | + if(map.get("xlName")!=null){ | |
| 395 | + xlName=map.get("xlName").toString(); | |
| 396 | + } | |
| 397 | + String type=""; | |
| 398 | + if(map.get("type")!=null){ | |
| 399 | + type=map.get("type").toString(); | |
| 400 | + } | |
| 374 | 401 | return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); |
| 375 | 402 | } |
| 376 | 403 | ... | ... |
src/main/java/com/bsth/data/schedule/thread/CalcOilThread.java
| 1 | 1 | package com.bsth.data.schedule.thread; |
| 2 | 2 | |
| 3 | +import com.bsth.service.oil.DlbService; | |
| 3 | 4 | import com.bsth.service.oil.YlbService; |
| 4 | 5 | import org.slf4j.Logger; |
| 5 | 6 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -15,7 +16,8 @@ public class CalcOilThread extends Thread{ |
| 15 | 16 | |
| 16 | 17 | @Autowired |
| 17 | 18 | YlbService ylbService; |
| 18 | - | |
| 19 | + @Autowired | |
| 20 | + DlbService dlbService; | |
| 19 | 21 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 20 | 22 | |
| 21 | 23 | @Override |
| ... | ... | @@ -23,6 +25,7 @@ public class CalcOilThread extends Thread{ |
| 23 | 25 | try{ |
| 24 | 26 | logger.info("开始计算路单里程加注量...."); |
| 25 | 27 | ylbService.obtainDsq(); |
| 28 | + dlbService.obtainDsq(); | |
| 26 | 29 | logger.info("计算路单里程加注量结束!"); |
| 27 | 30 | } catch(Exception e){ |
| 28 | 31 | logger.error("计算路单里程加注量失败",e); | ... | ... |
src/main/java/com/bsth/service/oil/DlbService.java
| ... | ... | @@ -18,4 +18,6 @@ public interface DlbService extends BaseService<Dlb, Integer>{ |
| 18 | 18 | Map<String, Object> sumYlb(Map<String, Object> map); |
| 19 | 19 | |
| 20 | 20 | Map<String, Object> saveDlbList(Map<String, Object> map) throws Exception; |
| 21 | + | |
| 22 | + String obtainDsq() throws Exception; | |
| 21 | 23 | } | ... | ... |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| ... | ... | @@ -6,6 +6,7 @@ import java.text.DecimalFormat; |
| 6 | 6 | import java.text.ParseException; |
| 7 | 7 | import java.text.SimpleDateFormat; |
| 8 | 8 | import java.util.ArrayList; |
| 9 | +import java.util.Calendar; | |
| 9 | 10 | import java.util.Date; |
| 10 | 11 | import java.util.HashMap; |
| 11 | 12 | import java.util.Iterator; |
| ... | ... | @@ -70,8 +71,144 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 70 | 71 | JdbcTemplate jdbcTemplate; |
| 71 | 72 | |
| 72 | 73 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 74 | + | |
| 75 | + @Transactional | |
| 76 | + @Override | |
| 77 | + public String obtainDsq() throws Exception{ | |
| 78 | + String result = "failure"; | |
| 79 | + List<Cars> carsList=carsRepository.findCars(); | |
| 80 | + Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | |
| 81 | + for (int i = 0; i < carsList.size(); i++) { | |
| 82 | + Cars c=carsList.get(i); | |
| 83 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 84 | + } | |
| 85 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 86 | + Date dNow = new Date(); //当前时间 | |
| 87 | + Date dBefore = new Date(); | |
| 88 | + Calendar calendar = Calendar.getInstance(); //得到日历 | |
| 89 | + calendar.setTime(dNow);//把当前时间赋给日历 | |
| 90 | + calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天 | |
| 91 | + dBefore = calendar.getTime(); //得到前一天的时间 | |
| 92 | + String rq=sdf.format(dBefore); | |
| 93 | + String line=""; | |
| 94 | + //保留两位小数 | |
| 95 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 96 | + // TODO Auto-generated method stub | |
| 97 | + Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 98 | + //当天DLB信息 | |
| 99 | + List<Dlb> dlList=repository.obtainDl(rq, "", "", line, "", "nbbm"); | |
| 100 | + //当天YLXXB信息 | |
| 101 | + List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,""); | |
| 102 | + //当天加电信息表 | |
| 103 | + List<Jdl> jdlList=jdlRepository.JdlList(rq); | |
| 104 | + //前一天所有车辆最后进场班次信息 | |
| 105 | + List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", ""); | |
| 106 | + List<Cdl> cdyList=cdlRepository.obtainCdl(); | |
| 107 | + //从排班表中计算出行驶的总里程 | |
| 108 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); | |
| 109 | + List<Ylb> addList=new ArrayList<Ylb>(); | |
| 110 | + List<Ylb> updateList=new ArrayList<Ylb>(); | |
| 111 | + for(int x=0;x<listpb.size();x++){ | |
| 112 | + String type="add"; | |
| 113 | + boolean sfdc=false; | |
| 114 | + Map<String, Object> map=listpb.get(x); | |
| 115 | + if (carsMap.get(map.get("clZbh").toString())!=null) { | |
| 116 | + sfdc= carsMap.get(map.get("clZbh").toString()); | |
| 117 | + }else{ | |
| 118 | + sfdc=false; | |
| 119 | + } | |
| 120 | + if(sfdc){ | |
| 121 | + //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 122 | + Dlb t=new Dlb(); | |
| 123 | + for(int k=0;k<dlList.size();k++){ | |
| 124 | + Dlb t1=dlList.get(k); | |
| 125 | + if(t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 126 | + &&t1.getJsy().equals(map.get("jGh").toString()) | |
| 127 | + &&t1.getXlbm().equals(map.get("xlBm").toString())) | |
| 128 | + { | |
| 129 | + t=t1; | |
| 130 | + type="update"; | |
| 131 | + } | |
| 132 | + } | |
| 133 | + try { | |
| 134 | + //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 135 | + Double jzl=0.0; | |
| 136 | + if(map.get("seqNumber").toString().equals("1")){ | |
| 137 | + boolean fage=true; | |
| 138 | + for (int i = 0; i < dlListBe.size(); i++) { | |
| 139 | + Dlb dlb=dlListBe.get(i); | |
| 140 | + if(map.get("clZbh").toString().equals(dlb.getNbbm())){ | |
| 141 | + t.setCzcd(dlb.getJzcd()); | |
| 142 | + fage=false; | |
| 143 | + break; | |
| 144 | + } | |
| 145 | + } | |
| 146 | + if(fage){ | |
| 147 | + for (int y = 0; y < cdyList.size(); y++) { | |
| 148 | + Cdl cdl=cdyList.get(y); | |
| 149 | + if(map.get("clZbh").toString().equals(cdl.getNbbm())){ | |
| 150 | + t.setCzcd(cdl.getClcd()==null?0:cdl.getClcd()); | |
| 151 | + fage=false; | |
| 152 | + break; | |
| 153 | + } | |
| 154 | + } | |
| 155 | + } | |
| 156 | + if(fage){ | |
| 157 | + t.setCzcd(0.0); | |
| 158 | + } | |
| 159 | + | |
| 160 | + //手动导入没有驾驶员工号 | |
| 161 | + for (int i = 0; i < jdlList.size(); i++) { | |
| 162 | + Jdl jdl=jdlList.get(i); | |
| 163 | + if(map.get("clZbh").toString().equals(jdl.getNbbm()) ){ | |
| 164 | + jzl+=jdl.getJdl(); | |
| 165 | + } | |
| 166 | + } | |
| 167 | + } | |
| 168 | + | |
| 169 | + | |
| 170 | + //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 171 | + for(int j=0;j<ylxxList.size();j++){ | |
| 172 | + Ylxxb ylxxb= ylxxList.get(j); | |
| 173 | + if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){ | |
| 174 | + jzl+=ylxxb.getJzl(); | |
| 175 | + } | |
| 176 | + } | |
| 177 | + | |
| 178 | + t.setCdl(jzl); | |
| 179 | + if(type.equals("add")){ | |
| 180 | + t.setHd(jzl); | |
| 181 | + t.setJzcd(t.getCzcd()); | |
| 182 | + } | |
| 183 | + | |
| 184 | + t.setNbbm(map.get("clZbh").toString()); | |
| 185 | + t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | |
| 186 | + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 187 | + t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | |
| 188 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 189 | + t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | |
| 190 | + t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | |
| 191 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 192 | + t.setRq(sdf.parse(rq)); | |
| 193 | + t.setCreatetime(new Date()); | |
| 194 | + /*if(type.equals("add")){ | |
| 195 | + addList.add(t); | |
| 196 | + }else{ | |
| 197 | + updateList.add(t); | |
| 198 | + }*/ | |
| 199 | + repository.save(t); | |
| 200 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 201 | + } catch (ParseException e) { | |
| 202 | + // TODO Auto-generated catch block | |
| 203 | + newMap.put("status", ResponseCode.ERROR); | |
| 204 | + e.printStackTrace(); | |
| 205 | + } | |
| 206 | + } | |
| 207 | + } | |
| 208 | + return result; | |
| 209 | + } | |
| 73 | 210 | /** |
| 74 | - * 获取进存油信息 | |
| 211 | + * 获取进存电信息 | |
| 75 | 212 | * @Transactional 回滚事物 |
| 76 | 213 | */ |
| 77 | 214 | @Transactional | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| ... | ... | @@ -172,7 +172,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 172 | 172 | t.setJzl(jzl);*/ |
| 173 | 173 | t.setNbbm(map.get("clZbh").toString()); |
| 174 | 174 | t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); |
| 175 | - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 175 | + t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(map.get("totalKilometers").toString())); | |
| 176 | 176 | t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); |
| 177 | 177 | t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); |
| 178 | 178 | t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -581,62 +581,20 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 581 | 581 | List<Iterator<?>> list = new ArrayList<Iterator<?>>(); |
| 582 | 582 | List<ScheduleRealInfo> scheduleRealInfos = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date, line); |
| 583 | 583 | List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); |
| 584 | - | |
| 584 | +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | |
| 585 | + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); | |
| 586 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 587 | + ScheduleRealInfo s=scheduleRealInfos.get(i); | |
| 588 | + if(s.getZdsjActual()!=null){ | |
| 589 | + lists.add(s); | |
| 590 | + } | |
| 591 | + } | |
| 585 | 592 | DecimalFormat format = new DecimalFormat("0.00"); |
| 586 | 593 | // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); |
| 587 | 594 | // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); |
| 588 | - int jhbc = 0, cjbc = 0, ljbc = 0; | |
| 589 | - double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0; | |
| 590 | - float addMileage = 0l, remMileage = 0l; | |
| 591 | 595 | |
| 592 | 596 | Map<String, Object> map; |
| 593 | 597 | for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { |
| 594 | - if (scheduleRealInfo != null) { | |
| 595 | - //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次 | |
| 596 | - if (scheduleRealInfo != null) { | |
| 597 | - //计划里程(主任务过滤掉临加班次), | |
| 598 | - //烂班里程(主任务烂班), | |
| 599 | - //临加里程(主任务临加), | |
| 600 | - //计划班次,烂班班次,增加班次 | |
| 601 | - tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc(); | |
| 602 | - if (scheduleRealInfo.isSflj()) { | |
| 603 | - ljbc++; | |
| 604 | - } else { | |
| 605 | - jhlc += tempJhlc; | |
| 606 | - jhbc++; | |
| 607 | - if (scheduleRealInfo.getStatus() == -1) { | |
| 608 | - remMileage += tempJhlc; | |
| 609 | - cjbc++; | |
| 610 | - } | |
| 611 | - } | |
| 612 | - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 613 | - //计算营运里程,空驶里程 | |
| 614 | - if (childTaskPlans.isEmpty()) { | |
| 615 | - if (scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out") | |
| 616 | - ) { | |
| 617 | - ksgl += tempJhlc; | |
| 618 | - } else { | |
| 619 | - yygl += tempJhlc; | |
| 620 | - } | |
| 621 | - } else { | |
| 622 | - Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 623 | - while (it.hasNext()) { | |
| 624 | - ChildTaskPlan childTaskPlan = it.next(); | |
| 625 | - if (childTaskPlan.getMileageType().equals("empty")) { | |
| 626 | - if (scheduleRealInfo.isSflj()) { | |
| 627 | - addMileage += tempJhlc; | |
| 628 | - } | |
| 629 | - ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 630 | - } else { | |
| 631 | - if (scheduleRealInfo.isSflj()) { | |
| 632 | - addMileage += tempJhlc; | |
| 633 | - } | |
| 634 | - yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage(); | |
| 635 | - } | |
| 636 | - } | |
| 637 | - } | |
| 638 | - } | |
| 639 | - | |
| 640 | 598 | map = new HashMap<String, Object>(); |
| 641 | 599 | try { |
| 642 | 600 | scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); |
| ... | ... | @@ -661,21 +619,23 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 661 | 619 | } catch (Exception e) { |
| 662 | 620 | e.printStackTrace(); |
| 663 | 621 | } |
| 664 | - } | |
| 665 | 622 | } |
| 666 | 623 | |
| 667 | 624 | //计算里程和班次数,并放入Map里 |
| 668 | 625 | map = new HashMap<String, Object>(); |
| 669 | - map.put("jhlc", format.format(jhlc)); | |
| 670 | - map.put("remMileage", format.format(remMileage)); | |
| 671 | - map.put("addMileage", format.format(addMileage)); | |
| 672 | - map.put("yygl", format.format(yygl)); | |
| 673 | - map.put("ksgl", format.format(ksgl)); | |
| 674 | - map.put("realMileage", format.format(yygl + ksgl)); | |
| 675 | - map.put("jhbc", jhbc); | |
| 676 | - map.put("cjbc", cjbc); | |
| 677 | - map.put("ljbc", ljbc); | |
| 678 | - map.put("sjbc", jhbc - cjbc + ljbc); | |
| 626 | + map.put("jhlc", culateMieageService.culateJhgl(scheduleRealInfos)); | |
| 627 | + map.put("remMileage",culateMieageService.culateLbgl(lists)); | |
| 628 | + map.put("addMileage", culateMieageService.culateLjgl(lists)); | |
| 629 | + double yygl=Arith.add(culateMieageService.culateSjgl(lists),culateMieageService.culateLjgl(lists)); | |
| 630 | + map.put("yygl", yygl); | |
| 631 | + double ksgl=Arith.add(culateMieageService.culateKsgl(lists),culateMieageService.culateJccgl(lists)); | |
| 632 | + map.put("ksgl",ksgl); | |
| 633 | + map.put("realMileage", Arith.add(yygl ,ksgl)); | |
| 634 | + map.put("jhbc", culateMieageService.culateJhgl(scheduleRealInfos)); | |
| 635 | + map.put("cjbc", culateMieageService.culateLbbc(lists)); | |
| 636 | + map.put("ljbc", culateMieageService.culateLjbc(lists, "")); | |
| 637 | + int sjbc =culateMieageService.culateLjbc(lists, "")+culateMieageService.culateSjbc(lists, ""); | |
| 638 | + map.put("sjbc", sjbc); | |
| 679 | 639 | |
| 680 | 640 | String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; |
| 681 | 641 | |
| ... | ... | @@ -1414,19 +1374,27 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1414 | 1374 | public Map<String, Object> findKMBC(String jGh, String clZbh, |
| 1415 | 1375 | String lpName, String date, String line) { |
| 1416 | 1376 | Map<String, Object> map = new HashMap<String, Object>(); |
| 1417 | - List<ScheduleRealInfo> lists=scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 1377 | + List<ScheduleRealInfo> list=scheduleRealInfoRepository.queryListWaybillXcld(jGh, clZbh, lpName, date, line); | |
| 1378 | + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); | |
| 1379 | + for (int i = 0; i < list.size(); i++) { | |
| 1380 | + ScheduleRealInfo s=list.get(i); | |
| 1381 | + if(s.getZdsjActual()!=null){ | |
| 1382 | + lists.add(s); | |
| 1383 | + } | |
| 1384 | + } | |
| 1418 | 1385 | double ksgl=culateService.culateKsgl(lists); |
| 1419 | 1386 | double sjgl=culateService.culateSjgl(lists); |
| 1420 | 1387 | double jccgl=culateService.culateJccgl(lists); |
| 1421 | 1388 | double ljgl=culateService.culateLjgl(lists); |
| 1422 | - map.put("jhlc", culateService.culateJhgl(lists)); //计划里程 | |
| 1389 | + | |
| 1390 | + map.put("jhlc", culateService.culateJhgl(list)); //计划里程 | |
| 1423 | 1391 | map.put("remMileage", culateService.culateLbgl(lists)); //烂班公里 |
| 1424 | 1392 | map.put("addMileage", ljgl); //临加公里 |
| 1425 | 1393 | map.put("yygl",Arith.add(sjgl,ljgl)); //实际公里 |
| 1426 | 1394 | map.put("ksgl", ksgl);//空驶公里 |
| 1427 | 1395 | map.put("realMileage",Arith.add(Arith.add(ksgl,jccgl ),Arith.add(sjgl,ljgl))); |
| 1428 | 1396 | // map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileage)); |
| 1429 | - map.put("jhbc", culateService.culateJhbc(lists,"")); | |
| 1397 | + map.put("jhbc", culateService.culateJhbc(list,"")); | |
| 1430 | 1398 | map.put("cjbc", culateService.culateLbbc(lists)); |
| 1431 | 1399 | map.put("ljbc", culateService.culateLjbc(lists,"")); |
| 1432 | 1400 | map.put("sjbc", culateService.culateJhbc(lists,"") - culateService.culateLbbc(lists) + culateService.culateLjbc(lists,"")); |
| ... | ... | @@ -1670,7 +1638,11 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1670 | 1638 | map.put("ssgl_kx", culateService.culateCJLC(lists, "客稀")); |
| 1671 | 1639 | map.put("ssgl_qh", culateService.culateCJLC(lists, "气候")); |
| 1672 | 1640 | map.put("ssgl_yw", culateService.culateCJLC(lists, "援外")); |
| 1673 | - map.put("ssgl_other", culateService.culateCJLC(lists, "其他")); | |
| 1641 | + double ssgl_pc=culateService.culateCJLC(lists, "配车"); | |
| 1642 | + double ssgl_by=culateService.culateCJLC(lists, "保养"); | |
| 1643 | + double ssgl_cj=culateService.culateCJLC(lists, "抽减"); | |
| 1644 | + double ssgl_qt=culateService.culateCJLC(lists, "其他"); | |
| 1645 | + map.put("ssgl_other", Arith.add(Arith.add(ssgl_pc, ssgl_by),Arith.add(ssgl_cj, ssgl_qt))); | |
| 1674 | 1646 | map.put("ssbc", culateService.culateLbbc(lists)); |
| 1675 | 1647 | map.put("ljgl", culateService.culateLjgl(lists)); |
| 1676 | 1648 | map.put("jhbc", culateService.culateJhbc(lists,"")); |
| ... | ... | @@ -3793,6 +3765,76 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3793 | 3765 | return new ArrayList<Map<String, Object>>(); |
| 3794 | 3766 | } |
| 3795 | 3767 | |
| 3768 | + public List<ScheduleRealInfo> exportWaybill_pl(List<ScheduleRealInfo> listpl,String date,String jName, String clZbh,String lpName) { | |
| 3769 | + ReportUtils ee = new ReportUtils(); | |
| 3770 | + ReportRelatedUtils rru = new ReportRelatedUtils(); | |
| 3771 | + List<Iterator<?>> list = new ArrayList<Iterator<?>>(); | |
| 3772 | + List<ScheduleRealInfo> scheduleRealInfos = listpl; | |
| 3773 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | |
| 3774 | +// List<ScheduleRealInfo> scheduleRealInfos=scheduleRealInfoRepository.queryListWaybillXcld(jName, clZbh, lpName, date, line); | |
| 3775 | + List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>(); | |
| 3776 | + for (int i = 0; i < scheduleRealInfos.size(); i++) { | |
| 3777 | + ScheduleRealInfo s=scheduleRealInfos.get(i); | |
| 3778 | + if(s.getZdsjActual()!=null){ | |
| 3779 | + lists.add(s); | |
| 3780 | + } | |
| 3781 | + } | |
| 3782 | + DecimalFormat format = new DecimalFormat("0.00"); | |
| 3783 | +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName); | |
| 3784 | +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName); | |
| 3785 | + | |
| 3786 | + Map<String, Object> map; | |
| 3787 | + for (ScheduleRealInfo scheduleRealInfo : scheduleRealInfos) { | |
| 3788 | + map = new HashMap<String, Object>(); | |
| 3789 | + try { | |
| 3790 | + scheduleRealInfo.setjName(scheduleRealInfo.getjGh() + scheduleRealInfo.getjName()); | |
| 3791 | + scheduleRealInfo.setsName(scheduleRealInfo.getsGh() + scheduleRealInfo.getsName()); | |
| 3792 | + map = rru.getMapValue(scheduleRealInfo); | |
| 3793 | + String zdsj = scheduleRealInfo.getZdsj(); | |
| 3794 | + String zdsjActual = scheduleRealInfo.getZdsjActual(); | |
| 3795 | + if (zdsj != null && zdsjActual != null && | |
| 3796 | + !zdsj.equals(zdsjActual)) { | |
| 3797 | + if (zdsj.compareTo(zdsjActual) > 0) { | |
| 3798 | + map.put("fast", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 3799 | + map.put("slow", ""); | |
| 3800 | + } else { | |
| 3801 | + map.put("fast", ""); | |
| 3802 | + map.put("slow", TimeUtils.getTimeDifference(zdsj, zdsjActual)); | |
| 3803 | + } | |
| 3804 | + } else { | |
| 3805 | + map.put("fast", ""); | |
| 3806 | + map.put("slow", ""); | |
| 3807 | + } | |
| 3808 | + listMap.add(map); | |
| 3809 | + } catch (Exception e) { | |
| 3810 | + e.printStackTrace(); | |
| 3811 | + } | |
| 3812 | + } | |
| 3813 | + | |
| 3814 | + //计算里程和班次数,并放入Map里 | |
| 3815 | + map = new HashMap<String, Object>(); | |
| 3816 | + map.put("jhlc", culateMieageService.culateJhgl(scheduleRealInfos)); | |
| 3817 | + map.put("remMileage",culateMieageService.culateLbgl(lists)); | |
| 3818 | + map.put("addMileage", culateMieageService.culateLjgl(lists)); | |
| 3819 | + double yygl=Arith.add(culateMieageService.culateSjgl(lists),culateMieageService.culateLjgl(lists)); | |
| 3820 | + map.put("yygl", yygl); | |
| 3821 | + double ksgl=Arith.add(culateMieageService.culateKsgl(lists),culateMieageService.culateJccgl(lists)); | |
| 3822 | + map.put("ksgl",ksgl); | |
| 3823 | + map.put("realMileage", Arith.add(yygl ,ksgl)); | |
| 3824 | + map.put("jhbc", culateMieageService.culateJhgl(scheduleRealInfos)); | |
| 3825 | + map.put("cjbc", culateMieageService.culateLbbc(lists)); | |
| 3826 | + map.put("ljbc", culateMieageService.culateLjbc(lists, "")); | |
| 3827 | + int sjbc =culateMieageService.culateLjbc(lists, "")+culateMieageService.culateSjbc(lists, ""); | |
| 3828 | + map.put("sjbc", sjbc); | |
| 3829 | + | |
| 3830 | + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/"; | |
| 3831 | + | |
| 3832 | + list.add(listMap.iterator()); | |
| 3833 | + ee.excelReplace(list, new Object[]{scheduleRealInfos.get(0), map}, path + "mould/waybill_minhang.xls", | |
| 3834 | + path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); | |
| 3835 | + return scheduleRealInfos; | |
| 3836 | + } | |
| 3837 | + | |
| 3796 | 3838 | @Override |
| 3797 | 3839 | public Map<String, Object> exportWaybillMore(Map<String, Object> map) { |
| 3798 | 3840 | String date = map.get("date").toString(); |
| ... | ... | @@ -3814,12 +3856,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 3814 | 3856 | } |
| 3815 | 3857 | } |
| 3816 | 3858 | file.mkdirs(); |
| 3817 | - | |
| 3859 | + List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date); | |
| 3818 | 3860 | for (List<String> list : lists) { |
| 3861 | + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>(); | |
| 3819 | 3862 | String jName = list.get(0); |
| 3820 | 3863 | String clZbh = list.get(1); |
| 3821 | 3864 | String lpName = list.get(2); |
| 3822 | - this.exportWaybill(jName, clZbh, lpName, date, line); | |
| 3865 | + for (int i = 0; i < lists_line.size(); i++) { | |
| 3866 | + ScheduleRealInfo s=lists_line.get(i); | |
| 3867 | + if(s.getjName().equals(jName) && s.getClZbh().equals(clZbh) && s.getLpName().equals(lpName)){ | |
| 3868 | + newList.add(s); | |
| 3869 | + } | |
| 3870 | + } | |
| 3871 | + this.exportWaybill_pl(newList, date, jName, clZbh, lpName); | |
| 3823 | 3872 | File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls"); |
| 3824 | 3873 | String fileName = file.getName(); |
| 3825 | 3874 | temp.renameTo(new File(path + fileName + "/" + temp.getName())); | ... | ... |
src/main/resources/static/pages/forms/statement/scheduleDaily.html
| ... | ... | @@ -401,7 +401,6 @@ |
| 401 | 401 | $('#forms .scheduleDaily_1').html(scheduleDaily_1); |
| 402 | 402 | }); |
| 403 | 403 | $.get('/realSchedule/queryUserInfo',{line:line,date:date,state:2,type:"query"},function(result){ |
| 404 | - console.log(result); | |
| 405 | 404 | var scheduleDaily_2 = template('scheduleDaily_2',{list:result}); |
| 406 | 405 | $('#forms .scheduleDaily_2').html(scheduleDaily_2); |
| 407 | 406 | }); |
| ... | ... | @@ -541,9 +540,18 @@ |
| 541 | 540 | <td>{{obj.fast}}</td> |
| 542 | 541 | <td>{{obj.slow}}</td> |
| 543 | 542 | <td>{{obj.fcsj}}</td> |
| 544 | - <td>{{obj.fcsjActual}}</td> | |
| 543 | + <td>{{obj.fcsjActual}} | |
| 544 | + {{if obj.bcType== "in"}} | |
| 545 | + (进) | |
| 546 | + {{/if}} | |
| 547 | + {{if obj.bcType== "out"}} | |
| 548 | + (出) | |
| 549 | + {{/if}} | |
| 550 | + </td> | |
| 545 | 551 | <td>{{obj.fast0}}</td> |
| 546 | - <td>{{obj.slow0}}</td> | |
| 552 | + <td>{{obj.slow0}} | |
| 553 | + | |
| 554 | + </td> | |
| 547 | 555 | <td colspan="2">{{obj.remarks}}</td> |
| 548 | 556 | {{if (i+1)%3 == 0}} |
| 549 | 557 | <td> </td> | ... | ... |
src/main/resources/static/pages/forms/statement/statisticsDaily.html
| ... | ... | @@ -247,8 +247,15 @@ |
| 247 | 247 | if(date==null || date =="" ||date2==null || date2 ==""){ |
| 248 | 248 | layer.msg('请选择时间段.'); |
| 249 | 249 | }else{ |
| 250 | - | |
| 251 | - $get('/realSchedule/statisticsDailyTj',{gsdm:gsdm,fgsdm:fgsdm,line:line,date:date,date2:date2,xlName:xlName,type:"query"},function(result){ | |
| 250 | + var params = {}; | |
| 251 | + params['gsdm'] = gsdm; | |
| 252 | + params['fgsdm'] =fgsdm ; | |
| 253 | + params['line'] = line; | |
| 254 | + params['date'] = date; | |
| 255 | + params['date2'] = date2; | |
| 256 | + params['xlName'] = xlName; | |
| 257 | + params['type'] = "query"; | |
| 258 | + $get('/realSchedule/statisticsDailyTj',params,function(result){ | |
| 252 | 259 | // 把数据填充到模版中 |
| 253 | 260 | var tbodyHtml = template('statisticsDaily',{list:result}); |
| 254 | 261 | // 把渲染好的模版html文本追加到表格中 |
| ... | ... | @@ -264,7 +271,15 @@ |
| 264 | 271 | }); |
| 265 | 272 | |
| 266 | 273 | $("#export").on("click",function(){ |
| 267 | - $get('/realSchedule/statisticsDailyTj',{gsdm:gsdm,fgsdm:fgsdm,line:line,date:date,date2:date2,xlName:xlName,type:"export"},function(result){ | |
| 274 | + var params = {}; | |
| 275 | + params['gsdm'] = gsdm; | |
| 276 | + params['fgsdm'] =fgsdm ; | |
| 277 | + params['line'] = line; | |
| 278 | + params['date'] = date; | |
| 279 | + params['date2'] = date2; | |
| 280 | + params['xlName'] = xlName; | |
| 281 | + params['type'] = "export"; | |
| 282 | + $get('/realSchedule/statisticsDailyTj',params,function(result){ | |
| 268 | 283 | window.open("/downloadFile/download?fileName=统计日报"+moment(date).format("YYYYMMDD")); |
| 269 | 284 | }); |
| 270 | 285 | }); | ... | ... |
src/main/resources/static/pages/forms/statement/waybill.html
| ... | ... | @@ -307,7 +307,7 @@ |
| 307 | 307 | param[index][i] = $(this).text().split("\\")[0]; |
| 308 | 308 | }); |
| 309 | 309 | }); |
| 310 | - $post('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ | |
| 310 | + $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){ | |
| 311 | 311 | window.open("/downloadFile/downloadList?fileName="+result.fileName); |
| 312 | 312 | }); |
| 313 | 313 | }); |
| ... | ... | @@ -435,7 +435,7 @@ |
| 435 | 435 | <td>{{obj.fast}}</td> |
| 436 | 436 | <td>{{obj.slow}}</td> |
| 437 | 437 | <td> |
| 438 | - {{if obj.fcsjActual !=null || obj.zdsjActual!=null}} | |
| 438 | + {{if obj.zdsjActual!=null}} | |
| 439 | 439 | {{obj.jhlc}} |
| 440 | 440 | {{/if}} |
| 441 | 441 | </td> | ... | ... |