From 7e20407e420b48f46956a5b212d9df5a8a00dea5 Mon Sep 17 00:00:00 2001 From: yuyang Date: Thu, 1 Sep 2022 14:07:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9E=E6=97=B6=E8=AE=A2?= =?UTF-8?q?=E5=8D=95BMS=E6=98=BE=E7=A4=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/api/XhpcPileOrderController.java | 20 +++ .../XhpcRealTimeOrderController.java | 46 ++++++- .../XhpcStopChargingOrderController.java | 4 +- .../order/domain/XhpcRealTimeOrderBms.java | 33 +++++ .../order/mapper/XhpcChargeOrderMapper.java | 1 - .../order/mapper/XhpcHistoryOrderMapper.java | 3 + .../order/mapper/XhpcRealTimeOrderMapper.java | 19 ++- .../service/IXhpcRealTimeOrderService.java | 27 +++- .../impl/XhpcChargeOrderServiceImpl.java | 2 + .../impl/XhpcHistoryOrderServiceImpl.java | 60 +++++++-- .../impl/XhpcRealTimeOrderServiceImpl.java | 60 ++++++++- .../mapper/XhpcHistoryOrderMapper.xml | 8 ++ .../mapper/XhpcRealTimeOrderMapper.xml | 123 ++++++++++++++++++ 13 files changed, 381 insertions(+), 25 deletions(-) create mode 100644 xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcRealTimeOrderBms.java 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 fb36b12a..13935f23 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 @@ -9,6 +9,7 @@ import com.xhpc.common.api.WebSocketService; import com.xhpc.common.api.WorkOrderYuService; import com.xhpc.common.core.domain.R; import com.xhpc.common.core.web.controller.BaseController; +import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData; import com.xhpc.common.data.redis.CacheOrderData; import com.xhpc.common.data.redis.CacheRealtimeData; import com.xhpc.common.domain.XhpcRate; @@ -785,4 +786,23 @@ public R pileStartUpBy3rd(@RequestParam(value = "internetSerialNumber") String i workOrderYuService.addNewOrder("28","有异常订单订单且该桩进行校时效价处理","定时任务自动扫描异常订单",date,""); } + /** + * 桩实时数据BMS回调接口 + * @param orderNo 订单号 + * @return + */ + @Transactional + @GetMapping("/chargeOrder/pileRimeOrderBms") + public R pileRimeOrderBms(@RequestParam(value = "orderNo")String orderNo) { + + logger.info("桩实时数据BMS回调接口>>>>>orderNo:" + orderNo); + //获取实时订单 + + xhpcRealTimeOrderService.addRealTimeOrderBms(orderNo); + + return R.ok(); + } + + + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcRealTimeOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcRealTimeOrderController.java index 9894d06d..46f216cd 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcRealTimeOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcRealTimeOrderController.java @@ -77,17 +77,57 @@ public class XhpcRealTimeOrderController extends BaseController { return getDataTable(list); } + @GetMapping("/timeBmsList") + public TableDataInfo timeBmsList(@RequestParam Long chargingOrderId) + { + startPage(); + List> list = xhpcRealTimeOrderService.timeBmsList(chargingOrderId); + return getDataTable(list); + } /** * 实时/异常订单详情数据图表(PC) * @param chargingOrderId * @return */ - @GetMapping("/timeChartList") - public AjaxResult timeChartList(@RequestParam Long chargingOrderId) +// @GetMapping("/timeChartList") +// public AjaxResult timeChartList(@RequestParam Long chargingOrderId) +// { +// return xhpcRealTimeOrderService.timeChartList(chargingOrderId); +// } + + /** + * 实时/异常订单详情数据电压图表(PC) + * @param chargingOrderId + * @return + */ + @GetMapping("/timeChartListVoltage") + public AjaxResult timeChartListVoltage(@RequestParam Long chargingOrderId) { - return xhpcRealTimeOrderService.timeChartList(chargingOrderId); + return xhpcRealTimeOrderService.timeChartListVoltage(chargingOrderId); } + /** + * 实时/异常订单详情数据电流图表(PC) + * @param chargingOrderId + * @return + */ + @GetMapping("/timeChartListCurrent") + public AjaxResult timeChartListCurrent(@RequestParam Long chargingOrderId) + { + return xhpcRealTimeOrderService.timeChartListCurrent(chargingOrderId); + } + /** + * 实时/异常订单详情数据soc图表(PC) + * @param chargingOrderId + * @return + */ + @GetMapping("/timeChartListSoc") + public AjaxResult timeChartListSoc(@RequestParam Long chargingOrderId) + { + return xhpcRealTimeOrderService.timeChartListSoc(chargingOrderId); + } + + /** *异常订单审核详情 */ diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStopChargingOrderController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStopChargingOrderController.java index de317551..0704bda6 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStopChargingOrderController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStopChargingOrderController.java @@ -59,13 +59,11 @@ public class XhpcStopChargingOrderController extends BaseController { if(cacheMap!=null){ if(cacheMap.get("orderkey") !=null){ String orderNumber = cacheMap.get("orderkey").toString().substring(6); - String orderkey = cacheMap.get("orderkey").toString(); - String version ="0A"; if(cacheMap.get("version") !=null){ version =cacheMap.get("version").toString(); } - R r = powerPileService.stopCharging(orderNumber, orderkey.substring(0,14), orderkey.substring(0,16), version); + R r = powerPileService.stopCharging(orderNumber, orderNumber.substring(0,14), orderNumber.substring(0,16), version); if(r.getCode()==200){ return AjaxResult.success("停止充电命令已下发"); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcRealTimeOrderBms.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcRealTimeOrderBms.java new file mode 100644 index 00000000..096c8c43 --- /dev/null +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcRealTimeOrderBms.java @@ -0,0 +1,33 @@ +package com.xhpc.order.domain; + +import com.xhpc.common.core.web.domain.BaseEntity; +import lombok.Data; + +/** + * @author yuyang + * @date 2022/8/31 17:32 + */ +@Data +public class XhpcRealTimeOrderBms extends BaseEntity { + + + private Long realTimeOrderBmsId; + + private String orderNo; //交易流水号 + private String pileNo; //桩号 + private String gunId; //枪号 + private Double bmsVoltageRequest; //BMS 电压需求 + private Double bmsCurrentRequest; //BMS 电流需求 + private Integer bmsChargingMod; //BMS 充电模式 + private Double bmsChargingVolt; //BMS 充电电压测量值 + private Double bmsChargingCurrent; //BMS 充电电流测量值 + private Double monoBatteryVolt; //BMS 最高单体动力蓄电池电压 + private Integer soc; //BMS 当前荷电状态 SOC( %) + private String bmsEstRemainingTime; //BMS 估算剩余充电时间 + private Double pileVoltageOutput; //电桩电压输出值 + private Double pileCurrentOutput; //电桩电流输出值 + private String chargingTimeSummary; //累计充电时间 + private Integer monoBatteryVoltGroupId; // BMS 最高单体动力蓄电池电压所在组号ID + private Long chargingOrderId; + +} diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcChargeOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcChargeOrderMapper.java index 2aba4810..f1989a09 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcChargeOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcChargeOrderMapper.java @@ -142,7 +142,6 @@ public interface XhpcChargeOrderMapper { */ void addXhpcOrderRedisRecord(XhpcOrderRedisRecord xhpcOrderRedisRecord); - /** * 添加流水 * @param userId 用户id diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java index 17b8c6df..fbdb98b7 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcHistoryOrderMapper.java @@ -134,4 +134,7 @@ public interface XhpcHistoryOrderMapper { * 查询启动订单表 */ Map getchargingOrderById(@Param("chargingOrderId")Long chargingOrderId,@Param("userId")Long userId,@Param("source")Integer source,@Param("tenantId")String tenantId); + + //获取跨天最后一帧数据 + Map getXhpcRealTimeOrderTwentyFour(@Param("chargingOrderId")Long chargingOrderId,@Param("time")String time); } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java index 85cf5999..086e5d21 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/mapper/XhpcRealTimeOrderMapper.java @@ -1,9 +1,6 @@ package com.xhpc.order.mapper; -import com.xhpc.order.domain.XhpcChargeOrderCurrent; -import com.xhpc.order.domain.XhpcChargeOrderSoc; -import com.xhpc.order.domain.XhpcChargeOrderVoltage; -import com.xhpc.order.domain.XhpcRealTimeOrder; +import com.xhpc.order.domain.*; import com.xhpc.order.dto.RateTime; import com.xhpc.order.dto.XhpcActivityDiscountDto; import com.xhpc.order.dto.XhpcActivityFormulaDomainDto; @@ -27,7 +24,12 @@ public interface XhpcRealTimeOrderMapper { */ int insertXhpcRealTimeOrder(XhpcRealTimeOrder xhpcRealTimeOrder); - + /** + * 添加实时充电订单 + * @param xhpcRealTimeOrderBms + * @return + */ + int insertRealTimeOrderBms(XhpcRealTimeOrderBms xhpcRealTimeOrderBms); /** * 添加订单实时SOC * @param xhpcChargeOrderSoc @@ -92,6 +94,13 @@ public interface XhpcRealTimeOrderMapper { */ List> timeList(@Param("chargingOrderId")Long chargingOrderId); + /** + * 实时订单详情数据列表BMS(PC) + * @param chargingOrderId + * @return + */ + List> timeBmsList(@Param("chargingOrderId")Long chargingOrderId); + /** * 实时订单详情数据图表SOC(PC) * @param chargingOrderId diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java index 7a53ab86..ef2910b9 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/IXhpcRealTimeOrderService.java @@ -47,12 +47,30 @@ public interface IXhpcRealTimeOrderService { */ List> timeList(Long chargingOrderId); + /** + * 实时订单详情数据列表(PC) + * @param chargingOrderId 充电订单id + * @return + */ + List> timeBmsList(Long chargingOrderId); /** * 实时订单详情数据图表(PC) * @param chargingOrderId * @return */ - AjaxResult timeChartList(Long chargingOrderId); + AjaxResult timeChartListVoltage(Long chargingOrderId); + /** + * 实时订单详情数据图表(PC) + * @param chargingOrderId + * @return + */ + AjaxResult timeChartListCurrent(Long chargingOrderId); + /** + * 实时订单详情数据图表(PC) + * @param chargingOrderId + * @return + */ + AjaxResult timeChartListSoc(Long chargingOrderId); /** * 删除之前的实时订单数据 @@ -149,4 +167,11 @@ public interface IXhpcRealTimeOrderService { * 添加一条金额为0的数据 */ void addZeroHistoryOrder(XhpcChargeOrder xhpcChargeOrder); + + + /** + * 添加一条实时订单的BMS + */ + void addRealTimeOrderBms(String orderNo); + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java index 5fcf3d77..49076eca 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java @@ -9,6 +9,7 @@ import com.xhpc.common.core.utils.StringUtils; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.service.BaseService; import com.xhpc.common.data.down.StartChargingData; +import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData; import com.xhpc.common.data.redis.CacheRealtimeData; import com.xhpc.common.data.redis.StaticBeanUtil; import com.xhpc.common.domain.XhpcRate; @@ -437,6 +438,7 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar xhpcChargeOrderMapper.addXhpcOrderRedisRecord(xhpcOrderRedisRecord); } + @Override public int addUserAccountStatement(Long userId, BigDecimal amount, BigDecimal remainingSum, Long chargeOrderId, Integer type, Date date,Integer source) { 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 bb0859c8..6b615446 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 @@ -541,6 +541,7 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis BigDecimal powerPriceTotal = new BigDecimal(0); BigDecimal servicePriceTotal = new BigDecimal(0); + BigDecimal divide = new BigDecimal(totalPower); //累计充电时间、计费模型、开始时间、结束时间、已充金额 XhpcChargeOrder chargeOrder = xhpcChargeOrderService.getSerialNumberMessage(serialNumber); Long rateModelId = chargeOrder.getRateModelId(); @@ -550,24 +551,64 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis BigDecimal chargingDegree = new BigDecimal(totalPower); List> list = new ArrayList<>(); //1时间没有跨天 - long betweenDay = DateUtil.between(startTime2, updateTime2, DateUnit.DAY); + DateTime parse = DateUtil.parse(DateUtil.format(startTime2, "yyyy-MM-dd"), "yyyy-MM-dd"); + DateTime parse1 = DateUtil.parse(DateUtil.format(updateTime2, "yyyy-MM-dd"), "yyyy-MM-dd"); + long betweenDay = DateUtil.between(parse, parse1, DateUnit.DAY); if (betweenDay == 0) { return getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime2, chargingDegree, list); } else { - //跨天 + //当天晚上时间 23:59:59 + Map map =new HashMap<>(); Date updateTime = DateUtil.endOfDay(startTime2); - Map map1 = getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime, chargingDegree, list); - //获取 - // BigDecimal powerPriceTotal1 = new BigDecimal(map1.get("powerPriceTotal").toString()); - // BigDecimal servicePriceTotal1 = new BigDecimal(map1.get("servicePriceTotal").toString()); - //明天 + String format = DateUtil.format(updateTime, "yyyy-MM-dd HH:mm:ss"); DateTime tomorrow = DateUtil.offsetDay(startTime2, 1); Date startTime3 = DateUtil.beginOfDay(tomorrow); - Map map2 = getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime3, updateTime2, chargingDegree, list); - return map2; + Map twentyFour = xhpcHistoryOrderMapper.getXhpcRealTimeOrderTwentyFour(chargeOrder.getChargeOrderId(), format); + if(twentyFour !=null && twentyFour.get("chargingDegree")!=null){ + BigDecimal chargingDegree1 = new BigDecimal(twentyFour.get("chargingDegree").toString()); + BigDecimal decimal = divide.subtract(chargingDegree1); + if(chargingDegree1.compareTo(new BigDecimal(0))==0){ + String start = DateUtil.formatTime(updateTime); + Map map1 = new HashMap<>(); + map1.put("time", start+"-23:59:59"); + map1.put("powerPrice", 0); + map1.put("servicePrice", 0); + map1.put("chargingDegree", 0); + map1.put("actPrice", 0); + list.add(map1); + map.put("list", list);//数据列表 + map.putAll(getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime3, updateTime2, chargingDegree, list)); + return map; + }else if(decimal.compareTo(new BigDecimal(0))==1){ + map =getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime, chargingDegree1, list); + map.putAll(getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime3, updateTime2, decimal, list));; + return map; + }else{ + String end = DateUtil.formatTime(updateTime2); + map.putAll(getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime, chargingDegree, list)); + Map map1 = new HashMap<>(); + map1.put("time", "00:00:00-"+end); + map1.put("powerPrice", 0); + map1.put("servicePrice", 0); + map1.put("chargingDegree", 0); + map1.put("actPrice", 0); + list.add(map1); + map.put("list", list);// + return map; + } + } + return null; + } } + + + + + + + private Map getBigDecimal(String totalPrice, BigDecimal powerPriceTotal, BigDecimal servicePriceTotal, XhpcChargeOrder chargeOrder, Long rateModelId, Date startTime2, Date updateTime2, BigDecimal chargingDegree, List> list) { Map map = new HashMap<>(); @@ -787,4 +828,5 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis return sr; // } } + } 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 63b29335..07ab8b93 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 @@ -11,6 +11,7 @@ import com.xhpc.common.core.domain.R; import com.xhpc.common.core.utils.SecurityUtils; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.core.web.service.BaseService; +import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData; import com.xhpc.common.data.redis.CacheOrderData; import com.xhpc.common.data.redis.CacheRealtimeData; import com.xhpc.common.domain.XhpcRate; @@ -135,11 +136,28 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe } @Override - public AjaxResult timeChartList(Long chargingOrderId) { + public List> timeBmsList(Long chargingOrderId) { + return xhpcRealTimeOrderMapper.timeBmsList(chargingOrderId); + } + + @Override + public AjaxResult timeChartListVoltage(Long chargingOrderId) { + Map map =new HashMap(); + map.put("voltage",xhpcRealTimeOrderMapper.timeChartVoltageList(chargingOrderId)); + return AjaxResult.success(map); + } + + @Override + public AjaxResult timeChartListCurrent(Long chargingOrderId) { + Map map =new HashMap(); + map.put("current",xhpcRealTimeOrderMapper.timeChartCurrentList(chargingOrderId)); + return AjaxResult.success(map); + } + + @Override + public AjaxResult timeChartListSoc(Long chargingOrderId) { Map map =new HashMap(); map.put("soc",xhpcRealTimeOrderMapper.timeChartSOCList(chargingOrderId)); - map.put("voltage",xhpcRealTimeOrderMapper.timeChartVoltageList(chargingOrderId)); - map.put("current",xhpcRealTimeOrderMapper.timeChartCurrentList(chargingOrderId)); return AjaxResult.success(map); } @@ -148,6 +166,40 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe return xhpcRealTimeOrderMapper.insertXhpcRealTimeOrder(xhpcRealTimeOrder); } + /** + * 添加一条实时订单的BMS + * + * @param orderNo + */ + @Override + public void addRealTimeOrderBms(String orderNo) { + CacheBmsReqChargerOutputData cacheBmsReqChargerOutputData = redisService.getCacheObject("order:" + orderNo + ".bms"); + if(cacheBmsReqChargerOutputData !=null){ + XhpcRealTimeOrderBms xhpcRealTimeOrderBms = new XhpcRealTimeOrderBms(); + BeanUtils.copyProperties(cacheBmsReqChargerOutputData, xhpcRealTimeOrderBms); + Integer bmsEstRemainingTime = cacheBmsReqChargerOutputData.getBmsEstRemainingTime(); + Integer chargingTimeSummary = cacheBmsReqChargerOutputData.getChargingTimeSummary(); + if (bmsEstRemainingTime > 60) { + Integer hours = bmsEstRemainingTime / 60; + Integer mins = bmsEstRemainingTime - (hours * 60); + xhpcRealTimeOrderBms.setBmsEstRemainingTime(hours + "时" + mins + "分"); + } else { + xhpcRealTimeOrderBms.setBmsEstRemainingTime(bmsEstRemainingTime + "分"); + } + if (chargingTimeSummary > 60) { + Integer hours = chargingTimeSummary / 60; + Integer mins = chargingTimeSummary - (hours * 60); + xhpcRealTimeOrderBms.setChargingTimeSummary(hours + "时" + mins + "分"); + } else { + xhpcRealTimeOrderBms.setChargingTimeSummary(chargingTimeSummary + "分"); + } + XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo); + xhpcRealTimeOrderBms.setChargingOrderId(xhpcChargeOrder.getChargeOrderId()); + xhpcRealTimeOrderMapper.insertRealTimeOrderBms(xhpcRealTimeOrderBms); + } + + } + @Override public int addSOC(XhpcChargeOrderSoc xhpcChargeOrderSoc) { return xhpcRealTimeOrderMapper.insertSOC(xhpcChargeOrderSoc); @@ -1648,6 +1700,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe xhpcHistoryOrderService.insert(xhpcHistoryOrder); } + + private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) { if("00:00:00".equals(updateTime)){ updateTime="23:59:59"; 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 18af0925..0ae07f9a 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -1616,4 +1616,12 @@ and serial_number=#{serialNumber} + + + diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml index f78e3011..35107998 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml @@ -212,6 +212,105 @@ + + insert into xhpc_real_time_order_bms + + + order_no, + + + pile_no, + + + gun_id, + + + bms_voltage_request, + + + bms_current_request, + + + bms_charging_mod, + + + bms_charging_volt, + + + bms_charging_current, + + + soc, + + + bms_est_remaining_time, + + + pile_voltage_output, + + + pile_current_output, + + + charging_time_summary, + + + mono_battery_volt_groupId, + + + charging_order_id, + + + + + #{orderNo}, + + + #{pileNo}, + + + #{gunId}, + + + #{bmsVoltageRequest}, + + + #{bmsCurrentRequest}, + + + #{bmsChargingMod}, + + + #{monoBatteryVolt}, + + + #{bmsChargingCurrent}, + + + #{soc}, + + + #{bmsEstRemainingTime}, + + + #{pileVoltageOutput}, + + + #{pileCurrentOutput}, + + + #{chargingTimeSummary}, + + + #{monoBatteryVoltGroupId}, + + + #{chargingOrderId}, + + + + + insert into xhpc_charge_order_soc @@ -614,6 +713,30 @@ order by create_time desc + + +