From 8c33942c04cd5e23f60f516fa427cf06ff06460e Mon Sep 17 00:00:00 2001 From: yuyang <2265829957@qq.com> Date: Tue, 24 Aug 2021 17:04:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A1=A9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=9B=9E=E8=B0=83=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0redis=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/api/HxpcChargeOrderController.java | 1 - .../order/api/HxpcPileOrderController.java | 299 +++++++++--------- .../XhpcHistoryOrderController.java | 2 +- .../mapper/XhpcHistoryOrderMapper.xml | 4 +- .../controller/WxPaymentController.java | 10 +- 5 files changed, 164 insertions(+), 152 deletions(-) diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/HxpcChargeOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/HxpcChargeOrderController.java index 6b10fd87..a80cf5fc 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/HxpcChargeOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/HxpcChargeOrderController.java @@ -104,5 +104,4 @@ public class HxpcChargeOrderController extends BaseController { return xhpcHistoryOrderService.gethistotyOrderMessage(userId,historyOrderId,type,chargingOrderId); } - } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/HxpcPileOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/HxpcPileOrderController.java index 4b1686c1..1acd925a 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/HxpcPileOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/api/HxpcPileOrderController.java @@ -5,7 +5,6 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; -import com.xhpc.common.api.PileOrderService; import com.xhpc.common.core.domain.R; import com.xhpc.common.core.web.controller.BaseController; import com.xhpc.common.data.redis.CacheOrderData; @@ -46,8 +45,6 @@ public class HxpcPileOrderController extends BaseController { @Autowired private IXhpcRealTimeOrderService xhpcRealTimeOrderService; - @Autowired - private PileOrderService pileOrderService; private static final Logger logger = LoggerFactory.getLogger(HxpcPileOrderController.class); /** @@ -55,23 +52,7 @@ public class HxpcPileOrderController extends BaseController { */ @GetMapping("/test/chargeOrder/pileStartup") private R test(@RequestParam String orderNo, @RequestParam Integer status, @RequestParam String remark) { - - //获取实时订单 - String key ="order:"+orderNo; - - Map cacheMap = redisService.getCacheMap("order:"+orderNo); - System.out.println(cacheMap.toString()); - - XhpcOrderRedisRecord xhpcOrderRedisRecord = redisService.getCacheObject(key); - - System.out.println(xhpcOrderRedisRecord.toString()); - - - - return null; - // R r = pileOrderService.pileStop(orderNo, status, remark); - // return r; } @@ -168,123 +149,18 @@ public class HxpcPileOrderController extends BaseController { public R pileRealtime(@RequestParam(value = "orderNo")String orderNo) { logger.info("桩实时数据回调接口>>>>>orderNo:"+orderNo); - - Date date = new Date(); - Map map = new HashMap<>(); //获取实时订单 CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:"+orderNo+".lord"); HxpcChargeOrder hxpcChargeOrder = hxpcChargeOrderService.getSerialNumberMessage(orderNo); Long userId = hxpcChargeOrder.getUserId(); try{ - XhpcRealTimeOrder xhpcRealTimeOrder =new XhpcRealTimeOrder(); - xhpcRealTimeOrder.setChargingOrderId(hxpcChargeOrder.getChargeOrderId()); - xhpcRealTimeOrder.setTransactionNumber(orderNo); - xhpcRealTimeOrder.setPileNumber(cacheRealtimeData.getPileNo()); - String gunId = cacheRealtimeData.getGunId(); - xhpcRealTimeOrder.setGunNumber(gunId); - if("00".equals(cacheRealtimeData.getPileGunStatus())){ - xhpcRealTimeOrder.setPileGunStatus(0); - }else if("01".equals(cacheRealtimeData.getPileGunStatus())){ - xhpcRealTimeOrder.setPileGunStatus(1); - }else{ - xhpcRealTimeOrder.setPileGunStatus(2); - } - if("00".equals(cacheRealtimeData.getVehicleGunStatus())){ - xhpcRealTimeOrder.setVehicleGunStatus(0); - }else{ - xhpcRealTimeOrder.setVehicleGunStatus(1); - } - BigDecimal v = new BigDecimal(cacheRealtimeData.getWorkingVoltage()).divide(new BigDecimal(10)); - BigDecimal c = new BigDecimal(cacheRealtimeData.getWorkingCurrent()).divide(new BigDecimal(10)); - xhpcRealTimeOrder.setVoltage(v); - xhpcRealTimeOrder.setElectricCurrent(c); - xhpcRealTimeOrder.setGunLineTemperature(cacheRealtimeData.getGunLineTemperature()); - xhpcRealTimeOrder.setGunLineNumber(cacheRealtimeData.getGunLineNumber()); - Integer soc = cacheRealtimeData.getSoc(); - xhpcRealTimeOrder.setSoc(soc.toString()); - xhpcRealTimeOrder.setMaxTemperature(cacheRealtimeData.getMaxTemperature()); - xhpcRealTimeOrder.setChargingTime(cacheRealtimeData.getChargingTime().toString()); - if(cacheRealtimeData.getChargingTime()>60){ - int mins = cacheRealtimeData.getChargingTime() % 60; - int hours = cacheRealtimeData.getChargingTime() / 60; - xhpcRealTimeOrder.setChargingTime(hours+"时"+mins+"分"); - }else{ - xhpcRealTimeOrder.setChargingTime(cacheRealtimeData.getChargingTime()+"分"); - } - if(cacheRealtimeData.getRemainingTime()>60){ - int mins = cacheRealtimeData.getChargingTime() % 60; - int hours = cacheRealtimeData.getChargingTime() / 60; - xhpcRealTimeOrder.setRemainingTime(hours+"时"+mins+"分"); - }else{ - xhpcRealTimeOrder.setRemainingTime(cacheRealtimeData.getChargingTime()+"分"); - } - BigDecimal decimal = new BigDecimal(100); - BigDecimal divide = new BigDecimal(cacheRealtimeData.getLossChargingDegree()).divide(decimal); - BigDecimal chargingDegree = new BigDecimal(cacheRealtimeData.getChargingDegree()).divide(decimal); - xhpcRealTimeOrder.setChargingDegree(chargingDegree); - xhpcRealTimeOrder.setLossChargingDegree(divide); - xhpcRealTimeOrder.setAmountCharged(divide); - xhpcRealTimeOrder.setHardwareFault(cacheRealtimeData.getHardwareFault()); - if("00".equals(cacheRealtimeData.getStatus())){ - xhpcRealTimeOrder.setStatus(0); - }else if("01".equals(cacheRealtimeData.getStatus())){ - xhpcRealTimeOrder.setStatus(1); - }else if("02".equals(cacheRealtimeData.getStatus())){ - xhpcRealTimeOrder.setStatus(2); - }else{ - xhpcRealTimeOrder.setStatus(3); - } - xhpcRealTimeOrder.setCreateTime(date); - xhpcRealTimeOrder.setUserId(hxpcChargeOrder.getUserId()); - Long chargingStationId = hxpcChargeOrder.getChargingStationId(); - Long chargeOrderId = hxpcChargeOrder.getChargeOrderId(); - xhpcRealTimeOrder.setChargingStationId(chargingStationId); - - xhpcRealTimeOrderService.addXhpcRealTimeOrder(xhpcRealTimeOrder); - //实时数据存入MYsql、soc、电流、电压 - - XhpcChargeOrderSoc xhpcChargeOrderSoc =new XhpcChargeOrderSoc(); - xhpcChargeOrderSoc.setChargeOrderId(chargeOrderId); - xhpcChargeOrderSoc.setSoc(soc.toString()); - xhpcChargeOrderSoc.setCreateTime(date); - xhpcRealTimeOrderService.addSOC(xhpcChargeOrderSoc); - - XhpcChargeOrderCurrent xhpcChargeOrderCurrent =new XhpcChargeOrderCurrent(); - xhpcChargeOrderCurrent.setChargeOrderId(chargeOrderId); - xhpcChargeOrderCurrent.setCurrent(c.toString()); - xhpcChargeOrderCurrent.setCreateTime(date); - xhpcRealTimeOrderService.addCurrent(xhpcChargeOrderCurrent); - - XhpcChargeOrderVoltage xhpcChargeOrderVoltage =new XhpcChargeOrderVoltage(); - xhpcChargeOrderVoltage.setChargeOrderId(chargeOrderId); - xhpcChargeOrderVoltage.setVoltage(v.toString()); - xhpcChargeOrderVoltage.setCreateTime(date); - xhpcRealTimeOrderService.addVoltage(xhpcChargeOrderVoltage); - - - map.put("code", 200); - map.put("message", "实时数据"); - map.put("userId", userId); - Map data = new HashMap<>(); - data.put("amountCharged",divide); - data.put("gunNumber",gunId); - data.put("chargingOrderId",chargeOrderId); - data.put("soc",soc); - data.put("chargingTime",xhpcRealTimeOrder.getChargingTime()); - data.put("electricCurrent",c); - data.put("voltage",v); - data.put("power",hxpcChargeOrder.getPower()); - data.put("chargingDegree",chargingDegree); - data.put("remainingTime",xhpcRealTimeOrder.getRemainingTime()); - data.put("serialNumber",orderNo.substring(0,16)); - data.put("parkingInstructions","在非充电情况下占用车位按照0.30元/分钟收费"); - map.put("data", data); - + Map map = addOrderTime(cacheRealtimeData, hxpcChargeOrder, orderNo,1); JSONObject json = new JSONObject(map); //消息对了内容 rabbimt(userId + "##" + json); }catch (Exception e){ + Map map = new HashMap<>(); map.put("code", 500); map.put("userId", hxpcChargeOrder.getUserId()); JSONObject json = new JSONObject(map); @@ -310,13 +186,13 @@ public class HxpcPileOrderController extends BaseController { //解析订单编号 Date date = new Date(); //总金额 - BigDecimal money = new BigDecimal((cacheOrderData.getCost()/100)); + BigDecimal money = new BigDecimal((cacheOrderData.getCost()/10000)); int sumCost =cacheOrderData.getT1Cost()+cacheOrderData.getT2Cost()+cacheOrderData.getT3Cost()+cacheOrderData.getT4Cost(); int sumService = cacheOrderData.getCost()-sumCost; //总电费 - BigDecimal powerPrice = new BigDecimal((sumCost/100)); + BigDecimal powerPrice = new BigDecimal((sumCost/10000)); //总服务费 - BigDecimal servicePrice = new BigDecimal((sumService/100)); + BigDecimal servicePrice = new BigDecimal((sumService/10000)); //剩余的电费 BigDecimal surplusPowerPrice = powerPrice; //剩余的服务费 @@ -400,22 +276,34 @@ public class HxpcPileOrderController extends BaseController { } if(!"".equals(state)){ + //查看是否优惠为0 + boolean fan = true; + if(discount.compareTo(new BigDecimal(0))==0){ + actPrice= money; + fan=false; + } 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))); + if(fan){ + promotionDiscount=money.multiply(discount); + 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); + if(fan){ + //电费 + 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); + if(fan){ + //服务费 + promotionDiscount = servicePrice.multiply(balance); + actPrice = money.subtract(promotionDiscount); + surplusServicePrice =surplusServicePrice.subtract(promotionDiscount); + } } } xhpcHistoryOrder.setInternetCommission(internetCommission); @@ -464,7 +352,6 @@ public class HxpcPileOrderController extends BaseController { hxpcChargeOrder.setStatus(2); //异常原因 hxpcChargeOrder.setErroRemark("桩异常:"+stopReason+">>>>用户id:"+userId+"为空"+">>>>运营商数据为空"); - } } Long chargeOrderId = hxpcChargeOrder.getChargeOrderId(); @@ -493,11 +380,10 @@ public class HxpcPileOrderController extends BaseController { xhpcHistoryOrder.setEndSoc(endSoc+""); xhpcHistoryOrder.setReconciliationStatus(0); xhpcHistoryOrder.setCreateTime(date); -// + xhpcHistoryOrderService.insert(xhpcHistoryOrder); hxpcChargeOrderService.updateXhpcChargeOrder(hxpcChargeOrder); - - + addPileEndOrder(xhpcHistoryOrder,hxpcChargeOrder,cacheMap,orderNo); Map map = new HashMap<>(); map.put("code", 500); map.put("userId", userId); @@ -511,7 +397,7 @@ public class HxpcPileOrderController extends BaseController { } - private void add(XhpcHistoryOrder xhpcHistoryOrder,HxpcChargeOrder hxpcChargeOrder,Map cacheMap){ + private void addPileEndOrder(XhpcHistoryOrder xhpcHistoryOrder,HxpcChargeOrder hxpcChargeOrder,Map cacheMap,String orderNo){ Date date =new Date(); Long chargeOrderId = hxpcChargeOrder.getChargeOrderId(); //删除实时数据,获取最新的实时数据 @@ -559,9 +445,130 @@ public class HxpcPileOrderController extends BaseController { xhpcOrderRedisRecord.setCreateTime(date); hxpcChargeOrderService.addXhpcOrderRedisRecord(xhpcOrderRedisRecord); + //删除redis + //redisService.deleteObject("order:"+orderNo); + logger.info("<<<<<<<<<<<<<<<<订单结束回调成功>>>>>>>>>>>>>>>>>"); + logger.info("<<<<<<<<<<<<<<<<订单结束回调成功>>>>>>>>>>>>>>>>>"); + logger.info("<<<<<<<<<<<<<<<<订单结束回调成功>>>>>>>>>>>>>>>>>"); } + /** + * 添加实时数据 + * @param cacheRealtimeData + * @param hxpcChargeOrder + * @param orderNo 订单号 + * @param type 1.实时数据回调 2.结算回调 + * @return + */ + private Map addOrderTime(CacheRealtimeData cacheRealtimeData,HxpcChargeOrder hxpcChargeOrder,String orderNo,Integer type){ + Map map = new HashMap<>(); + Date date =new Date(); + Long chargeOrderId = hxpcChargeOrder.getChargeOrderId(); + XhpcRealTimeOrder xhpcRealTimeOrder =new XhpcRealTimeOrder(); + xhpcRealTimeOrder.setChargingOrderId(hxpcChargeOrder.getChargeOrderId()); + xhpcRealTimeOrder.setTransactionNumber(orderNo); + xhpcRealTimeOrder.setPileNumber(cacheRealtimeData.getPileNo()); + String gunId = cacheRealtimeData.getGunId(); + xhpcRealTimeOrder.setGunNumber(gunId); + if("00".equals(cacheRealtimeData.getPileGunStatus())){ + xhpcRealTimeOrder.setPileGunStatus(0); + }else if("01".equals(cacheRealtimeData.getPileGunStatus())){ + xhpcRealTimeOrder.setPileGunStatus(1); + }else{ + xhpcRealTimeOrder.setPileGunStatus(2); + } + if("00".equals(cacheRealtimeData.getVehicleGunStatus())){ + xhpcRealTimeOrder.setVehicleGunStatus(0); + }else{ + xhpcRealTimeOrder.setVehicleGunStatus(1); + } + BigDecimal v = new BigDecimal(cacheRealtimeData.getWorkingVoltage()).divide(new BigDecimal(10)); + BigDecimal c = new BigDecimal(cacheRealtimeData.getWorkingCurrent()).divide(new BigDecimal(10)); + xhpcRealTimeOrder.setVoltage(v); + xhpcRealTimeOrder.setElectricCurrent(c); + xhpcRealTimeOrder.setGunLineTemperature(cacheRealtimeData.getGunLineTemperature()); + xhpcRealTimeOrder.setGunLineNumber(cacheRealtimeData.getGunLineNumber()); + Integer soc = cacheRealtimeData.getSoc(); + xhpcRealTimeOrder.setSoc(soc.toString()); + xhpcRealTimeOrder.setMaxTemperature(cacheRealtimeData.getMaxTemperature()); + xhpcRealTimeOrder.setChargingTime(cacheRealtimeData.getChargingTime().toString()); + if(cacheRealtimeData.getChargingTime()>60){ + int mins = cacheRealtimeData.getChargingTime() % 60; + int hours = cacheRealtimeData.getChargingTime() / 60; + xhpcRealTimeOrder.setChargingTime(hours+"时"+mins+"分"); + }else{ + xhpcRealTimeOrder.setChargingTime(cacheRealtimeData.getChargingTime()+"分"); + } + if(cacheRealtimeData.getRemainingTime()>60){ + int mins = cacheRealtimeData.getChargingTime() % 60; + int hours = cacheRealtimeData.getChargingTime() / 60; + xhpcRealTimeOrder.setRemainingTime(hours+"时"+mins+"分"); + }else{ + xhpcRealTimeOrder.setRemainingTime(cacheRealtimeData.getChargingTime()+"分"); + } + BigDecimal decimal = new BigDecimal(10000); + BigDecimal divide = new BigDecimal(cacheRealtimeData.getLossChargingDegree()).divide(decimal); + BigDecimal chargingDegree = new BigDecimal(cacheRealtimeData.getChargingDegree()).divide(decimal); + xhpcRealTimeOrder.setChargingDegree(chargingDegree); + xhpcRealTimeOrder.setLossChargingDegree(divide); + xhpcRealTimeOrder.setAmountCharged(divide); + xhpcRealTimeOrder.setHardwareFault(cacheRealtimeData.getHardwareFault()); + if("00".equals(cacheRealtimeData.getStatus())){ + xhpcRealTimeOrder.setStatus(0); + }else if("01".equals(cacheRealtimeData.getStatus())){ + xhpcRealTimeOrder.setStatus(1); + }else if("02".equals(cacheRealtimeData.getStatus())){ + xhpcRealTimeOrder.setStatus(2); + }else{ + xhpcRealTimeOrder.setStatus(3); + } + xhpcRealTimeOrder.setCreateTime(date); + xhpcRealTimeOrder.setUserId(hxpcChargeOrder.getUserId()); + Long chargingStationId = hxpcChargeOrder.getChargingStationId(); + xhpcRealTimeOrder.setChargingStationId(chargingStationId); + + xhpcRealTimeOrderService.addXhpcRealTimeOrder(xhpcRealTimeOrder); + //实时数据存入MYsql、soc、电流、电压 + + XhpcChargeOrderSoc xhpcChargeOrderSoc =new XhpcChargeOrderSoc(); + xhpcChargeOrderSoc.setChargeOrderId(chargeOrderId); + xhpcChargeOrderSoc.setSoc(soc.toString()); + xhpcChargeOrderSoc.setCreateTime(date); + xhpcRealTimeOrderService.addSOC(xhpcChargeOrderSoc); + + XhpcChargeOrderCurrent xhpcChargeOrderCurrent =new XhpcChargeOrderCurrent(); + xhpcChargeOrderCurrent.setChargeOrderId(chargeOrderId); + xhpcChargeOrderCurrent.setCurrent(c.toString()); + xhpcChargeOrderCurrent.setCreateTime(date); + xhpcRealTimeOrderService.addCurrent(xhpcChargeOrderCurrent); + + XhpcChargeOrderVoltage xhpcChargeOrderVoltage =new XhpcChargeOrderVoltage(); + xhpcChargeOrderVoltage.setChargeOrderId(chargeOrderId); + xhpcChargeOrderVoltage.setVoltage(v.toString()); + xhpcChargeOrderVoltage.setCreateTime(date); + xhpcRealTimeOrderService.addVoltage(xhpcChargeOrderVoltage); + if(type==1){ + map.put("code", 200); + map.put("message", "实时数据"); + map.put("userId", hxpcChargeOrder.getUserId()); + Map data = new HashMap<>(); + data.put("amountCharged",divide); + data.put("gunNumber",gunId); + data.put("chargingOrderId",chargeOrderId); + data.put("soc",soc); + data.put("chargingTime",xhpcRealTimeOrder.getChargingTime()); + data.put("electricCurrent",c); + data.put("voltage",v); + data.put("power",hxpcChargeOrder.getPower()); + data.put("chargingDegree",chargingDegree); + data.put("remainingTime",xhpcRealTimeOrder.getRemainingTime()); + data.put("serialNumber",orderNo.substring(0,16)); + data.put("parkingInstructions","在非充电情况下占用车位按照0.30元/分钟收费"); + map.put("data", data); + } + return map; + } /** 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 3fdd3b5d..4cb25955 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 @@ -43,7 +43,7 @@ public class XhpcHistoryOrderController extends BaseController { * @return */ @GetMapping("/getListPage") - public TableDataInfo getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String startTime,String endTime,@RequestParam("userId") Long userId,@RequestParam("type") Integer type) + public TableDataInfo getListPage(String phone,String transactionNumber,@RequestParam("status")Integer status,String chargingStationName,Long operatorId,Integer source,String startTime,String endTime,@RequestParam("userId") Long userId, Integer type) { startPage(); List> listPage = xhpcHistoryOrderService.getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, startTime, endTime, userId, type); 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 8f4d70dd..e020914a 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -418,11 +418,11 @@ #{phone}, '%')) - + and co.source =0 and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId}) - + and co.source =1 and co.user_id=#{userId} diff --git a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java index c5f0638a..24a2f685 100644 --- a/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java +++ b/xhpc-modules/xhpc-payment/src/main/java/com/xhpc/payment/controller/WxPaymentController.java @@ -366,6 +366,7 @@ public class WxPaymentController { BigDecimal money = BigDecimal.valueOf(Double.valueOf(balance)).add(xhpcRechargeOrder.getAmount()); //判断用户是否在充电中 String serialMumber = xhpcUserAccountStatementMapper.getUserHistotyChargeOrder(xhpcRechargeOrder.getUserId()); + logger.info("<<<<<<<<<<<<充电终端>>>>>>>>>serialMumber:"+serialMumber); if(!"".equals(serialMumber) && serialMumber !=null){ //充电中 postRefreshBalance(money, serialMumber); @@ -388,8 +389,12 @@ public class WxPaymentController { private void postRefreshBalance(BigDecimal money, String serialMumber) { StartChargingData startChargingData =new StartChargingData(); - startChargingData.setPileNo(serialMumber.substring(0,16)); - startChargingData.setGunId(serialMumber.substring(16)); + String su1 = serialMumber.substring(0, 14); + String su2 = serialMumber.substring(14); + logger.info("<<<<<<<<<<<>>>>>>>>"+su1); + logger.info("<<<<<<<<<<<>>>>>>>>"+su2); + startChargingData.setPileNo(su1); + startChargingData.setGunId(su2); String s1 =money.multiply(new BigDecimal(100)).toString(); startChargingData.setBalance(Double.valueOf(s1).intValue()); R r = powerPileService.refreshBalance(startChargingData); @@ -462,4 +467,5 @@ public class WxPaymentController { } return null; } + }