Commit def6e2478d75a42a9f4767e78cca741917e18f22

Authored by 廖磊
1 parent a2c50bdd

电量

src/main/java/com/bsth/controller/oil/DlbController.java
@@ -180,4 +180,5 @@ public class DlbController extends BaseController<Dlb, Integer>{ @@ -180,4 +180,5 @@ public class DlbController extends BaseController<Dlb, Integer>{
180 return resList; 180 return resList;
181 181
182 } 182 }
  183 +
183 } 184 }
src/main/java/com/bsth/repository/oil/DlbRepository.java
@@ -22,8 +22,9 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ @@ -22,8 +22,9 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{
22 @Modifying 22 @Modifying
23 @Query(value="SELECT a.* FROM bsth_c_dlb a where to_days(?1)-to_days(a.rq)=1" 23 @Query(value="SELECT a.* FROM bsth_c_dlb a where to_days(?1)-to_days(a.rq)=1"
24 + " and jcsx=(select max(b.jcsx) from bsth_c_dlb b where a.nbbm=b.nbbm and " 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 * 当天DLB信息 29 * 当天DLB信息
29 * @param rq 30 * @param rq
@@ -31,8 +32,10 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{ @@ -31,8 +32,10 @@ public interface DlbRepository extends BaseRepository&lt;Dlb, Integer&gt;{
31 */ 32 */
32 @Transactional 33 @Transactional
33 @Modifying 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 @Query(value="select s from Dlb s " 40 @Query(value="select s from Dlb s "
38 + " where to_days(?1)=to_days(s.rq) " 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,7 +26,9 @@ import org.springframework.stereotype.Service;
26 import com.alibaba.fastjson.JSONArray; 26 import com.alibaba.fastjson.JSONArray;
27 import com.alibaba.fastjson.JSONObject; 27 import com.alibaba.fastjson.JSONObject;
28 import com.bsth.common.ResponseCode; 28 import com.bsth.common.ResponseCode;
  29 +import com.bsth.data.BasicData;
29 import com.bsth.entity.Cars; 30 import com.bsth.entity.Cars;
  31 +import com.bsth.entity.Line;
30 import com.bsth.entity.oil.Cdl; 32 import com.bsth.entity.oil.Cdl;
31 import com.bsth.entity.oil.Cyl; 33 import com.bsth.entity.oil.Cyl;
32 import com.bsth.entity.oil.Dlb; 34 import com.bsth.entity.oil.Dlb;
@@ -97,13 +99,13 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -97,13 +99,13 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
97 // TODO Auto-generated method stub 99 // TODO Auto-generated method stub
98 Map<String, Object> newMap=new HashMap<String,Object>(); 100 Map<String, Object> newMap=new HashMap<String,Object>();
99 //当天DLB信息 101 //当天DLB信息
100 - List<Dlb> dlList=repository.obtainDl(rq); 102 + List<Dlb> dlList=repository.obtainDl(rq, gsbm, "", line, "", "nbbm");
101 //当天YLXXB信息 103 //当天YLXXB信息
102 List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); 104 List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
103 //当天加电信息表 105 //当天加电信息表
104 List<Jdl> jdlList=jdlRepository.JdlList(rq); 106 List<Jdl> jdlList=jdlRepository.JdlList(rq);
105 //前一天所有车辆最后进场班次信息 107 //前一天所有车辆最后进场班次信息
106 - List<Dlb> dlListBe=repository.obtainYlbefore(rq); 108 + List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", "");
107 List<Cdl> cdyList=cdlRepository.obtainCdl(); 109 List<Cdl> cdyList=cdlRepository.obtainCdl();
108 //从排班表中计算出行驶的总里程 110 //从排班表中计算出行驶的总里程
109 List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","",""); 111 List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","","");
@@ -258,25 +260,48 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -258,25 +260,48 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
258 @Override 260 @Override
259 public Map<String, Object> checkDl(Map<String, Object> map) { 261 public Map<String, Object> checkDl(Map<String, Object> map) {
260 Map<String, Object> newMap=new HashMap<String,Object>(); 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 // TODO Auto-generated method stub 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 try{ 276 try{
268 //获取车辆存油信息 277 //获取车辆存油信息
269 -// List<Cyl> cylList=cylRepository.findAll(new CustomerSpecs<Cyl>(newMap)); 278 +
270 String rq=map.get("rq").toString(); 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 for (int i = 0; i < ylxxbList.size(); i++) { 300 for (int i = 0; i < ylxxbList.size(); i++) {
276 Boolean fage=true; 301 Boolean fage=true;
277 Ylxxb y1=ylxxbList.get(i); 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 if(y1.getNbbm().equals(y2.getNbbm())){ 305 if(y1.getNbbm().equals(y2.getNbbm())){
281 fage=false; 306 fage=false;
282 break; 307 break;
@@ -290,37 +315,55 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS @@ -290,37 +315,55 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
290 t.setJsy(y1.getJsy()); 315 t.setJsy(y1.getJsy());
291 t.setCdl(y1.getJzl()); 316 t.setCdl(y1.getJzl());
292 t.setSsgsdm(y1.getGsdm()); 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 newMap.put("status", ResponseCode.SUCCESS); 362 newMap.put("status", ResponseCode.SUCCESS);
321 }catch(Exception e){ 363 }catch(Exception e){
322 newMap.put("status", ResponseCode.ERROR); 364 newMap.put("status", ResponseCode.ERROR);
323 logger.error("save erro.", e); 365 logger.error("save erro.", e);
  366 + throw e;
324 } 367 }
325 368
326 return newMap; 369 return newMap;
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
@@ -701,7 +701,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -701,7 +701,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
701 t.setJsy(y1.getJsy()); 701 t.setJsy(y1.getJsy());
702 t.setJzl(y1.getJzl()); 702 t.setJzl(y1.getJzl());
703 t.setSsgsdm(y1.getGsdm()); 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 t.setFgsdm(fgsdm); 708 t.setFgsdm(fgsdm);
706 t.setJcsx(1); 709 t.setJcsx(1);
707 Line line= BasicData.nbbm2LineMap.get(y1.getNbbm()); 710 Line line= BasicData.nbbm2LineMap.get(y1.getNbbm());
@@ -737,7 +740,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS @@ -737,7 +740,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
737 // double jzyl=Arith.add(t.getJzl(), t.getCzyl()); 740 // double jzyl=Arith.add(t.getJzl(), t.getCzyl());
738 t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); 741 t.setJzyl(Arith.add(t.getJzl(), t.getCzyl()));
739 t.setYh(0.0); 742 t.setYh(0.0);
740 - if(fgsdm.equals("fgsbm")){ 743 + if(fgsdm.equals(fgsbm)){
741 repository.save(t); 744 repository.save(t);
742 if(null!=cyl){ 745 if(null!=cyl){
743 cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl())); 746 cyl.setCyl(Arith.add(t.getJzl(), t.getCzyl()));
src/main/resources/static/pages/electricity/list/list.html
@@ -261,11 +261,11 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep @@ -261,11 +261,11 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
261 //var id = 15; 261 //var id = 15;
262 //$('.in_carpark_jzcd[data-id='+id+']', '#dl_oil_list') 262 //$('.in_carpark_jzcd[data-id='+id+']', '#dl_oil_list')
263 263
264 - $("#checkYl").on('click', function () { 264 + $("#checkDl").on('click', function () {
265 if ($("#rq").val() != "") { 265 if ($("#rq").val() != "") {
266 var params=getParamsList(); 266 var params=getParamsList();
267 var i = layer.load(2); 267 var i = layer.load(2);
268 - $get('/ylb/checkYl', params, function () { 268 + $get('/dlb/checkDl', params, function () {
269 layer.close(i); 269 layer.close(i);
270 jsDoQuery(params, true); 270 jsDoQuery(params, true);
271 }); 271 });