Commit d696ce4e1b981dc3afbbe8ff4c7ccf05a00ea89e

Authored by 廖磊
1 parent 32b72df4

油,电管理,报表修改

src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -23,8 +23,9 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{
23 23 @Modifying
24 24 @Query(value="SELECT a.* FROM bsth_c_ylb a where to_days(?1)-to_days(a.rq)=1"
25 25 + " and jcsx=(select max(b.jcsx) from bsth_c_ylb b where a.nbbm=b.nbbm and "
26   - + " to_days(?1)-to_days(b.rq)=1 )",nativeQuery=true)
27   - List<Ylb> obtainYlbefore(String rq);
  26 + + " to_days(?1)-to_days(b.rq)=1 ) and ssgsdm like %?2% and fgsdm like %?3% and "
  27 + + " xlbm like %?4% and nbbm like %?5% ",nativeQuery=true)
  28 + List<Ylb> obtainYlbefore(String rq,String gsbm,String fgsbm,String xlbm,String nbbm);
28 29  
29 30 /**
30 31 * 当天YLB信息
... ... @@ -50,6 +51,6 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
50 51 */
51 52 @Transactional
52 53 @Modifying
53   - @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc ,sum(sh) as sh from bsth_c_ylb where nbbm=?1 and rq=?2",nativeQuery=true)
54   - List<Object[]> sumLcYl(String nbbm,Date rq);
  54 + @Query(value="select sum(jzl) as jzl,sum(zlc) as zlc ,sum(sh) as sh from bsth_c_ylb where nbbm=?1 and rq=?2 and xlbm like %?3%",nativeQuery=true)
  55 + List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm);
55 56 }
... ...
src/main/java/com/bsth/repository/oil/YlxxbRepository.java
... ... @@ -19,8 +19,8 @@ public interface YlxxbRepository extends BaseRepository&lt;Ylxxb, Integer&gt;{
19 19 */
20 20 @Transactional
21 21 @Modifying
22   - @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nylx=?2",nativeQuery=true)
23   - List<Ylxxb> obtainYlxx(String rq,int nylx);
  22 + @Query(value="SELECT * FROM bsth_c_ylxxb where to_days(?1)=to_days(yyrq) and nylx=?2 and gsdm like %?3%",nativeQuery=true)
  23 + List<Ylxxb> obtainYlxx(String rq,int nylx,String gsdm);
24 24  
25 25 @Transactional
26 26 @Modifying
... ...
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
... ... @@ -92,7 +92,7 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
92 92 @Query(value="select s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj")
93 93 List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line);
94 94  
95   - @Query(value="select s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by realExecDate,fcsj")
  95 + @Query(value="select s from ScheduleRealInfo s where s.jGh like %?1% and s.clZbh like %?2% and s.scheduleDate = str_to_date(?3,'%Y-%m-%d') order by realExecDate,fcsj")
96 96 List<ScheduleRealInfo> queryListWaybill3(String jName,String clZbh,String date);
97 97  
98 98 @Query(value="select s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') between str_to_date(?3,'%Y-%m-%d') and str_to_date(?4,'%Y-%m-%d') order by bcs")
... ... @@ -127,8 +127,8 @@ public interface ScheduleRealInfoRepository extends BaseRepository&lt;ScheduleRealI
127 127 @Query(value="select s from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m') = ?2 and s.bcType not in ('in','out') order by s.xlBm")
128 128 List<ScheduleRealInfo> scheduleByDateAndLine3(String line,String date);
129 129  
130   - @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh")
131   - List<Map<String,Object>> yesterdayDataList(String line,String date);
  130 + @Query(value="select new map(s.scheduleDate as scheduleDate,s.xlBm as xlBm,s.clZbh as clZbh,s.jGh as jGh) from ScheduleRealInfo s where s.xlBm like %?1% and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.gsBm like %?3% and s.fgsBm like %?4% GROUP BY xlBm,clZbh,jGh,scheduleDate,jGh ORDER BY xlBm,clZbh")
  131 + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm);
132 132  
133 133 @Query(value="select s from ScheduleRealInfo s where DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?1 ORDER BY xlBm,lpName,clZbh,xlDir")
134 134 List<ScheduleRealInfo> setLD(String date);
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
... ... @@ -77,6 +77,10 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
77 77 Cars c=carsList.get(i);
78 78 carsMap.put(c.getInsideCode(), c.getSfdc());
79 79 }
  80 + String gsbm="";
  81 + if(map2.get("ssgsdm_like")!=null){
  82 + gsbm=map2.get("ssgsdm_like").toString();
  83 + }
