Commit c0b44efc0f742c364119407523a29926c3bb1b38

Authored by BSTH
1 parent 762e3950

报表优化

src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
@@ -464,20 +464,43 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf @@ -464,20 +464,43 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf
464 List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>(); 464 List<Map<String,Object>> listMap = new ArrayList<Map<String,Object>>();
465 465
466 DecimalFormat format = new DecimalFormat("0.00"); 466 DecimalFormat format = new DecimalFormat("0.00");
467 - int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);  
468 - int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);  
469 - int jhbc = 0;  
470 - double jhlc = 0;  
471 - float realMileage = 0l,addMileage = 0l,remMileage = 0l; 467 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  468 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  469 + int jhbc = 0,cjbc = 0,ljbc = 0;
  470 + double jhlc = 0, yygl = 0, ksgl = 0;
  471 + float addMileage = 0l,remMileage = 0l;
472 472
473 Map<String,Object> map; 473 Map<String,Object> map;
474 for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){ 474 for(ScheduleRealInfo scheduleRealInfo : scheduleRealInfos){
475 if(scheduleRealInfo != null){ 475 if(scheduleRealInfo != null){
476 - jhlc += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();  
477 - realMileage += scheduleRealInfo.getRealMileage()==null?0:scheduleRealInfo.getRealMileage();  
478 - addMileage += scheduleRealInfo.getAddMileage()==null?0:scheduleRealInfo.getAddMileage();  
479 - remMileage += scheduleRealInfo.getRemMileage()==null?0:scheduleRealInfo.getRemMileage();  
480 - jhbc++; 476 + //计算计划里程(主任务过滤掉临加班次),烂班里程,临加里程,计划班次,烂班班次,增加班次
  477 + if(scheduleRealInfo.isSflj()){
  478 + addMileage += addMileage += scheduleRealInfo.getAddMileage()==null?0:scheduleRealInfo.getAddMileage();
  479 + ljbc++;
  480 + }else{
  481 + jhlc += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  482 + if(scheduleRealInfo.getStatus() != -1){
  483 + remMileage += scheduleRealInfo.getRemMileage()==null?0:scheduleRealInfo.getRemMileage();
  484 + }else{
  485 + cjbc++;
  486 + }
  487 + jhbc++;
  488 + }
  489 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  490 + //计算营运里程,空驶里程
  491 + if(childTaskPlans.isEmpty()){
  492 + yygl += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  493 + }else{
  494 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  495 + while(it.hasNext()){
  496 + ChildTaskPlan childTaskPlan = it.next();
  497 + if(childTaskPlan.getMileageType().equals("empty")){
  498 + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  499 + }else{
  500 + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  501 + }
  502 + }
  503 + }
481 504
482 map = new HashMap<String, Object>(); 505 map = new HashMap<String, Object>();
483 try { 506 try {
@@ -509,9 +532,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -509,9 +532,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
509 map.put("jhlc", format.format(jhlc)); 532 map.put("jhlc", format.format(jhlc));
510 map.put("remMileage", format.format(remMileage)); 533 map.put("remMileage", format.format(remMileage));
511 map.put("addMileage", format.format(addMileage)); 534 map.put("addMileage", format.format(addMileage));
512 - map.put("yygl", format.format(realMileage-addMileage));  
513 - map.put("ksgl", format.format(realMileage-addMileage));  
514 - map.put("realMileage", format.format(realMileage)); 535 + map.put("yygl", format.format(yygl));
  536 + map.put("ksgl", format.format(ksgl));
  537 + map.put("realMileage", format.format(yygl+ksgl));
515 map.put("jhbc", jhbc); 538 map.put("jhbc", jhbc);
516 map.put("cjbc", cjbc); 539 map.put("cjbc", cjbc);
517 map.put("ljbc", ljbc); 540 map.put("ljbc", ljbc);
@@ -520,7 +543,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -520,7 +543,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
520 String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\"; 543 String path = this.getClass().getResource("/").getPath()+"static\\pages\\forms\\";
521 544
522 list.add(listMap.iterator()); 545 list.add(listMap.iterator());
523 - ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould\\waybill.xls", 546 + ee.excelReplace(list, new Object[] { scheduleRealInfos.get(0),map }, path+"mould\\waybill_minhang.xls",
524 path+"export\\" + jName + ".xls"); 547 path+"export\\" + jName + ".xls");
525 return scheduleRealInfos; 548 return scheduleRealInfos;
526 } 549 }
@@ -983,27 +1006,58 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -983,27 +1006,58 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
983 String lpName,String date) { 1006 String lpName,String date) {
984 List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date); 1007 List<ScheduleRealInfo> list = scheduleRealInfoRepository.queryListWaybill(jName, clZbh, lpName, date);
985 DecimalFormat format = new DecimalFormat("0.00"); 1008 DecimalFormat format = new DecimalFormat("0.00");
986 - int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);  
987 - int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);  
988 - int jhbc = 0;  
989 - double jhlc = 0;  
990 - float realMileage = 0l,addMileage = 0l,remMileage = 0l; 1009 +// int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
  1010 +// int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
  1011 + int jhbc = 0,cjbc = 0,ljbc = 0;
  1012 + double jhlc = 0, yygl = 0, ksgl = 0,tempJhlc = 0;
  1013 + float addMileage = 0l,remMileage = 0l;
