|
|
@@ -7,10 +7,12 @@ import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.kxs.common.core.exception.GlobalCustomerException;
|
|
|
+import com.kxs.common.mq.handlers.IMQSender;
|
|
|
import com.kxs.product.api.model.KxsGdReport;
|
|
|
import com.kxs.product.api.req.gd.GdQueryCardOrderReq;
|
|
|
import com.kxs.product.api.res.gd.GdCommRes;
|
|
|
import com.kxs.product.api.res.gd.GdQueryOrderRes;
|
|
|
+import com.kxs.product.api.amqp.rabbit.RabbitGdActQueueMQ;
|
|
|
import com.kxs.product.biz.config.RsaProperties;
|
|
|
import com.kxs.product.biz.constant.enums.GdReportEnum;
|
|
|
import com.kxs.product.biz.mapper.KxsGdReportMapper;
|
|
|
@@ -39,8 +41,11 @@ public class KxsGdServiceImpl implements KxsGdService {
|
|
|
|
|
|
private final KxsGdReportMapper kxsGdReportMapper;
|
|
|
|
|
|
+ private final IMQSender mqSender;
|
|
|
+
|
|
|
@Async("getAsyncExecutor")
|
|
|
- public void checkGdAsyncData(String startTime, String endTime){
|
|
|
+ @Override
|
|
|
+ public void checkGdAsyncData(String startTime, String endTime) {
|
|
|
int pageNo = 1;
|
|
|
int pageSize = 50;
|
|
|
|
|
|
@@ -48,28 +53,30 @@ public class KxsGdServiceImpl implements KxsGdService {
|
|
|
List<GdQueryOrderRes.GdQueryOrder> list = this.queryCardOrders(startTime, endTime, pageNo, pageSize);
|
|
|
if (list.isEmpty()) {
|
|
|
pageNo = -1;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
for (GdQueryOrderRes.GdQueryOrder gdQueryOrder : list) {
|
|
|
- if("已激活".equals(gdQueryOrder.getActivationStatusName())){
|
|
|
+ if ("已激活".equals(gdQueryOrder.getActivationStatusName())) {
|
|
|
KxsGdReport kxsGdReport = kxsGdReportMapper.selectOne(Wrappers.<KxsGdReport>lambdaQuery()
|
|
|
- .eq(KxsGdReport::getGdSn, gdQueryOrder.getIccId())
|
|
|
+ .eq(KxsGdReport::getIsCheck, GdReportEnum.CHECK_NO.getType())
|
|
|
+ .eq(KxsGdReport::getGdSn, gdQueryOrder.getIccId())
|
|
|
.eq(KxsGdReport::getGdMobile, gdQueryOrder.getPhoneNo()));
|
|
|
- if(kxsGdReport != null){
|
|
|
+ if (kxsGdReport != null) {
|
|
|
kxsGdReportMapper.update(null, Wrappers.<KxsGdReport>lambdaUpdate().eq(KxsGdReport::getId, kxsGdReport.getId())
|
|
|
- .set(KxsGdReport::getIsCheck, GdReportEnum.CHECK_SUC.getType())
|
|
|
- .set(KxsGdReport::getGdMobile, gdQueryOrder.getPhoneNo()));
|
|
|
- //TODO 调用激活接口
|
|
|
-
|
|
|
+ .set(KxsGdReport::getIsCheck, GdReportEnum.CHECK_SUC.getType())
|
|
|
+ .set(KxsGdReport::getGdMobile, gdQueryOrder.getPhoneNo()));
|
|
|
+ //发送广电激活MQ消息
|
|
|
+ RabbitGdActQueueMQ.MsgEntity msgEntity = new RabbitGdActQueueMQ.MsgEntity();
|
|
|
+ BeanUtil.copyProperties(gdQueryOrder, msgEntity);
|
|
|
+ mqSender.send(RabbitGdActQueueMQ.build(msgEntity));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
pageNo++;
|
|
|
}
|
|
|
- }while (pageNo != -1);
|
|
|
+ } while (pageNo != -1);
|
|
|
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
public List<GdQueryOrderRes.GdQueryOrder> queryCardOrders(String startTime, String endTime, int pageNo, int pageSize) {
|
|
|
|
|
|
try {
|
|
|
@@ -93,10 +100,11 @@ public class KxsGdServiceImpl implements KxsGdService {
|
|
|
.timeout(50000)//超时,毫秒
|
|
|
.execute().body();
|
|
|
Optional.ofNullable(response).orElseThrow(() -> new GlobalCustomerException("调用接口失败"));
|
|
|
- GdCommRes<GdQueryOrderRes> commRes = JSONUtil.toBean(response, new TypeReference<GdCommRes<GdQueryOrderRes>>() {}, true);
|
|
|
- if(commRes.getResultCode() == 1){
|
|
|
+ GdCommRes<GdQueryOrderRes> commRes = JSONUtil.toBean(response, new TypeReference<GdCommRes<GdQueryOrderRes>>() {
|
|
|
+ }, true);
|
|
|
+ if (commRes.getResultCode() == 1) {
|
|
|
return commRes.getData().getRecords();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new GlobalCustomerException(commRes.getErrorDesc());
|
|
|
}
|
|
|
|