admin
2022-08-25 146dbd5ed24c1fe63766aa45e0ce602caa39748e
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -25,7 +25,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoLink;
import com.yeshi.fanli.exception.dynamic.ActivityUserException;
import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException;
import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException;
import com.yeshi.fanli.exception.goods.ConvertLinkException;
import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.lijin.manager.GoodsLijinMnager;
@@ -437,7 +437,7 @@
        params.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system));
        if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
            try {
                TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(Long.parseLong(goodsId));
                TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(goodsId);
                goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(goodsBrief, params);
            } catch (TaobaoGoodsDownException e) {
                throw new GoodsEvaluateException(1, "商品已下架");
@@ -555,7 +555,7 @@
        String commentText = "";
        if (addComment) {
            if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
                TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(system, 1L, Long.parseLong(goodsId), "0", null);
                TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(system, 1L, goodsId, "0", null);
                String template = configService.getValue(ConfigKeyEnum.quickShareTBCommentText.getKey(), system);
                commentText = template.replace("[淘口令]", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
            } else if (goodsType == Constant.SOURCE_TYPE_JD) {
@@ -623,7 +623,7 @@
    private String createTokenAndLink(GoodsDetailVO goodsDetailVO, SystemEnum system) throws Exception {
        String commentText = "";
        if (goodsDetailVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
            TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(system, 1L, Long.parseLong(goodsDetailVO.getGoodsId()), "0", null);
            TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(system, 1L, goodsDetailVO.getGoodsId(), "0", null);
            String template = configService.getValue(ConfigKeyEnum.quickShareTBCommentText.getKey(), system);
            commentText = template.replace("[淘口令]", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
        } else if (goodsDetailVO.getGoodsType() == Constant.SOURCE_TYPE_JD) {
@@ -663,7 +663,7 @@
        return commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n");
    }
    public GoodsDetailVO getGoodsDetailVO(Long goodsId, Integer goodsType, SystemEnum system) throws GoodsEvaluateException {
    public GoodsDetailVO getGoodsDetailVO(String goodsId, Integer goodsType, SystemEnum system) throws GoodsEvaluateException {
        GoodsDetailVO goodsDetail = null;
        GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system);
        params.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system));
@@ -679,10 +679,10 @@
                throw new GoodsEvaluateException(1, "商品已下架");
            }
        } else if (goodsType == Constant.SOURCE_TYPE_JD) {
            JDGoods goodsInfo = jdGoodsCacheUtil.getGoodsInfo(goodsId);
            JDGoods goodsInfo = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsId));
            goodsDetail = GoodsDetailVOFactory.convertJDGoods(goodsInfo, params);
        } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
            PDDGoodsDetail goodsInfo = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
            PDDGoodsDetail goodsInfo = pinDuoDuoCacheUtil.getGoodsInfo(Long.parseLong(goodsId));
            goodsDetail = GoodsDetailVOFactory.convertPDDGoods(goodsInfo, params);
        }
        if (goodsDetail != null)
