From 682c4a8c35398933cd50465649c6873e9d7f150c Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Wed, 18 Aug 2021 14:01:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=A9=E5=9B=9E=E8=B0=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/common/api/PileOrderService.java | 21 + .../api/factory/PileOrderFallbackFactory.java | 13 + .../com/xhpc/common/dto/PileEndOrder.java | 14 +- .../order/api/HxpcPileOrderController.java | 466 +++++++++--------- .../xhpc/order/domain/XhpcRealTimeOrder.java | 38 +- .../order/mapper/HxpcChargeOrderMapper.java | 13 +- .../service/IHxpcChargeOrderService.java | 7 +- .../impl/HxpcChargeOrderServiceImpl.java | 8 + .../mapper/XhpcChargeOrderMapper.xml | 16 + 9 files changed, 342 insertions(+), 254 deletions(-) diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PileOrderService.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PileOrderService.java index 60ffc99b..a20f8d38 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PileOrderService.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/PileOrderService.java @@ -3,8 +3,12 @@ package com.xhpc.common.api; import com.xhpc.common.api.factory.PileOrderFallbackFactory; import com.xhpc.common.core.constant.ServiceNameConstants; import com.xhpc.common.core.domain.R; +import com.xhpc.common.dto.PileEndOrder; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; /** @@ -36,4 +40,21 @@ public interface PileOrderService { @GetMapping("/chargeOrder/pileStop") R pileStop(@RequestParam(value = "orderNo") String orderNo, @RequestParam(value = "status") Integer status, @RequestParam(value = "remark") String remark); + + /** + * 桩订单结束回调接口 + * @param pileEndOrder 订单结束回调实体类 + * @return + */ + @PostMapping("/chargeOrder/pileEndOrder") + R pileEndOrder(@Validated @RequestBody PileEndOrder pileEndOrder); + + + /** + * 桩订单实时订单回调接口 + * @param orderNo 订单号 + * @return + */ + @GetMapping("/chargeOrder/pileRimeOrder") + R pileRimeOrder(@RequestParam(value = "orderNo") String orderNo); } diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PileOrderFallbackFactory.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PileOrderFallbackFactory.java index d1181995..624f18c8 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PileOrderFallbackFactory.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/api/factory/PileOrderFallbackFactory.java @@ -2,6 +2,7 @@ package com.xhpc.common.api.factory; import com.xhpc.common.api.PileOrderService; import com.xhpc.common.core.domain.R; +import com.xhpc.common.dto.PileEndOrder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.openfeign.FallbackFactory; @@ -32,6 +33,18 @@ public class PileOrderFallbackFactory implements FallbackFactory cacheMap = redisService.getCacheMap("order:"+orderNo); + JSONArray st = (JSONArray)cacheMap.get("realtimeDataList"); + System.out.println(st.toString()); + HxpcChargeOrder hxpcChargeOrder = hxpcChargeOrderService.getSerialNumberMessage(orderNo); + if(st!=null && st.size()>0){ + for (int i = 0; i userMessage = hxpcChargeOrderService.getUserMessage(userId); - if(userMessage ==null || userMessage.get("balance") ==null){ - //订单异常 - hxpcChargeOrder.setStatus(2); - //异常原因 - hxpcChargeOrder.setErroRemark("桩异常:"+pileEndOrder.getErroRemark()+">>>>用户id:"+userId+"为空"); - } - BigDecimal balance = new BigDecimal(userMessage.get("balance").toString()).divide(new BigDecimal(100)); - - //电站活动抵扣--抵扣的总金额 - BigDecimal promotionDiscount = new BigDecimal(0); - //实际价格-用户支付的钱 - BigDecimal actPrice =new BigDecimal(0); - //实收电费-运营商电费 - BigDecimal actPowerPrice =new BigDecimal(0); - //实收服务费-运营商服务费 - BigDecimal actServicePrice =new BigDecimal(0); - //流量方总金额抽成 - BigDecimal internetCommission =new BigDecimal(0); - //流量方服务费抽成 - BigDecimal internetSvcCommission =new BigDecimal(0); - //平台总金额抽成 - BigDecimal platformCommission =new BigDecimal(0); - //平台服务费抽成 - BigDecimal platformSvcCommission =new BigDecimal(0); - //运维总抽成 - BigDecimal operationCommission =new BigDecimal(0); - //运维服务费抽成 - BigDecimal operationSvcCommission =new BigDecimal(0); - - //判断是C端用户还是流量端用户 - if(hxpcChargeOrder.getSource() ==0){ - String state =""; - BigDecimal discount =new BigDecimal(0); - //用户第几次充电 - int count = hxpcChargeOrderService.getCount(userId); - if(count==0){ - //活动折扣 - Map promotion = hxpcChargeOrderService.getPromotion(); - if(promotion !=null && promotion.get("state") !=null && promotion.get("discount") !=null){ - //state 1.总金额 2.电费 3.服务费 discount 折扣率 - state = promotion.get("state").toString(); - discount = (BigDecimal)promotion.get("discount"); - } - } - if(!"".equals(state)){ - - if("1".equals(state)){ - //总金额 - promotionDiscount=money.multiply(balance); - actPrice = money.subtract(promotionDiscount); - surplusPowerPrice = surplusPowerPrice.subtract(promotionDiscount.divide(new BigDecimal(2))); - surplusServicePrice= surplusServicePrice.subtract(promotionDiscount.divide(new BigDecimal(2))); - }else if("2".equals(state)){ - //电费 - promotionDiscount =powerPrice.multiply(balance); - actPrice = money.subtract(promotionDiscount); - surplusPowerPrice=surplusPowerPrice.subtract(promotionDiscount); - }else if("3".equals(state)){ - //服务费 - promotionDiscount = servicePrice.multiply(balance); - actPrice = money.subtract(promotionDiscount); - surplusServicePrice =surplusServicePrice.subtract(promotionDiscount); - } - } - xhpcHistoryOrder.setInternetCommission(internetCommission); - xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission); - }else{ - //流量方,未实现 - } - - //获取运营商 - Map operatorMessage = hxpcChargeOrderService.getOperatorMessage(hxpcChargeOrder.getChargingStationId()); - if(operatorMessage !=null){ - if(operatorMessage.get("maintenanceCommissionRate") !=null && operatorMessage.get("commissionType") !=null && operatorMessage.get("platformCommissionRate") !=null){ - Integer commissionType = (Integer) operatorMessage.get("commissionType"); - //运维提成 - BigDecimal maintenanceCommissionRate = new BigDecimal(userMessage.get("maintenanceCommissionRate").toString()).divide(new BigDecimal(100)); - //平台提成 - BigDecimal platformCommissionRate = new BigDecimal(userMessage.get("platformCommissionRate").toString()).divide(new BigDecimal(100)); - //提成类型(0总金额提成 1服务费提成) - if(commissionType==0){ - BigDecimal multiply1 = surplusPowerPrice.multiply(platformCommissionRate); - BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate); - platformCommission = multiply1.add(multiply2); - //剩下的钱 - surplusPowerPrice = surplusPowerPrice.subtract(multiply1); - surplusServicePrice = surplusServicePrice.subtract(multiply2); - BigDecimal multiply3 = surplusPowerPrice.multiply(maintenanceCommissionRate); - BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate); - operationCommission = multiply1.add(multiply2); - //剩下的钱 - surplusPowerPrice = surplusPowerPrice.subtract(multiply3); - surplusServicePrice = surplusServicePrice.subtract(multiply4); - - }else if(commissionType==1){ - BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate); - platformSvcCommission=multiply2; - //剩下的钱 - surplusServicePrice = surplusServicePrice.subtract(multiply2); - - BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate); - operationCommission = multiply4; - //剩下的钱 - surplusServicePrice = surplusServicePrice.subtract(multiply4); - } - }else{ + Map userMessage = hxpcChargeOrderService.getUserMessage(userId); + if(userMessage ==null || userMessage.get("balance") ==null){ //订单异常 hxpcChargeOrder.setStatus(2); //异常原因 - hxpcChargeOrder.setErroRemark("桩异常:"+pileEndOrder.getErroRemark()+">>>>用户id:"+userId+"为空"+">>>>运营商提出为空"); - + hxpcChargeOrder.setErroRemark("桩异常:"+pileEndOrder.getErroRemark()+">>>>用户id:"+userId+"为空"); } + BigDecimal balance = new BigDecimal(userMessage.get("balance").toString()).divide(new BigDecimal(100)); + + //电站活动抵扣--抵扣的总金额 + BigDecimal promotionDiscount = new BigDecimal(0); + //实际价格-用户支付的钱 + BigDecimal actPrice =new BigDecimal(0); + //实收电费-运营商电费 + BigDecimal actPowerPrice =new BigDecimal(0); + //实收服务费-运营商服务费 + BigDecimal actServicePrice =new BigDecimal(0); + //流量方总金额抽成 + BigDecimal internetCommission =new BigDecimal(0); + //流量方服务费抽成 + BigDecimal internetSvcCommission =new BigDecimal(0); + //平台总金额抽成 + BigDecimal platformCommission =new BigDecimal(0); + //平台服务费抽成 + BigDecimal platformSvcCommission =new BigDecimal(0); + //运维总抽成 + BigDecimal operationCommission =new BigDecimal(0); + //运维服务费抽成 + BigDecimal operationSvcCommission =new BigDecimal(0); + + //判断是C端用户还是流量端用户 + if(hxpcChargeOrder.getSource() ==0){ + String state =""; + BigDecimal discount =new BigDecimal(0); + //用户第几次充电 + int count = hxpcChargeOrderService.getCount(userId); + if(count==0){ + //活动折扣 + Map promotion = hxpcChargeOrderService.getPromotion(); + if(promotion !=null && promotion.get("state") !=null && promotion.get("discount") !=null){ + //state 1.总金额 2.电费 3.服务费 discount 折扣率 + state = promotion.get("state").toString(); + discount = (BigDecimal)promotion.get("discount"); + } + } + if(!"".equals(state)){ + + if("1".equals(state)){ + //总金额 + promotionDiscount=money.multiply(balance); + actPrice = money.subtract(promotionDiscount); + surplusPowerPrice = surplusPowerPrice.subtract(promotionDiscount.divide(new BigDecimal(2))); + surplusServicePrice= surplusServicePrice.subtract(promotionDiscount.divide(new BigDecimal(2))); + }else if("2".equals(state)){ + //电费 + promotionDiscount =powerPrice.multiply(balance); + actPrice = money.subtract(promotionDiscount); + surplusPowerPrice=surplusPowerPrice.subtract(promotionDiscount); + }else if("3".equals(state)){ + //服务费 + promotionDiscount = servicePrice.multiply(balance); + actPrice = money.subtract(promotionDiscount); + surplusServicePrice =surplusServicePrice.subtract(promotionDiscount); + } + } + xhpcHistoryOrder.setInternetCommission(internetCommission); + xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission); + }else{ + //流量方,未实现 + } + + //获取运营商 + Map operatorMessage = hxpcChargeOrderService.getOperatorMessage(hxpcChargeOrder.getChargingStationId()); + if(operatorMessage !=null){ + if(operatorMessage.get("maintenanceCommissionRate") !=null && operatorMessage.get("commissionType") !=null && operatorMessage.get("platformCommissionRate") !=null){ + Integer commissionType = (Integer) operatorMessage.get("commissionType"); + //运维提成 + BigDecimal maintenanceCommissionRate = new BigDecimal(userMessage.get("maintenanceCommissionRate").toString()).divide(new BigDecimal(100)); + //平台提成 + BigDecimal platformCommissionRate = new BigDecimal(userMessage.get("platformCommissionRate").toString()).divide(new BigDecimal(100)); + //提成类型(0总金额提成 1服务费提成) + if(commissionType==0){ + BigDecimal multiply1 = surplusPowerPrice.multiply(platformCommissionRate); + BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate); + platformCommission = multiply1.add(multiply2); + //剩下的钱 + surplusPowerPrice = surplusPowerPrice.subtract(multiply1); + surplusServicePrice = surplusServicePrice.subtract(multiply2); + BigDecimal multiply3 = surplusPowerPrice.multiply(maintenanceCommissionRate); + BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate); + operationCommission = multiply1.add(multiply2); + //剩下的钱 + surplusPowerPrice = surplusPowerPrice.subtract(multiply3); + surplusServicePrice = surplusServicePrice.subtract(multiply4); + + }else if(commissionType==1){ + BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate); + platformSvcCommission=multiply2; + //剩下的钱 + surplusServicePrice = surplusServicePrice.subtract(multiply2); + + BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate); + operationCommission = multiply4; + //剩下的钱 + surplusServicePrice = surplusServicePrice.subtract(multiply4); + } + }else{ + //订单异常 + hxpcChargeOrder.setStatus(2); + //异常原因 + hxpcChargeOrder.setErroRemark("桩异常:"+pileEndOrder.getErroRemark()+">>>>用户id:"+userId+"为空"+">>>>运营商提出为空"); + + } + } + + + xhpcHistoryOrder.setChargeOrderId(hxpcChargeOrder.getChargeOrderId()); + xhpcHistoryOrder.setChargingStationId(hxpcChargeOrder.getChargingStationId()); + xhpcHistoryOrder.setUserId(userId); + xhpcHistoryOrder.setTerminalId(hxpcChargeOrder.getTerminalId()); + xhpcHistoryOrder.setSerialNumber(hxpcChargeOrder.getSerialNumber()); + xhpcHistoryOrder.setStartSoc(hxpcChargeOrder.getStartSoc()); + xhpcHistoryOrder.setReconciliationStatus(0); + xhpcHistoryOrder.setSortingStatus(0); + xhpcHistoryOrder.setType(1); + xhpcHistoryOrder.setStatus(0); + xhpcHistoryOrder.setDelFlag(0); + //订单总价---运维服务费抽成 + xhpcHistoryOrder.setTotalPrice(money); + xhpcHistoryOrder.setPromotionDiscount(promotionDiscount); + xhpcHistoryOrder.setActPowerPrice(actPowerPrice); + xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice); + xhpcHistoryOrder.setActServicePrice(surplusServicePrice); + xhpcHistoryOrder.setInternetCommission(internetCommission); + xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission); + xhpcHistoryOrder.setPlatformCommission(platformCommission); + xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission); + xhpcHistoryOrder.setOperationCommission(operationCommission); + xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission); + xhpcHistoryOrder.setStartSoc(pileEndOrder.getStartSoc()); + xhpcHistoryOrder.setEndSoc(pileEndOrder.getEndSoc()); + xhpcHistoryOrder.setReconciliationStatus(0); + xhpcHistoryOrder.setCreateTime(date); + + xhpcHistoryOrderService.insert(xhpcHistoryOrder); + hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder); + //删除实时数据,获取最新的实时数据 + //hxpcChargeOrderService.deleteRealTimeOrder(hxpcChargeOrder.getChargeOrderId()); + + //添加新的实时数据 + }catch (Exception e){ + return R.fail(500,"添加订单回调失败"); } - - - xhpcHistoryOrder.setChargeOrderId(hxpcChargeOrder.getChargeOrderId()); - xhpcHistoryOrder.setChargingStationId(hxpcChargeOrder.getChargingStationId()); - xhpcHistoryOrder.setUserId(userId); - xhpcHistoryOrder.setTerminalId(hxpcChargeOrder.getTerminalId()); - xhpcHistoryOrder.setSerialNumber(hxpcChargeOrder.getSerialNumber()); - xhpcHistoryOrder.setStartSoc(hxpcChargeOrder.getStartSoc()); - xhpcHistoryOrder.setReconciliationStatus(0); - xhpcHistoryOrder.setSortingStatus(0); - xhpcHistoryOrder.setType(1); - xhpcHistoryOrder.setStatus(0); - xhpcHistoryOrder.setDelFlag(0); - xhpcHistoryOrder.setCreateTime(date); - //订单总价---运维服务费抽成 - xhpcHistoryOrder.setTotalPrice(money); - xhpcHistoryOrder.setPromotionDiscount(promotionDiscount); - xhpcHistoryOrder.setActPowerPrice(actPowerPrice); - xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice); - xhpcHistoryOrder.setActServicePrice(surplusServicePrice); - xhpcHistoryOrder.setInternetCommission(internetCommission); - xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission); - xhpcHistoryOrder.setPlatformCommission(platformCommission); - xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission); - xhpcHistoryOrder.setOperationCommission(operationCommission); - xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission); - xhpcHistoryOrder.setStartSoc(pileEndOrder.getStartSoc()); - xhpcHistoryOrder.setEndSoc(pileEndOrder.getEndSoc()); - xhpcHistoryOrder.setReconciliationStatus(0); - xhpcHistoryOrder.setCreateTime(date); - - xhpcHistoryOrderService.insert(xhpcHistoryOrder); - hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder); - //删除实时数据,获取最新的实时数据 - return R.ok(); } - - private void gun(){ - // Date date = new Date(); -// //获取实时订单 -// Map cacheMap = redisService.getCacheMap("order:"+serialNumber); -// JSONArray st = (JSONArray)cacheMap.get("realtimeDataList"); -// System.out.println(st.toString()); -// CacheRealtimeData cacheRealtimeData = JSON.toJavaObject(st.getJSONObject(0), CacheRealtimeData.class); -// -// //用户第几次充电 -// int count = iHxpcChargeOrderService.getCount(userId); -// String state =""; -// String discount =""; -// if(count==0){ -// //活动折扣 -// Map promotion = iHxpcChargeOrderService.getPromotion(); -// if(promotion !=null){ -// //state 1.总金额 2.金额 3.服务费 discount 折扣率 -// state = promotion.get("state").toString(); -// discount = promotion.get("discount").toString(); -// } -// } -// -// //生成一条历史订单 -// XhpcHistoryOrder xhpcHistoryOrder =new XhpcHistoryOrder(); -// xhpcHistoryOrder.setChargeOrderId(hxpcChargeOrder.getChargeOrderId()); -// xhpcHistoryOrder.setChargingStationId(hxpcChargeOrder.getChargingStationId()); -// xhpcHistoryOrder.setUserId(userId); -// xhpcHistoryOrder.setTerminalId(hxpcChargeOrder.getTerminalId()); -// xhpcHistoryOrder.setSerialNumber(hxpcChargeOrder.getSerialNumber()); -// xhpcHistoryOrder.setStartSoc(hxpcChargeOrder.getStartSoc()); -// xhpcHistoryOrder.setReconciliationStatus(0); -// xhpcHistoryOrder.setSortingStatus(0); -// xhpcHistoryOrder.setType(1); -// xhpcHistoryOrder.setStatus(0); -// xhpcHistoryOrder.setDelFlag(0); -// xhpcHistoryOrder.setCreateTime(date); -// //订单总价---运维服务费抽成 -// //结束时soc -// xhpcHistoryOrderService.insert(xhpcHistoryOrder); -// -// //充电订单 --结束soc、充电时长、充电度数 -// hxpcChargeOrder.setEndTime(date); -// -// //实时数据存入MYsql、soc、电流、电压 - } - - /** * @param status 状态 * @param delFlag 是否删除 diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcRealTimeOrder.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcRealTimeOrder.java index b926528e..d41b3106 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcRealTimeOrder.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcRealTimeOrder.java @@ -2,6 +2,8 @@ package com.xhpc.order.domain; import com.xhpc.common.core.web.domain.BaseEntity; +import java.math.BigDecimal; + /** * @author yuyang * @date 2021/8/7 15:06 @@ -35,23 +37,23 @@ public class XhpcRealTimeOrder extends BaseEntity { /** * 是否插枪(0否 1是) */ - private Long vehicleGunStatus; + private Integer vehicleGunStatus; /** * 电压 */ - private Double voltage; + private BigDecimal voltage; /** * 电流 */ - private Double electricCurrent; + private BigDecimal electricCurrent; /** * 枪线温度 */ - private Double gunLineTemperature; + private Integer gunLineTemperature; /** * 枪线编码 */ - private Double gunLineNumber; + private String gunLineNumber; /** * SOC */ @@ -59,7 +61,7 @@ public class XhpcRealTimeOrder extends BaseEntity { /** * 电池组最高温度 */ - private Double maxTemperature; + private Integer maxTemperature; /** * 累计充电时间 */ @@ -142,52 +144,52 @@ public class XhpcRealTimeOrder extends BaseEntity { this.pileGunStatus = pileGunStatus; } - public Long getVehicleGunStatus() { + public Integer getVehicleGunStatus() { return vehicleGunStatus; } - public void setVehicleGunStatus(Long vehicleGunStatus) { + public void setVehicleGunStatus(Integer vehicleGunStatus) { this.vehicleGunStatus = vehicleGunStatus; } - public Double getVoltage() { + public BigDecimal getVoltage() { return voltage; } - public void setVoltage(Double voltage) { + public void setVoltage(BigDecimal voltage) { this.voltage = voltage; } - public Double getElectricCurrent() { + public BigDecimal getElectricCurrent() { return electricCurrent; } - public void setElectricCurrent(Double electricCurrent) { + public void setElectricCurrent(BigDecimal electricCurrent) { this.electricCurrent = electricCurrent; } - public Double getGunLineTemperature() { + public Integer getGunLineTemperature() { return gunLineTemperature; } - public void setGunLineTemperature(Double gunLineTemperature) { + public void setGunLineTemperature(Integer gunLineTemperature) { this.gunLineTemperature = gunLineTemperature; } - public Double getGunLineNumber() { + public String getGunLineNumber() { return gunLineNumber; } - public void setGunLineNumber(Double gunLineNumber) { + public void setGunLineNumber(String gunLineNumber) { this.gunLineNumber = gunLineNumber; } @@ -202,12 +204,12 @@ public class XhpcRealTimeOrder extends BaseEntity { this.soc = soc; } - public Double getMaxTemperature() { + public Integer getMaxTemperature() { return maxTemperature; } - public void setMaxTemperature(Double maxTemperature) { + public void setMaxTemperature(Integer maxTemperature) { this.maxTemperature = maxTemperature; } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/HxpcChargeOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/HxpcChargeOrderMapper.java index 7cc6b267..b0aac282 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/HxpcChargeOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/HxpcChargeOrderMapper.java @@ -96,9 +96,20 @@ public interface HxpcChargeOrderMapper { /** * 获取运营商信息 - * @param operatorId + * @param chargingStationId * @return */ Map getOperatorMessage(@Param("chargingStationId") Long chargingStationId); + + /** + * 删除之前的实时订单数据 + */ + void deleteRealTimeOrder(@Param("chargingStationId")Long chargingOrderId); + + void deleteChargeVoltage(@Param("chargingStationId")Long chargingOrderId); + + void deleteChargeOrderSoc(@Param("chargingStationId")Long chargingOrderId); + + void deleteChargeOrderCurrent(@Param("chargingStationId")Long chargingOrderId); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IHxpcChargeOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IHxpcChargeOrderService.java index e58bf63a..d687a662 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IHxpcChargeOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IHxpcChargeOrderService.java @@ -82,8 +82,13 @@ public interface IHxpcChargeOrderService { /** * 获取运营商信息 - * @param operatorId + * @param chargingStationId * @return */ Map getOperatorMessage( Long chargingStationId); + + /** + * 删除之前的实时订单数据 + */ + void deleteRealTimeOrder(Long chargingOrderId); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/HxpcChargeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/HxpcChargeOrderServiceImpl.java index 07f11a92..700d26eb 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/HxpcChargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/HxpcChargeOrderServiceImpl.java @@ -212,4 +212,12 @@ public class HxpcChargeOrderServiceImpl implements IHxpcChargeOrderService { return hxpcChargeOrderMapper.getOperatorMessage(chargingStationId); } + @Override + public void deleteRealTimeOrder(Long chargingOrderId) { + hxpcChargeOrderMapper.deleteRealTimeOrder(chargingOrderId); + hxpcChargeOrderMapper.deleteChargeOrderCurrent(chargingOrderId); + hxpcChargeOrderMapper.deleteChargeOrderSoc(chargingOrderId); + hxpcChargeOrderMapper.deleteChargeVoltage(chargingOrderId); + } + } 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 4625787a..312db149 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml @@ -285,4 +285,20 @@ maintenance_commission_rate as maintenanceCommissionRate from xhpc_operator where operator_id=(select operator_id from xhpc_charging_station where charging_station_id=#{chargingStationId}) + + + delete from xhpc_real_time_order where charging_order_id=#{chargingOrderId} + + + + delete from xhpc_charge_order_current where charging_order_id=#{chargingOrderId} + + + + delete from xhpc_charge_order_soc where charging_order_id=#{chargingOrderId} + + + + delete from xhpc_charge_order_voltage where charging_order_id=#{chargingOrderId} + \ No newline at end of file