Commit f4a911addbb7500547ede6a2c23c4b8e098c34f2

Authored by 廖磊
1 parent 3a9befa5

油量拆分添加跨分公司用车处理

src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -54,7 +54,7 @@ public interface YlbRepository extends BaseRepository<Ylb, Integer>{
54 54  
55 55 @Query(value="select * from bsth_c_ylb where rq>=?1 "
56 56 + " and rq<= ?2 and ssgsdm =?3"
57   - + " and fgsdm =?4 and xlbm like %?5% "
  57 + + " and fgsdm like %?4% and xlbm like %?5% "
58 58 + " order by nbbm , rq desc,jcsx desc,lp desc",nativeQuery=true)
59 59 List<Ylb> listByMonthJcsx(String rq,String rq2,String gsbm,String fgsbm,String xlbm);
60 60  
... ... @@ -155,7 +155,7 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
155 155 @Query(value="select s from Ylb s "
156 156 + " where to_days(s.rq)=to_days(?1) "
157 157 + " and s.ssgsdm =?2 "
158   - + " and s.fgsdm =?3 "
  158 + + " and s.fgsdm like %?3% "
159 159 + " and s.xlbm like %?4% "
160 160 + " and s.nbbm in ?5 order by nbbm,jcsx")
161 161 List<Ylb> listYlb(String rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
... ... @@ -163,7 +163,7 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
163 163 @Query(value="select s from Ylb s "
164 164 + " where s.rq=?1 "
165 165 + " and s.ssgsdm =?2 "
166   - + " and s.fgsdm =?3 "
  166 + + " and s.fgsdm like %?3% "
167 167 + " and s.xlbm like %?4% "
168 168 + " and s.nbbm in ?5 order by nbbm,jcsx")
169 169 List<Ylb> listYlb_s(Date rq, String gsbm,String fgsbm,String xlbm,List<String> listNbbm);
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -1395,6 +1395,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1395 1395 try {
1396 1396 List<Cyl> cylList = cylRepository.findAll(new CustomerSpecs<Cyl>(newMap));
1397 1397 String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString());
  1398 + String fgsbm="999";
  1399 + if(map.get("fgsbm")!=null){
  1400 + fgsbm=map.get("fgsbm").toString();
  1401 + }
1398 1402 JSONArray jsonArray=JSONArray.parseArray(json);
1399 1403 JSONObject jsonObject;
1400 1404 for (int x = 0; x < jsonArray.size(); x++) {
... ... @@ -1409,7 +1413,12 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1409 1413 String nbbm_eq = ylb.getNbbm();
1410 1414 Date rq_eq = ylb.getRq();
1411 1415 // 得到一天总的加油和里程(根据车,时间)
1412   - List<Object[]> sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),ylb.getFgsdm());
  1416 + List<Object[]> sumList=new ArrayList<Object[]>();
  1417 + if(fgsbm.equals(""))
  1418 + sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),fgsbm);
  1419 + else
  1420 + sumList = repository.sumLcYl(nbbm_eq, rq_eq,"",ylb.getSsgsdm(),ylb.getFgsdm());
  1421 +
1413 1422 // 保存总的加油量
1414 1423 Double jzl = 0.0;
1415 1424 // 保存总的里程
... ... @@ -1431,9 +1440,14 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1431 1440 }*/
1432 1441 map.put("nbbm_eq", nbbm_eq);
1433 1442 map.put("rq_eq", rq_eq);
1434   -
1435   - List<Ylb> iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"",
1436   - ylb.getNbbm(),"jcsx");
  1443 + List<Ylb> iterator2=null;
  1444 + if(fgsbm.equals(""))
  1445 + iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),fgsbm,"",
  1446 + ylb.getNbbm(),"jcsx");
  1447 + else
  1448 + iterator2=this.listOrderBy(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"",
  1449 + ylb.getNbbm(),"jcsx");
  1450 +
1437 1451 // repository.obtainYl(sdf.format(rq_eq),ylb.getSsgsdm(),ylb.getFgsdm(),"",
1438 1452 // ylb.getNbbm(),"jcsx");
1439 1453 DecimalFormat df = new DecimalFormat("#.00");
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -547,6 +547,8 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
547 547 }else{
548 548 var params2 = {};
549 549 params2['ylbList']=JSON.stringify(ylArray2);
  550 + params2['fgsbm']=$("#ylbListFgsdmId").val();
  551 +
550 552 var i = layer.load(2);
551 553 //保存操作
552 554 $post('/ylb/saveYlbList', params, function () {
... ... @@ -661,7 +663,8 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
661 663 var ylbFgsdm=$("#ylbListFgsdmId").val();
662 664 if ($("#rq").val() == "" || $("#rq").val() ==null){
663 665 layer.msg('请选择日期.');
664   - }else if(ylbGsdm=="" || ylbGsdm==null || ylbFgsdm=="" ||ylbFgsdm==null){
  666 + }else if(ylbGsdm=="" || ylbGsdm==null||ylbFgsdm==null){
  667 +// || ylbFgsdm==""
665 668 layer.msg('请选择公司和分公司.');
666 669 }else {
667 670 var params = getParamsList();
... ... @@ -697,6 +700,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
697 700 }
698 701 }
699 702 }
  703 + options += '<option value="">全部分公司</option>';
700 704 $('#ylbListFgsdmId').html(options);
701 705 initXl();
702 706 initCl();
... ...