From 934bc941dc77bfa184004da9580efa4759f1a571 Mon Sep 17 00:00:00 2001 From: yuyang Date: Wed, 8 Dec 2021 18:00:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8E=86=E5=8F=B2=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E7=BB=86=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/controller/XhpcHistoryOrderController.java | 9 ++++++--- .../service/impl/XhpcHistoryOrderServiceImpl.java | 12 ++++++++++++ .../main/resources/mapper/XhpcChargeOrderMapper.xml | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java index 84da0e23..9ac56cd0 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcHistoryOrderController.java @@ -449,12 +449,13 @@ public class XhpcHistoryOrderController extends BaseController { continue; } int endHour = DateUtil.hour(endTime, true); - //没有跨时段 XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval(); xhpcSt.setStatus(endHour+1); xhpcSt.setChargingDegree(xhpc.getChargingDegree()); - xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600),2, BigDecimal.ROUND_DOWN)); + if(xhpc.getChargingTimeNumber() !=null){ + xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_DOWN)); + } xhpcSt.setChargingNumber(1); xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal()); xhpcSt.setServicePrice(xhpc.getServicePriceTotal()); @@ -894,7 +895,9 @@ public class XhpcHistoryOrderController extends BaseController { for (XhpcChargeHistoryOrder xhpc:list) { XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation(); xhpcSt.setChargingDegree(xhpc.getChargingDegree()); - xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_DOWN)); + if(xhpc.getChargingTimeNumber() !=null){ + xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_DOWN)); + } xhpcSt.setChargingNumber(1); xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal()); xhpcSt.setServicePrice(xhpc.getServicePriceTotal()); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java index 32100728..eb52985a 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcHistoryOrderServiceImpl.java @@ -551,6 +551,18 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService { private Map getBigDecimal(String actPrice, BigDecimal powerPriceTotal, BigDecimal servicePriceTotal, XhpcChargeOrder chargeOrder, Long rateModelId, Date startTime2, Date updateTime2, BigDecimal chargingDegree, List> list) { Map map = new HashMap<>(); + if(chargingDegree.compareTo(new BigDecimal(0))==0){ + Map map1 = new HashMap<>(); + map1.put("time", 0); + map1.put("powerPrice", 0); + map1.put("servicePrice", 0); + map1.put("chargingDegree", chargeOrder.getChargingDegree()); + map1.put("actPrice", actPrice); + list.add(map1); + map.put("list", list);//数据列表 + return map; + } + //算出相差时间,分 BigDecimal decimal = new BigDecimal((updateTime2.getTime() - startTime2.getTime()) / 60000).setScale(2); //每分钟多少度 diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml index 15cd2ce5..9a56dece 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml @@ -612,6 +612,6 @@