Commit ac11d6f1746daf88d800e6080fdf4ea29335990d
1 parent
62a338a8
车卡不符添加分公司查询
事后修改路单自动计算油账
Showing
9 changed files
with
580 additions
and
312 deletions
src/main/java/com/bsth/controller/oil/YlbController.java
| ... | ... | @@ -288,4 +288,22 @@ public class YlbController extends BaseController<Ylb, Integer>{ |
| 288 | 288 | return resList; |
| 289 | 289 | |
| 290 | 290 | } |
| 291 | + | |
| 292 | + /* | |
| 293 | + * 历史修改行车路单后重新统计油量信息 (传参:line --线路编码 date --日期) | |
| 294 | + */ | |
| 295 | + | |
| 296 | + @RequestMapping(value = "/updateHistory",method = RequestMethod.POST) | |
| 297 | + public Map<String, Object> updateHistory(@RequestParam Map<String, Object> map) throws Exception{ | |
| 298 | + Map<String, Object> list =new HashMap<String, Object>(); | |
| 299 | + try { | |
| 300 | + list = yblService.updateHistory(map); | |
| 301 | + } catch (Exception e) { | |
| 302 | + // TODO Auto-generated catch block | |
| 303 | + throw e; | |
| 304 | + } | |
| 305 | + return list; | |
| 306 | + } | |
| 307 | + | |
| 308 | + | |
| 291 | 309 | } | ... | ... |
src/main/java/com/bsth/entity/oil/YlxxbUpdate.java
| ... | ... | @@ -31,6 +31,7 @@ public class YlxxbUpdate { |
| 31 | 31 | private Date xgrq; |
| 32 | 32 | private String xgr; |
| 33 | 33 | private String tj; |
| 34 | + private Integer zt; | |
| 34 | 35 | public Integer getId() { |
| 35 | 36 | return id; |
| 36 | 37 | } |
| ... | ... | @@ -103,8 +104,11 @@ public class YlxxbUpdate { |
| 103 | 104 | public void setTj(String tj) { |
| 104 | 105 | this.tj = tj; |
| 105 | 106 | } |
| 106 | - | |
| 107 | - | |
| 108 | - | |
| 107 | + public Integer getZt() { | |
| 108 | + return zt; | |
| 109 | + } | |
| 110 | + public void setZt(Integer zt) { | |
| 111 | + this.zt = zt; | |
| 112 | + } | |
| 109 | 113 | |
| 110 | 114 | } | ... | ... |
src/main/java/com/bsth/service/oil/DlbService.java
| ... | ... | @@ -26,6 +26,8 @@ public interface DlbService extends BaseService<Dlb, Integer>{ |
| 26 | 26 | Map<String, Object> saveDlb(Dlb t); |
| 27 | 27 | |
| 28 | 28 | Map<String, Object> deleteIds(Map<String, Object> map) throws Exception; |
| 29 | - | |
| 29 | + | |
| 30 | + Map<String, List<Dlb>> updeteHistory(List<Map<String, Object>> list,String date, | |
| 31 | + String gsdm,String fgsdm,String line) ; | |
| 30 | 32 | |
| 31 | 33 | } | ... | ... |
src/main/java/com/bsth/service/oil/YlbService.java
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
| ... | ... | @@ -214,181 +214,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 214 | 214 | } |
| 215 | 215 | return result; |
| 216 | 216 | } |
| 217 | - /** | |
| 218 | - * 获取进存电信息 | |
| 219 | - * @Transactional 回滚事物 | |
| 220 | - */ | |
| 221 | - /*@Transactional | |
| 222 | - @Override | |
| 223 | - public Map<String, Object> obtain(Map<String, Object> map2) { | |
| 224 | - List<Cars> carsList=carsRepository.findCars(); | |
| 225 | - Map<String, Boolean> carsMap=new HashMap<String, Boolean>(); | |
| 226 | - for (int i = 0; i < carsList.size(); i++) { | |
| 227 | - Cars c=carsList.get(i); | |
| 228 | - carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 229 | - } | |
| 230 | - String gsbm=""; | |
| 231 | - if(map2.get("ssgsdm_like")!=null){ | |
| 232 | - gsbm=map2.get("ssgsdm_like").toString(); | |
| 233 | - } | |
| 234 | - | |
| 235 | - String nbbm=""; | |
| 236 | - if(map2.get("nbbm_eq")!=null){ | |
| 237 | - nbbm=map2.get("nbbm_eq").toString(); | |
| 238 | - } | |
| 239 | - String fgsbm=""; | |
| 240 | - if(map2.get("fgsdm_like")!=null){ | |
| 241 | - fgsbm=map2.get("fgsdm_like").toString(); | |
| 242 | - } | |
| 243 | - | |
| 244 | - String rq=map2.get("rq").toString(); | |
| 245 | - String line=""; | |
| 246 | - if(map2.get("xlbm_eq")!=null){ | |
| 247 | - line=map2.get("xlbm_eq").toString(); | |
| 248 | - } | |
| 249 | - | |
| 250 | - SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 251 | - //保留两位小数 | |
| 252 | - DecimalFormat df = new DecimalFormat("#.00"); | |
| 253 | - // TODO Auto-generated method stub | |
| 254 | - Map<String, Object> newMap=new HashMap<String,Object>(); | |
| 255 | - //当天DLB信息 | |
| 256 | - List<Dlb> dlList=repository.obtainDl(rq, gsbm, fgsbm, line, nbbm, "nbbm"); | |
| 257 | - //当天YLXXB信息 | |
| 258 | - List<Ylxxb> ylxxList=ylxxbRepository.obtainYlxx(rq,1,gsbm); | |
| 259 | - //当天加电信息表 | |
| 260 | - List<Jdl> jdlList=jdlRepository.JdlList(rq); | |
| 261 | - //前一天所有车辆最后进场班次信息 | |
| 262 | - List<Dlb> dlListBe=repository.obtainYlbefore(rq, gsbm, fgsbm, line, nbbm); | |
| 263 | - List<Cdl> cdyList=cdlRepository.obtainCdl(); | |
| 264 | - //从排班表中计算出行驶的总里程 | |
| 265 | - List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line, rq, gsbm, fgsbm, "", nbbm); | |
| 266 | - List<Dlb> addList=new ArrayList<Dlb>(); | |
| 267 | - List<Dlb> updateList=new ArrayList<Dlb>(); | |
| 268 | - for(int x=0;x<listpb.size();x++){ | |
| 269 | - String type="add"; | |
| 270 | - boolean sfdc=false; | |
| 271 | - Map<String, Object> map=listpb.get(x); | |
| 272 | - if (carsMap.get(map.get("clZbh").toString())!=null) { | |
| 273 | - sfdc= carsMap.get(map.get("clZbh").toString()); | |
| 274 | - }else{ | |
| 275 | - sfdc=false; | |
| 276 | - } | |
| 277 | - if(sfdc){ | |
| 278 | - //判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 279 | - Dlb t=new Dlb(); | |
| 280 | - for(int k=0;k<dlList.size();k++){ | |
| 281 | - Dlb t1=dlList.get(k); | |
| 282 | - if(t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 283 | - &&t1.getJsy().equals(map.get("jGh").toString()) | |
| 284 | - &&t1.getXlbm().equals(map.get("xlBm").toString())) | |
| 285 | - { | |
| 286 | - t=t1; | |
| 287 | - type="update"; | |
| 288 | - } | |
| 289 | - } | |
| 290 | - try { | |
| 291 | - //当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 292 | - Double jzl=0.0; | |
| 293 | - if(map.get("seqNumber").toString().equals("1")){ | |
| 294 | - boolean fage=true; | |
| 295 | - for (int i = 0; i < dlListBe.size(); i++) { | |
| 296 | - Dlb dlb=dlListBe.get(i); | |
| 297 | - if(map.get("clZbh").toString().equals(dlb.getNbbm())){ | |
| 298 | - t.setCzcd(dlb.getJzcd()); | |
| 299 | - fage=false; | |
| 300 | - break; | |
| 301 | - } | |
| 302 | - } | |
| 303 | - if(fage){ | |
| 304 | - for (int y = 0; y < cdyList.size(); y++) { | |
| 305 | - Cdl cdl=cdyList.get(y); | |
| 306 | - if(map.get("clZbh").toString().equals(cdl.getNbbm())){ | |
| 307 | - t.setCzcd(cdl.getClcd()==null?0:cdl.getClcd()); | |
| 308 | - fage=false; | |
| 309 | - break; | |
| 310 | - } | |
| 311 | - } | |
| 312 | - } | |
| 313 | - if(fage){ | |
| 314 | - t.setCzcd(0.0); | |
| 315 | - } | |
| 316 | - | |
| 317 | - // | |
| 318 | - for (int i = 0; i < jdlList.size(); i++) { | |
| 319 | - Jdl jdl=jdlList.get(i); | |
| 320 | - if(map.get("clZbh").toString().equals(jdl.getNbbm()) | |
| 321 | - &&map.get("jGh").toString().equals(jdl.getJsy()) | |
| 322 | - &&map.get("bCompany").toString().equals(jdl.getFgsBm())){ | |
| 323 | - jzl+=jdl.getJdl(); | |
| 324 | - } | |
| 325 | - } | |
| 326 | - } | |
| 327 | - | |
| 328 | - | |
| 329 | - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 330 | - for(int j=0;j<ylxxList.size();j++){ | |
| 331 | - Ylxxb ylxxb= ylxxList.get(j); | |
| 332 | - if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){ | |
| 333 | - jzl+=ylxxb.getJzl(); | |
| 334 | - } | |
| 335 | - } | |
| 336 | - | |
| 337 | - t.setCdl(jzl); | |
| 338 | -// if(type.equals("add")){ | |
| 339 | - t.setHd(jzl); | |
| 340 | - t.setJzcd(t.getCzcd()); | |
| 341 | -// } | |
| 342 | - | |
| 343 | - t.setNbbm(map.get("clZbh").toString()); | |
| 344 | - t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); | |
| 345 | - t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(df.format(Double.parseDouble(map.get("totalKilometers").toString())))); | |
| 346 | - t.setXlbm(map.get("xlBm")==null?"":map.get("xlBm").toString()); | |
| 347 | - t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 348 | - t.setSsgsdm(map.get("company")==null?"":map.get("company").toString()); | |
| 349 | - t.setFgsdm(map.get("bCompany")==null?"":map.get("bCompany").toString()); | |
| 350 | - t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 351 | - t.setRq(sdf.parse(rq)); | |
| 352 | - t.setCreatetime(new Date()); | |
| 353 | - if(type.equals("add")){ | |
| 354 | - addList.add(t); | |
| 355 | - }else{ | |
| 356 | - updateList.add(t); | |
| 357 | - } | |
| 358 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 359 | - } catch (ParseException e) { | |
| 360 | - // TODO Auto-generated catch block | |
| 361 | - newMap.put("status", ResponseCode.ERROR); | |
| 362 | - e.printStackTrace(); | |
| 363 | - } | |
| 364 | - } | |
| 365 | - } | |
| 366 | - try { | |
| 367 | - if(addList.size()>0){ | |
| 368 | - try{ | |
| 369 | - new BatchSaveUtils<Dlb>().saveList(addList, Dlb.class); | |
| 370 | - } catch (Exception e) { | |
| 371 | - // TODO: handle exception | |
| 372 | - if(e.getMessage().indexOf("PK_DLB_UK")>0){ | |
| 373 | - newMap.put("fage", "存在相同数据,数据已经过滤"); | |
| 374 | - logger.info("获取:存在相同数据,数据已经过滤"); | |
| 375 | - } | |
| 376 | - } | |
| 377 | - } | |
| 378 | - | |
| 379 | - if(updateList.size()>0){ | |
| 380 | - for (int i = 0; i < updateList.size(); i++) { | |
| 381 | - repository.save(updateList.get(i)); | |
| 382 | - } | |
| 383 | - } | |
| 384 | - newMap.put("status", ResponseCode.SUCCESS); | |
| 385 | - } | |
| 386 | - catch (Exception e) { | |
| 387 | - // TODO: handle exception | |
| 388 | - newMap.put("status", ResponseCode.ERROR); | |
| 389 | - } | |
| 390 | - return newMap; | |
| 391 | - }*/ | |
| 392 | 217 | |
| 393 | 218 | /** |
| 394 | 219 | * 获取进存油信息 |
| ... | ... | @@ -640,6 +465,7 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 640 | 465 | t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); |
| 641 | 466 | t.setRq(sdf.parse(rq)); |
| 642 | 467 | t.setLp(map.get("lpName").toString()); |
| 468 | + t.setCdl(Arith.add(t.getCdl(), t.getSh())); | |
| 643 | 469 | if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ |
| 644 | 470 | if(type.equals("add")){ |
| 645 | 471 | t.setCreatetime(date); |
| ... | ... | @@ -649,7 +475,6 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 649 | 475 | updateList.add(t); |
| 650 | 476 | } |
| 651 | 477 | } |
| 652 | - t.setCdl(Arith.add(t.getCdl(), t.getSh())); | |
| 653 | 478 | newMap.put("status", ResponseCode.SUCCESS); |
| 654 | 479 | } |
| 655 | 480 | } |
| ... | ... | @@ -1143,6 +968,208 @@ public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbS |
| 1143 | 968 | } |
| 1144 | 969 | return maps; |
| 1145 | 970 | } |
| 971 | + | |
| 972 | + @Override | |
| 973 | + public Map<String, List<Dlb>> updeteHistory(List<Map<String, Object>> listpbDc,String date, | |
| 974 | + String gsdm,String fgsdm,String line) { | |
| 975 | + // TODO Auto-generated method stub | |
| 976 | + Map<String, List<Dlb>> mapList=new HashMap<String,List<Dlb>>(); | |
| 977 | + SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); | |
| 978 | + // 保留两位小数 | |
| 979 | + DecimalFormat df = new DecimalFormat("#.00"); | |
| 980 | + List<Dlb> dlbList=this.listOrderBy(date,gsdm,fgsdm,line,"","nbbm"); | |
| 981 | + List<Dlb> dlbList_upd=new ArrayList<Dlb>(); | |
| 982 | + List<Dlb> dlbList_del=new ArrayList<Dlb>(); | |
| 983 | + try{ | |
| 984 | + for (int j = 0; j < dlbList.size(); j++) { | |
| 985 | + Dlb t=dlbList.get(j); | |
| 986 | + boolean fage=true; | |
| 987 | + for (int i = 0; i < listpbDc.size(); i++) { | |
| 988 | + Map<String, Object> m = listpbDc.get(i); | |
| 989 | + if(t.getNbbm().equals(m.get("clZbh").toString()) | |
| 990 | + &&t.getJsy().equals(m.get("jGh").toString()) | |
| 991 | + &&t.getXlbm().equals(m.get("xlBm").toString()) | |
| 992 | + &&t.getLp().equals(m.get("lpName").toString())){ | |
| 993 | + //该条记录不用删除 | |
| 994 | + fage =false; | |
| 995 | + dlbList_upd.add(t); | |
| 996 | + } | |
| 997 | + } | |
| 998 | + if(fage){ | |
| 999 | + dlbList_del.add(t); | |
| 1000 | + } | |
| 1001 | + } | |
| 1002 | + mapList.put("delList", dlbList_del); | |
| 1003 | + Map<String, Double> lcMap=new HashMap<String,Double>(); | |
| 1004 | + for (int i = 0; i < listpbDc.size(); i++) { | |
| 1005 | + String cl=listpbDc.get(i).get("clZbh").toString(); | |
| 1006 | + Double lc= listpbDc.get(i).get("totalKilometers") == null ? 0.0 | |
| 1007 | + : Double.parseDouble(listpbDc.get(i).get("totalKilometers").toString()); | |
| 1008 | + if(lcMap.get(cl)==null){ | |
| 1009 | + lcMap.put(cl, lc); | |
| 1010 | + }else{ | |
| 1011 | + double lc_=lcMap.get(cl); | |
| 1012 | + lcMap.remove(cl); | |
| 1013 | + lcMap.put(cl, Arith.add(lc, lc_)); | |
| 1014 | + } | |
| 1015 | + } | |
| 1016 | + Map<String, Double> shMap=new HashMap<String,Double>(); | |
| 1017 | + for (int i = 0; i < dlbList_upd.size(); i++) { | |
| 1018 | + Dlb dlb=dlbList_upd.get(i); | |
| 1019 | + String cl=dlb.getNbbm(); | |
| 1020 | + if(shMap.get(cl)==null){ | |
| 1021 | + shMap.put(cl, dlb.getSh()); | |
| 1022 | + }else{ | |
| 1023 | + double sh=shMap.get(cl); | |
| 1024 | + shMap.remove(cl); | |
| 1025 | + shMap.put(cl, Arith.add(sh, dlb.getSh())); | |
| 1026 | + } | |
| 1027 | + } | |
| 1028 | + List<Jdl> jdlList=jdlRepository.JdlList(date); | |
| 1029 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); | |
| 1030 | + Map<String, Object> newMap_=new HashMap<String,Object>(); | |
| 1031 | + Map<String, Object> cMap=new HashMap<String, Object>(); | |
| 1032 | + List<Map<String, Object>> listpb_=listpbDc; | |
| 1033 | + Collections.sort(listpbDc,new NbbmJcsxMap()); | |
| 1034 | + List<Dlb> updateDlb=new ArrayList<Dlb>(); | |
| 1035 | + for (int x = 0; x < listpb_.size(); x++) { | |
| 1036 | + String type = "add"; | |
| 1037 | + Map<String, Object> map_ = listpb_.get(x); | |
| 1038 | + if(newMap_.get(map_.get("clZbh").toString())==null){ | |
| 1039 | + newMap_.put(map_.get("clZbh").toString(), map_.get("clZbh").toString()); | |
| 1040 | + //车辆总里程 | |
| 1041 | + double zlc =lcMap.get(map_.get("clZbh").toString()); | |
| 1042 | + //车辆总加电量 | |
| 1043 | + double zjzl = 0.0; | |
| 1044 | + for (int j = 0; j < ylxxList.size(); j++) { | |
| 1045 | + Ylxxb ylxxb = ylxxList.get(j); | |
| 1046 | + if (map_.get("clZbh").toString().equals(ylxxb.getNbbm()) | |
| 1047 | + && map_.get("company").toString().equals(ylxxb.getGsdm())) { | |
| 1048 | + zjzl = Arith.add(zjzl, ylxxb.getJzl()); | |
| 1049 | + } | |
| 1050 | + } | |
| 1051 | + for (int i = 0; i < jdlList.size(); i++) { | |
| 1052 | + Jdl jdl=jdlList.get(i); | |
| 1053 | + if(map_.get("clZbh").toString().equals(jdl.getNbbm()) | |
| 1054 | + &&map_.get("company").toString().equals(jdl.getGsBm()) | |
| 1055 | + &&map_.get("bCompany").toString().equals(jdl.getFgsBm())){ | |
| 1056 | + zjzl = Arith.add(zjzl,jdl.getJdl()); | |
| 1057 | + } | |
| 1058 | + } | |
| 1059 | + double clsh=0.0; | |
| 1060 | + if(shMap.get(map_.get("clZbh").toString())==null){ | |
| 1061 | + clsh=0.0; | |
| 1062 | + }else{ | |
| 1063 | + clsh=shMap.get(map_.get("clZbh").toString()); | |
| 1064 | + } | |
| 1065 | + zjzl =Arith.sub(zjzl, clsh); | |
| 1066 | + Double nextJzyl = 0.0; | |
| 1067 | + for (int i = 0; i < listpbDc.size(); i++) { | |
| 1068 | + Map<String, Object> map = listpbDc.get(i); | |
| 1069 | + if(map_.get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 1070 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 1071 | + Dlb t = new Dlb(); | |
| 1072 | + for (int k = 0; k < dlbList_upd.size(); k++) { | |
| 1073 | + Dlb t1 = dlbList_upd.get(k); | |
| 1074 | + if (t1.getNbbm().equals(map.get("clZbh").toString()) | |
| 1075 | + && t1.getJsy().equals(map.get("jGh").toString()) | |
| 1076 | + && t1.getXlbm().equals(map.get("xlBm").toString()) | |
| 1077 | + && t1.getLp().equals(map.get("lpName").toString())) { | |
| 1078 | + t = t1; | |
| 1079 | + type = "update"; | |
| 1080 | + } | |
| 1081 | + | |
| 1082 | + } | |
| 1083 | + Double lc= Double.parseDouble(map.get("totalKilometers").toString()); | |
| 1084 | + if(map.get("seqNumber").toString().equals("1")){ | |
| 1085 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 1086 | + Double dh=0.0; | |
| 1087 | + if(zlc>0){ | |
| 1088 | + dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 1089 | + } | |
| 1090 | + nextJzyl =Arith.sub(zjzl,dh); | |
| 1091 | + if(zlc>0){ | |
| 1092 | + long l=Math.round(nextJzyl); | |
| 1093 | + double ylxs=l*100/100; | |
| 1094 | + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 1095 | + if(dh<0){ | |
| 1096 | + t.setHd(dh); | |
| 1097 | + t.setCdl(dh); | |
| 1098 | + nextJzyl=Arith.add(ylxs, dh); | |
| 1099 | + }else{ | |
| 1100 | + t.setHd(dh); | |
| 1101 | + t.setCdl(dh); | |
| 1102 | + nextJzyl=ylxs; | |
| 1103 | + } | |
| 1104 | + }else{ | |
| 1105 | + t.setHd(0.0); | |
| 1106 | + t.setCdl(0.0); | |
| 1107 | + } | |
| 1108 | + }else{ | |
| 1109 | + Double dh=0.0; | |
| 1110 | + if(zlc>0){ | |
| 1111 | + dh = Double.parseDouble(df.format(zjzl * (lc / zlc))); | |
| 1112 | + } | |
| 1113 | + nextJzyl =Arith.sub( nextJzyl,dh); | |
| 1114 | + if(zlc>0){ | |
| 1115 | + long l=0l; | |
| 1116 | + double ylxs=0.0; | |
| 1117 | + if(i==listpbDc.size()-1){ | |
| 1118 | +// ylxs=czyl; | |
| 1119 | + }else{ | |
| 1120 | + if(listpbDc.get(i+1).get("clZbh").toString().equals(map.get("clZbh").toString())){ | |
| 1121 | + l=Math.round(nextJzyl); | |
| 1122 | + ylxs=l*100/100; | |
| 1123 | + } | |
| 1124 | + | |
| 1125 | + } | |
| 1126 | + dh=Arith.add(dh, Arith.sub(nextJzyl,ylxs)); | |
| 1127 | + if(dh<0){ | |
| 1128 | + t.setHd(dh); | |
| 1129 | + t.setCdl(dh); | |
| 1130 | + nextJzyl=Arith.add(ylxs, dh); | |
| 1131 | + }else{ | |
| 1132 | + t.setHd(dh); | |
| 1133 | + t.setCdl(dh); | |
| 1134 | + nextJzyl=ylxs; | |
| 1135 | + } | |
| 1136 | + }else{ | |
| 1137 | + t.setHd(0.0); | |
| 1138 | + t.setCdl(0.0); | |
| 1139 | + } | |
| 1140 | + } | |
| 1141 | + t.setCzcd(100.0); | |
| 1142 | + t.setJzcd(100.0); | |
| 1143 | + t.setNbbm(map.get("clZbh").toString()); | |
| 1144 | + t.setJsy(map.get("jGh") == null ? "" : map.get("jGh").toString()); | |
| 1145 | + t.setZlc(map.get("totalKilometers") == null ? 0.0 | |
| 1146 | + : Double.parseDouble(map.get("totalKilometers").toString())); | |
| 1147 | + t.setXlbm(map.get("xlBm") == null ? "" : map.get("xlBm").toString()); | |
| 1148 | + t.setJcsx(Integer.parseInt(map.get("seqNumber").toString())); | |
| 1149 | + t.setSsgsdm(map.get("company") == null ? "" : map.get("company").toString()); | |
| 1150 | + t.setFgsdm(map.get("bCompany") == null ? "" : map.get("bCompany").toString()); | |
| 1151 | + t.setJhsj(map.get("fcsj")==null?"":map.get("fcsj").toString()); | |
| 1152 | + t.setRq(sdf.parse(date)); | |
| 1153 | + t.setLp(map.get("lpName").toString()); | |
| 1154 | + t.setCdl(Arith.add(t.getCdl(), t.getSh())); | |
| 1155 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | |
| 1156 | + if(type.equals("add")){ | |
| 1157 | + t.setCreatetime(new Date()); | |
| 1158 | + }else{ | |
| 1159 | + t.setUpdatetime(new Date()); | |
| 1160 | + } | |
| 1161 | + } | |
| 1162 | + updateDlb.add(t); | |
| 1163 | + } | |
| 1164 | + } | |
| 1165 | + } | |
| 1166 | + } | |
| 1167 | + mapList.put("updList", updateDlb); | |
| 1168 | + }catch(Exception e){ | |
| 1169 | + logger.error("save erro.", e); | |
| 1170 | + } | |
| 1171 | + return mapList; | |
| 1172 | + } | |
| 1146 | 1173 | |
| 1147 | 1174 | } |
| 1148 | 1175 | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| ... | ... | @@ -33,14 +33,17 @@ import com.bsth.entity.Cars; |
| 33 | 33 | import com.bsth.entity.Line; |
| 34 | 34 | import com.bsth.entity.mcy_forms.Daily; |
| 35 | 35 | import com.bsth.entity.oil.Cyl; |
| 36 | +import com.bsth.entity.oil.Dlb; | |
| 36 | 37 | import com.bsth.entity.oil.Ylb; |
| 37 | 38 | import com.bsth.entity.oil.Ylxxb; |
| 38 | 39 | import com.bsth.entity.search.CustomerSpecs; |
| 39 | 40 | import com.bsth.repository.CarsRepository; |
| 40 | 41 | import com.bsth.repository.oil.CylRepository; |
| 42 | +import com.bsth.repository.oil.DlbRepository; | |
| 41 | 43 | import com.bsth.repository.oil.YlbRepository; |
| 42 | 44 | import com.bsth.repository.oil.YlxxbRepository; |
| 43 | 45 | import com.bsth.service.impl.BaseServiceImpl; |
| 46 | +import com.bsth.service.oil.DlbService; | |
| 44 | 47 | import com.bsth.service.oil.YlbService; |
| 45 | 48 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 46 | 49 | import com.bsth.util.Arith; |
| ... | ... | @@ -48,6 +51,8 @@ import com.bsth.util.BatchSaveUtils; |
| 48 | 51 | import com.bsth.util.ReportUtils; |
| 49 | 52 | import com.github.abel533.echarts.code.Y; |
| 50 | 53 | |
| 54 | +import javassist.bytecode.stackmap.BasicBlock.Catch; | |
| 55 | + | |
| 51 | 56 | @Service |
| 52 | 57 | public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbService{ |
| 53 | 58 | @Autowired |
| ... | ... | @@ -55,6 +60,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 55 | 60 | |
| 56 | 61 | @Autowired |
| 57 | 62 | YlxxbRepository ylxxbRepository; |
| 63 | + | |
| 64 | + @Autowired | |
| 65 | + DlbService dlbService; | |
| 66 | + | |
| 67 | + @Autowired | |
| 68 | + DlbRepository dlbRepository; | |
| 58 | 69 | |
| 59 | 70 | @Autowired |
| 60 | 71 | CylRepository cylRepository; |
| ... | ... | @@ -168,16 +179,6 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 168 | 179 | t.setCzyl(0.0); |
| 169 | 180 | } |
| 170 | 181 | } |
| 171 | - | |
| 172 | - /*Double jzl=0.0; | |
| 173 | - //把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 174 | - for(int j=0;j<ylxxList.size();j++){ | |
| 175 | - Ylxxb ylxxb= ylxxList.get(j); | |
| 176 | - if(map.get("clZbh").toString().equals(ylxxb.getNbbm()) &&map.get("jGh").toString().equals(ylxxb.getJsy())){ | |
| 177 | - jzl+=ylxxb.getJzl(); | |
| 178 | - } | |
| 179 | - } | |
| 180 | - t.setJzl(jzl);*/ | |
| 181 | 182 | t.setNbbm(map.get("clZbh").toString()); |
| 182 | 183 | t.setJsy(map.get("jGh")==null?"":map.get("jGh").toString()); |
| 183 | 184 | t.setZlc(map.get("totalKilometers")==null?0.0:Double.parseDouble(map.get("totalKilometers").toString())); |
| ... | ... | @@ -212,7 +213,6 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 212 | 213 | logger.info("定时器:存在相同数据,数据已经过滤"); |
| 213 | 214 | } |
| 214 | 215 | } |
| 215 | -// new BatchSaveUtils<Ylb>().saveList(addList, Ylb.class); | |
| 216 | 216 | } |
| 217 | 217 | result = "success"; |
| 218 | 218 | }catch (Exception e) { |
| ... | ... | @@ -670,15 +670,6 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | repository.save(t); |
| 673 | - /*for (int z = 0; z < cylList.size(); z++) { | |
| 674 | - Cyl cyl = cylList.get(z); | |
| 675 | - if (t.getNbbm().equals(cyl.getNbbm())) { | |
| 676 | - cyl.setCyl(t.getJzyl()); | |
| 677 | - cyl.setUpdatetime(t.getRq()); | |
| 678 | - break; | |
| 679 | - } | |
| 680 | - cylRepository.save(cyl); | |
| 681 | - }*/ | |
| 682 | 673 | } |
| 683 | 674 | map2.put("status", ResponseCode.SUCCESS); |
| 684 | 675 | } |
| ... | ... | @@ -770,63 +761,67 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 770 | 761 | return s; |
| 771 | 762 | } |
| 772 | 763 | }); |
| 764 | + Map<String, Object> m=new HashMap<String,Object>(); | |
| 773 | 765 | for (int i = 0; i < ylxxbList.size(); i++) { |
| 774 | 766 | Boolean fage=false; |
| 775 | 767 | Ylxxb y1=ylxxbList.get(i); |
| 776 | - Line line=BasicData.nbbm2LineMap.get(y1.getNbbm()); | |
| 777 | - if(null !=line){ | |
| 778 | - if(!xlbm.equals("")){ | |
| 779 | - if(line.getLineCode().equals(xlbm)){ | |
| 768 | + if(m.get(y1.getNbbm())!=null){ | |
| 769 | + Line line=BasicData.nbbm2LineMap.get(y1.getNbbm()); | |
| 770 | + if(null !=line){ | |
| 771 | + if(!xlbm.equals("")){ | |
| 772 | + if(line.getLineCode().equals(xlbm)){ | |
| 773 | + fage=true; | |
| 774 | + } | |
| 775 | + }else{ | |
| 780 | 776 | fage=true; |
| 781 | 777 | } |
| 782 | - }else{ | |
| 783 | - fage=true; | |
| 784 | - } | |
| 785 | - } | |
| 786 | - | |
| 787 | - if(fage){ | |
| 788 | - Ylb t=new Ylb(); | |
| 789 | - t.setNbbm(y1.getNbbm()); | |
| 790 | - t.setRq(y1.getYyrq()); | |
| 791 | - t.setJsy(y1.getJsy()); | |
| 792 | - t.setJzl(y1.getJzl()); | |
| 793 | - t.setSsgsdm(y1.getGsdm()); | |
| 794 | - String fgsdm=""; | |
| 795 | - if(null !=carsMap.get(y1.getNbbm())){ | |
| 796 | - fgsdm=carsMap.get(y1.getNbbm()); | |
| 797 | 778 | } |
| 798 | - t.setFgsdm(fgsdm); | |
| 799 | - t.setJcsx(1); | |
| 800 | - if(null !=line){ | |
| 801 | - t.setXlbm(line.getLineCode()); | |
| 802 | - }else{ | |
| 803 | - t.setXlbm(""); | |
| 804 | - } | |
| 805 | - t.setJcsx(1); | |
| 806 | - boolean status=true; | |
| 807 | - for (int j = 0; j < ylListBe.size(); j++) { | |
| 808 | - Ylb b=ylListBe.get(j); | |
| 809 | - if(b.getNbbm().equals(y1.getNbbm())){ | |
| 810 | - t.setCzyl(b.getJzyl()); | |
| 811 | - status=false; | |
| 812 | - break; | |
| 779 | + | |
| 780 | + if(fage){ | |
| 781 | + Ylb t=new Ylb(); | |
| 782 | + t.setNbbm(y1.getNbbm()); | |
| 783 | + t.setRq(y1.getYyrq()); | |
| 784 | + t.setJsy(y1.getJsy()); | |
| 785 | + t.setJzl(y1.getJzl()); | |
| 786 | + t.setSsgsdm(y1.getGsdm()); | |
| 787 | + String fgsdm=""; | |
| 788 | + if(null !=carsMap.get(y1.getNbbm())){ | |
| 789 | + fgsdm=carsMap.get(y1.getNbbm()); | |
| 813 | 790 | } |
| 814 | - } | |
| 815 | - if(status){ | |
| 816 | - t.setCzyl(0.0); | |
| 817 | - } | |
| 818 | -// double jzyl=Arith.add(t.getJzl(), t.getCzyl()); | |
| 819 | - t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); | |
| 820 | - t.setYh(0.0); | |
| 821 | - if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | |
| 822 | - t.setCreatetime(new Date()); | |
| 823 | - try { | |
| 824 | - repository.save(t); | |
| 825 | - } catch (Exception e) { | |
| 826 | - // TODO: handle exception | |
| 827 | - if(e.getMessage().indexOf("PK_YLB_UK")>0){ | |
| 828 | - newMap.put("fage", "存在相同数据,数据已经过滤"); | |
| 829 | - logger.info("核对有存油没里程:存在相同数据,数据已经过滤"); | |
| 791 | + t.setFgsdm(fgsdm); | |
| 792 | + t.setJcsx(1); | |
| 793 | + if(null !=line){ | |
| 794 | + t.setXlbm(line.getLineCode()); | |
| 795 | + }else{ | |
| 796 | + t.setXlbm(""); | |
| 797 | + } | |
| 798 | + t.setJcsx(1); | |
| 799 | + boolean status=true; | |
| 800 | + for (int j = 0; j < ylListBe.size(); j++) { | |
| 801 | + Ylb b=ylListBe.get(j); | |
| 802 | + if(b.getNbbm().equals(y1.getNbbm())){ | |
| 803 | + t.setCzyl(b.getJzyl()); | |
| 804 | + status=false; | |
| 805 | + break; | |
| 806 | + } | |
| 807 | + } | |
| 808 | + if(status){ | |
| 809 | + t.setCzyl(0.0); | |
| 810 | + } | |
| 811 | +// double jzyl=Arith.add(t.getJzl(), t.getCzyl()); | |
| 812 | + t.setJzyl(Arith.add(t.getJzl(), t.getCzyl())); | |
| 813 | + t.setYh(0.0); | |
| 814 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | |
| 815 | + t.setCreatetime(new Date()); | |
| 816 | + try { | |
| 817 | + repository.save(t); | |
| 818 | + m.put(t.getName(), t.getName()); | |
| 819 | + } catch (Exception e) { | |
| 820 | + // TODO: handle exception | |
| 821 | + if(e.getMessage().indexOf("PK_YLB_UK")>0){ | |
| 822 | + newMap.put("fage", "存在相同数据,数据已经过滤"); | |
| 823 | + logger.info("核对有存油没里程:存在相同数据,数据已经过滤"); | |
| 824 | + } | |
| 830 | 825 | } |
| 831 | 826 | } |
| 832 | 827 | } |
| ... | ... | @@ -1439,4 +1434,228 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS |
| 1439 | 1434 | |
| 1440 | 1435 | return lists; |
| 1441 | 1436 | } |
| 1437 | + | |
| 1438 | + @Override | |
| 1439 | + public Map<String, Object> updateHistory(Map<String, Object> map) throws Exception { | |
| 1440 | + // TODO Auto-generated method stub | |
| 1441 | + Map<String, Object> newMap = new HashMap<String, Object>(); | |
| 1442 | + | |
| 1443 | + List<Cars> carsList = carsRepository.findCars(); | |
| 1444 | + Map<String, Boolean> carsMap = new HashMap<String, Boolean>(); | |
| 1445 | + for (int i = 0; i < carsList.size(); i++) { | |
| 1446 | + Cars c = carsList.get(i); | |
| 1447 | + carsMap.put(c.getInsideCode(), c.getSfdc()); | |
| 1448 | + } | |
| 1449 | + try{ | |
| 1450 | + String date = map.get("date").toString(); | |
| 1451 | + String line = map.get("line").toString(); | |
| 1452 | + String gsdm = map.get("gsdm").toString(); | |
| 1453 | + String fgsdm = map.get("fgsdm").toString(); | |
| 1454 | + | |
| 1455 | + List<Map<String, Object>> listpbYc=new ArrayList<Map<String, Object>>();//油车数据 | |
| 1456 | + List<Map<String, Object>> listpbDc=new ArrayList<Map<String, Object>>();//电车数据 | |
| 1457 | + List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line, date,gsdm, fgsdm, "", ""); | |
| 1458 | + for (int i = 0; i < listpb.size(); i++) { | |
| 1459 | + boolean sfdc=true; | |
| 1460 | + Map<String, Object> m = listpb.get(i); | |
| 1461 | + if (carsMap.get(m.get("clZbh").toString()) != null) { | |
| 1462 | + sfdc = carsMap.get(m.get("clZbh").toString()); | |
| 1463 | + } else { | |
| 1464 | + sfdc = true; | |
| 1465 | + } | |
| 1466 | + if(sfdc){ | |
| 1467 | + listpbDc.add(m); | |
| 1468 | + }else{ | |
| 1469 | + listpbYc.add(m); | |
| 1470 | + } | |
| 1471 | + } | |
| 1472 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 1473 | + //初始存油量 | |
| 1474 | + List<Cyl> clyList = cylRepository.obtainCyl("",gsdm); | |
| 1475 | + List<Ylxxb> ylxxList = ylxxbRepository.obtainYlxx(date, 0,gsdm); | |
| 1476 | + //重新统计油车数据开始 | |
| 1477 | + List<Ylb> ylListBe =repository.listMaxRqJcsx(date, gsdm, fgsdm, line, ""); | |
| 1478 | + List<Ylb> ylbList=this.listOrderBy(date,gsdm,fgsdm,line,"","nbbm"); | |
| 1479 | + List<Ylb> ylbList_upd=new ArrayList<Ylb>(); | |
| 1480 | + List<Ylb> ylbList_del=new ArrayList<Ylb>(); | |
| 1481 | + | |
| 1482 | + for (int j = 0; j < ylbList.size(); j++) { | |
| 1483 | + Ylb t=ylbList.get(j); | |
| 1484 | + boolean fage=true; | |
| 1485 | + for (int i = 0; i < listpbYc.size(); i++) { | |
| 1486 | + Map<String, Object> m = listpbYc.get(i); | |
| 1487 | + if(t.getNbbm().equals(m.get("clZbh").toString()) | |
| 1488 | + &&t.getJsy().equals(m.get("jGh").toString()) | |
| 1489 | + &&t.getXlbm().equals(m.get("xlBm").toString()) | |
| 1490 | + &&t.getLp().equals(m.get("lpName").toString())){ | |
| 1491 | + //该条记录不用删除 | |
| 1492 | + fage =false; | |
| 1493 | + ylbList_upd.add(t); | |
| 1494 | + } | |
| 1495 | + } | |
| 1496 | + if(fage){ | |
| 1497 | + ylbList_del.add(t); | |
| 1498 | + } | |
| 1499 | + | |
| 1500 | + } | |
| 1501 | + | |
| 1502 | + List<Ylb> list=new ArrayList<Ylb>(); | |
| 1503 | + /* | |
| 1504 | + * 第一步 修改车辆里程 和加注量 | |
| 1505 | + */ | |
| 1506 | + Map<String, Object> ylMap=new HashMap<String, Object>(); | |
| 1507 | + for (int x = 0; x < listpbYc.size(); x++) { | |
| 1508 | + String type = "add"; | |
| 1509 | + Map<String, Object> maps = listpb.get(x); | |
| 1510 | + // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断) | |
| 1511 | + Ylb t = new Ylb(); | |
| 1512 | + for (int k = 0; k < ylbList_upd.size(); k++) { | |
| 1513 | + Ylb t1 = ylbList_upd.get(k); | |
| 1514 | + if (t1.getNbbm().equals(maps.get("clZbh").toString()) | |
| 1515 | + && t1.getJsy().equals(maps.get("jGh").toString()) | |
| 1516 | + && t1.getXlbm().equals(maps.get("xlBm").toString()) | |
| 1517 | + && t1.getLp().equals(maps.get("lpName").toString())) { | |
| 1518 | + t = t1; | |
| 1519 | + type = "update"; | |
| 1520 | + } | |
| 1521 | + } | |
| 1522 | + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量 | |
| 1523 | + if (maps.get("seqNumber").toString().equals("1")) { | |
| 1524 | + boolean fage = true; | |
| 1525 | + for (int i = 0; i < ylListBe.size(); i++) { | |
| 1526 | + Ylb ylb = ylListBe.get(i); | |
| 1527 | + if (maps.get("clZbh").toString().equals(ylb.getNbbm())) { | |
| 1528 | + if(ylb.getJzyl()>0){ | |
| 1529 | + t.setCzyl(ylb.getJzyl()); | |
| 1530 | + fage = false; | |
| 1531 | + break; | |
| 1532 | + } | |
| 1533 | + } | |
| 1534 | + } | |
| 1535 | + if (fage) { | |
| 1536 | + for (int y = 0; y < clyList.size(); y++) { | |
| 1537 | + Cyl cyl = clyList.get(y); | |
| 1538 | + if (maps.get("clZbh").toString().equals(cyl.getNbbm())) { | |
| 1539 | + if(cyl!=null){ | |
| 1540 | + if(cyl.getCyl()>=0){ | |
| 1541 | + t.setCzyl(cyl.getCyl()); | |
| 1542 | + fage = false; | |
| 1543 | + break; | |
| 1544 | + }else { | |
| 1545 | + if(cyl.getCxrl()!=null){ | |
| 1546 | + if(cyl.getCxrl()>0){ | |
| 1547 | + t.setCzyl(cyl.getCxrl()); | |
| 1548 | + fage = false; | |
| 1549 | + break; | |
| 1550 | + } | |
| 1551 | + } | |
| 1552 | + } | |
| 1553 | + } | |
| 1554 | + } | |
| 1555 | + } | |
| 1556 | + } | |
| 1557 | + if (fage) { | |
| 1558 | + t.setCzyl(0.0); | |
| 1559 | + } | |
| 1560 | + } | |
| 1561 | + | |
| 1562 | + Double jzl = 0.0; | |
| 1563 | + //一人一车加注量只匹配一次 | |
| 1564 | + if(ylMap.get(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString())!=null){ | |
| 1565 | + }else{ | |
| 1566 | + boolean fage2=false; | |
| 1567 | + for (int i = 0; i < ylxxList.size(); i++) { | |
| 1568 | + Ylxxb ylxxb = ylxxList.get(i); | |
| 1569 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | |
| 1570 | + && maps.get("jGh").toString().equals(ylxxb.getJsy()) | |
| 1571 | + && ylxxb.getJylx()>0) { | |
| 1572 | + if(ylxxb.getJzl()>0){ | |
| 1573 | + fage2=true; | |
| 1574 | + } | |
| 1575 | + } | |
| 1576 | + } | |
| 1577 | + //车辆的加注量如果有任工干预,略接口过来 数据 | |
| 1578 | + if(fage2){ | |
| 1579 | + // 把当天手工输入的的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断,加油类型为1) | |
| 1580 | + for (int j = 0; j < ylxxList.size(); j++) { | |
| 1581 | + Ylxxb ylxxb = ylxxList.get(j); | |
| 1582 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | |
| 1583 | + && maps.get("jGh").toString().equals(ylxxb.getJsy()) | |
| 1584 | + && ylxxb.getJylx()>0) { | |
| 1585 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | |
| 1586 | + } | |
| 1587 | + } | |
| 1588 | + ylMap.put(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString(),maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | |
| 1589 | + }else{ | |
| 1590 | + // 把当天的YLXXB的加注量设置为当天YLB的加注量(根据车号,驾驶员判断) | |
| 1591 | + for (int j = 0; j < ylxxList.size(); j++) { | |
| 1592 | + Ylxxb ylxxb = ylxxList.get(j); | |
| 1593 | + if (maps.get("clZbh").toString().equals(ylxxb.getNbbm()) | |
| 1594 | + && maps.get("jGh").toString().equals(ylxxb.getJsy())) { | |
| 1595 | + jzl =Arith.add(jzl, ylxxb.getJzl()); | |
| 1596 | + } | |
| 1597 | + } | |
| 1598 | + ylMap.put(maps.get("clZbh").toString()+"_"+ maps.get("jGh").toString(),maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | |
| 1599 | + } | |
| 1600 | + } | |
| 1601 | + t.setJzl(jzl); | |
| 1602 | + t.setNbbm(maps.get("clZbh").toString()); | |
| 1603 | + t.setJsy(maps.get("jGh") == null ? "" : maps.get("jGh").toString()); | |
| 1604 | + t.setZlc(maps.get("totalKilometers") == null ? 0.0 | |
| 1605 | + : Double.parseDouble(maps.get("totalKilometers").toString())); | |
| 1606 | + t.setXlbm(maps.get("xlBm") == null ? "" : maps.get("xlBm").toString()); | |
| 1607 | + t.setJcsx(Integer.parseInt(maps.get("seqNumber").toString())); | |
| 1608 | + t.setSsgsdm(maps.get("company") == null ? "" : maps.get("company").toString()); | |
| 1609 | + t.setFgsdm(maps.get("bCompany") == null ? "" : maps.get("bCompany").toString()); | |
| 1610 | + t.setJhsj(maps.get("fcsj")==null?"":maps.get("fcsj").toString()); | |
| 1611 | + t.setRq(sdf.parse(date)); | |
| 1612 | + t.setLp(maps.get("lpName")==null?"":maps.get("lpName").toString()); | |
| 1613 | + if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){ | |
| 1614 | + if(type.equals("add")){ | |
| 1615 | + t.setCreatetime(new Date()); | |
| 1616 | + }else{ | |
| 1617 | + t.setUpdatetime(new Date()); | |
| 1618 | + } | |
| 1619 | + } | |
| 1620 | + repository.save(t); | |
| 1621 | + | |
| 1622 | + } | |
| 1623 | + | |
| 1624 | + for (int i = 0; i < ylbList_del.size(); i++) { | |
| 1625 | + Ylb y=ylbList_del.get(i); | |
| 1626 | + repository.delete(y.getId()); | |
| 1627 | + } | |
| 1628 | + //重新统计油车数据结束 | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + //重新获取电耗数据开始 | |
| 1633 | + Map<String, List<Dlb>> mapList=dlbService.updeteHistory(listpbDc, date, gsdm, fgsdm, line); | |
| 1634 | + List<Dlb> delDlb=mapList.get("delList"); | |
| 1635 | + for (int i = 0; i < delDlb.size(); i++) { | |
| 1636 | + Dlb d=delDlb.get(i); | |
| 1637 | + dlbRepository.delete(d.getId()); | |
| 1638 | + } | |
| 1639 | + List<Dlb> updDlb=mapList.get("updList"); | |
| 1640 | + for (int i = 0; i < updDlb.size(); i++) { | |
| 1641 | + Dlb d=updDlb.get(i); | |
| 1642 | + dlbRepository.save(d); | |
| 1643 | + } | |
| 1644 | + //重新获取电耗数据结束 | |
| 1645 | + newMap.put("status", ResponseCode.SUCCESS); | |
| 1646 | + }catch(Exception e){ | |
| 1647 | + // TODO Auto-generated catch block | |
| 1648 | + newMap.put("status", ResponseCode.ERROR); | |
| 1649 | + throw e; | |
| 1650 | + } | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + return newMap; | |
| 1654 | + } | |
| 1655 | + | |
| 1656 | + public List<Ylb> listByRqJcsx(String rq,String gsdm,String fgsdm,String xlbm,String nbbm, | |
| 1657 | + String px) { | |
| 1658 | + | |
| 1659 | + return null; | |
| 1660 | + } | |
| 1442 | 1661 | } | ... | ... |
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
| ... | ... | @@ -56,7 +56,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 56 | 56 | String fgsdm=map.get("fgsdm_like").toString(); |
| 57 | 57 | |
| 58 | 58 | String sql=" select * from (" |
| 59 | - + "select *,CONCAT(nbbm,jsy) as nj " | |
| 59 | + + "select *,CONCAT(nbbm,jsy) as nj, CONCAT(nbbm,'_',jsy,'_',jzl) as njj " | |
| 60 | 60 | + " from bsth_c_ylxxb where yyrq='"+rq+"' " |
| 61 | 61 | + " and gsdm ='"+gsdm+"' and jylx !='1') x where x.nj not in (" |
| 62 | 62 | + " select CONCAT(nbbm,jsy) from bsth_c_ylb " |
| ... | ... | @@ -65,35 +65,10 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 65 | 65 | + " and x.nbbm in (select nbbm from bsth_c_ylb " |
| 66 | 66 | + " where rq='"+rq+"'" |
| 67 | 67 | + " and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"') " |
| 68 | - + " and x.nbbm not in (select nbbm from bsth_c_ylxxb" | |
| 69 | - + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx !='0')"; | |
| 70 | - | |
| 71 | - | |
| 72 | - /*String sql= "select v.*,u.jsy as ldgh from " | |
| 73 | - + " ( select * from bsth_c_ylxxb x where " | |
| 74 | - + " DATE_FORMAT(x.yyrq,'%Y-%m-%d')='"+rq+"' and x.gsdm='"+gsdm+"'" | |
| 75 | - + " and x.jsy not in (" | |
| 76 | - + " select jsy from bsth_c_ylb " | |
| 77 | - + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"' " | |
| 78 | - + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"')" | |
| 79 | - + " and x.nbbm in (select nbbm from bsth_c_ylb " | |
| 80 | - + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"' " | |
| 81 | - + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' )) v " | |
| 82 | - + " left join (select * from bsth_c_ylb " | |
| 83 | - + " where DATE_FORMAT(rq,'%Y-%m-%d')='"+rq+"'" | |
| 84 | - + " and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"' ) u " | |
| 85 | - + " on v.nbbm=u.nbbm ";*/ | |
| 86 | - | |
| 87 | - //根具条件查询指定日期Ylxxb的数据 | |
| 88 | -// List<Ylxxb> iterator=repository.checkYlxx(rq,gsdm); | |
| 89 | - /*if(map.get("gsdm_in")!=null){ | |
| 90 | - map.put("ssgsdm_in", map.get("gsdm_in")); | |
| 91 | - map.remove("gsdm_in"); | |
| 92 | - | |
| 93 | - }else{ | |
| 94 | - map.put("ssgsdm_like", map.get("gsdm_like")); | |
| 95 | - map.remove("gsdm_like"); | |
| 96 | - }*/ | |
| 68 | + + " and x.nj not in (select CONCAT(nbbm,jsy) from bsth_c_ylxxb" | |
| 69 | + + " where yyrq='"+rq+"' and gsdm ='"+gsdm+"' AND jylx in (1,3))" | |
| 70 | + + " and x.njj not in (SELECT tj FROM bsth_c_ylxxb_update " | |
| 71 | + + " where yyrq='"+rq+"' and zt='3')"; | |
| 97 | 72 | |
| 98 | 73 | //根具条件查询指定日期Ylb的数据 |
| 99 | 74 | // List<Ylb> ylbIterator=ylbRepository.checkYl(rq,gsdm,fgsdm); |
| ... | ... | @@ -135,25 +110,6 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 135 | 110 | list.get(i).setLdgh(ldgh); |
| 136 | 111 | |
| 137 | 112 | } |
| 138 | - //正式使用用下面代码 | |
| 139 | -// for (int i = 0; i < iterator.size(); i++) { | |
| 140 | -// Ylxxb y1=iterator.get(i); | |
| 141 | -// boolean fage=true; | |
| 142 | -// String ldgh=""; | |
| 143 | -// for (int j = 0; j < ylbIterator.size(); j++) { | |
| 144 | -// Ylb y2 = ylbIterator.get(j); | |
| 145 | -// if(y1.getNbbm().equals(y2.getNbbm())){ | |
| 146 | -// if(y1.getJsy().equals(y2.getJsy())){ | |
| 147 | -// fage=false; | |
| 148 | -// } | |
| 149 | -// ldgh +=y2.getJsy()+"/"; | |
| 150 | -// } | |
| 151 | -// } | |
| 152 | -// if(fage){ | |
| 153 | -// y1.setLdgh(ldgh); | |
| 154 | -// list.add(y1); | |
| 155 | -// } | |
| 156 | -// } | |
| 157 | 113 | |
| 158 | 114 | |
| 159 | 115 | |
| ... | ... | @@ -186,6 +142,17 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 186 | 142 | if(!lsjsy.equals(jsy)){ |
| 187 | 143 | if(ldgh.indexOf(jsy)>-1){ |
| 188 | 144 | Ylxxb ylxxb=repository.findOne(id); |
| 145 | + YlxxbUpdate ylxxbUpdate=new YlxxbUpdate(); | |
| 146 | + ylxxbUpdate.setGsdm(ylxxb.getGsdm()); | |
| 147 | + ylxxbUpdate.setJsy(ylxxb.getJsy()); | |
| 148 | + ylxxbUpdate.setJzl(ylxxb.getJzl()); | |
| 149 | + ylxxbUpdate.setJlrq(ylxxb.getJlrq()); | |
| 150 | + ylxxbUpdate.setNbbm(ylxxb.getNbbm()); | |
| 151 | + ylxxbUpdate.setYyrq(ylxxb.getYyrq()); | |
| 152 | + ylxxbUpdate.setCreatetime(new Date()); | |
| 153 | + ylxxbUpdate.setTj(ylxxb.getNbbm()+"_"+ylxxb.getJsy()+"_"+ylxxb.getJzl()); | |
| 154 | + ylxxbUpdate.setZt(3); | |
| 155 | + updateRepository.save(ylxxbUpdate); | |
| 189 | 156 | ylxxb.setJsy(jsy); |
| 190 | 157 | ylxxb.setJylx(3); |
| 191 | 158 | repository.save(ylxxb); |
| ... | ... | @@ -205,14 +172,26 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 205 | 172 | // TODO Auto-generated method stub |
| 206 | 173 | String rq=map.get("yyrq").toString(); |
| 207 | 174 | String gsdm=map.get("gsdm_like").toString(); |
| 175 | + String fgsdm=map.get("fgsdm_like").toString(); | |
| 176 | + | |
| 208 | 177 | String nbbm=map.get("nbbm").toString(); |
| 209 | 178 | |
| 210 | - String sql="select * from (select *,CONCAT(t.nbbm,'_',t.jsy,'_',t.jzl) as tj " | |
| 211 | - + " from bsth_c_ylxxb t where t.yyrq='"+rq+"' and t.gsdm='"+gsdm+"' and " | |
| 212 | - + " t.nylx=0 and t.jylx=0 and t.nbbm like '%"+nbbm+"%') y " | |
| 213 | - + " where y.nbbm not in (select c.inside_code from bsth_c_cars c " | |
| 214 | - + " where c.business_code ='05' and c.sfdc=0) and y.tj not in (" | |
| 215 | - + " select x.tj from bsth_c_ylxxb_update x)"; | |
| 179 | + String sql="select * from (" | |
| 180 | + + " select t.*,CONCAT(t.nbbm,'_',t.jsy,'_',t.jzl) as tj from bsth_c_ylxxb t where " | |
| 181 | + + " t.yyrq='"+rq+"' and t.gsdm='"+gsdm+"' and t.nylx=0 and t.jylx in(0,2) " | |
| 182 | + + " and t.nbbm in (select c.inside_code from bsth_c_cars c " | |
| 183 | + + " where c.business_code ='"+gsdm+"' and c.sfdc=0 and c.branche_company_code ='"+fgsdm+"')" | |
| 184 | + + " and t.nbbm not in (select nbbm from bsth_c_ylb y " | |
| 185 | + + " where y.rq= '"+rq+"' and ssgsdm='"+gsdm+"' and fgsdm='"+fgsdm+"') " | |
| 186 | + + " union " | |
| 187 | + + " select t.*,CONCAT(t.nbbm,'_',t.jsy,'_',t.jzl) as tj from bsth_c_ylxxb t where " | |
| 188 | + + " t.yyrq ='"+rq+"' and t.gsdm='"+gsdm+"' and t.nylx=0 and t.jylx in(0,2) " | |
| 189 | + + " and t.nbbm not in ( select c.inside_code from bsth_c_cars c " | |
| 190 | + + " where c.business_code ='"+gsdm+"' and c.sfdc=0 )" | |
| 191 | + + " ) z" | |
| 192 | + + " where z.tj not in (" | |
| 193 | + + " SELECT x.tj FROM bsth_c_ylxxb_update x where x.yyrq='"+rq+"' and zt=2" | |
| 194 | + + " ) and z.nbbm like '%"+nbbm+"%'"; | |
| 216 | 195 | |
| 217 | 196 | //根具条件查询指定日期Ylb的数据 |
| 218 | 197 | // List<Ylb> ylbIterator=ylbRepository.checkYl(rq,gsdm,fgsdm); |
| ... | ... | @@ -268,10 +247,11 @@ public class YlxxbServiceImpl extends BaseServiceImpl<Ylxxb,Integer> implements |
| 268 | 247 | ylxxbUpdate.setJsy(ylxxb.getJsy()); |
| 269 | 248 | ylxxbUpdate.setJzl(ylxxb.getJzl()); |
| 270 | 249 | ylxxbUpdate.setJlrq(ylxxb.getJlrq()); |
| 271 | - ylxxbUpdate.setNbbm(ylxxb.getNbbm()); | |
| 250 | + ylxxbUpdate.setNbbm(nbbm); | |
| 272 | 251 | ylxxbUpdate.setYyrq(ylxxb.getYyrq()); |
| 273 | 252 | ylxxbUpdate.setCreatetime(new Date()); |
| 274 | 253 | ylxxbUpdate.setTj(nbbm+"_"+ylxxb.getJsy()+"_"+ylxxb.getJzl()); |
| 254 | + ylxxbUpdate.setZt(2); | |
| 275 | 255 | updateRepository.save(ylxxbUpdate); |
| 276 | 256 | } |
| 277 | 257 | } | ... | ... |
src/main/resources/static/pages/oil/checkNbbmList.html
| ... | ... | @@ -34,6 +34,7 @@ |
| 34 | 34 | <th width="3%">#</th> |
| 35 | 35 | <th width="10%">日期</th> |
| 36 | 36 | <th width="10%">公司</th> |
| 37 | + <th width="10%">分公司</th> | |
| 37 | 38 | <th width="15%">车辆</th> |
| 38 | 39 | <th width="12%">驾驶员</th> |
| 39 | 40 | <th width="4%">加注量</th> |
| ... | ... | @@ -52,6 +53,9 @@ |
| 52 | 53 | <select class="form-control" name="gsdm_like" id="jyryListGsdmId" ></select> |
| 53 | 54 | </td> |
| 54 | 55 | <td> |
| 56 | + <select class="form-control" name="fgsdm_like" id="jyryListFgsdmId" ></select> | |
| 57 | + </td> | |
| 58 | + <td> | |
| 55 | 59 | <input type="text" id="nbbm" class="form-control form-filter input-sm" name="nbbm"> |
| 56 | 60 | </td> |
| 57 | 61 | <td> |
| ... | ... | @@ -92,6 +96,8 @@ |
| 92 | 96 | {{obj.gsname}} |
| 93 | 97 | </td> |
| 94 | 98 | <td> |
| 99 | + </td> | |
| 100 | + <td> | |
| 95 | 101 | <input type="text" class="form-control in_carpark_nbbm" name="nbbm" id="nbbm{{obj.id}}" data-id="{{obj.id}}" value="{{obj.nbbm}}"/> |
| 96 | 102 | </td> |
| 97 | 103 | <td> |
| ... | ... | @@ -173,16 +179,26 @@ $(function(){ |
| 173 | 179 | $.get('/user/companyData', function(result){ |
| 174 | 180 | obj = result; |
| 175 | 181 | var options = ''; |
| 176 | -// '<option value="">请选择</option>'; | |
| 177 | 182 | for(var i = 0; i < obj.length; i++){ |
| 178 | 183 | options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>'; |
| 179 | -// setFgsqx(obj[i].companyCode); | |
| 180 | -// gsqx +=obj[i].companyCode+","; | |
| 181 | 184 | } |
| 182 | 185 | $('#jyryListGsdmId').html(options); |
| 183 | -// updateCompany(); | |
| 186 | + updateCompany(); | |
| 184 | 187 | }); |
| 185 | - | |
| 188 | + $("#jyryListGsdmId").on("change",updateCompany); | |
| 189 | + function updateCompany(){ | |
| 190 | + var company = $('#jyryListGsdmId').val(); | |
| 191 | + var options = ''; | |
| 192 | + for(var i = 0; i < obj.length; i++){ | |
| 193 | + if(obj[i].companyCode == company){ | |
| 194 | + var children = obj[i].children; | |
| 195 | + for(var j = 0; j < children.length; j++){ | |
| 196 | + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>'; | |
| 197 | + } | |
| 198 | + } | |
| 199 | + } | |
| 200 | + $('#jyryListFgsdmId').html(options); | |
| 201 | + } | |
| 186 | 202 | |
| 187 | 203 | //提交 |
| 188 | 204 | $('tr.filter .filter-submit').on('click', function(){ | ... | ... |
src/main/resources/static/pages/oil/list_ph.html
| ... | ... | @@ -327,7 +327,6 @@ onkeyup="this.value=this.value.replace(/[^(\d||/.)]/g,'').replace('.','$#$').rep |
| 327 | 327 | layer.msg('请选择日期.'); |
| 328 | 328 | } |
| 329 | 329 | }) |
| 330 | - | |
| 331 | 330 | //进场等于出场 |
| 332 | 331 | $("#outAndIn").on('click', function () { |
| 333 | 332 | // console.log("进场油量等于出场油量"); | ... | ... |