80 84 String rq=map2.get("rq").toString();
81 85 String line="";
82 86 if(map2.get("xlbm_eq")!=null){
... ... @@ -91,14 +95,14 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
91 95 //当天DLB信息
92 96 List<Dlb> dlList=repository.obtainDl(rq);
93 97 //当天YLXXB信息
94   - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1);
  98 + List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
95 99 //当天加电信息表
96 100 List<Jdl> jdlList=jdlRepository.JdlList(rq);
97 101 //前一天所有车辆最后进场班次信息
98 102 List<Dlb> dlListBe=repository.obtainYlbefore(rq);
99 103 List<Cdl> cdyList=cdlRepository.obtainCdl();
100 104 //从排班表中计算出行驶的总里程
101   - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq);
  105 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","","");
102 106 List<Ylb> addList=new ArrayList<Ylb>();
103 107 List<Ylb> updateList=new ArrayList<Ylb>();
104 108 for(int x=0;x<listpb.size();x++){
... ... @@ -244,14 +248,17 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
244 248 public Map<String, Object> checkDl(Map<String, Object> map) {
245 249 Map<String, Object> newMap=new HashMap<String,Object>();
246 250 String xlbm=map.get("xlbm_eq").toString();
247   -
  251 + String gsbm="";
  252 + if(map.get("ssgsdm_like")!=null){
  253 + gsbm=map.get("ssgsdm_like").toString();
  254 + }
248 255 // TODO Auto-generated method stub
249 256 try{
250 257 //获取车辆存油信息
251 258 // List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
252 259 String rq=map.get("rq").toString();
253 260 List<Dlb> dlbList=repository.obtainDl(rq);
254   - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,1);
  261 + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
255 262 //当天加电信息表
256 263 List<Jdl> jdlList=jdlRepository.JdlList(rq);
257 264 for (int i = 0; i < ylxxbList.size(); i++) {
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -97,10 +97,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
97 97 //当天YLXXB信息
98 98 // List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq);
99 99 //前一天所有车辆最后进场班次信息
100   - List<Ylb> ylListBe=repository.obtainYlbefore(rq);
  100 + List<Ylb> ylListBe=repository.obtainYlbefore(rq,"","","","");
101 101 List<Cyl> clyList=cylRepository.obtainCyl("","");
102 102 //从排班表中计算出行驶的总里程
103   - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("",rq);
  103 + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList("", rq, "", "", "", "");
104 104  
105 105 for(int x=0;x<listpb.size();x++){
106 106 boolean sfdc=true;
... ... @@ -222,14 +222,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
222 222 // 当天YLB信息
223 223 List<Ylb> ylList = repository.obtainYl(rq,gsbm,fgsbm,line,nbbm,"nbbm");
224 224 // 当天YLXXB信息
225   - List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0);
  225 + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(rq, 0,gsbm);
226 226 // 前一天所有车辆最后进场班次信息
227   - List<Ylb> ylListBe = repository.obtainYlbefore(rq);
  227 + List<Ylb> ylListBe = repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm);
228 228 List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm);
229 229 // 从排班表中计算出行驶的总里程
230   - List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq);
  230 + List<Map<String, Object>> listpb = scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm);
231 231 List<Ylb> addList = new ArrayList<Ylb>();
232 232 List<Ylb> updateList = new ArrayList<Ylb>();
  233 + String ins="";
233 234 for (int x = 0; x < listpb.size(); x++) {
234 235 String type = "add";
235 236 boolean sfdc = true;
... ... @@ -312,29 +313,34 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
312 313 t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString());
313 314 t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString());
314 315 t.setRq(sdf.parse(rq));
315   - /*
316   - * if(type.equals("add")){ addList.add(t); }else{
317   - * updateList.add(t); }
318   - */
319   - repository.save(t);
  316 +
  317 + if(type.equals("add")){
  318 + addList.add(t);
  319 + }else{
  320 + updateList.add(t);
  321 + ins += t.getId().toString()+",";
  322 + }
  323 +// repository.save(t);
