From 5b343c0d63965bf8876c14b4212e39cf9ea40e15 Mon Sep 17 00:00:00 2001 From: yuyang Date: Wed, 1 Dec 2021 16:27:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E4=BA=8E=E5=88=9B=E5=BB=BA4=E5=B0=8F?= =?UTF-8?q?=E6=97=B6,=E6=B2=A1=E6=9C=89=E5=AE=9E=E6=97=B6=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=94=E8=AF=A5=E6=9E=AA=E4=B9=8B=E5=90=8E=E6=9C=89?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E8=AE=A2=E5=8D=95,=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E6=9C=AA=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/mapper/XhpcChargeOrderMapper.java | 15 +++++++++++- .../impl/XhpcChargeOrderServiceImpl.java | 23 ++++++++++++++++++- .../mapper/XhpcChargeOrderMapper.xml | 12 ++++++++-- .../mapper/XhpcHistoryOrderMapper.xml | 6 +++++ .../resources/mapper/XhpcStatisticsMapper.xml | 10 ++++++-- 5 files changed, 60 insertions(+), 6 deletions(-) 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 22eba14f..b2f0df12 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 @@ -189,7 +189,20 @@ public interface XhpcChargeOrderMapper { /** * 标记异常大于创建4小时,标记为异常 */ - void updateStatus(); + void updateStatus(@Param("status")Integer status,@Param("chargeOrderId")Long chargeOrderId); + + /** + * 4小时订单未结算的订单 + * @return + */ + List getFourTimsStatus(); + + /** + * 查询相同桩之后是否有订单结算 + * @param serialNumber 订单号 + * @return + */ + int getSerialNumberLike(@Param("serialNumber")String serialNumber,@Param("chargeOrderId")Long chargeOrderId); List> selectDate3rdNeedBy(@Param(value = "serialNumber") String serialNumber); 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 cb28683c..a3790561 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 @@ -5,6 +5,7 @@ import com.xhpc.common.api.PowerPileService; import com.xhpc.common.core.domain.R; import com.xhpc.common.core.web.domain.AjaxResult; import com.xhpc.common.data.down.StartChargingData; +import com.xhpc.common.data.redis.CacheRealtimeData; import com.xhpc.common.data.redis.StaticBeanUtil; import com.xhpc.common.domain.XhpcRate; import com.xhpc.common.domain.XhpcTerminal; @@ -509,7 +510,27 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { @Override public void updateStatus() { - xhpcChargeOrderMapper.updateStatus(); + //标记异常大于创建4小时,标记为异常 且没有实时数据的订单 + //查询是否有实时数据,没有实时数据查看该桩是否有成功的数据,有成功的数据表示该订单是无效的 + List list = xhpcChargeOrderMapper.getFourTimsStatus(); + if(list !=null && list.size()>0){ + for (XhpcChargeOrder xhpcChargeOrder:list) { + CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + xhpcChargeOrder.getSerialNumber() + ".lord"); + Long chargeOrderId = xhpcChargeOrder.getChargeOrderId(); + if(cacheRealtimeData ==null){ + int count = xhpcChargeOrderMapper.getSerialNumberLike(xhpcChargeOrder.getSerialNumber().substring(0, 16), chargeOrderId); + if(count>0){ + //有充电改为 由充电中变为启动充电中 + xhpcChargeOrderMapper.updateStatus(-1,chargeOrderId); + }else{ + //标记异常 + xhpcChargeOrderMapper.updateStatus(2,chargeOrderId); + } + }else{ + xhpcChargeOrderMapper.updateStatus(2,chargeOrderId); + } + } + } } @Override 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 0592ccf4..a2d79dc1 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml @@ -603,7 +603,15 @@ where operator_id_evcs = #{operatorIdEvcs} - + select * from xhpc_charge_order where now() >DATE_ADD(create_time,interval 4 hour) and status=0 + + + 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 447e3522..a0486576 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcHistoryOrderMapper.xml @@ -210,6 +210,9 @@ phone, + + charging_mode, + @@ -353,6 +356,9 @@ #{phone,jdbcType=VARCHAR}, + + #{chargingMode,jdbcType=VARCHAR}, + diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml index 7c05cbbd..2484f98f 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcStatisticsMapper.xml @@ -647,7 +647,10 @@ type, - history_order_id + history_order_id, + + + charging_mode, @@ -727,7 +730,10 @@ #{type}, - #{historyOrderId} + #{historyOrderId}, + + + #{chargingMode},