Commit 8f31697946c2d710092ecc929f04fbe8006e4af9
1 parent
b58f098c
1.浦东分支油耗逻辑问题修复
Showing
3 changed files
with
67 additions
and
21 deletions
src/main/java/com/bsth/redis/OilRedisService.java
| @@ -18,11 +18,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; | @@ -18,11 +18,7 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; | ||
| 18 | import org.springframework.stereotype.Component; | 18 | import org.springframework.stereotype.Component; |
| 19 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
| 20 | 20 | ||
| 21 | -import java.util.ArrayList; | ||
| 22 | -import java.util.Map; | ||
| 23 | -import java.util.HashMap; | ||
| 24 | -import java.util.Iterator; | ||
| 25 | -import java.util.List; | 21 | +import java.util.*; |
| 26 | import java.util.concurrent.TimeUnit; | 22 | import java.util.concurrent.TimeUnit; |
| 27 | 23 | ||
| 28 | /** | 24 | /** |
| @@ -85,9 +81,13 @@ public class OilRedisService implements CommandLineRunner { | @@ -85,9 +81,13 @@ public class OilRedisService implements CommandLineRunner { | ||
| 85 | rq = rq.replaceAll("-", ""); | 81 | rq = rq.replaceAll("-", ""); |
| 86 | try { | 82 | try { |
| 87 | List<OilInfo> list = new ArrayList<>(); | 83 | List<OilInfo> list = new ArrayList<>(); |
| 84 | + Set<String> nbbms = new HashSet<>(); | ||
| 88 | for (String nbbm : nbbmArray) { | 85 | for (String nbbm : nbbmArray) { |
| 89 | nbbm = nbbm.split("_")[1]; | 86 | nbbm = nbbm.split("_")[1]; |
| 90 | - list.addAll(read(nbbm, rq)); | 87 | + if (!nbbms.contains(nbbm)) { |
| 88 | + nbbms.add(nbbm); | ||
| 89 | + list.addAll(read(nbbm, rq)); | ||
| 90 | + } | ||
| 91 | } | 91 | } |
| 92 | Class clazz = OilInfo.class; | 92 | Class clazz = OilInfo.class; |
| 93 | rs = new ConvertUtil().groupMultiList(list, "_", clazz.getDeclaredField("nbbm"), clazz.getDeclaredField("jsy")); | 93 | rs = new ConvertUtil().groupMultiList(list, "_", clazz.getDeclaredField("nbbm"), clazz.getDeclaredField("jsy")); |
src/main/java/com/bsth/server_ws/util/WSDataConver.java
| @@ -15,6 +15,7 @@ import java.util.Map; | @@ -15,6 +15,7 @@ import java.util.Map; | ||
| 15 | import java.util.Set; | 15 | import java.util.Set; |
| 16 | 16 | ||
| 17 | import org.apache.commons.lang3.StringUtils; | 17 | import org.apache.commons.lang3.StringUtils; |
| 18 | +import org.apache.poi.ss.formula.functions.T; | ||
| 18 | import org.slf4j.Logger; | 19 | import org.slf4j.Logger; |
| 19 | import org.slf4j.LoggerFactory; | 20 | import org.slf4j.LoggerFactory; |
| 20 | 21 | ||
| @@ -168,7 +169,7 @@ public class WSDataConver { | @@ -168,7 +169,7 @@ public class WSDataConver { | ||
| 168 | * @param oilInfoMap | 169 | * @param oilInfoMap |
| 169 | * @return | 170 | * @return |
| 170 | */ | 171 | */ |
| 171 | - public static NH_waybill[] to_waybill_NH(ArrayListMultimap<String, ScheduleRealInfo> listMap, ArrayListMultimap<String, OilInfo> oilInfoMap, List<DutyEmployee> des) throws NoSuchFieldException { | 172 | + public static NH_waybill[] to_waybill_NH(ArrayListMultimap<String, ScheduleRealInfo> listMap, ArrayListMultimap<String, OilInfo> oilInfoMap, ArrayListMultimap<String, ElecInfo> elecInfoMap, List<DutyEmployee> des) throws NoSuchFieldException { |
| 172 | List<String> nbbmArray = new ArrayList<>(listMap.keySet()); | 173 | List<String> nbbmArray = new ArrayList<>(listMap.keySet()); |
| 173 | 174 | ||
| 174 | NH_waybill[] rs = new NH_waybill[nbbmArray.size() + 1]; | 175 | NH_waybill[] rs = new NH_waybill[nbbmArray.size() + 1]; |
| @@ -181,9 +182,11 @@ public class WSDataConver { | @@ -181,9 +182,11 @@ public class WSDataConver { | ||
| 181 | NH_waybill nh_waybill, total = new NH_waybill(); | 182 | NH_waybill nh_waybill, total = new NH_waybill(); |
| 182 | NH_waybillItem nh_waybillItem, totalItem = new NH_waybillItem(); | 183 | NH_waybillItem nh_waybillItem, totalItem = new NH_waybillItem(); |
| 183 | List<OilInfo> oilInfo; | 184 | List<OilInfo> oilInfo; |
| 185 | + List<ElecInfo> elecInfo; | ||
| 184 | boolean isFirst = true; | 186 | boolean isFirst = true; |
| 185 | 187 | ||
| 186 | double jhlc = 0, sjjhlc = 0, cclc = 0, jclc = 0, yylc = 0, kslc = 0, cjlc = 0, lblc = 0, zjlc = 0, zlc = 0; | 188 | double jhlc = 0, sjjhlc = 0, cclc = 0, jclc = 0, yylc = 0, kslc = 0, cjlc = 0, lblc = 0, zjlc = 0, zlc = 0; |
| 189 | + double yhTotal = 0; | ||
| 187 | for (int i = 0; i < nbbmArray.size(); i++) { | 190 | for (int i = 0; i < nbbmArray.size(); i++) { |
| 188 | list = listMap.get(nbbmArray.get(i)); | 191 | list = listMap.get(nbbmArray.get(i)); |
| 189 | if (list.size() == 0) | 192 | if (list.size() == 0) |
| @@ -282,16 +285,18 @@ public class WSDataConver { | @@ -282,16 +285,18 @@ public class WSDataConver { | ||
| 282 | nh_waybillItem.setM_strBZ(""); | 285 | nh_waybillItem.setM_strBZ(""); |
| 283 | 286 | ||
| 284 | oilInfo = oilInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh()); | 287 | oilInfo = oilInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh()); |
| 285 | - if (oilInfo != null) { | 288 | + if (oilInfo != null && oilInfo.size() > 0) { |
| 286 | Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.; | 289 | Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.; |
| 287 | String rylx = ""; | 290 | String rylx = ""; |
| 288 | for (OilInfo oi : oilInfo) { | 291 | for (OilInfo oi : oilInfo) { |
| 289 | - czyl = Arith.add(czyl, oi.getCzyl()); | ||
| 290 | - jzyl = Arith.add(jzyl, oi.getJzyl()); | ||
| 291 | - jzl = Arith.add(jzl, oi.getJzl()); | ||
| 292 | - ns = Arith.add(ns, oi.getNs()); | ||
| 293 | - yh = Arith.add(yh, oi.getYh()); | ||
| 294 | - rylx = oi.getRylx(); | 292 | + if (oi.getXlbm().equals(sch.getXlBm())) { |
| 293 | + czyl = Arith.add(czyl, oi.getCzyl()); | ||
| 294 | + jzyl = Arith.add(jzyl, oi.getJzyl()); | ||
| 295 | + jzl = Arith.add(jzl, oi.getJzl()); | ||
| 296 | + ns = Arith.add(ns, oi.getNs()); | ||
| 297 | + yh = Arith.add(yh, oi.getYh()); | ||
| 298 | + rylx = oi.getRylx(); | ||
| 299 | + } | ||
| 295 | } | 300 | } |
| 296 | //出场存油 | 301 | //出场存油 |
| 297 | nh_waybillItem.setM_dblCCCY(czyl); | 302 | nh_waybillItem.setM_dblCCCY(czyl); |
| @@ -305,6 +310,7 @@ public class WSDataConver { | @@ -305,6 +310,7 @@ public class WSDataConver { | ||
| 305 | nh_waybillItem.setM_dblNS(ns); | 310 | nh_waybillItem.setM_dblNS(ns); |
| 306 | //消耗量 | 311 | //消耗量 |
| 307 | nh_waybillItem.setM_dblYH(yh); | 312 | nh_waybillItem.setM_dblYH(yh); |
| 313 | + yhTotal = Arith.add(yhTotal, yh); | ||
| 308 | //加油地点1 | 314 | //加油地点1 |
| 309 | nh_waybillItem.setM_strJYD1(""); | 315 | nh_waybillItem.setM_strJYD1(""); |
| 310 | //加油地点2 | 316 | //加油地点2 |
| @@ -319,6 +325,40 @@ public class WSDataConver { | @@ -319,6 +325,40 @@ public class WSDataConver { | ||
| 319 | nh_waybillItem.setM_strYHLX1(""); | 325 | nh_waybillItem.setM_strYHLX1(""); |
| 320 | } | 326 | } |
| 321 | 327 | ||
| 328 | + /*elecInfo = elecInfoMap.get(list.get(0).getClZbh() + "_" + list.get(0).getjGh()); | ||
| 329 | + if (elecInfo != null && elecInfo.size() > 0) { | ||
| 330 | + Double cdl = 0., hd = 0.; | ||
| 331 | + for (ElecInfo ei : elecInfo) { | ||
| 332 | + cdl = Arith.add(cdl, ei.getCdl()); | ||
| 333 | + hd = Arith.add(hd, ei.getHd()); | ||
| 334 | + } | ||
| 335 | + //出场存油 | ||
| 336 | + nh_waybillItem.setM_dblCCCY(100.0); | ||
| 337 | + //进场存油 | ||
| 338 | + nh_waybillItem.setM_dblJCCY(100.0); | ||
| 339 | + //加注量1 | ||
| 340 | + nh_waybillItem.setM_dblJZL1(cdl); | ||
| 341 | + //加注量2 | ||
| 342 | + nh_waybillItem.setM_dblJZL2(0.0); | ||
| 343 | + //尿素 | ||
| 344 | + nh_waybillItem.setM_dblNS(0.0); | ||
| 345 | + //消耗量 | ||
| 346 | + nh_waybillItem.setM_dblYH(hd); | ||
| 347 | + yhTotal = Arith.add(yhTotal, hd); | ||
| 348 | + //加油地点1 | ||
| 349 | + nh_waybillItem.setM_strJYD1(""); | ||
| 350 | + //加油地点2 | ||
| 351 | + nh_waybillItem.setM_strJYD2(""); | ||
| 352 | + //加油工工号1 | ||
| 353 | + nh_waybillItem.setM_strJYG1(""); | ||
| 354 | + //加油工工号1 | ||
| 355 | + nh_waybillItem.setM_strJYG2(""); | ||
| 356 | + //油耗类型1 | ||
| 357 | + nh_waybillItem.setM_strYHLX1(""); | ||
| 358 | + //油耗类型2 | ||
| 359 | + nh_waybillItem.setM_strYHLX1(""); | ||
| 360 | + }*/ | ||
| 361 | + | ||
| 322 | nh_waybill.getM_SubInfos().add(nh_waybillItem); | 362 | nh_waybill.getM_SubInfos().add(nh_waybillItem); |
| 323 | } | 363 | } |
| 324 | 364 | ||
| @@ -340,6 +380,7 @@ public class WSDataConver { | @@ -340,6 +380,7 @@ public class WSDataConver { | ||
| 340 | totalItem.setM_strSPYKQ(""); | 380 | totalItem.setM_strSPYKQ(""); |
| 341 | totalItem.setM_strYYZT(""); | 381 | totalItem.setM_strYYZT(""); |
| 342 | totalItem.setM_strBZ(""); | 382 | totalItem.setM_strBZ(""); |
| 383 | + totalItem.setM_dblYH(yhTotal); | ||
| 343 | 384 | ||
| 344 | total.getM_SubInfos().add(totalItem); | 385 | total.getM_SubInfos().add(totalItem); |
| 345 | 386 | ||
| @@ -453,12 +494,14 @@ public class WSDataConver { | @@ -453,12 +494,14 @@ public class WSDataConver { | ||
| 453 | Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.; | 494 | Double czyl = 0., jzyl = 0., jzl = 0., ns = 0., yh = 0.; |
| 454 | String rylx = ""; | 495 | String rylx = ""; |
| 455 | for (OilInfo oi : oilInfo) { | 496 | for (OilInfo oi : oilInfo) { |
| 456 | - czyl = Arith.add(czyl, oi.getCzyl()); | ||
| 457 | - jzyl = Arith.add(jzyl, oi.getJzyl()); | ||
| 458 | - jzl = Arith.add(jzl, oi.getJzl()); | ||
| 459 | - ns = Arith.add(ns, oi.getNs()); | ||
| 460 | - yh = Arith.add(yh, oi.getYh()); | ||
| 461 | - rylx = oi.getRylx(); | 497 | + if (oi.getXlbm().equals(sch.getXlBm())) { |
| 498 | + czyl = Arith.add(czyl, oi.getCzyl()); | ||
| 499 | + jzyl = Arith.add(jzyl, oi.getJzyl()); | ||
| 500 | + jzl = Arith.add(jzl, oi.getJzl()); | ||
| 501 | + ns = Arith.add(ns, oi.getNs()); | ||
| 502 | + yh = Arith.add(yh, oi.getYh()); | ||
| 503 | + rylx = oi.getRylx(); | ||
| 504 | + } | ||
| 462 | } | 505 | } |
| 463 | //出场存油 | 506 | //出场存油 |
| 464 | nh_waybillItem.setM_dblCCCY(czyl); | 507 | nh_waybillItem.setM_dblCCCY(czyl); |
src/main/java/com/bsth/server_ws/waybill/LD_ServiceSoap.java
| @@ -6,6 +6,7 @@ import java.util.Map; | @@ -6,6 +6,7 @@ import java.util.Map; | ||
| 6 | import javax.jws.WebService; | 6 | import javax.jws.WebService; |
| 7 | import javax.xml.ws.Holder; | 7 | import javax.xml.ws.Holder; |
| 8 | 8 | ||
| 9 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 9 | import org.joda.time.format.DateTimeFormat; | 10 | import org.joda.time.format.DateTimeFormat; |
| 10 | import org.joda.time.format.DateTimeFormatter; | 11 | import org.joda.time.format.DateTimeFormatter; |
| 11 | import org.slf4j.Logger; | 12 | import org.slf4j.Logger; |
| @@ -69,11 +70,13 @@ public class LD_ServiceSoap implements LD_Service, ApplicationContextAware { | @@ -69,11 +70,13 @@ public class LD_ServiceSoap implements LD_Service, ApplicationContextAware { | ||
| 69 | ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(prveRq, companyId); | 70 | ArrayListMultimap<String, ScheduleRealInfo> listMap = scheduleRedisService.findByDateAndGroupByNbbm(prveRq, companyId); |
| 70 | //油耗信息 | 71 | //油耗信息 |
| 71 | ArrayListMultimap<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroup(listMap.keySet(), prveRq); | 72 | ArrayListMultimap<String, OilInfo> oilInfoMap = oilRedisService.findByNbbmGroup(listMap.keySet(), prveRq); |
| 73 | + //电耗信息 | ||
| 74 | + ArrayListMultimap<String, ElecInfo> elecInfoMap = elecRedisService.findByNbbmGroup(listMap.keySet(), prveRq); | ||
| 72 | //当班调派 | 75 | //当班调派 |
| 73 | long st = fmtyyyyMMddHHmm.parseMillis(prveRq + "00:00"), et = fmtyyyyMMddHHmm.parseMillis(prveRq + "23:59"); | 76 | long st = fmtyyyyMMddHHmm.parseMillis(prveRq + "00:00"), et = fmtyyyyMMddHHmm.parseMillis(prveRq + "23:59"); |
| 74 | List<DutyEmployee> des = dutyEmployeeRepository.findByTime(st, et); | 77 | List<DutyEmployee> des = dutyEmployeeRepository.findByTime(st, et); |
| 75 | //转换成南汇路单需要的格式 | 78 | //转换成南汇路单需要的格式 |
| 76 | - NH_waybill[] array = WSDataConver.to_waybill_NH(listMap, oilInfoMap, des); | 79 | + NH_waybill[] array = WSDataConver.to_waybill_NH(listMap, oilInfoMap, elecInfoMap, des); |
| 77 | result.value = array; | 80 | result.value = array; |
| 78 | 81 | ||
| 79 | //不再代理老接口数据 | 82 | //不再代理老接口数据 |