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 086e5d21..d4b1cad3 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
@@ -188,4 +188,17 @@ public interface XhpcRealTimeOrderMapper {
XhpcActivityFormulaDomainDto getActivityFormulaTimeById(@Param("activityId") Integer activityId,@Param("startTime") String startTime, @Param("endTime") String endTime);
+
+ void deleteOrderCurrent(@Param("time")String time);
+
+ void deleteOrderVoltage(@Param("time")String time);
+
+ void deleteOrderSoc(@Param("time")String time);
+
+ void deleteRealTimeOrderTime(@Param("time")String time);
+
+ void deleteOorderRedisRecord(@Param("time")String time);
+
+ void deleteRealTimeOrderBms(@Param("time")String time);
+
}
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 ef2910b9..9e6244a1 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
@@ -170,8 +170,30 @@ public interface IXhpcRealTimeOrderService {
/**
- * 添加一条实时订单的BMS
+ * 添加一条实时订单的BMS,清除一个月半之前的数据
*/
void addRealTimeOrderBms(String orderNo);
+ /**
+ * 实时电流定时任务,每天下午2点,清除一个月半之前的数据
+ */
+ void orderCurrent();
+ /**
+ * 实时电压定时任务,每天下午3点,清除一个月半之前的数据
+ */
+ void orderVoltage();
+
+ /**
+ * 实时soc定时任务,每天下午2点30,清除一个月半之前的数据
+ */
+ void orderSoc();
+
+ //实时充电数据定时任务,每天下午3点30,清除一个月半之前的数据
+ void realTimeOrder();
+
+ //充电结算订单报文定时任务,每天下午4点,清除一个月半之前的数据
+ void orderRedisRecord();
+
+ //充电车辆BMS报文定时任务,每天下午4点30,清除一个月半之前的数据
+ void realTimeOrderBms();
}
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 bec0bfbb..82422f44 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
@@ -1703,6 +1703,50 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
}
+ @Override
+ public void orderCurrent() {
+ String time = monthTime();
+ xhpcRealTimeOrderMapper.deleteOrderCurrent(time);
+ }
+
+ @Override
+ public void orderVoltage() {
+ String time = monthTime();
+ xhpcRealTimeOrderMapper.deleteOrderVoltage(time);
+ }
+
+ @Override
+ public void orderSoc() {
+ String time = monthTime();
+ xhpcRealTimeOrderMapper.deleteOrderSoc(time);
+ }
+
+ @Override
+ public void realTimeOrder() {
+ String time = monthTime();
+ xhpcRealTimeOrderMapper.deleteRealTimeOrderTime(time);
+ }
+ @Override
+ public void orderRedisRecord() {
+ String time = monthTime();
+ xhpcRealTimeOrderMapper.deleteOorderRedisRecord(time);
+ }
+ @Override
+ public void realTimeOrderBms() {
+ String time = monthTime();
+ xhpcRealTimeOrderMapper.deleteRealTimeOrderBms(time);
+ }
+
+
+
+
+
+ //获今天之后一个月半后时间
+ private String monthTime(){
+ Date date = new Date();
+ Date beginOfDay = DateUtil.beginOfDay(date);
+ return DateUtil.formatDateTime(DateUtil.offsetDay(beginOfDay, -35));
+ }
private BigDecimal getBigDecimal(Long rateModelId, String startTime, String updateTime, BigDecimal powerPriceTotal, BigDecimal divide) {
if("00:00:00".equals(updateTime)){
@@ -1742,7 +1786,6 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
return bigDecimal;
}
-
private BigDecimal getRealOrderTime(Long chargingOrderId,String startTime,String endTime){
//结束时间差时间
int differenceEndTime =0;
diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/tasks/ScheduledTasks.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/tasks/ScheduledTasks.java
new file mode 100644
index 00000000..1f6f339c
--- /dev/null
+++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/tasks/ScheduledTasks.java
@@ -0,0 +1,66 @@
+package com.xhpc.order.tasks;
+
+import com.xhpc.order.service.IXhpcRealTimeOrderService;
+import io.swagger.annotations.Api;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * @author yuyang
+ * @date 2022/10/20 14:30
+ */
+@EnableScheduling
+@RestController
+@RequestMapping("/scheduledTasks")
+@Api(value = "定时任务接口", tags = "定时任务接口")
+public class ScheduledTasks {
+
+ @Resource
+ IXhpcRealTimeOrderService xhpcRealTimeOrderService;
+
+ //实时电流定时任务,每天下午2点,清除一个月半之前的数据
+ @GetMapping("/orderCurrent")
+ @Scheduled(cron = "0 0 14 * * ?")
+ public void orderCurrent(){
+ xhpcRealTimeOrderService.orderCurrent();
+ }
+
+
+ //实时电压定时任务,每天下午2点30,清除一个月半之前的数据
+ @GetMapping("/orderVoltage")
+ @Scheduled(cron = "0 30 14 * * ?")
+ public void orderVoltage(){
+ xhpcRealTimeOrderService.orderVoltage();
+ }
+
+ //实时soc定时任务,每天下午3点,清除一个月半之前的数据
+ @GetMapping("/orderSoc")
+ @Scheduled(cron = "0 0 15 * * ?")
+ public void orderSoc(){
+ xhpcRealTimeOrderService.orderSoc();
+ }
+
+ //实时充电数据定时任务,每天下午3.30点,清除一个月半之前的数据
+ @GetMapping("/realTimeOrder")
+ @Scheduled(cron = "0 30 15 * * ?")
+ public void realTimeOrder(){
+ xhpcRealTimeOrderService.realTimeOrder();
+ }
+ //充电结算订单报文定时任务,每天下午4点,清除一个月半之前的数据
+ @GetMapping("/orderRedisRecord")
+ @Scheduled(cron = "0 0 16 * * ?")
+ public void orderRedisRecord(){
+ xhpcRealTimeOrderService.orderRedisRecord();
+ }
+ //充电结算订单报文定时任务,每天下午4点30,清除一个月半之前的数据
+ @GetMapping("/realTimeOrderBms")
+ @Scheduled(cron = "0 30 16 * * ?")
+ public void realTimeOrderBms(){
+ xhpcRealTimeOrderService.realTimeOrderBms();
+ }
+}
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 b678a42d..9dd618c8 100644
--- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml
+++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcRealTimeOrderMapper.xml
@@ -1009,4 +1009,29 @@
and start_time >= #{startTime} AND end_time <= #{endTime}
+
+
+ delete from xhpc_charge_order_current where create_time <=#{time}
+
+
+
+ delete from xhpc_charge_order_voltage where create_time <=#{time}
+
+
+
+ delete from xhpc_charge_order_soc where create_time <=#{time}
+
+
+
+ delete from xhpc_real_time_order where create_time <=#{time}
+
+
+
+ delete from xhpc_order_redis_record where create_time <=#{time}
+
+
+
+ delete from xhpc_real_time_order_bms where create_time <=#{time}
+
+
\ No newline at end of file