Commit b48a57fd1b9a317ba7678c8152f2e4c5c9ef9833

Authored by 廖磊
1 parent d1c098ed

油量信息排除公司编码或分公司编码为空的数据

src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -56,8 +56,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{
56 56 */
57 57 @Transactional
58 58 @Modifying
59   - @Query(value="select ifnull(jzl,0),ifnull(zlc,0),ifnull(sh,0) from bsth_c_ylb where nbbm=?1 and rq=?2 and xlbm like %?3%",nativeQuery=true)
60   - List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm);
  59 + @Query(value="select ifnull(jzl,0),ifnull(zlc,0),ifnull(sh,0) from bsth_c_ylb where nbbm=?1 and rq=?2 and xlbm like %?3% and ssgsdm like %?4% and fgsdm like %?5%",nativeQuery=true)
  60 + List<Object[]> sumLcYl(String nbbm,Date rq,String xlbm,String fgsbm,String gsbm);
61 61  
62 62 /**
63 63 *
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -180,7 +180,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
180 180 t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
181 181 t.setRq(sdf.parse(rq));
182 182 t.setCreatetime(dNow);
183   - repository.save(t);
  183 + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
  184 + repository.save(t);
  185 + }
  186 +
184 187  
185 188 }
186 189 result = "success";
... ... @@ -330,12 +333,14 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
330 333 t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString());
331 334 t.setRq(sdf.parse(rq));
332 335 t.setCreatetime(date);
333   - if(type.equals("add")){
334   - addList.add(t);
335   - }else{
336   - updateList.add(t);
337   - ins += t.getId().toString()+",";
338   - }
  336 + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
  337 + if(type.equals("add")){
  338 + addList.add(t);
  339 + }else{
  340 + updateList.add(t);
  341 + ins += t.getId().toString()+",";
  342 + }
  343 + }
339 344 // repository.save(t);
340 345 newMap.put("status", ResponseCode.SUCCESS);
341 346  
... ... @@ -405,7 +410,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
405 410 String nbbm_eq = ylb.getNbbm();
406 411 Date rq_eq = ylb.getRq();
407 412 // 得到一天总的加油和里程(根据车,时间)
408   - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
  413 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm(),gsbm,fgsbm);
409 414 // 保存总的加油量
410 415 Double jzl = 0.0;
411 416 // 保存总的里程
... ... @@ -436,14 +441,14 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
436 441 if(t.getNbbm().equals(ylb.getNbbm())){
437 442 if (t.getJcsx() == 1) {
438 443 // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量
439   - Double yl = t.getCzyl();
440   - Double jcyl = t.getCzyl();
441   - zyl =Arith.sub( Arith.add(jcyl, jzl),yl);
  444 +// Double yl = t.getCzyl();
  445 +// Double jcyl = t.getCzyl();
  446 + zyl =jzl;
442 447 Double yh=0.0;
443 448 if(zlc>0){
444 449 yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
445 450 }
446   - nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh);
  451 + nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()), t.getCzyl()),yh);
447 452 //把进场油量的小数和整数分别取出
448 453 // int ylxs=(int) nextJzyl; 10.6--11 10.3--10
449 454 long l=Math.round(nextJzyl);
... ... @@ -459,7 +464,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
459 464 if(zlc>0){
460 465 yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
461 466 }
462   - nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh);
  467 + nextJzyl =Arith.sub( Arith.add(Arith.sub(t.getJzl(),t.getSh()),nextJzyl),yh);
463 468 long l=Math.round(nextJzyl);
464 469 double ylxs=l*100/100;
465 470 // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs));
... ... @@ -744,10 +749,11 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
744 749 // double jzyl=Arith.add(t.getJzl(), t.getCzyl());
745 750 t.setJzyl(Arith.add(t.getJzl(), t.getCzyl()));
746 751 t.setYh(0.0);
747   - if(fgsdm.equals(fgsbm)){
  752 + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
748 753 repository.save(t);
749 754 if(null!=cyl){
750 755 cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl()));
  756 + cyl.setUpdatetime(y1.getYyrq());
751 757 cylRepository.save(cyl);
752 758 }
753 759 }
... ... @@ -1090,7 +1096,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1090 1096 String nbbm_eq = ylb.getNbbm();
1091 1097 Date rq_eq = ylb.getRq();
1092 1098 // 得到一天总的加油和里程(根据车,时间)
1093   - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm());
  1099 + List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,ylb.getXlbm(),ylb.getSsgsdm(),ylb.getFgsdm());
1094 1100 // 保存总的加油量
1095 1101 Double jzl = 0.0;
1096 1102 // 保存总的里程
... ... @@ -1102,7 +1108,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1102 1108 zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
1103 1109 zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString()));
1104 1110 }
1105   - jzl = Arith.sub(jzl, zsh);
  1111 +// jzl = Arith.sub(jzl, zsh);
1106 1112 //新的 损耗不等于 旧的损耗 总损耗从新算
1107 1113 if(Arith.sub(ylb.getSh(),sh )!=0){
1108 1114 zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh);
... ... @@ -1126,8 +1132,8 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1126 1132 t.setSh(sh);
1127 1133 t.setShyy(shyy);
1128 1134 }
1129   - Double jcyl = t.getCzyl();
1130   - zyl = Arith.sub(Arith.add(jcyl, jzl), yl);
  1135 +// Double jcyl = t.getCzyl();
  1136 + zyl = jzl;
1131 1137 Double yh = 0.0;
1132 1138 if (zlc > 0 && t.getZlc() > 0) {
1133 1139 yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
... ...