|
@@ -43,98 +43,58 @@ public class DeviceSimJob {
|
|
|
Map<String, SysDictRedis> stringSysDictRedisMap = SysDictUtils.get(EnumMercCostMsgConfig.Code.CODE.getCode());
|
|
|
String tel = stringSysDictRedisMap.get(EnumMercCostMsgConfig.CUSTOM_TEL.getCode()).getValue();
|
|
|
String mmiTime = DataTime.getStringAround(0, -1, 0, 0, 0, 0, now);
|
|
|
+ //数据逻辑
|
|
|
+ FunctionUtils.ParamsResult<Tuple.Tuple4<Integer, JMap<String, Object>, JMap<String, Object>, Integer>, Boolean> datas = tuple -> {
|
|
|
+ Integer current = tuple.getV1();
|
|
|
+ JMap<String, Object> params = tuple.getV2();
|
|
|
+ JMap<String, Object> msg = tuple.getV3();
|
|
|
+ Integer workType = tuple.getV4();
|
|
|
+ //查询数据
|
|
|
+ IPage<Long> longIPage = deviceSimMapper.deviceSimTimeout(Page.of(current, 100), params);
|
|
|
+ List<Long> mercIds = longIPage.getRecords();
|
|
|
+ if (!Emptys.check(mercIds)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ //发送消息
|
|
|
+ MsgUtils.sendMsg(17L, mercIds)
|
|
|
+ .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), msg))
|
|
|
+ .mxr(userInfo -> new MsgUtils.MsgInfo(String.valueOf(userInfo.getAuthorizeUserId()), msg))
|
|
|
+ .builder();
|
|
|
+ //写入记录
|
|
|
+ mercMsgInfoService.save(new MercMsgInfoDto.Save()
|
|
|
+ .setMercId(mercIds)
|
|
|
+ .setType(2)
|
|
|
+ .setWorkType(workType)
|
|
|
+ );
|
|
|
+ return true;
|
|
|
+ };
|
|
|
//即将过期
|
|
|
FunctionUtils.NoParamsNoResult timeout1 = () -> {
|
|
|
int day = SysDictUtils.getValue(EnumDeviceCharging.Code.CODE.getCode(), EnumDeviceCharging.N_200.getCode(), Integer.class);
|
|
|
- String end = DataTime.getStringAround(0, 0, day, 0, 0, 0);
|
|
|
+ String end = DataTime.getStringAround(0, 0, day, 0, 0, 0, now);
|
|
|
JMap<String, Object> map = new JHashMap<String, Object>()
|
|
|
.set("mmiTime", mmiTime)
|
|
|
.set("workType", 1)
|
|
|
.set("begin", now)
|
|
|
.set("end", end);
|
|
|
- deviceSimTimeout1(map, 1, 100, tel);
|
|
|
+ JMap<String, Object> sendParams = new JHashMap<String, Object>()
|
|
|
+ .set("content", String.format("尊敬的客户,您有%s即将到期,为避免设备停机,请及时续费,客服电话%s", "设备流量卡", tel));
|
|
|
+ RecursionUtils.recursion(current -> datas.run(new Tuple.Tuple4<>(current, map, sendParams, 1)));
|
|
|
};
|
|
|
//欠费
|
|
|
FunctionUtils.NoParamsNoResult timeout2 = () -> {
|
|
|
- int day = Integer.valueOf(stringSysDictRedisMap.get(EnumMercCostMsgConfig.ARREARAGE_DAY.getCode()).getValue());
|
|
|
+ int day = Integer.parseInt(stringSysDictRedisMap.get(EnumMercCostMsgConfig.ARREARAGE_DAY.getCode()).getValue());
|
|
|
String time1 = DataTime.getStringAround(0, 0, day, 0, 0, 0, now);
|
|
|
JMap<String, Object> map = new JHashMap<String, Object>()
|
|
|
.set("mmiTime", mmiTime)
|
|
|
.set("workType", 2)
|
|
|
.set("end", now);
|
|
|
- deviceSimTimeout2(map, now, time1, 1, 100, tel);
|
|
|
+ JMap<String, Object> sendParams = new JHashMap<String, Object>()
|
|
|
+ .set("content", String.format("尊敬的客户,截止%s您的%s已欠费,如您在%s前未完成续费,您的设备将停止交易,客服电话%s", now, "设备流量卡", time1, tel));
|
|
|
+ RecursionUtils.recursion(current -> datas.run(new Tuple.Tuple4<>(current, map, sendParams, 2)));
|
|
|
};
|
|
|
timeout1.run();
|
|
|
timeout2.run();
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 即将过期
|
|
|
- *
|
|
|
- * @param map
|
|
|
- * @param current
|
|
|
- * @param size
|
|
|
- * @param tel
|
|
|
- */
|
|
|
- private void deviceSimTimeout1(JMap<String, Object> map, long current, long size, String tel) {
|
|
|
- //查询数据
|
|
|
- IPage<Long> longIPage = deviceSimMapper.deviceSimTimeout(Page.of(current, size), map);
|
|
|
- List<Long> mercIds = longIPage.getRecords();
|
|
|
- if (!Emptys.check(mercIds)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- //发送消息
|
|
|
- JMap<String, Object> officialParams = new JHashMap<String, Object>()
|
|
|
- .set("content", String.format("尊敬的客户,您有设备流量卡即将到期,为避免设备停机,请及时续费,客服电话%s", tel));
|
|
|
- JMap<String, Object> mxrParams = officialParams;
|
|
|
- MsgUtils.sendMsg(17L, mercIds)
|
|
|
- .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), officialParams))
|
|
|
- .mxr(userInfo -> new MsgUtils.MsgInfo(String.valueOf(userInfo.getAuthorizeUserId()), mxrParams))
|
|
|
- .builder();
|
|
|
- //写入记录
|
|
|
- mercMsgInfoService.save(new MercMsgInfoDto.Save()
|
|
|
- .setMercId(mercIds)
|
|
|
- .setType(2)
|
|
|
- .setWorkType(1)
|
|
|
- );
|
|
|
- //下一页
|
|
|
- current++;
|
|
|
- deviceSimTimeout1(map, current, size, tel);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 已欠费
|
|
|
- *
|
|
|
- * @param map
|
|
|
- * @param thisTime
|
|
|
- * @param current
|
|
|
- * @param size
|
|
|
- * @param tel
|
|
|
- */
|
|
|
- private void deviceSimTimeout2(JMap<String, Object> map, String thisTime, String time1, long current, long size, String tel) {
|
|
|
- //查询数据
|
|
|
- IPage<Long> longIPage = deviceSimMapper.deviceSimTimeout(Page.of(current, size), map);
|
|
|
- List<Long> mercIds = longIPage.getRecords();
|
|
|
- if (!Emptys.check(mercIds)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- //发送消息
|
|
|
- JMap<String, Object> officialParams = new JHashMap<String, Object>()
|
|
|
- .set("content", String.format("尊敬的客户,截止%s您的%s已欠费,如您在%s前未完成续费,您的设备将停止交易,客服电话%s", thisTime, "设备流量卡", time1, tel));
|
|
|
- JMap<String, Object> mxrParams = officialParams;
|
|
|
- MsgUtils.sendMsg(17L, mercIds)
|
|
|
- .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), officialParams))
|
|
|
- .mxr(userInfo -> new MsgUtils.MsgInfo(String.valueOf(userInfo.getAuthorizeUserId()), mxrParams))
|
|
|
- .builder();
|
|
|
- //写入记录
|
|
|
- mercMsgInfoService.save(new MercMsgInfoDto.Save()
|
|
|
- .setMercId(mercIds)
|
|
|
- .setType(2)
|
|
|
- .setWorkType(2)
|
|
|
- );
|
|
|
- //下一页
|
|
|
- current++;
|
|
|
- deviceSimTimeout2(map, thisTime, time1, current, size, tel);
|
|
|
- }
|
|
|
}
|