991 Map<String,Object> map = new HashMap<String, Object>(); 1014 Map<String,Object> map = new HashMap<String, Object>();
992 for(ScheduleRealInfo scheduleRealInfo : list){ 1015 for(ScheduleRealInfo scheduleRealInfo : list){
993 if(scheduleRealInfo != null){ 1016 if(scheduleRealInfo != null){
994 - jhlc += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();  
995 - realMileage += scheduleRealInfo.getRealMileage()==null?0:scheduleRealInfo.getRealMileage();  
996 - addMileage += scheduleRealInfo.getAddMileage()==null?0:scheduleRealInfo.getAddMileage();  
997 - remMileage += scheduleRealInfo.getRemMileage()==null?0:scheduleRealInfo.getRemMileage();  
998 - jhbc++; 1017 + //计划里程(主任务过滤掉临加班次),
  1018 + //烂班里程(主任务烂班),
  1019 + //临加里程(主任务临加),
  1020 + //计划班次,烂班班次,增加班次
  1021 + tempJhlc = scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  1022 + if(scheduleRealInfo.isSflj()){
  1023 + addMileage += tempJhlc;
  1024 + ljbc++;
  1025 + }else{
  1026 + jhlc += tempJhlc;
  1027 + jhbc++;
  1028 + if(scheduleRealInfo.getStatus() == -1){
  1029 + remMileage += tempJhlc;
  1030 + cjbc++;
  1031 + }
  1032 + }
  1033 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1034 + //计算营运里程,空驶里程
  1035 + if(childTaskPlans.isEmpty()){
  1036 + if(scheduleRealInfo.getBcType().equals("in") || scheduleRealInfo.getBcType().equals("out")
  1037 + || scheduleRealInfo.getBcType().equals("venting")){
  1038 + ksgl += tempJhlc;
  1039 + }else{
  1040 + yygl += tempJhlc;
  1041 + }
  1042 + }else{
  1043 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1044 + while(it.hasNext()){
  1045 + ChildTaskPlan childTaskPlan = it.next();
  1046 + if(childTaskPlan.getMileageType().equals("empty")){
  1047 + ksgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1048 + }else{
  1049 + yygl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1050 + }
  1051 + }
  1052 + }
999 } 1053 }
1000 } 1054 }
1001 map.put("jhlc", format.format(jhlc)); 1055 map.put("jhlc", format.format(jhlc));
1002 map.put("remMileage", format.format(remMileage)); 1056 map.put("remMileage", format.format(remMileage));
1003 map.put("addMileage", format.format(addMileage)); 1057 map.put("addMileage", format.format(addMileage));
1004 - map.put("yygl", format.format(jhlc));  
1005 - map.put("ksgl", format.format(realMileage-addMileage));  
1006 - map.put("realMileage", format.format(jhlc)); 1058 + map.put("yygl", format.format(yygl));
  1059 + map.put("ksgl", format.format(ksgl));
  1060 + map.put("realMileage", format.format(yygl+ksgl));
