瀏覽代碼

费用提醒

李进 1 年之前
父節點
當前提交
ec3bed3203

+ 16 - 0
device-api-service/src/main/java/com/xy/job/DeviceChargingJob.java

@@ -6,8 +6,10 @@ import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xy.collections.map.JHashMap;
 import com.xy.collections.map.JMap;
+import com.xy.dto.MercMsgInfoDto;
 import com.xy.entity.SysDictRedis;
 import com.xy.mapper.DeviceChargingMapper;
+import com.xy.service.MercMsgInfoService;
 import com.xy.sys.EnumMercCostMsgConfig;
 import com.xy.utils.*;
 import lombok.AllArgsConstructor;
@@ -27,6 +29,8 @@ public class DeviceChargingJob {
 
     private DeviceChargingMapper deviceChargingMapper;
 
+    private MercMsgInfoService mercMsgInfoService;
+
     /**
      * 设备管理费过期消息
      *
@@ -89,6 +93,12 @@ public class DeviceChargingJob {
                 .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), officialParams))
                 .mini(userInfo -> new MsgUtils.MsgInfo(userInfo.getWechatOpenid(), miniParams))
                 .builder();
+        //写入记录
+        mercMsgInfoService.save(new MercMsgInfoDto.Save()
+                .setMercId(mercIds)
+                .setType(1)
+                .setWorkType(1)
+        );
         //下一页
         current++;
         deviceChargingTimeout1(map, current, size, tel);
@@ -123,6 +133,12 @@ public class DeviceChargingJob {
                 .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), officialParams))
                 .mini(userInfo -> new MsgUtils.MsgInfo(userInfo.getWechatOpenid(), miniParams))
                 .builder();
+        //写入记录
+        mercMsgInfoService.save(new MercMsgInfoDto.Save()
+                .setMercId(mercIds)
+                .setType(1)
+                .setWorkType(2)
+        );
         //下一页
         current++;
         deviceChargingTimeout2(map, thisTime, time1, current, size, tel);

+ 16 - 0
device-api-service/src/main/java/com/xy/job/DeviceSimJob.java

@@ -7,8 +7,10 @@ import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xy.collections.map.JHashMap;
 import com.xy.collections.map.JMap;
 import com.xy.device.EnumDeviceCharging;
+import com.xy.dto.MercMsgInfoDto;
 import com.xy.entity.SysDictRedis;
 import com.xy.mapper.DeviceSimMapper;
+import com.xy.service.MercMsgInfoService;
 import com.xy.sys.EnumMercCostMsgConfig;
 import com.xy.utils.*;
 import lombok.AllArgsConstructor;
@@ -28,6 +30,8 @@ public class DeviceSimJob {
 
     private DeviceSimMapper deviceSimMapper;
 
+    private MercMsgInfoService mercMsgInfoService;
+
     /**
      * 设备流量卡过期消息
      *
@@ -90,6 +94,12 @@ public class DeviceSimJob {
                 .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), officialParams))
                 .mini(userInfo -> new MsgUtils.MsgInfo(userInfo.getWechatOpenid(), miniParams))
                 .builder();
+        //写入记录
+        mercMsgInfoService.save(new MercMsgInfoDto.Save()
+                .setMercId(mercIds)
+                .setType(2)
+                .setWorkType(1)
+        );
         //下一页
         current++;
         deviceSimTimeout1(map, current, size, tel);
@@ -123,6 +133,12 @@ public class DeviceSimJob {
                 .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), officialParams))
                 .mini(userInfo -> new MsgUtils.MsgInfo(userInfo.getWechatOpenid(), miniParams))
                 .builder();
+        //写入记录
+        mercMsgInfoService.save(new MercMsgInfoDto.Save()
+                .setMercId(mercIds)
+                .setType(2)
+                .setWorkType(2)
+        );
         //下一页
         current++;
         deviceSimTimeout2(map, thisTime, time1, current, size, tel);

+ 5 - 2
device-api-service/src/main/java/com/xy/mapper/mapper/DeviceChargingMapper.xml

@@ -20,9 +20,12 @@
         select di.merc_id
         from device_charging dc
         join device_info di on(dc.device_id = di.device_id)
-        left join merc_msg_info mmi on(di.merc_id = mmi.merc_id and mmi.create_time >= #{query.mmiTime} and mmi.type = 1 and mmi.work_type = #{query.workType})
         where
-        mmi.id is null
+        NOT EXISTS (
+            SELECT 1
+            FROM merc_msg_info mmi
+            WHERE di.merc_id = mmi.merc_id and mmi.create_time >= #{query.mmiTime} and mmi.type = 1 and mmi.work_type = #{query.workType}
+        )
         <if test="query.begin != null">
             and dc.timeout >= #{query.begin}
         </if>

+ 5 - 3
device-api-service/src/main/java/com/xy/mapper/mapper/DeviceSimMapper.xml

@@ -153,10 +153,12 @@
         from device_sysinfo dsi
         join device_info di on(dsi.device_id = di.device_id)
         join device_sim dsim on(dsi.sim_iccid = dsim.id)
-        left join merc_msg_info mmi on(di.merc_id = mmi.merc_id and mmi.create_time >= #{query.mmiTime} and mmi.type = 2
-        and mmi.work_type = #{query.workType})
         where
-        mmi.id is null
+        NOT EXISTS (
+            SELECT 1
+            FROM merc_msg_info mmi
+            WHERE di.merc_id = mmi.merc_id and mmi.create_time >= #{query.mmiTime} and mmi.type = 1 and mmi.work_type = #{query.workType}
+        )
         <if test="query.begin != null">
             and dsim.timeout >= #{query.begin}
         </if>