320 324 newMap.put("status", ResponseCode.SUCCESS);
321 325  
322 326 }
323 327 }
  328 + if(addList.size()>0){
  329 + new BatchSaveUtils<Ylb>().saveList(addList, Ylb.class);
  330 + }
  331 +
  332 + if(updateList.size()>0){
  333 + for (int i = 0; i < updateList.size(); i++) {
  334 + repository.save(updateList.get(i));
  335 + }
  336 + }
  337 + newMap.put("status", ResponseCode.SUCCESS);
324 338 } catch (ParseException e) {
325 339 // TODO Auto-generated catch block
326 340 newMap.put("status", ResponseCode.ERROR);
327 341 throw e;
328 342 }
329   - /*
330   - * try { if(addList.size()>0){ new
331   - * BatchSaveUtils<Ylb>().saveList(addList, Ylb.class); }
332   - *
333   - * if(updateList.size()>0){
334   - *
335   - * } newMap.put("status", ResponseCode.SUCCESS); } catch (Exception e) {
336   - * // TODO: handle exception newMap.put("status", ResponseCode.ERROR); }
337   - */
  343 +
338 344 return newMap;
339 345 }
340 346  
... ... @@ -383,7 +389,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
383 389 String nbbm_eq = ylb.getNbbm();
384 390 Date rq_eq = ylb.getRq();
385 391 // 得到一天总的加油和里程(根据车,时间)
386   - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq);
  392 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
387 393 // 保存总的加油量
388 394 Double jzl = Double.valueOf(sumList.get(0)[0].toString());
389 395 // 保存总的里程
... ... @@ -484,7 +490,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
484 490 String nbbm_eq = ylb.getNbbm();
485 491 Date rq_eq = ylb.getRq();
486 492 // 得到一天总的加油和里程(根据车,时间)
487   - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq);
  493 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
488 494 // 保存总的加油量
489 495 Double jzl = Double.valueOf(sumList.get(0)[0].toString());
490 496 // 保存总的里程
... ... @@ -610,7 +616,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
610 616 nbbm=map.get("nbbm_eq").toString();
611 617 }
612 618 List<Ylb> ylbList=repository.obtainYl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
613   - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0);
  619 + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm);
