ANDRU-PC\Andru
2022-07-07 45739eda6d68c398882507bcb682772299449024
提交修改crm发送短信
2个文件已修改
55 ■■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/service/userMoney/impl/UserMoneyUnclaimedServiceImpl.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/util/api/UserMoneyUtil.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/userMoney/impl/UserMoneyUnclaimedServiceImpl.java
@@ -9,6 +9,8 @@
import com.hx.phiappt.common.OriginChannelConstants;
import com.hx.phiappt.constants.tool.money.UserMoneyTool;
import com.hx.phiappt.model.*;
import com.hx.phiappt.model.order.OrderItem;
import com.hx.phiappt.model.order.OrdersTotal;
import com.hx.phip.common.wx.corp.WeiXinMpUtil;
import com.hx.phip.dao.mapper.*;
import com.hx.phip.model.ApplyParameter;
@@ -114,6 +116,13 @@
        int count = userMoneyUnclaimedMapper.insert(userMoneyUnclaimed);
        if (count != 1) {
            throw new TipsException("新增失败!");
        } else {
            // 重新获取下数据
            UserMoneyUnclaimed checkUserMoneyUnclaimed = userMoneyUnclaimedMapper.selectOneByKey(userMoneyUnclaimed.getId());
            if(checkUserMoneyUnclaimed != null) {
                // 过滤待领取的数据
                this.handlerReceiveData(checkUserMoneyUnclaimed, BaseEntity.YES);
            }
        }
    }
@@ -329,7 +338,7 @@
        }
        // 判断订单 先不判断订单
        /*if(!StringUtils.isEmpty(userMoneyUnclaimed.getOrderId())){
        if(!StringUtils.isEmpty(userMoneyUnclaimed.getOrderId())){
            OrdersTotal ordersTotal = commonService.selectOneByKey(OrdersTotalMapper.class, userMoneyUnclaimed.getOrderId());
            if(ordersTotal == null){
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "主订单的信息不存在");
@@ -349,7 +358,7 @@
                    throw new PlatTipsException(PlatformCode.ERROR_TIPS, "子订单的信息与主订单的信息不匹配");
                }
            }
        }*/
        }
        // 获取有效期时间配置 待领取默认30天领取
        Date validityTime = UserMoneyTool.getUnclaimedValidityTime(commonService);
@@ -412,14 +421,14 @@
    private void checkIsNeedSentSMS(UserMoneyUnclaimed userMoneyUnclaimed){
        if(!StringUtils.isEmpty(userMoneyUnclaimed.getOriginChannel()) && userMoneyUnclaimed.getOpType() == UserMoneyUnclaimed.OP_TYPE_RECEIVE) {
            // CRM不用发送短信领取其他平台需要发送短信领取
            if(!OriginChannelConstants.ORIGIN_CHANNEL_CRM.equals(userMoneyUnclaimed.getOriginChannel())) {
                userMoneyUnclaimed.setIsSentSMS(BaseEntity.YES);
                String url = getSMSUrl();
                if(StringUtils.isEmpty(url)){
                    throw new PlatTipsException(PlatformCode.ERROR_TIPS, "获取发送短信链接地址出现异常!");
                }
                userMoneyUnclaimed.setSMSUrl(url);
            // if(!OriginChannelConstants.ORIGIN_CHANNEL_CRM.equals(userMoneyUnclaimed.getOriginChannel())) {
            userMoneyUnclaimed.setIsSentSMS(BaseEntity.YES);
            String url = getSMSUrl();
            if (StringUtils.isEmpty(url)) {
                throw new PlatTipsException(PlatformCode.ERROR_TIPS, "获取发送短信链接地址出现异常!");
            }
            userMoneyUnclaimed.setSMSUrl(url);
            //}
        }
    }
phi_platform_user/src/main/java/com/hx/phip/util/api/UserMoneyUtil.java
@@ -58,39 +58,19 @@
    /**
     * 添加待处理资金数据
     */
    public static  String addUserMoneyUnclaimedData(UserMoneyUnclaimed userMoneyUnclaimed){
    public static  String addUserMoneyUnclaimedData(UserMoneyUnclaimed userMoneyUnclaimed) {
        //调用工具类打印入参
        try{
        try {
            String jsonString = JSONObject.toJSONString(userMoneyUnclaimed);
            logger.info("添加待处理资金数据调用工具类打印入参:{}", jsonString);
        } catch (Exception ex){
            logger.error("打印入参解析失败:",ex);
        } catch (Exception ex) {
            logger.error("打印入参解析失败:", ex);
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "打印入参解析失败");
        }
        // 校验参数
        userMoneyUtil.userMoneyUnclaimedService.checkParam(userMoneyUnclaimed);
        // 添加数据
        userMoneyUtil.userMoneyUnclaimedService.insert(userMoneyUnclaimed);
        // 处理数据id
        String id = userMoneyUnclaimed.getId();
        // 固定线程池
        ExecutorService threadPool = Executors.newFixedThreadPool(5);
        // 多线程处理领取用户资产
        threadPool.execute(() -> {
            try {
                // 重新获取下数据
                UserMoneyUnclaimed checkUserMoneyUnclaimed = userMoneyUtil.userMoneyUnclaimedService.selectOneByKey(id);
                if(checkUserMoneyUnclaimed != null) {
                    // 过滤待领取的数据
                    userMoneyUtil.userMoneyUnclaimedService.handlerReceiveData(checkUserMoneyUnclaimed, BaseEntity.YES);
                    // 成功后打印日志
                    logger.error("用户资产领取id:{} 处理用户资产操作成功!", id);
                }
            } catch (Exception ex){
                logger.error("用户资产领取id:{} 处理用户资产操作出现错误", id, ex);
            }
        });
        logger.info("添加待处理资金数据成功!数据id:{}", userMoneyUnclaimed.getId());
        // 成功返回id
        return userMoneyUnclaimed.getId();
    }