1007 map.put("jhbc", jhbc); 1061 map.put("jhbc", jhbc);
1008 map.put("cjbc", cjbc); 1062 map.put("cjbc", cjbc);
1009 map.put("ljbc", ljbc); 1063 map.put("ljbc", ljbc);
@@ -1066,17 +1120,43 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf @@ -1066,17 +1120,43 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1066 public List<Map<String, Object>> statisticsDaily(String line, String date, 1120 public List<Map<String, Object>> statisticsDaily(String line, String date,
1067 String xlName) { 1121 String xlName) {
1068 List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date); 1122 List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  1123 + List<Map<String,Object>> lMap = new ArrayList<Map<String,Object>>();
  1124 + DecimalFormat format = new DecimalFormat("0.00");
1069 double jhlc = 0.00; 1125 double jhlc = 0.00;
1070 - float realMileage = 0l; 1126 + float sjgl = 0l,ssgl = 0l;
  1127 + Map<String,Object> map = new HashMap<String, Object>();
1071 for(ScheduleRealInfo scheduleRealInfo: list){ 1128 for(ScheduleRealInfo scheduleRealInfo: list){
1072 if(scheduleRealInfo != null){ 1129 if(scheduleRealInfo != null){
1073 - jhlc += scheduleRealInfo.getJhlc();  
1074 - if(scheduleRealInfo.getsName().equals("1")){  
1075 - realMileage += scheduleRealInfo.getRealMileage(); 1130 + if(!scheduleRealInfo.isSflj()){
  1131 + jhlc += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  1132 + }
  1133 + if(scheduleRealInfo.isDestroy()){
  1134 + ssgl += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  1135 + }
  1136 +
  1137 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  1138 + //计算实际里程,空驶里程
  1139 + if(childTaskPlans.isEmpty()){
  1140 + sjgl += scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc();
  1141 + }else{
  1142 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  1143 + while(it.hasNext()){
  1144 + ChildTaskPlan childTaskPlan = it.next();
  1145 + if(childTaskPlan.isDestroy()){
  1146 + ssgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1147 + }else{
  1148 + sjgl += childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage();
  1149 + }
  1150 + }
1076 } 1151 }
1077 } 1152 }
1078 } 1153 }
1079 - return null; 1154 + map.put("xlName", xlName);
  1155 + map.put("jhlc", format.format(jhlc));
  1156 + map.put("sjgl", format.format(sjgl));
  1157 + map.put("ssgl", format.format(ssgl));
  1158 + lMap.add(map);
  1159 + return lMap;
1080 } 1160 }
1081 1161
1082 @Override 1162 @Override
src/main/resources/static/pages/forms/mould/waybill_minhang.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/statisticsDaily .html
@@ -101,7 +101,7 @@ @@ -101,7 +101,7 @@
101 <td>16:01~18:00</td> 101 <td>16:01~18:00</td>
102 </tr> 102 </tr>
103 </thead> 103 </thead>
104 - <tbody> 104 + <tbody class="statisticsDaily">
105 105
106 </tbody> 106 </tbody>
107 <tr> 107 <tr>
@@ -207,17 +207,52 @@ @@ -207,17 +207,52 @@
207 var date = $("#date").val(); 207 var date = $("#date").val();
208 $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName},function(result){ 208 $get('/realSchedule/statisticsDaily',{line:line,date:date,xlName:xlName},function(result){
209 // 把数据填充到模版中 209 // 把数据填充到模版中
210 - var tbodyHtml = template('list_account',{list:result}); 210 + var tbodyHtml = template('statisticsDaily',{list:result});
211 // 把渲染好的模版html文本追加到表格中 211 // 把渲染好的模版html文本追加到表格中
212 - $('#forms tbody').html(tbodyHtml); 212 + $('#forms .statisticsDaily').html(tbodyHtml);
213 }); 213 });
214 }); 214 });
215 }); 215 });
216 </script> 216 </script>
217 -<script type="text/html" id="list_forms"> 217 +<script type="text/html" id="statisticsDaily">
218 {{each list as obj i}} 218 {{each list as obj i}}
219 - <tr>  
220 - 219 + <tr>
  220 + <td>{{obj.xlName}}</td>
  221 + <td>{{obj.jhlc}}</td>
  222 + <td>{{obj.sjgl}}</td>
  223 + <td>{{obj.ssgl}}</td>
  224 + <td>&nbsp;</td>
  225 + <td>&nbsp;</td>
  226 + <td>&nbsp;</td>
  227 + <td>&nbsp;</td>
  228 + <td>&nbsp;</td>
  229 + <td>&nbsp;</td>
  230 + <td>&nbsp;</td>
  231 + <td>&nbsp;</td>
  232 + <td>&nbsp;</td>
  233 + <td>&nbsp;</td>
  234 + <td>&nbsp;</td>
  235 + <td>&nbsp;</td>
  236 + <td>&nbsp;</td>
  237 + <td>&nbsp;</td>
  238 + <td>&nbsp;</td>
  239 + <td>&nbsp;</td>
  240 + <td>&nbsp;</td>
  241 + <td>&nbsp;</td>
  242 + <td>&nbsp;</td>
  243 + <td>&nbsp;</td>
  244 + <td>&nbsp;</td>
  245 + <td>&nbsp;</td>
  246 + <td>&nbsp;</td>
  247 + <td>&nbsp;</td>
  248 + <td>&nbsp;</td>
  249 + <td>&nbsp;</td>
  250 + <td>&nbsp;</td>
  251 + <td>&nbsp;</td>
  252 + <td>&nbsp;</td>
  253 + <td>&nbsp;</td>
  254 + <td>&nbsp;</td>
  255 + <td>&nbsp;</td>