614 620 for (int i = 0; i < ylxxbList.size(); i++) {
615 621 Boolean fage=true;
616 622 Ylxxb y1=ylxxbList.get(i);
... ...
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
... ... @@ -126,7 +126,7 @@ public interface ScheduleRealInfoService extends BaseService&lt;ScheduleRealInfo, L
126 126 List<ScheduleRealInfo> realScheduleList(String line,String date);
127 127 List<ScheduleRealInfo> realScheduleListQp(String line,String date);
128 128  
129   - List<Map<String,Object>> yesterdayDataList(String line,String date);
  129 + List<Map<String,Object>> yesterdayDataList(String line,String date,String gsbm,String fgsbm,String jGh,String nbbm);
130 130  
131 131 List<Map<String,Object>> yesterdayDataList(String line);
132 132  
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -1290,7 +1290,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1290 1290 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
1291 1291 int jhbc = 0, cjbc = 0, ljbc = 0;
1292 1292 double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
1293   - float addMileage = 0l, remMileage = 0l;
  1293 + float addMileage = 0l, remMileage = 0l,addMileageYy = 0l,addMileageJc =0l;
1294 1294 Map<String, Object> map = new HashMap<String, Object>();
1295 1295 for (ScheduleRealInfo scheduleRealInfo : list) {
1296 1296 if (scheduleRealInfo != null) {
... ... @@ -1301,7 +1301,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1301 1301 tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
1302 1302 if (scheduleRealInfo.isSflj()) {
1303 1303 addMileage += tempJhlc;
1304   - ljbc++;
  1304 + if (scheduleRealInfo.getBcType().equals("in")
  1305 + || scheduleRealInfo.getBcType().equals("out")) {
  1306 + addMileageJc +=tempJhlc;
  1307 + }else{
  1308 + ljbc++;
  1309 + addMileageYy +=tempJhlc;
  1310 + }
  1311 +
1305 1312 } else {
1306 1313 if (!(scheduleRealInfo.getBcType().equals("in")
1307 1314 || scheduleRealInfo.getBcType().equals("out"))) {
... ... @@ -1358,15 +1365,15 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1358 1365 map.put("jhlc", format.format(jhlc));
1359 1366 map.put("remMileage", format.format(remMileage));
1360 1367 map.put("addMileage", format.format(addMileage));
1361   - map.put("yygl", format.format(yygl));
  1368 + map.put("yygl", format.format(yygl+addMileageYy));
1362 1369 map.put("ksgl", format.format(ksgl));
1363   - map.put("realMileage", format.format(yygl + ksgl + jcclc));
  1370 + map.put("realMileage", format.format(yygl + ksgl + jcclc+addMileage));
1364 1371 map.put("jhbc", jhbc);
1365 1372 map.put("cjbc", cjbc);
1366 1373 map.put("ljbc", ljbc);
1367 1374 map.put("sjbc", jhbc - cjbc + ljbc);
1368 1375 map.put("jcclc", jcclc);
1369   - map.put("zkslc", format.format(ksgl + jcclc));
  1376 + map.put("zkslc", format.format(ksgl + jcclc+addMileageJc));
1370 1377 return map;
1371 1378 }
1372 1379  
... ... @@ -1500,6 +1507,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
1500 1507 if (!childTaskPlans.isEmpty()) {
1501 1508 s.setFcsjActual("");
1502 1509 s.setZdsjActual("");
  1510 + s.setJhlc(0.0);
1503 1511 }
1504 1512  
1505 1513 if (s.isDestroy()) {
... ... @@ -2331,86 +2339,91 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
2331 2339 return list;
2332 2340 }
2333 2341  
2334   - public List<Map<String, Object>> yesterdayDataList(String line, String date) {
  2342 + public List<Map<String, Object>> yesterdayDataList(String line, String date,String gsbm,String fgsbm,String jGh,String nbbm) {
2335 2343 //前一天日期
2336 2344 // String date = sdfMonth.format(org.apache.commons.lang.time.DateUtils.addDays(new Date(), -1));
2337 2345 // String date = "2016-09-20";
2338   - List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date);
  2346 + List<Map<String, Object>> yesterdayDataList = scheduleRealInfoRepository.yesterdayDataList(line, date,gsbm,fgsbm);
2339 2347 // List<ScheduleRealInfo> list = scheduleRealInfoRepository.scheduleByDateAndLine(line, date);
  2348 + List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jGh, nbbm, date);
2340 2349 for (int x = 0; x < yesterdayDataList.size(); x++) {
2341 2350 String jName = yesterdayDataList.get(x).get("jGh").toString();
2342 2351 String clZbh = yesterdayDataList.get(x).get("clZbh").toString();
2343   - List<ScheduleRealInfo> lists = scheduleRealInfoRepository.queryListWaybill3(jName, clZbh, date);
  2352 +
2344 2353 double jhlc = 0, yygl = 0, ksgl = 0, tempJhlc = 0, jcclc = 0;
2345 2354 float addMileage = 0l, remMileage = 0l;
2346 2355 Map<String, Object> map = new HashMap<String, Object>();
2347 2356 boolean fage = true;
  2357 + String company="";
  2358 + String bCompany="";
2348 2359 for (ScheduleRealInfo scheduleRealInfo : lists) {
2349   - if (fage) {
2350   - //根据线路代码获取公司
2351   - Line li = lineRepository.findByLineCode(scheduleRealInfo.getXlBm());
2352   - yesterdayDataList.get(x).put("company", li.getCompany());
2353   - yesterdayDataList.get(x).put("bCompany", li.getBrancheCompany());
2354   - fage = false;
2355   - }
2356   - if (scheduleRealInfo != null) {
2357   - //计划里程(主任务过滤掉临加班次),
2358   - //烂班里程(主任务烂班),
2359   - //临加里程(主任务临加),
2360   - //计划班次,烂班班次,增加班次
2361   - tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
2362   - if (scheduleRealInfo.isSflj()) {
2363   - addMileage += tempJhlc;
2364   - } else {
2365   - if (!(scheduleRealInfo.getBcType().equals("in")
2366   - || scheduleRealInfo.getBcType().equals("out"))) {
2367   - jhlc += tempJhlc;
2368   - }
2369   -
2370   - if (scheduleRealInfo.getStatus() == -1) {
2371   - remMileage += tempJhlc;
2372   - }
2373   - }
2374   - Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
2375   - //计算营运里程,空驶里程
2376   - if (childTaskPlans.isEmpty()) {
2377   - if (scheduleRealInfo.getBcType().equals("in") ||
2378   - scheduleRealInfo.getBcType().equals("out")) {
2379   - if (scheduleRealInfo.getStatus() != -1) {
2380   - jcclc += tempJhlc;
2381   - }
2382   - }
2383   - //主任务 放空班次属于营运
2384   -// else if(scheduleRealInfo.getBcType().equals("venting")){
2385   -// ksgl += tempJhlc;
2386   -// }
2387   - else {
2388   - if (scheduleRealInfo.getStatus() != -1) {
2389   - yygl += tempJhlc;
2390   - }
2391   - }
2392   - } else {
2393   - Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
2394   - while (it.hasNext()) {
2395   - ChildTaskPlan childTaskPlan = it.next();
2396   - if (childTaskPlan.getMileageType().equals("empty")) {
2397   - if (childTaskPlan.isDestroy()) {
2398   - remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2399   - } else {
2400   - ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2401   - }
2402   - } else {
2403   - if (childTaskPlan.isDestroy()) {
2404   - remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2405   - } else {
2406   - yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
2407   - }
2408   - }
2409   - }
2410   - }
2411   - }
2412   - }
2413   -
  2360 + if(scheduleRealInfo.getjGh().equals(jName) && scheduleRealInfo.getClZbh().equals(clZbh)){
  2361 + if (fage) {
  2362 + //根据线路代码获取公司
  2363 + company=scheduleRealInfo.getGsBm();
  2364 + bCompany=scheduleRealInfo.getFgsBm();
  2365 + fage = false;
  2366 + }
  2367 + if (scheduleRealInfo != null) {
  2368 + //计划里程(主任务过滤掉临加班次),
  2369 + //烂班里程(主任务烂班),
  2370 + //临加里程(主任务临加),
  2371 + //计划班次,烂班班次,增加班次
  2372 + tempJhlc = scheduleRealInfo.getJhlc() == null ? 0 : scheduleRealInfo.getJhlc();
  2373 + if (scheduleRealInfo.isSflj()) {
  2374 + addMileage += tempJhlc;
  2375 + } else {
  2376 + if (!(scheduleRealInfo.getBcType().equals("in")
  2377 + || scheduleRealInfo.getBcType().equals("out"))) {
  2378 + jhlc += tempJhlc;
  2379 + }
  2380 +
  2381 + if (scheduleRealInfo.getStatus() == -1) {
  2382 + remMileage += tempJhlc;
  2383 + }
  2384 + }
  2385 + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks();
  2386 + //计算营运里程,空驶里程
  2387 + if (childTaskPlans.isEmpty()) {
  2388 + if (scheduleRealInfo.getBcType().equals("in") ||
  2389 + scheduleRealInfo.getBcType().equals("out")) {
  2390 + if (scheduleRealInfo.getStatus() != -1) {
  2391 + jcclc += tempJhlc;
  2392 + }
  2393 + }
  2394 + //主任务 放空班次属于营运
  2395 + // else if(scheduleRealInfo.getBcType().equals("venting")){
  2396 + // ksgl += tempJhlc;
  2397 + // }
  2398 + else {
  2399 + if (scheduleRealInfo.getStatus() != -1) {
  2400 + yygl += tempJhlc;
  2401 + }
  2402 + }
  2403 + } else {
  2404 + Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
  2405 + while (it.hasNext()) {
  2406 + ChildTaskPlan childTaskPlan = it.next();
  2407 + if (childTaskPlan.getMileageType().equals("empty")) {
  2408 + if (childTaskPlan.isDestroy()) {
  2409 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2410 + } else {
  2411 + ksgl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2412 + }
  2413 + } else {
  2414 + if (childTaskPlan.isDestroy()) {
  2415 + remMileage += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2416 + } else {
  2417 + yygl += childTaskPlan.getMileage() == null ? 0 : childTaskPlan.getMileage();
  2418 + }
  2419 + }
  2420 + }
  2421 + }
  2422 + }
  2423 + }
  2424 + }
  2425 + yesterdayDataList.get(x).put("company", company);
  2426 + yesterdayDataList.get(x).put("bCompany", bCompany);
2414 2427 yesterdayDataList.get(x).put("totalKilometers", yygl + ksgl + jcclc);
2415 2428  
2416 2429 }
... ... @@ -3118,7 +3131,9 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3118 3131 }
3119 3132  
3120 3133 if (!c.isDestroy()) {
3121   - sjlc += c.getMileage() == null ? 0 : c.getMileage();
  3134 + if(c.getMileageType().equals("service")){
  3135 + sjlc += c.getMileage() == null ? 0 : c.getMileage();
  3136 + }
3122 3137 }
3123 3138  
3124 3139 }
... ...