|
@@ -7,6 +7,8 @@ import cn.hutool.core.lang.TypeReference;
|
|
|
import cn.hutool.http.Header;
|
|
import cn.hutool.http.Header;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.kxs.common.core.exception.GlobalCustomerException;
|
|
import com.kxs.common.core.exception.GlobalCustomerException;
|
|
@@ -28,6 +30,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -87,30 +90,47 @@ public class KxsGdServiceImpl implements KxsGdService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void checkGdAsyncData(JSONObject orderData) {
|
|
|
|
|
|
|
+ public void checkGdAsyncData(Map<String, Object> param) {
|
|
|
|
|
|
|
|
- String gdMobile = orderData.getString("mobile");
|
|
|
|
|
- KxsGdReport kxsGdReport = kxsGdReportMapper.selectOne(Wrappers.<KxsGdReport>lambdaQuery()
|
|
|
|
|
- .eq(KxsGdReport::getIsCheck, GdReportEnum.CHECK_NO.getType())
|
|
|
|
|
- .eq(KxsGdReport::getGdMobile, gdMobile));
|
|
|
|
|
- if (kxsGdReport == null) {
|
|
|
|
|
|
|
+ JSONArray dataList = JSON.parseArray(param.get("data").toString());
|
|
|
|
|
+ if(dataList.isEmpty()){
|
|
|
|
|
+ log.error("接收广电订单数据失败:{}", JSON.toJSONString(param));
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ try {
|
|
|
|
|
+ boolean checkSign = GdRsaUtils.checkSign(param, rsaProperties.getGd().getPublicKey());
|
|
|
|
|
+ if(!checkSign) {
|
|
|
|
|
+ throw new GlobalCustomerException("广电接收激活数据验证签名失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ throw new GlobalCustomerException("广电接收激活数据验证签名失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ for (Object obj : dataList) {
|
|
|
|
|
+ JSONObject orderData = JSON.parseObject(obj.toString());
|
|
|
|
|
+
|
|
|
|
|
+ String gdMobile = orderData.getString("mobile");
|
|
|
|
|
+ KxsGdReport kxsGdReport = kxsGdReportMapper.selectOne(Wrappers.<KxsGdReport>lambdaQuery()
|
|
|
|
|
+ .eq(KxsGdReport::getIsCheck, GdReportEnum.CHECK_NO.getType())
|
|
|
|
|
+ .eq(KxsGdReport::getGdMobile, gdMobile));
|
|
|
|
|
+ if (kxsGdReport == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- RabbitGdActQueueMQ.MsgEntity msgEntity = new RabbitGdActQueueMQ.MsgEntity();
|
|
|
|
|
- msgEntity.setPosSn(orderData.getString("iccid"));
|
|
|
|
|
- msgEntity.setPhoneNo(orderData.getString("mobile"));
|
|
|
|
|
- msgEntity.setProductName(orderData.getString("offerName"));
|
|
|
|
|
- msgEntity.setActivationStatusName("已激活");
|
|
|
|
|
- msgEntity.setActivationTime(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
|
|
|
|
|
|
|
+ RabbitGdActQueueMQ.MsgEntity msgEntity = new RabbitGdActQueueMQ.MsgEntity();
|
|
|
|
|
+ msgEntity.setPosSn(orderData.getString("iccid"));
|
|
|
|
|
+ msgEntity.setPhoneNo(orderData.getString("mobile"));
|
|
|
|
|
+ msgEntity.setProductName(orderData.getString("offerName"));
|
|
|
|
|
+ msgEntity.setActivationStatusName("已激活");
|
|
|
|
|
+ msgEntity.setActivationTime(LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_PATTERN));
|
|
|
|
|
|
|
|
- mqSender.send(RabbitGdActQueueMQ.build(msgEntity));
|
|
|
|
|
|
|
+ mqSender.send(RabbitGdActQueueMQ.build(msgEntity));
|
|
|
|
|
|
|
|
- kxsGdReportMapper.update(null, Wrappers.<KxsGdReport>lambdaUpdate().eq(KxsGdReport::getId, kxsGdReport.getId())
|
|
|
|
|
- .set(KxsGdReport::getIsCheck, GdReportEnum.CHECK_SUC.getType())
|
|
|
|
|
- .set(KxsGdReport::getGdMobile, gdMobile));
|
|
|
|
|
- log.info("发送电渠广电激活数据{}", kxsGdReport.getGdSn()
|
|
|
|
|
- + "," + kxsGdReport.getGdMobile());
|
|
|
|
|
|
|
+ kxsGdReportMapper.update(null, Wrappers.<KxsGdReport>lambdaUpdate().eq(KxsGdReport::getId, kxsGdReport.getId())
|
|
|
|
|
+ .set(KxsGdReport::getIsCheck, GdReportEnum.CHECK_SUC.getType())
|
|
|
|
|
+ .set(KxsGdReport::getGdMobile, gdMobile));
|
|
|
|
|
+ log.info("发送电渠广电激活数据{}", kxsGdReport.getGdSn()
|
|
|
|
|
+ + "," + kxsGdReport.getGdMobile());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -130,6 +150,7 @@ public class KxsGdServiceImpl implements KxsGdService {
|
|
|
.timestamp(String.valueOf(timestamp)).build();
|
|
.timestamp(String.valueOf(timestamp)).build();
|
|
|
String sign = GdRsaUtils.rsa256Sign(BeanUtil.beanToMap(req), rsaProperties.getGd().getPrivateKey());
|
|
String sign = GdRsaUtils.rsa256Sign(BeanUtil.beanToMap(req), rsaProperties.getGd().getPrivateKey());
|
|
|
req.setSign(sign);
|
|
req.setSign(sign);
|
|
|
|
|
+ boolean b = GdRsaUtils.checkSign(BeanUtil.beanToMap(req), rsaProperties.getGd().getPublicKey());
|
|
|
String body = JSONUtil.toJsonStr(req);
|
|
String body = JSONUtil.toJsonStr(req);
|
|
|
String response = HttpRequest.post(url)
|
|
String response = HttpRequest.post(url)
|
|
|
.header(Header.CONTENT_TYPE, "application/json")
|
|
.header(Header.CONTENT_TYPE, "application/json")
|