221 </tr> 256 </tr>
222 {{/each}} 257 {{/each}}
223 {{if list.length == 0}} 258 {{if list.length == 0}}
src/main/resources/static/pages/forms/statement/waybill_minhang.html
@@ -304,32 +304,32 @@ @@ -304,32 +304,32 @@
304 <tr> 304 <tr>
305 <td colspan="2">计划公里</td> 305 <td colspan="2">计划公里</td>
306 <td>{{jhlc}}</td> 306 <td>{{jhlc}}</td>
307 - <td>抽减公里</td> 307 + <td>烂班公里</td>
308 <td>{{remMileage}}</td> 308 <td>{{remMileage}}</td>
309 - <td colspan="2">加公里</td> 309 + <td colspan="2">加公里</td>
310 <td>{{addMileage}}</td> 310 <td>{{addMileage}}</td>
311 - <td colspan="2">实际计划公里</td>  
312 - <td colspan="3">{{jhlc}}</td> 311 + <td colspan="2">营运公里</td>
  312 + <td colspan="3">{{yygl}}</td>
313 </tr> 313 </tr>
314 <tr> 314 <tr>
315 - <td colspan="2">营运公里</td>  
316 - <td>{{realMileage}}</td>  
317 - <td>空驶公里</td> 315 + <td colspan="2">空驶公里</td>
318 <td>{{ksgl}}</td> 316 <td>{{ksgl}}</td>
319 - <td colspan="2">总公里</td> 317 + <td>总公里</td>
320 <td>{{realMileage}}</td> 318 <td>{{realMileage}}</td>
321 <td colspan="2">计划班次</td> 319 <td colspan="2">计划班次</td>
322 - <td colspan="3">{{jhbc}}</td> 320 + <td>{{jhbc}}</td>
  321 + <td colspan="2">烂班班次</td>
  322 + <td colspan="3">{{cjbc}}</td>
323 </tr> 323 </tr>
324 <tr> 324 <tr>
325 - <td colspan="2">抽减班次</td>  
326 - <td>{{cjbc}}</td>  
327 - <td>增加班次</td> 325 + <td colspan="2">增加班次</td>
328 <td>{{ljbc}}</td> 326 <td>{{ljbc}}</td>
329 - <td colspan="2">实际计划班次</td>  
330 - <td>{{jhbc}}</td>  
331 - <td colspan="2">实际班次</td>  
332 - <td colspan="3">{{sjbc}}</td> 327 + <td>实际班次</td>
  328 + <td>{{sjbc}}</td>
  329 + <td colspan="2"></td>
  330 + <td></td>
  331 + <td colspan="2"></td>
  332 + <td colspan="3"></td>
333 </tr> 333 </tr>
334 </script> 334 </script>
335 <script type="text/html" id="ludan_4"> 335 <script type="text/html" id="ludan_4">