|
@@ -37,6 +37,7 @@ import com.fs.common.event.TemplateEvent;
|
|
|
import com.fs.common.event.TemplateListenEnum;
|
|
import com.fs.common.event.TemplateListenEnum;
|
|
|
import com.fs.common.exception.CustomException;
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.utils.*;
|
|
import com.fs.common.utils.*;
|
|
|
|
|
+import com.fs.live.utils.CrossServiceRsaUtil;
|
|
|
import com.fs.company.domain.Company;
|
|
import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyDept;
|
|
import com.fs.company.domain.CompanyDept;
|
|
|
import com.fs.company.domain.CompanyMoneyLogs;
|
|
import com.fs.company.domain.CompanyMoneyLogs;
|
|
@@ -2901,6 +2902,31 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void getPhoneByHttp(LiveOrder liveOrder) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ String encryptedStr = CrossServiceRsaUtil.encryptForRequest("phone");
|
|
|
|
|
+ String url = "http://42.194.245.189:8010/app/common/getEncryptedPhone?encryptedStr="
|
|
|
|
|
+ + java.net.URLEncoder.encode(encryptedStr, "UTF-8")
|
|
|
|
|
+ + "&addressId=" + liveOrder.getAddressId();
|
|
|
|
|
+ org.springframework.web.client.RestTemplate restTemplate = new org.springframework.web.client.RestTemplate();
|
|
|
|
|
+ String responseBody = restTemplate.getForObject(url, String.class);
|
|
|
|
|
+ if (StringUtils.isNotEmpty(responseBody)) {
|
|
|
|
|
+ com.alibaba.fastjson.JSONObject respObj = com.alibaba.fastjson.JSON.parseObject(responseBody);
|
|
|
|
|
+ if (respObj != null && "200".equals(respObj.getString("code"))) {
|
|
|
|
|
+ String encryptedPhone = respObj.getString("data");
|
|
|
|
|
+ if (StringUtils.isNotEmpty(encryptedPhone)) {
|
|
|
|
|
+ String realPhone = CrossServiceRsaUtil.decryptResponse(encryptedPhone);
|
|
|
|
|
+ if (StringUtils.isNotEmpty(realPhone)) {
|
|
|
|
|
+ liveOrder.setUserPhone(realPhone);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
|
+ log.error("请求his_java获取加密手机号失败, userId:{}, addressId:{}", liveOrder.getUserId(), liveOrder.getAddressId(), ex);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public R createLiveOrderTest(LiveOrder liveOrder) {
|
|
public R createLiveOrderTest(LiveOrder liveOrder) {
|
|
|
String orderKey = redisCache.getCacheObject("orderKey:" + liveOrder.getOrderKey());
|
|
String orderKey = redisCache.getCacheObject("orderKey:" + liveOrder.getOrderKey());
|
|
@@ -3136,6 +3162,8 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
if (liveOrder.getUserAddress() == null) return R.error("用户地址不能为空");
|
|
if (liveOrder.getUserAddress() == null) return R.error("用户地址不能为空");
|
|
|
if (liveOrder.getTotalNum() == null) return R.error("商品数量不能为空");
|
|
if (liveOrder.getTotalNum() == null) return R.error("商品数量不能为空");
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
Live live = liveService.selectLiveByLiveId(liveOrder.getLiveId());
|
|
Live live = liveService.selectLiveByLiveId(liveOrder.getLiveId());
|
|
|
if (live == null) return R.error("当前直播不存在");
|
|
if (live == null) return R.error("当前直播不存在");
|
|
|
FsStoreProduct fsStoreProduct = fsStoreProductService.selectFsStoreProductById(liveOrder.getProductId());
|
|
FsStoreProduct fsStoreProduct = fsStoreProductService.selectFsStoreProductById(liveOrder.getProductId());
|
|
@@ -3192,6 +3220,27 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
// log.error("插入 liveGoodsStock 队列时被中断: {}", e.getMessage(), e);
|
|
// log.error("插入 liveGoodsStock 队列时被中断: {}", e.getMessage(), e);
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
+ // 判断用户手机号是否为脱敏格式(如177****5248),如果是则尝试替换为真实加密手机号
|
|
|
|
|
+ if (liveOrder.getUserPhone().contains("****")) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ FsUser fsUser = userService.selectFsUserById(Long.parseLong(liveOrder.getUserId()));
|
|
|
|
|
+ if (fsUser != null && StringUtils.isNotEmpty(fsUser.getPhone())) {
|
|
|
|
|
+ // fs_user的phone是AES加密存储的,脱敏后与liveOrder的脱敏手机号比较
|
|
|
|
|
+ String maskedPhone = ParseUtils.parsePhone(fsUser.getPhone());
|
|
|
|
|
+ if (maskedPhone != null && maskedPhone.equals(liveOrder.getUserPhone())) {
|
|
|
|
|
+ // 脱敏格式匹配,用fs_user的加密phone替换
|
|
|
|
|
+ liveOrder.setUserPhone(fsUser.getPhone());
|
|
|
|
|
+ } else if (liveOrder.getAddressId() != null) {
|
|
|
|
|
+ getPhoneByHttp(liveOrder);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (liveOrder.getAddressId() != null) {
|
|
|
|
|
+ // fs_user查不到,但有addressId,发起请求③
|
|
|
|
|
+ getPhoneByHttp(liveOrder);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("处理脱敏手机号替换异常, userId:{}", liveOrder.getUserId(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
//判断是否是三种特定产品
|
|
//判断是否是三种特定产品
|
|
|
if (fsStoreProduct.getProductId() != null && (fsStoreProduct.getProductId().equals(3168L)
|
|
if (fsStoreProduct.getProductId() != null && (fsStoreProduct.getProductId().equals(3168L)
|
|
|
|| fsStoreProduct.getProductId().equals(3184L)
|
|
|| fsStoreProduct.getProductId().equals(3184L)
|