yujian
2020-06-30 c952838555e557097f84a47624bc2860e0a2d9a8
云发单异步 + 首单
3个文件已修改
89 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/cloud/UserCloudServiceImpl.java 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/UserInfoAdminController.java
@@ -538,12 +538,16 @@
        JSONObject data = new JSONObject();
        
        Integer state = user.getState();
        if (state == UserInfo.STATE_FORBIDDEN) {
            data.put("state", false);
        } else {
            data.put("state", true);
        if (state == UserInfo.STATE_NORMAL) {
            data.put("stateDesc", "正常");
        } else if (state == UserInfo.STATE_DELETE) {
            data.put("stateDesc", "已删除");
        } else if (state == UserInfo.STATE_FORBIDDEN) {
            data.put("stateDesc", "已封禁");
        } else if (state == UserInfo.STATE_DELETE_OUT_OF_DATE) {
            data.put("stateDesc",  "长期未登录删除");
        }
        data.put("state", state);
        data.put("phone", user.getPhone());
        
        // 微信授权
@@ -592,10 +596,10 @@
            // 支付宝
            if (type != null && type == 1) {
                accountState = true;
                accountName = bindingAccount.getName();
                accountName = bindingAccount.getAccount();
            } 
        }
        data.put("accountName", accountName);
        data.put("account", accountName);
        data.put("accountState", accountState);
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
    }
fanli/src/main/java/com/yeshi/fanli/mapping/order/CommonOrderMapper.xml
@@ -1235,6 +1235,7 @@
    <select id="getFirstOrder" resultMap="BaseResultMap">
        SELECT * FROM `yeshi_ec_common_order` d
        WHERE d.co_uid = #{uid}
        limit 1
        ORDER BY co.co_third_create_time
        LIMIT 1
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/user/cloud/UserCloudServiceImpl.java
@@ -14,7 +14,6 @@
import org.yeshi.utils.BigDecimalUtil;
import org.yeshi.utils.taobao.TbImgUtil;
import com.alibaba.druid.support.logging.Log;
import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.Producer;
import com.yeshi.fanli.dao.mybatis.user.cloud.UserCloudMapper;
@@ -533,6 +532,17 @@
        if (!hasToken)
            throw new UserCloudException(1, "该内容包含可转链口令或链接");
        // 异步执行发送
        executor.execute(new Runnable() {
            @Override
            public void run() {
                sendEvaluate(uid, evaluate, way, userCloud, listOpen, listComment);
            }
        });
    }
    private void sendEvaluate(Long uid, GoodsEvaluate evaluate, int way, UserCloud userCloud,
            List<UserCloudGroup> listOpen, List<String> listComment) {
        ImgInfo imgVideo = null;
        List<String> listImg = new ArrayList<>();
@@ -547,14 +557,12 @@
            }
        }
        
        long time7= java.lang.System.currentTimeMillis();
        LogHelper.test("sendCircleByDynamic发圈内容组织转链:" + (time7 - time6));
        String wxId = userCloud.getWxId();
        Integer robotId = userCloud.getRobotId();
        // 保存发送记录
        UserCloudSendRecord sendRecord = new UserCloudSendRecord();
        sendRecord.setUid(uid);
        sendRecord.setSendId(id);
        sendRecord.setSendId(evaluate.getId());
        sendRecord.setSendWay(way);
        sendRecord.setWxId(wxId);
        sendRecord.setRobotId(robotId);
@@ -562,9 +570,6 @@
        sendRecord.setSendOrigin(UserCloudSendRecord.ORIGIN_EVALUATE);
        UserCloudSendRecord result = userCloudSendRecordService.save(sendRecord);
        String pid = result.getId();
        long time8= java.lang.System.currentTimeMillis();
        LogHelper.test("sendCircleByDynamic保存发圈记录:" + (time8 - time7));
        
        
        for (UserCloudGroup cloudGroup : listOpen) {
@@ -658,11 +663,9 @@
            }
            userCloudSendContentService.save(sendContent);
        }
        long time9= java.lang.System.currentTimeMillis();
        LogHelper.test("sendCircleByDynamic执行发圈耗时:" + (time9 - time8));
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -908,8 +911,13 @@
        String commentText = shareGoodsTextTemplateService.getCommentTextByTaoToken(coupon, taoBaoLink.getTaoToken(),
                goods.getZkPrice().toString(), quanPrice);
        // 云发单
        // 异步执行发送
        executor.execute(new Runnable() {
            @Override
            public void run() {
        sendGoods(robotId, wxId, listOpen, recommendText, commentText, goods.getImgList(), user.getId(), pid);
            }
        });
    }
    /**
@@ -966,8 +974,14 @@
        String commentText = shareGoodsTextTemplateService.getCommentTextByLink(coupon, jumpLink, zkPrice, quanPrice,
                ConfigKeyEnum.quickShareJDCommentText);
        // 云发单
        // 异步执行发送
        executor.execute(new Runnable() {
            @Override
            public void run() {
        sendGoods(robotId, wxId, listOpen, recommendText, commentText, jdGoods.getImageList(), user.getId(), pid);
            }
        });
    }
    /**
@@ -1023,8 +1037,16 @@
        if (goodsGalleryUrls != null && goodsGalleryUrls.length > 0) {
            list = Arrays.asList(goodsGalleryUrls);
        }
        // 云发单
        sendGoods(robotId, wxId, listOpen, recommendText, commentText, list, user.getId(), pid);
        List<String> list2 = list;
        // 异步执行发送
        executor.execute(new Runnable() {
            @Override
            public void run() {
                sendGoods(robotId, wxId, listOpen, recommendText, commentText, list2, user.getId(), pid);
            }
        });
    }
    /**
@@ -1059,9 +1081,14 @@
        String commentText = shareGoodsTextTemplateService.getCommentTextByLink(coupon, jumpLink,
                goods.getMarketPrice(), quanPrice, ConfigKeyEnum.quickShareVIPCommentText);
        // 云发单
        // 异步执行发送
        executor.execute(new Runnable() {
            @Override
            public void run() {
        sendGoods(robotId, wxId, listOpen, recommendText, commentText, goods.getGoodsDetailPictures(), user.getId(),
                pid);
            }
        });
    }
    /**
@@ -1106,9 +1133,14 @@
            imgList.add(img.getPicUrl());
        }
        executor.execute(new Runnable() {
            @Override
            public void run() {
        // 云发单
        sendGoods(robotId, wxId, listOpen, recommendText, commentText, imgList, user.getId(), pid);
    }
        });
    }
    /**
     * 发送商品