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 017328f4..8b9bf9c1 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 @@ -350,7 +350,7 @@ public class XhpcPileOrderController extends BaseController { xhpcHistoryOrder.setMeterValueStartEvcs(cacheOrderData.getElectricMeterStart().doubleValue()); xhpcHistoryOrder.setMeterValueEndEvcs(cacheOrderData.getElectricMeterEnd().doubleValue()); Map userMessage =new HashMap<>(); - if(xhpcChargeOrder.getSource()==1 && xhpcChargeOrder.getInternetSerialNumber() !=null){ + if(xhpcChargeOrder.getSource()==0){ userMessage = xhpcChargeOrderService.getUserMessage(userId); if (userMessage == null || userMessage.get("balance") == null) { //订单异常 @@ -360,6 +360,9 @@ public class XhpcPileOrderController extends BaseController { xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder); R.ok(); } + }else{ + Map pushOrder = redisService.getCacheMap("pushOrder:"+orderNo); + xhpcHistoryOrder.setInternetSerialNumber(pushOrder.get("internetSerialNumber").toString()); } //结算 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 3fc429e7..1e0987c6 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 @@ -452,14 +452,15 @@ public class XhpcHistoryOrderController extends BaseController { BigDecimal number = new BigDecimal(endHour + 1 - startHour); for (int i = startHour; i < endHour + 1; i++) { + String end = String.format("%02d", i); //获取费率 if (i == startHour) { //开始时间、结束时间 - addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, DateUtil.formatTime(startTime), i + ":59:59",yyyyMMdd,multiply); + addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, DateUtil.formatTime(startTime), end + ":59:59",yyyyMMdd,multiply); } else if (i != endHour) { - addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, i + ":00:00", i + ":59:59",yyyyMMdd,multiply); + addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, end + ":00:00", end + ":59:59",yyyyMMdd,multiply); } else { - addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, i + ":00:00", DateUtil.formatTime(endTime),yyyyMMdd,multiply); + addStatis(xhpc, rateModelId, operatorId, chargingStationId, terminalId, historyOrderId, i, number, end + ":00:00", DateUtil.formatTime(endTime),yyyyMMdd,multiply); } } } @@ -622,5 +623,12 @@ public class XhpcHistoryOrderController extends BaseController { System.out.println(date2.getTime()-date1.getTime()); + + int i =4; + int i1 =04; + + + String end = String.format("%02d", i); + System.out.println(end); } } 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 0a5c0e3b..742621b9 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 @@ -238,15 +238,16 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { if(operatorIdEvcs !=null){ //未完成 if(operatorIdEvcs.get("operatorIdEvcs")!=null && operatorIdEvcs.get("commissionType")!=null && operatorIdEvcs.get("commissionRate")!=null){ - Integer commissionType = Integer.parseInt(operatorIdEvcs.get("commissionType").toString()); BigDecimal commissionRate = new BigDecimal(operatorIdEvcs.get("commissionRate").toString()); //0总金额提成 1服务费提成 - if(commissionType==0){ - internetCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN); - actPrice = actPrice.multiply(internetCommission); - }else{ - internetSvcCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN); - actPrice = actPrice.multiply(internetSvcCommission); + if(new BigDecimal(0).compareTo(commissionRate)==-1){ + if("0".equals(operatorIdEvcs.get("commissionType").toString())){ + internetCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN); + actPrice = actPrice.multiply(internetCommission); + }else{ + internetSvcCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN); + actPrice = actPrice.multiply(internetSvcCommission); + } } } } @@ -382,11 +383,12 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { Date date = new Date(); xhpcHistoryOrder.setCreateTime(date); xhpcHistoryOrder.setChargeModelEvcs(3); - xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString()); - xhpcHistoryOrder.setPhone(userMessage.get("phone").toString()); - xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower())); - + if(xhpcChargeOrder.getPower()!=null){ + xhpcHistoryOrder.setConnectorPowerEvcs(Double.parseDouble(xhpcChargeOrder.getPower())); + } if(source==0){ + xhpcHistoryOrder.setUserNameEvcs(userMessage.get("phone").toString()); + xhpcHistoryOrder.setPhone(userMessage.get("phone").toString()); //扣除用户实际消费金额,添加消费记录 Map user = xhpcChargeOrderService.getUserMessage(userId); //剩余的钱 diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml index bd1c4480..6756c4c3 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -594,6 +594,7 @@ ho.internet_serial_number as internetSerialNumber, ho.total_price as totalPrice, ho.act_price as actPrice, + ho.confirm_Result as confirmResult, co.charging_time as chargingTime, co.charging_degree as chargingDegree, co.start_time as startTime, @@ -671,11 +672,11 @@ left join xhpc_rate ra on rt.rate_id =ra.rate_id where rt.rate_model_id=#{rateModelId} and ( - (rt.start_time <= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime} ) + (rt.start_time <= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime} ) OR - (rt.start_time <= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') <= #{endTime}) + (rt.start_time <= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{startTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime} ) OR - (rt.start_time <= #{endTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime}) + (rt.start_time <= #{endTime} and replace(rt.end_time, '00:00:00', '23:59:59') >= #{endTime} ) )