Commit def6e2478d75a42a9f4767e78cca741917e18f22
1 parent
a2c50bdd
电量
Showing
5 changed files
with
96 additions
and
46 deletions
src/main/java/com/bsth/controller/oil/DlbController.java
src/main/java/com/bsth/repository/oil/DlbRepository.java
| ... | ... | @@ -22,8 +22,9 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ |
| 22 | 22 | @Modifying |
| 23 | 23 | @Query(value="SELECT a.* FROM bsth_c_dlb a where to_days(?1)-to_days(a.rq)=1" |
| 24 | 24 | + " and jcsx=(select max(b.jcsx) from bsth_c_dlb b where a.nbbm=b.nbbm and " |
| 25 | - + " to_days(?1)-to_days(b.rq)=1 )",nativeQuery=true) | |
| 26 | - List<Dlb> obtainYlbefore(String rq); | |
| 25 | + + " to_days(?1)-to_days(b.rq)=1 ) and ssgsdm like %?2% and fgsdm like %?3% and " | |
| 26 | + + " xlbm like %?4% and nbbm like %?5%",nativeQuery=true) | |
| 27 | + List<Dlb> obtainYlbefore(String rq,String gsdm,String fgsdm,String xlbm,String nbbm); | |
| 27 | 28 | /** |
| 28 | 29 | * 当天DLB信息 |
| 29 | 30 | * @param rq |
| ... | ... | @@ -31,8 +32,10 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ |
| 31 | 32 | */ |
| 32 | 33 | @Transactional |
| 33 | 34 | @Modifying |
| 34 | - @Query(value="SELECT * FROM bsth_c_dlb where to_days(?)=to_days(rq)",nativeQuery=true) | |
| 35 | - List<Dlb> obtainDl(String rq); | |
| 35 | + @Query(value="SELECT * FROM bsth_c_dlb where to_days(?1)=to_days(rq) and ssgsdm like %?2% " | |
| 36 | + + " and fgsdm like %?3%" | |
| 37 | + + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc",nativeQuery=true) | |
| 38 | + List<Dlb> obtainDl(String rq,String gsbm,String fgsdm,String xlbm,String nbbm,String px); | |
| 36 | 39 | |
| 37 | 40 | @Query(value="select s from Dlb s " |
| 38 | 41 | + " where to_days(?1)=to_days(s.rq) " | ... | ... |
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| ... | ... | @@ -26,7 +26,9 @@ import org.springframework.stereotype.Service; |
| 26 | 26 | import com.alibaba.fastjson.JSONArray; |
| 27 | 27 | import com.alibaba.fastjson.JSONObject; |
| 28 | 28 | import com.bsth.common.ResponseCode; |
| 29 | +import com.bsth.data.BasicData; | |
| 29 | 30 | import com.bsth.entity.Cars; |
| 31 | +import com.bsth.entity.Line; | |
| 30 | 32 | import com.bsth.entity.oil.Cdl; |
| 31 | 33 | import com.bsth.entity.oil.Cyl; |
| 32 | 34 | import com.bsth.entity.oil.Dlb; |
| ... | ... | @@ -97,13 +99,13 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 97 | 99 | // TODO Auto-generated method stub |
| 98 | 100 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 99 | 101 | //当天DLB信息 |
| 100 | - List<Dlb> dlList=repository.obtainDl(rq); | |
| 102 | + List<Dlb> dlList=repository.obtainDl(rq, gsbm, "", line, "", "nbbm"); | |
| 101 | 103 | //当天YLXXB信息 |
| 102 | 104 | List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); |
| 103 | 105 | //当天加电信息表 |
| 104 | 106 | List<Jdl> jdlList=jdlRepository.JdlList(rq); |
| 105 | 107 | //前一天所有车辆最后进场班次信息 |
| 106 | - List<Dlb> dlListBe=repository.obtainYlbefore(rq); | |
| 108 | + List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", ""); | |
| 107 | 109 | List<Cdl> cdyList=cdlRepository.obtainCdl(); |
| 108 | 110 | //从排班表中计算出行驶的总里程 |
| 109 | 111 | List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); |
| ... | ... | @@ -258,25 +260,48 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 258 | 260 | @Override |
| 259 | 261 | public Map<String, Object> checkDl(Map<String, Object> map) { |
| 260 | 262 | Map<String, Object> newMap=new HashMap<String,Object>(); |
| 261 | - String xlbm=map.get("xlbm_eq").toString(); | |
| 262 | - String gsbm=""; | |
| 263 | - if(map.get("ssgsdm_like")!=null){ | |
| 264 | - gsbm=map.get("ssgsdm_like").toString(); | |
| 265 | - } | |
| 263 | +// String xlbm=""; | |
| 264 | +// if(map.get("xlbm_like")!=null){ | |
| 265 | +// xlbm=map.get("xlbm_like").toString(); | |
| 266 | +// } | |
| 266 | 267 | // TODO Auto-generated method stub |
| 268 | + | |
| 269 | + List<Cars> carsList = carsRepository.findCars(); | |
| 270 | + Map<String, String> carsMap = new HashMap<String, String>(); | |
| 271 | + for (int i = 0; i < carsList.size(); i++) { | |
| 272 | + Cars c = carsList.get(i); | |
| 273 | + carsMap.put(c.getInsideCode(), c.getBrancheCompanyCode()==null?"":c.getBrancheCompanyCode()); | |
| 274 | + } | |
| 275 | + | |
| 267 | 276 | try{ |
| 268 | 277 | //获取车辆存油信息 |
| 269 | -// List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); | |
| 278 | + | |
| 270 | 279 | String rq=map.get("rq").toString(); |
| 271 | - List<Dlb> dlbList=repository.obtainDl(rq); | |
| 272 | - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,1,gsbm); | |
| 273 | - //当天加电信息表 | |
| 274 | - List<Jdl> jdlList=jdlRepository.JdlList(rq); | |
| 280 | + String xlbm=""; | |
| 281 | + if(map.get("xlbm_like")!=null){ | |
| 282 | + xlbm= map.get("xlbm_like").toString().trim(); | |
| 283 | + } | |
| 284 | + String gsbm=""; | |
| 285 | + if(map.get("ssgsdm_like")!=null){ | |
| 286 | + gsbm=map.get("ssgsdm_like").toString(); | |
| 287 | + } | |
| 288 | + String fgsbm=""; | |
| 289 | + if(map.get("fgsdm_like")!=null){ | |
| 290 | + fgsbm=map.get("fgsdm_like").toString(); | |
| 291 | + } | |
| 292 | + String nbbm=""; | |
| 293 | + if(map.get("nbbm_eq")!=null){ | |
| 294 | + nbbm=map.get("nbbm_eq").toString(); | |
| 295 | + } | |
| 296 | + List<Dlb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm); | |
| 297 | +// List<Cdl> cylList=cdlRepository.obtainCdl(nbbm, gsbm); | |
| 298 | + List<Dlb> ylbList=repository.obtainDl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm"); | |
| 299 | + List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,0,gsbm); | |
| 275 | 300 | for (int i = 0; i < ylxxbList.size(); i++) { |
| 276 | 301 | Boolean fage=true; |
| 277 | 302 | Ylxxb y1=ylxxbList.get(i); |
| 278 | - for(int y=0;y<dlbList.size();y++){ | |
| 279 | - Dlb y2=dlbList.get(y); | |
| 303 | + for(int y=0;y<ylbList.size();y++){ | |
| 304 | + Dlb y2=ylbList.get(y); | |
| 280 | 305 | if(y1.getNbbm().equals(y2.getNbbm())){ |
| 281 | 306 | fage=false; |
| 282 | 307 | break; |
| ... | ... | @@ -290,37 +315,55 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 290 | 315 | t.setJsy(y1.getJsy()); |
| 291 | 316 | t.setCdl(y1.getJzl()); |
| 292 | 317 | t.setSsgsdm(y1.getGsdm()); |
| 293 | - t.setXlbm(xlbm); | |
| 294 | - repository.save(t); | |
| 295 | - } | |
| 296 | - } | |
| 297 | - | |
| 298 | - for (int i = 0; i < jdlList.size(); i++) { | |
| 299 | - Boolean fage=true; | |
| 300 | - Jdl y1=jdlList.get(i); | |
| 301 | - for(int y=0;y<dlbList.size();y++){ | |
| 302 | - Dlb y2=dlbList.get(y); | |
| 303 | - if(y1.getNbbm().equals(y2.getNbbm())){ | |
| 304 | - fage=false; | |
| 305 | - break; | |
| 318 | + String fgsdm=""; | |
| 319 | + if(null!=carsMap.get(y1.getNbbm())){ | |
| 320 | + fgsdm=carsMap.get(y1.getNbbm()); | |
| 321 | + } | |
| 322 | + t.setFgsdm(fgsdm); | |
| 323 | + t.setJcsx(1); | |
| 324 | + Line line= BasicData.nbbm2LineMap.get(y1.getNbbm()); | |
| 325 | + if(null !=line){ | |
| 326 | + t.setXlbm(line.getLineCode()); | |
| 327 | + }else{ | |
| 328 | + t.setXlbm(""); | |
| 329 | + } | |
| 330 | + t.setJcsx(1); | |
| 331 | + boolean status=true; | |
| 332 | + for (int j = 0; j < ylListBe.size(); j++) { | |
| 333 | + Dlb b=ylListBe.get(j); | |
| 334 | + if(b.getNbbm().equals(y1.getNbbm())){ | |
| 335 | + t.setCzcd(b.getJzcd()); | |
| 336 | + status=false; | |
| 337 | + break; | |
| 338 | + } | |
| 339 | + } | |
| 340 | + /*if(status){ | |
| 341 | + for (int j = 0; j < cylList.size(); j++) { | |
| 342 | + Cyl c=cylList.get(j); | |
| 343 | + if(c.getNbbm().equals(y1.getNbbm())){ | |
| 344 | + t.setCzyl(c.getCyl()); | |
| 345 | + cyl=c; | |
| 346 | + status=false; | |
| 347 | + break; | |
| 348 | + } | |
| 349 | + } | |
| 350 | + }*/ | |
| 351 | + if(status){ | |
| 352 | + t.setCzcd(0.0); | |
| 353 | + } | |
| 354 | +// double jzyl=Arith.add(t.getJzl(), t.getCzyl()); | |
| 355 | + t.setJzcd(100.0); | |
| 356 | + t.setHd(0.0); | |
| 357 | + if(fgsdm.equals(fgsbm)){ | |
| 358 | + repository.save(t); | |
| 306 | 359 | } |
| 307 | - } | |
| 308 | - | |
| 309 | - if(fage){ | |
| 310 | - Dlb t=new Dlb(); | |
| 311 | - t.setNbbm(y1.getNbbm()); | |
| 312 | - t.setRq(y1.getRq()); | |
| 313 | -// t.setJsy(y1.getJsy()); | |
| 314 | - t.setCdl(y1.getJdl()); | |
| 315 | - t.setSsgsdm(y1.getGsBm()); | |
| 316 | - t.setXlbm(xlbm); | |
| 317 | - repository.save(t); | |
| 318 | 360 | } |
| 319 | 361 | } |
| 320 | 362 | newMap.put("status", ResponseCode.SUCCESS); |
| 321 | 363 | }catch(Exception e){ |
| 322 | 364 | newMap.put("status", ResponseCode.ERROR); |
| 323 | 365 | logger.error("save erro.", e); |
| 366 | + throw e; | |
| 324 | 367 | } |
| 325 | 368 | |
| 326 | 369 | return newMap; | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| ... | ... | @@ -701,7 +701,10 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 701 | 701 | t.setJsy(y1.getJsy()); |
| 702 | 702 | t.setJzl(y1.getJzl()); |
| 703 | 703 | t.setSsgsdm(y1.getGsdm()); |
| 704 | - String fgsdm=carsMap.get(y1.getNbbm()); | |
| 704 | + String fgsdm=""; | |
| 705 | + if(null !=carsMap.get(y1.getNbbm())){ | |
| 706 | + fgsdm=carsMap.get(y1.getNbbm()); | |
| 707 | + } | |
| 705 | 708 | t.setFgsdm(fgsdm); |
| 706 | 709 | t.setJcsx(1); |
| 707 | 710 | Line line= BasicData.nbbm2LineMap.get(y1.getNbbm()); |
| ... | ... | @@ -737,7 +740,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 737 | 740 | // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); |
| 738 | 741 | t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); |
| 739 | 742 | t.setYh(0.0); |
| 740 | - if(fgsdm.equals("fgsbm")){ | |
| 743 | + if(fgsdm.equals(fgsbm)){ | |
| 741 | 744 | repository.save(t); |
| 742 | 745 | if(null!=cyl){ |
| 743 | 746 | cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); | ... | ... |
src/main/resources/static/pages/electricity/list/list.html
| ... | ... | @@ -261,11 +261,11 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep |
| 261 | 261 | //var id = 15; |
| 262 | 262 | //$('.in_carpark_jzcd[data-id='+id+']', '#dl_oil_list') |
| 263 | 263 | |
| 264 | - $("#checkYl").on('click', function () { | |
| 264 | + $("#checkDl").on('click', function () { | |
| 265 | 265 | if ($("#rq").val() != "") { |
| 266 | 266 | var params=getParamsList(); |
| 267 | 267 | var i = layer.load(2); |
| 268 | - $get('/ylb/checkYl', params, function () { | |
| 268 | + $get('/dlb/checkDl', params, function () { | |
| 269 | 269 | layer.close(i); |
| 270 | 270 | jsDoQuery(params, true); |
| 271 | 271 | }); | ... | ... |