@@ -776,7 +776,7 @@
                for (int i = 0; i < goodsArray.length && i < 9; i++) {
                    String goodsids = goodsArray[i];
                    String[] g = goodsids.split("-");
                    GoodsDetailVO goodsDetailVO = getGoodsDetailVO(Long.parseLong(g[0]), Integer.parseInt(g[1]), resultObj.getSystem());
                    GoodsDetailVO goodsDetailVO = getGoodsDetailVO(g[0], Integer.parseInt(g[1]), resultObj.getSystem());
                    if (goodsDetailVO == null) {
                        continue;
                    }
@@ -997,8 +997,8 @@
        if (!StringUtil.isNullOrEmpty(content) && commentInfo.getNeedSpin()) {
            try {
                convertLinkManager.convertLinkFromText(system, content, Constant.LINK_TOKEN_VERIFY_UID, true, false);
            } catch (ConvertLinkExceptionException e) {
                if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) {
            } catch (ConvertLinkException e) {
                if (ConvertLinkException.CODE_NONE != e.getCode()) {
                    throw new GoodsEvaluateException(1, "包含不可转链的口令与链接");
                }
            } catch (Exception e) {
@@ -1721,7 +1721,7 @@
                                for (String st : activityIdList)
                                    content = content.replace(st, "");
                                content = content.replace("{relationId}", "");
                                if (system == SystemEnum.yhqjx) {
                                if (system == SystemEnum.yhqjx || system == SystemEnum.hsb) {
                                    content = content.replace("\n", "<br>");
                                }
                                commentInfoNew.setContent(content);
@@ -1813,7 +1813,7 @@
                                    simpleGoods.setState(1);
                                    simpleGoods.setRemarks("评论验证下架");
                                }
                                if (system == SystemEnum.yhqjx) {
                                if (system == SystemEnum.yhqjx || system == SystemEnum.hsb) {
                                    imgInfo.setGoods(null);
                                }
                            }
@@ -1965,7 +1965,7 @@
        if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
            TaoBaoGoodsBrief goods;
            try {
                goods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(goodsId));
                goods = redisManager.getTaoBaoGoodsBrief(goodsId);
                if (goods != null) {
                    vo = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
                }
@@ -2001,7 +2001,7 @@
        TaoBaoGoodsBrief goodsBrief = null;
        try {
            goodsBrief = redisManager.getTaoBaoGoodsBrief(Long.parseLong(goodsId));
            goodsBrief = redisManager.getTaoBaoGoodsBrief(goodsId);
        } catch (TaobaoGoodsDownException e) {
            throw new GoodsEvaluateException(1, "商品已下架");
        }
@@ -2133,7 +2133,7 @@
        }
        Date limitDate = DateUtil.reduceDay(new Date(), 7);
        Long goodsId = goodsBrief.getAuctionId();
        String goodsId = goodsBrief.getAuctionId();
        List<GoodsEvaluate> evaluateList = goodsEvaluateDao.queryExistLimitTime(Constant.SOURCE_TYPE_TAOBAO, goodsId + "", limitDate);
        if (evaluateList != null && evaluateList.size() > 0)
            throw new GoodsEvaluateException(1, "该商品已存在");
@@ -2152,7 +2152,7 @@
        // 商品图片信息
        int i = 0;
        List<ImgInfo> imgList = new ArrayList<ImgInfo>();
        List<ImgInfo> imgList = new ArrayList<>();
        for (String img : imgs) {
            ImgInfo imgInfo = new ImgInfo();
@@ -2301,7 +2301,7 @@
        Date limitDate = DateUtil.reduceDay(new Date(), 7);
        String identifyCode = "dataoke-" + StringUtil.Md5(DaTaoKeTipOffUtil.getRecoomendDesc(dto)) + "-" + dto.getUpdateTime().getTime();
        String identifyCode = "dataoke-" + StringUtil.Md5(DaTaoKeTipOffUtil.getRecoomendDesc(dto));
        GoodsEvaluate evaluate = goodsEvaluateDao.selectExistLimitTime(identifyCode, limitDate);
        if (evaluate != null)
@@ -2319,16 +2319,15 @@
            Set<String> imgSet = new HashSet<>();
            imgSet.addAll(imgs);
            String id = dto.getIdList().get(0);
            String source = dto.getSource();
            String source = dto.getPlatformType();
            switch (source) {
                case "tmall":
                case "taobao":
                case "tb":
                    try {
                        TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.getSimpleGoodsInfo(Long.parseLong(id));
                        TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.searchGoodsDetail(id);
                        if (goodsBrief != null && goodsBrief.getImgList() != null) {
                            GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system);
                            goods = GoodsDetailVOFactory.convertTaoBao(goodsBrief, params);
                            goods = goodsLijinMnager.loadTBMoneyInfo(system, null, goodsBrief, goods);
                            goods = goodsLijinMnager.loadTBMoneyInfo(system, null, goodsBrief, goods, false);
                            for (String img : goodsBrief.getImgList()) {
                                if (!imgSet.contains(img) && imgs.size() < 9) {
                                    imgSet.add(img);
@@ -2414,7 +2413,11 @@
        goodsEvaluate.setPublishTime(new Date());
        goodsEvaluate.setCreateTime(new Date());
        goodsEvaluate.setUpdateTime(new Date());
        goodsEvaluate.setGoods(goods);
        //线报不显示商品
        if (goods != null && goods.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
            goods.setCreatetime(null);
            goodsEvaluate.setGoods(goods);
        }
        goodsEvaluate.setLineNum(lineNum);
        goodsEvaluate.setImgList(imgList);
        goodsEvaluate.setComments(null);
@@ -2702,7 +2705,7 @@
            }
            for (SystemEnum system : SystemEnum.values()) {
                List<GoodsEvaluate> queryExist = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_TAOBAO,
                        goods.getAuctionId() + "", system);
                        goods.getAuctionId(), system);
                if (queryExist == null || queryExist.size() == 0) {
                    continue;
                }