From b6589410457d7eece1870b84a44feac78324a77c Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Thu, 21 Oct 2021 16:19:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E8=AE=A2=E5=8D=95=EF=BC=8C=E9=87=91=E9=A2=9D=E5=B0=8F?= =?UTF-8?q?=E6=95=B0=E5=90=8E2=E4=BD=8D=E4=B8=8D=E5=9C=A8=E5=9B=9B?= =?UTF-8?q?=E8=88=8D=E4=BA=94=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/api/XhpcPileOrderController.java | 23 ++++---- .../impl/XhpcRealTimeOrderServiceImpl.java | 54 +++++++++---------- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java index 673a53b0..68f73794 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/XhpcPileOrderController.java @@ -286,6 +286,7 @@ public class XhpcPileOrderController extends BaseController { totalPower =totalPower+cacheOrderData.getT4PowerQuantity(); powerPrice=powerPrice.add(multiply); } + powerPrice =powerPrice.setScale(2,BigDecimal.ROUND_DOWN); //总服务费 BigDecimal servicePrice = money.subtract(powerPrice); //剩余的电费 @@ -600,17 +601,17 @@ public class XhpcPileOrderController extends BaseController { xhpcHistoryOrder.setSortingStatus(0); xhpcHistoryOrder.setType(1); //订单总价---运维服务费抽成 - xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setPlatformCommission(platformCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setOperationCommission(operationCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); + xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setPlatformCommission(platformCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setOperationCommission(operationCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission.setScale(2, BigDecimal.ROUND_DOWN)); xhpcHistoryOrder.setStartSoc(xhpcChargeOrder.getStartSoc()); xhpcHistoryOrder.setEndSoc(xhpcChargeOrder.getEndSoc()); xhpcHistoryOrder.setReconciliationStatus(0); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index 14696707..910d0446 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -341,17 +341,17 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { xhpcHistoryOrder.setSortingStatus(0); xhpcHistoryOrder.setType(1); //订单总价---运维服务费抽成 - xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setPlatformCommission(platformCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setOperationCommission(operationCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); - xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP)); + xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setPlatformCommission(platformCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setOperationCommission(operationCommission.setScale(2, BigDecimal.ROUND_DOWN)); + xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission.setScale(2, BigDecimal.ROUND_DOWN)); xhpcHistoryOrder.setStartSoc(xhpcChargeOrder.getStartSoc()); xhpcHistoryOrder.setEndSoc(xhpcChargeOrder.getEndSoc()); xhpcHistoryOrder.setReconciliationStatus(0); @@ -376,21 +376,21 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { xhpcHistoryOrderService.insert(xhpcHistoryOrder); //添加流水 - xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date); + //xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date); try{ - Map xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId()); - if(xhpcChargingPile !=null){ - //发送短信 - if(user.get("phone") !=null){ - if("1".equals(xhpcChargingPile.get("type").toString())){ - String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; - smsService.sendNotice(user.get("phone").toString(),content); - }else{ - String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; - smsService.sendNotice(user.get("phone").toString(),content); - } - } - } +// Map xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId()); +// if(xhpcChargingPile !=null){ +// //发送短信 +// if(user.get("phone") !=null){ +// if("1".equals(xhpcChargingPile.get("type").toString())){ +// String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; +// smsService.sendNotice(user.get("phone").toString(),content); +// }else{ +// String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。"; +// smsService.sendNotice(user.get("phone").toString(),content); +// } +// } +// } }catch (Exception e){ logger.info("<<<<<<<<<<<<<<<<发送短信失败>>>>>>>>>>>>>>>>>"); } @@ -398,7 +398,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { executorService.execute(new Runnable() { @Override public void run() { - addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1); + // addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1); } }); } @@ -412,7 +412,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { double time = (updateTime2.getTime()-startTime2.getTime())/60000; BigDecimal decimal = new BigDecimal(time).setScale(2); //每分钟多少度 - BigDecimal degree =chargingDegree.divide(decimal,2,BigDecimal.ROUND_HALF_UP); + BigDecimal degree =chargingDegree.divide(decimal,2,BigDecimal.ROUND_DOWN); //获取费率时间段 String startTime = DateUtil.formatTime(startTime2); String endTime = DateUtil.formatTime(updateTime2);