|
@@ -1,5 +1,6 @@
|
|
package com.xy.job;
|
|
package com.xy.job;
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -10,9 +11,12 @@ import com.xy.collections.map.JHashMap;
|
|
import com.xy.collections.map.JMap;
|
|
import com.xy.collections.map.JMap;
|
|
import com.xy.device.EnumSimConfig;
|
|
import com.xy.device.EnumSimConfig;
|
|
import com.xy.dto.MercMsgInfoDto;
|
|
import com.xy.dto.MercMsgInfoDto;
|
|
|
|
+import com.xy.dto.be.MercDto;
|
|
import com.xy.entity.DeviceSim;
|
|
import com.xy.entity.DeviceSim;
|
|
|
|
+import com.xy.enums.MsgConfigId;
|
|
import com.xy.mapper.DeviceSimMapper;
|
|
import com.xy.mapper.DeviceSimMapper;
|
|
import com.xy.service.MercMsgInfoService;
|
|
import com.xy.service.MercMsgInfoService;
|
|
|
|
+import com.xy.service.be.MercFeignService;
|
|
import com.xy.sys.EnumMercCostMsgConfig;
|
|
import com.xy.sys.EnumMercCostMsgConfig;
|
|
import com.xy.utils.*;
|
|
import com.xy.utils.*;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -20,8 +24,11 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 设备流量卡job
|
|
* 设备流量卡job
|
|
@@ -36,6 +43,9 @@ public class DeviceSimJob {
|
|
|
|
|
|
private MercMsgInfoService mercMsgInfoService;
|
|
private MercMsgInfoService mercMsgInfoService;
|
|
|
|
|
|
|
|
+ private MercFeignService mercFeignService;
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 设备流量卡过期消息
|
|
* 设备流量卡过期消息
|
|
*
|
|
*
|
|
@@ -58,11 +68,35 @@ public class DeviceSimJob {
|
|
if (!Emptys.check(mercIds)) {
|
|
if (!Emptys.check(mercIds)) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+ List<MercDto.Vo> mercList = R.feignCheckData(mercFeignService.listMerc(new MercDto.ListDTO().setIds(mercIds)));
|
|
|
|
+ Map<Long, MercDto.Vo> mercMap = mercList.stream().collect(Collectors.toMap(MercDto.Vo::getId, m -> m));
|
|
|
|
+ List<Long> cmMercIds = new ArrayList<>();
|
|
|
|
+ List<Long> mxrMercIds = new ArrayList<>();
|
|
|
|
+ //遍历mercMap 区分喵星人、创米商户
|
|
|
|
+ for (Map.Entry<Long, MercDto.Vo> entry : mercMap.entrySet()) {
|
|
|
|
+ Long mercId = entry.getKey();
|
|
|
|
+ String mercCode = entry.getValue().getMercCode();
|
|
|
|
+ if (MercAuthUtils.sendMsgToCM(mercCode)) {
|
|
|
|
+ cmMercIds.add(mercId);
|
|
|
|
+ } else {
|
|
|
|
+ mxrMercIds.add(mercId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
//发送消息
|
|
//发送消息
|
|
- MsgUtils.sendMsg(17L, mercIds)
|
|
|
|
- .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), msg))
|
|
|
|
- .mxr(userInfo -> new MsgUtils.MsgInfo(String.valueOf(userInfo.getAuthorizeUserId()), msg))
|
|
|
|
- .builder();
|
|
|
|
|
|
+ if (CollUtil.isNotEmpty(mxrMercIds)) {
|
|
|
|
+ MsgUtils.sendMsg(MsgConfigId.FEE_NOTIFY.getId(), mercIds)
|
|
|
|
+ .official(userInfo -> new MsgUtils.MsgInfo(userInfo.getMpOpenid(), msg))
|
|
|
|
+ .mxr(userInfo -> new MsgUtils.MsgInfo(String.valueOf(userInfo.getAuthorizeUserId()), msg))
|
|
|
|
+ .builder();
|
|
|
|
+ }
|
|
|
|
+ //创米商户
|
|
|
|
+ if (CollUtil.isNotEmpty(cmMercIds)) {
|
|
|
|
+ MsgUtils.sendMsg(MsgConfigId.CM_FEE_NOTIFY.getId(), 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()
|
|
mercMsgInfoService.save(new MercMsgInfoDto.Save()
|
|
.setMercId(mercIds)
|
|
.setMercId(mercIds)
|
|
@@ -109,7 +143,7 @@ public class DeviceSimJob {
|
|
public ReturnT<String> deviceSimWaitHandle() {
|
|
public ReturnT<String> deviceSimWaitHandle() {
|
|
Long count = deviceSimMapper.selectCount(new LambdaQueryWrapper<DeviceSim>().eq(DeviceSim::getWaitHandle, true));
|
|
Long count = deviceSimMapper.selectCount(new LambdaQueryWrapper<DeviceSim>().eq(DeviceSim::getWaitHandle, true));
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
- MsgUtils.sendMsg(19L)
|
|
|
|
|
|
+ MsgUtils.sendMsg(MsgConfigId.SIM_CARD_TO_PAY_NOTIFY.getId())
|
|
.official(() -> {
|
|
.official(() -> {
|
|
JMap<String, Object> map = new JHashMap<String, Object>()
|
|
JMap<String, Object> map = new JHashMap<String, Object>()
|
|
.set("thing1", "有需要缴费的流量卡")
|
|
.set("thing1", "有需要缴费的流量卡")
|