Commit b48a57fd1b9a317ba7678c8152f2e4c5c9ef9833
1 parent
d1c098ed
油量信息排除公司编码或分公司编码为空的数据
Showing
2 changed files
with
26 additions
and
20 deletions
src/main/java/com/bsth/repository/oil/YlbRepository.java
| @@ -56,8 +56,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | @@ -56,8 +56,8 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{ | ||
| 56 | */ | 56 | */ |
| 57 | @Transactional | 57 | @Transactional |
| 58 | @Modifying | 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<Ylb,Integer> implements YlbS | @@ -180,7 +180,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 180 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 180 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 181 | t.setRq(sdf.parse(rq)); | 181 | t.setRq(sdf.parse(rq)); |
| 182 | t.setCreatetime(dNow); | 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 | result = "success"; | 189 | result = "success"; |
| @@ -330,12 +333,14 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -330,12 +333,14 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 330 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | 333 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 331 | t.setRq(sdf.parse(rq)); | 334 | t.setRq(sdf.parse(rq)); |
| 332 | t.setCreatetime(date); | 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 | // repository.save(t); | 344 | // repository.save(t); |
| 340 | newMap.put("status", ResponseCode.SUCCESS); | 345 | newMap.put("status", ResponseCode.SUCCESS); |
| 341 | 346 | ||
| @@ -405,7 +410,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -405,7 +410,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 405 | String nbbm_eq = ylb.getNbbm(); | 410 | String nbbm_eq = ylb.getNbbm(); |
| 406 | Date rq_eq = ylb.getRq(); | 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 | Double jzl = 0.0; | 415 | Double jzl = 0.0; |
| 411 | // 保存总的里程 | 416 | // 保存总的里程 |
| @@ -436,14 +441,14 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -436,14 +441,14 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 436 | if(t.getNbbm().equals(ylb.getNbbm())){ | 441 | if(t.getNbbm().equals(ylb.getNbbm())){ |
| 437 | if (t.getJcsx() == 1) { | 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 | Double yh=0.0; | 447 | Double yh=0.0; |
| 443 | if(zlc>0){ | 448 | if(zlc>0){ |
| 444 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 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 | // int ylxs=(int) nextJzyl; 10.6--11 10.3--10 | 453 | // int ylxs=(int) nextJzyl; 10.6--11 10.3--10 |
| 449 | long l=Math.round(nextJzyl); | 454 | long l=Math.round(nextJzyl); |
| @@ -459,7 +464,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -459,7 +464,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 459 | if(zlc>0){ | 464 | if(zlc>0){ |
| 460 | yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 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 | long l=Math.round(nextJzyl); | 468 | long l=Math.round(nextJzyl); |
| 464 | double ylxs=l*100/100; | 469 | double ylxs=l*100/100; |
| 465 | // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | 470 | // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); |
| @@ -744,10 +749,11 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -744,10 +749,11 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 744 | // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); | 749 | // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); |
| 745 | t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); | 750 | t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); |
| 746 | t.setYh(0.0); | 751 | t.setYh(0.0); |
| 747 | - if(fgsdm.equals(fgsbm)){ | 752 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| 748 | repository.save(t); | 753 | repository.save(t); |
| 749 | if(null!=cyl){ | 754 | if(null!=cyl){ |
| 750 | cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); | 755 | cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); |
| 756 | + cyl.setUpdatetime(y1.getYyrq()); | ||
| 751 | cylRepository.save(cyl); | 757 | cylRepository.save(cyl); |
| 752 | } | 758 | } |
| 753 | } | 759 | } |
| @@ -1090,7 +1096,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1090,7 +1096,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1090 | String nbbm_eq = ylb.getNbbm(); | 1096 | String nbbm_eq = ylb.getNbbm(); |
| 1091 | Date rq_eq = ylb.getRq(); | 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 | Double jzl = 0.0; | 1101 | Double jzl = 0.0; |
| 1096 | // 保存总的里程 | 1102 | // 保存总的里程 |
| @@ -1102,7 +1108,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1102,7 +1108,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1102 | zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); | 1108 | zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString())); |
| 1103 | zsh = Arith.add(zsh, Double.valueOf(sumList.get(j)[2].toString())); | 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 | if(Arith.sub(ylb.getSh(),sh )!=0){ | 1113 | if(Arith.sub(ylb.getSh(),sh )!=0){ |
| 1108 | zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh); | 1114 | zsh =Arith.add(Arith.sub(zsh, ylb.getSh()), sh); |
| @@ -1126,8 +1132,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1126,8 +1132,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1126 | t.setSh(sh); | 1132 | t.setSh(sh); |
| 1127 | t.setShyy(shyy); | 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 | Double yh = 0.0; | 1137 | Double yh = 0.0; |
| 1132 | if (zlc > 0 && t.getZlc() > 0) { | 1138 | if (zlc > 0 && t.getZlc() > 0) { |
| 1133 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 1139 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); |