From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java | 400 +++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 306 insertions(+), 94 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java index 891119e..b1d7ff1 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java @@ -1,42 +1,15 @@ package com.yeshi.fanli.service.impl.dynamic; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.math.BigDecimal; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.annotation.Resource; -import javax.imageio.ImageIO; - -import com.yeshi.fanli.entity.SystemEnum; -import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException; -import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager; -import org.apache.commons.beanutils.PropertyUtils; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.core.task.TaskExecutor; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.yeshi.utils.DateUtil; -import org.yeshi.utils.ImageCropUtil; -import org.yeshi.utils.tencentcloud.COSManager; - +import com.yeshi.common.vo.ClientTextStyleVO; import com.yeshi.fanli.dao.dynamic.GoodsEvaluateDao; -import com.yeshi.fanli.dto.ConfigParamsDTO; +import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; import com.yeshi.fanli.dto.jd.JDCouponInfo; import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; import com.yeshi.fanli.dto.suning.SuningGoodsInfo; import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; +import com.yeshi.fanli.entity.SystemEnum; +import com.yeshi.fanli.entity.SystemFunction; +import com.yeshi.fanli.entity.SystemPIDInfo; import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser; import com.yeshi.fanli.entity.bus.activity.ActivityUser; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; @@ -49,13 +22,13 @@ import com.yeshi.fanli.entity.dynamic.SimpleGoods; import com.yeshi.fanli.entity.jd.JDGoods; import com.yeshi.fanli.entity.system.ConfigKeyEnum; -import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoLink; -import com.yeshi.goods.facade.entity.taobao.dataoke.DaTaoKeDetailV2; 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; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.activity.ActivityUserService; import com.yeshi.fanli.service.inter.config.ConfigService; @@ -63,26 +36,52 @@ import com.yeshi.fanli.service.inter.goods.ShareGoodsService; import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; -import com.yeshi.goods.facade.service.DaTaoKeGoodsDetailV2Service; +import com.yeshi.fanli.service.manger.PIDManager; import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; -import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.FilePathEnum; -import com.yeshi.fanli.util.FileUtil; -import org.yeshi.utils.MoneyBigDecimalUtil; -import com.yeshi.fanli.util.RedisManager; -import com.yeshi.fanli.util.StringUtil; -import org.yeshi.utils.TimeUtil; +import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager; +import com.yeshi.fanli.service.manger.goods.tb.DaTaoKeTipOffManager; +import com.yeshi.fanli.util.*; import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil; +import com.yeshi.fanli.util.factory.CommonGoodsFactory; import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; +import com.yeshi.fanli.util.goods.douyin.vo.DYGoods; +import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; import com.yeshi.fanli.util.jd.JDApiUtil; import com.yeshi.fanli.util.jd.JDUtil; import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; +import com.yeshi.fanli.util.taobao.DaTaoKeTipOffUtil; import com.yeshi.fanli.util.taobao.DaTaoKeUtil; import com.yeshi.fanli.util.taobao.TaoBaoUtil; +import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.vo.goods.CouponInfoVO; import com.yeshi.fanli.vo.goods.GoodsDetailVO; -import com.yeshi.common.vo.ClientTextStyleVO; +import com.yeshi.goods.facade.dto.taobao.dataoke.DaTaoKeListTopOffDTO; +import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; +import com.yeshi.goods.facade.entity.taobao.dataoke.DaTaoKeDetailV2; +import com.yeshi.goods.facade.service.DaTaoKeGoodsDetailV2Service; +import org.apache.commons.beanutils.PropertyUtils; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.core.task.TaskExecutor; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.yeshi.utils.DateUtil; +import org.yeshi.utils.ImageCropUtil; +import org.yeshi.utils.MoneyBigDecimalUtil; +import org.yeshi.utils.TimeUtil; +import org.yeshi.utils.tencentcloud.COSManager; + +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.*; @Service public class GoodsEvaluateServiceImpl implements GoodsEvaluateService { @@ -125,6 +124,13 @@ @Resource private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; + + + @Resource + private PIDManager pidManager; + + @Resource + private GoodsLijinMnager goodsLijinMnager; @Override public void switchState(String id) throws GoodsEvaluateException { @@ -340,6 +346,9 @@ } } } + if (oldGoodsVO != null) { + oldGoodsVO.setCreatetime(null); + } // 瑙嗛閮ㄥ垎 if (fileRequest != null) { @@ -426,26 +435,28 @@ GoodsDetailVO goodsDetailVO = null; JDGoods jdGoods = null; PDDGoodsDetail pddGoods = null; - ConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); 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, "鍟嗗搧宸蹭笅鏋�"); } } else if (goodsType == Constant.SOURCE_TYPE_JD) { - jdGoods = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsId)); + jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsId); goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(jdGoods, params); } else if (goodsType == Constant.SOURCE_TYPE_PDD) { - pddGoods = pinDuoDuoCacheUtil.getGoodsInfo(Long.parseLong(goodsId)); + pddGoods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(pddGoods, params); } if (goodsDetailVO == null) { throw new GoodsEvaluateException(1, "璇ュ晢鍝佷俊鎭笉瀛樺湪"); } + + goodsDetailVO.setCreatetime(null); List<ImgInfo> tempList = new ArrayList<ImgInfo>(); int totalImg = 0; @@ -546,7 +557,7 @@ String commentText = ""; if (addComment) { if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { - TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(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) { @@ -556,15 +567,17 @@ couponUrl = couponInfo.getLink(); } String materialId = "https://item.jd.com/" + goodsId + ".html"; - String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, - JDApiUtil.POSITION_SHARE + "", "1"); + String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, + pidManager.getPidCache(system, Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.share), "1"); String template = configService.getValue(ConfigKeyEnum.quickShareJDCommentText.getKey(), system); if (jumpLink == null) { throw new GoodsEvaluateException(1, "璇ュ晢鍝佽浆閾惧け璐�"); } commentText = template.replace("[閾炬帴]", jumpLink); } else if (goodsType == Constant.SOURCE_TYPE_PDD) { - String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(Long.parseLong(goodsId), PinDuoDuoApiUtil.PID_SHARE + "", "1"); + String sharePid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.share); + PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(goodsId, sharePid, "1"); + String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsDetail.getGoodsSign(), sharePid, "1"); if (jumpLink == null) { throw new GoodsEvaluateException(1, "璇ュ晢鍝佽浆閾惧け璐�"); } @@ -612,25 +625,31 @@ private String createTokenAndLink(GoodsDetailVO goodsDetailVO, SystemEnum system) throws Exception { String commentText = ""; if (goodsDetailVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { - TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(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) { String couponUrl = null; - JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsDetailVO.getGoodsId())); + JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsDetailVO.getGoodsId()); JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(jdGoods); if (couponInfo != null) { couponUrl = couponInfo.getLink(); } String materialId = "https://item.jd.com/" + goodsDetailVO.getGoodsId() + ".html"; - String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", + String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, pidManager.getPidCache(system, Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.share), "1"); String template = configService.getValue(ConfigKeyEnum.quickShareJDCommentText.getKey(), system); commentText = template.replace("[閾炬帴]", jumpLink); } else if (goodsDetailVO.getGoodsType() == Constant.SOURCE_TYPE_PDD) { - String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(Long.parseLong(goodsDetailVO.getGoodsId()), - PinDuoDuoApiUtil.PID_SHARE + "", "1"); + + String sharePid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.share); + + PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(goodsDetailVO.getGoodsId(), + sharePid, "1"); + + String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsDetail.getGoodsSign(), + sharePid, "1"); String template = configService.getValue(ConfigKeyEnum.quickSharePDDCommentText.getKey(), system); commentText = template.replace("[閾炬帴]", jumpLink); } @@ -646,9 +665,9 @@ 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; - ConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); params.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { try { @@ -668,6 +687,8 @@ PDDGoodsDetail goodsInfo = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); goodsDetail = GoodsDetailVOFactory.convertPDDGoods(goodsInfo, params); } + if (goodsDetail != null) + goodsDetail.setCreatetime(null); return goodsDetail; } @@ -757,7 +778,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; } @@ -907,7 +928,7 @@ } } else if (i == 0 && kind == 1) { try { - convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true); + convertLinkManager.convertLinkFromText(system, content, Constant.LINK_TOKEN_VERIFY_UID, true, false); } catch (Exception e) { throw new GoodsEvaluateException(1, "涓嶅寘鍚彲杞摼鐨勫彛浠や笌閾炬帴"); } @@ -932,7 +953,7 @@ } @Override - public void saveCurrencyCoupon(String pid, int kind, CommentInfo commentInfo) + public void saveCurrencyCoupon(SystemEnum system, String pid, int kind, CommentInfo commentInfo) throws GoodsEvaluateException, Exception { if (StringUtil.isNullOrEmpty(pid)) { throw new GoodsEvaluateException(1, "璇蜂繚瀛樼涓�閮ㄥ垎淇℃伅"); @@ -977,9 +998,9 @@ String content = commentInfo.getContent(); if (!StringUtil.isNullOrEmpty(content) && commentInfo.getNeedSpin()) { try { - convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true); - } catch (ConvertLinkExceptionException e) { - if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) { + convertLinkManager.convertLinkFromText(system, content, Constant.LINK_TOKEN_VERIFY_UID, true, false); + } catch (ConvertLinkException e) { + if (ConvertLinkException.CODE_NONE != e.getCode()) { throw new GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴"); } } catch (Exception e) { @@ -1682,6 +1703,7 @@ if (typeEnum != null && typeEnum == EvaluateEnum.single) { GoodsDetailVO goods = evaluateNew.getGoods(); + goods.setCreatetime(null); if (goods != null) { String content = commentInfoNew.getContent(); if (!StringUtil.isNullOrEmpty(content)) { @@ -1700,7 +1722,10 @@ List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(content); for (String st : activityIdList) content = content.replace(st, ""); - + content = content.replace("{relationId}", ""); + if (system == SystemEnum.yhqjx || system == SystemEnum.hsb) { + content = content.replace("\n", "<br>"); + } commentInfoNew.setContent(content); } } @@ -1711,12 +1736,15 @@ List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(content); for (String st : activityIdList) content = content.replace(st, ""); + content = content.replace("{relationId}", ""); + commentInfoNew.setContent(content); } CommentInfoEnum typeComment = commentInfoNew.getTypeEnum(); if (typeComment != null && typeComment == CommentInfoEnum.goodsCoupon) { GoodsDetailVO goods = evaluateNew.getGoods(); + goods.setCreatetime(null); if (goods != null && goods.isHasCoupon()) { commentNew.add(commentInfoNew); continue; @@ -1758,9 +1786,23 @@ evaluateNew.setComments(commentNew); if (typeEnum != null && typeEnum == EvaluateEnum.single) { + + if (!SystemInfoUtil.hasFunctions(system, SystemFunction.share)) { + List<ImgInfo> imgList = evaluateNew.getImgList(); + if (imgList != null) { + for (ImgInfo imgInfo : imgList) { + imgInfo.setGoods(null); + if (imgInfo.getType() == ImgEnum.goods) + imgInfo.setType(ImgEnum.img); + } + } + } + + if (!currencyCoupon && !singleCoupn) { // 鎵�鏈夊埜璇勮涓嬫灦 GoodsDetailVO goods = evaluateNew.getGoods(); if (goods != null) { + goods.setCreatetime(null); goods.setState(1); // 璇勮涓嶅瓨鍦� 涓嬫灦 evaluateNew.setRemarks("璇勮楠岃瘉涓嬫灦"); } @@ -1772,6 +1814,9 @@ if (simpleGoods != null) { simpleGoods.setState(1); simpleGoods.setRemarks("璇勮楠岃瘉涓嬫灦"); + } + if (system == SystemEnum.yhqjx || system == SystemEnum.hsb) { + imgInfo.setGoods(null); } } @@ -1785,17 +1830,19 @@ List<GoodsEvaluate> listOBJ = list; // 鏇存柊鍟嗗搧淇℃伅 - executor.execute(new Runnable() { - @Override - public void run() { - updateGoodInfo(listOBJ); + executor.execute(new - // 鍒犻櫎宸茶繃鏈� - removeOverdue(); + Runnable() { + @Override + public void run() { + updateGoodInfo(listOBJ); - removeDownGoods(); - } - }); + // 鍒犻櫎宸茶繃鏈� + removeOverdue(); + + removeDownGoods(); + } + }); return listNew; } @@ -1822,7 +1869,7 @@ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); for (GoodsEvaluate goodsEvaluate : list) { - ConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", goodsEvaluate.getSystem()); + GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", goodsEvaluate.getSystem()); params.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(goodsEvaluate.getSystem())); // 鏄惁2涓皬鏃朵箣鍐呭凡鏇存柊 Date updateTime = goodsEvaluate.getUpdateTime(); @@ -1915,12 +1962,12 @@ } } - private GoodsDetailVO getGoodsNewInfo(String goodsId, int goodsType, ConfigParamsDTO paramsDTO) { + private GoodsDetailVO getGoodsNewInfo(String goodsId, int goodsType, GoodsMoneyConfigParamsDTO paramsDTO) { GoodsDetailVO vo = null; 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); } @@ -1929,12 +1976,12 @@ } } else if (goodsType == Constant.SOURCE_TYPE_JD) { - JDGoods goodsInfo = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsId)); + JDGoods goodsInfo = jdGoodsCacheUtil.getGoodsInfo(goodsId); if (goodsInfo != null) { vo = GoodsDetailVOFactory.convertJDGoods(goodsInfo, paramsDTO); } } else if (goodsType == Constant.SOURCE_TYPE_PDD) { - PDDGoodsDetail goodsInfo = pinDuoDuoCacheUtil.getGoodsInfo(Long.parseLong(goodsId)); + PDDGoodsDetail goodsInfo = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); if (goodsInfo != null) vo = GoodsDetailVOFactory.convertPDDGoods(goodsInfo, paramsDTO); } @@ -1956,7 +2003,7 @@ TaoBaoGoodsBrief goodsBrief = null; try { - goodsBrief = redisManager.getTaoBaoGoodsBrief(Long.parseLong(goodsId)); + goodsBrief = redisManager.getTaoBaoGoodsBrief(goodsId); } catch (TaobaoGoodsDownException e) { throw new GoodsEvaluateException(1, "鍟嗗搧宸蹭笅鏋�"); } @@ -1976,7 +2023,7 @@ imgs.addAll(goodsBrief.getImgList()); // 鍟嗗搧VO - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); GoodsDetailVO goodsVO = GoodsDetailVOFactory.convertTaoBao(goodsBrief, paramsDTO); @@ -2088,7 +2135,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, "璇ュ晢鍝佸凡瀛樺湪"); @@ -2101,13 +2148,13 @@ } // 鍟嗗搧VO - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); GoodsDetailVO goodsVO = GoodsDetailVOFactory.convertTaoBao(goodsBrief, paramsDTO); // 鍟嗗搧鍥剧墖淇℃伅 int i = 0; - List<ImgInfo> imgList = new ArrayList<ImgInfo>(); + List<ImgInfo> imgList = new ArrayList<>(); for (String img : imgs) { ImgInfo imgInfo = new ImgInfo(); @@ -2142,7 +2189,7 @@ // 鐢熸垚鍙d护 String token = null; try { - TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(Constant.LINK_TOKEN_VERIFY_UID, goodsBrief.getAuctionId(), "1", null); + TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(system, Constant.LINK_TOKEN_VERIFY_UID, goodsBrief.getAuctionId(), Constant.LINK_TOKEN_VERIFY_RELATION_ID, null); token = taoBaoLink.getTaoToken(); } catch (TaoBaoConvertLinkException e) { e.printStackTrace(); @@ -2236,6 +2283,152 @@ return result; } + @Resource + private DaTaoKeTipOffManager daTaoKeTipOffManager; + + @Override + public int addGoodsEvaluate(DaTaoKeListTopOffDTO dto, ActivityUser user, SystemEnum system) throws GoodsEvaluateException { + if (dto == null || user == null || system == null) { + throw new GoodsEvaluateException(1, "鐩稿叧鍙傛暟涓嶈兘涓虹┖"); + } + + String title = null; + + try { + title = daTaoKeTipOffManager.convertLinkForEvaluateWithEncode(dto, system); + } catch (Exception e) { + throw new GoodsEvaluateException(1, "杞摼鍑洪敊"); + } + + + Date limitDate = DateUtil.reduceDay(new Date(), 7); + + String identifyCode = "dataoke-" + StringUtil.Md5(DaTaoKeTipOffUtil.getRecoomendDesc(dto)); + + GoodsEvaluate evaluate = goodsEvaluateDao.selectExistLimitTime(identifyCode, limitDate); + if (evaluate != null) + throw new GoodsEvaluateException(1, "绾挎姤宸插瓨鍦�"); + + List<String> imgs = new ArrayList<>(); + if (!StringUtil.isNullOrEmpty(dto.getPicUrls())) { + imgs.addAll(Arrays.asList(dto.getPicUrls().split(","))); + } + + GoodsDetailVO goods = null; + + //鑾峰彇鍥剧墖 + if (!StringUtil.isNullOrEmpty( dto.getItemIds())) { + Set<String> imgSet = new HashSet<>(); + imgSet.addAll(imgs); + String id = dto.getItemIds().split(",")[0]; + String source = dto.getPlatform(); + switch (source) { + case "娣樺疂": + try { + 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, false); + for (String img : goodsBrief.getImgList()) { + if (!imgSet.contains(img) && imgs.size() < 9) { + imgSet.add(img); + imgs.add(img); + } + } + } + + } catch (TaobaoGoodsDownException e) { + e.printStackTrace(); + } + break; + case "浜笢": { + JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); + if (jdGoods != null && jdGoods.getImageList() != null) { + GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + goods = GoodsDetailVOFactory.convertJDGoods(jdGoods, params); + goods = goodsLijinMnager.loadOtherMoneyInfo(system, null, CommonGoodsFactory.create(jdGoods), goods); + for (String img : jdGoods.getImageList()) { + if (!imgSet.contains(img) && imgs.size() < 9) { + imgSet.add(img); + imgs.add(img); + } + } + } + } + break; + case "鎷煎澶�": { + PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(id); + if (goodsDetail != null && goodsDetail.getGoodsGalleryUrls() != null) { + GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + goods = GoodsDetailVOFactory.convertPDDGoods(goodsDetail, params); + goods = goodsLijinMnager.loadOtherMoneyInfo(system, null, CommonGoodsFactory.create(goodsDetail), goods); + + for (String img : goodsDetail.getGoodsGalleryUrls()) { + if (!imgSet.contains(img) && imgs.size() < 9) { + imgSet.add(img); + imgs.add(img); + } + } + } + } + break; + default: + throw new GoodsEvaluateException(1, "涓嶆敮鎸佺殑source锛�" + source); + } + } + + + // 鍟嗗搧鍥剧墖淇℃伅 + List<ImgInfo> imgList = new ArrayList<>(); + for (String img : imgs) { + ImgInfo imgInfo = new ImgInfo(); + imgInfo.setH(1); + imgInfo.setW(1); + imgInfo.setLarge(false); + imgInfo.setUrl(img); + imgInfo.setUrlHD(img); + imgInfo.setType(ImgEnum.img); + imgList.add(imgInfo); + } + + // 涓�琛屾樉绀哄灏戜釜鍥剧墖 + int lineNum = 3; + int result = 0; + int zeroPoint = 0; + Date startTime = new Date(); + + + GoodsEvaluate goodsEvaluate = new GoodsEvaluate(); + goodsEvaluate.setId(UUID.randomUUID().toString().replace("-", "")); + goodsEvaluate.setUser(user); + goodsEvaluate.setTitle(title); + goodsEvaluate.setState(1); + goodsEvaluate.setZeroPoint(zeroPoint); + goodsEvaluate.setDynamicType(1); + goodsEvaluate.setType(EvaluateEnum.single); + goodsEvaluate.setShareNum((int) (Math.random() * 5000) + 1000); + goodsEvaluate.setShareNumReal(0); + goodsEvaluate.setWeight(0.0); + goodsEvaluate.setStartTime(startTime); + goodsEvaluate.setEndTime(DateUtil.plusDayDate(3, startTime)); + goodsEvaluate.setPublishTime(new Date()); + goodsEvaluate.setCreateTime(new Date()); + goodsEvaluate.setUpdateTime(new Date()); + //绾挎姤涓嶆樉绀哄晢鍝� + if (goods != null && goods.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { + goods.setCreatetime(null); + goodsEvaluate.setGoods(goods); + } + goodsEvaluate.setLineNum(lineNum); + goodsEvaluate.setImgList(imgList); + goodsEvaluate.setComments(null); + goodsEvaluate.setSystem(system); + goodsEvaluate.setIdentifyCode(identifyCode); + goodsEvaluateDao.save(goodsEvaluate); + return result; + } + @Override public void addGoodsEvaluateByDaTaoKe(SystemEnum system) { List<Long> listId = null; @@ -2288,7 +2481,7 @@ return false; } - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); GoodsDetailVO goodsVO = GoodsDetailVOFactory.convertTaoBao(goodsBrief, paramsDTO); @@ -2514,11 +2707,11 @@ } 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; } - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); updateGoods(queryExist, goodsNew); @@ -2535,12 +2728,12 @@ return; } for (SystemEnum system : SystemEnum.values()) { - List<GoodsEvaluate> queryExist = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_JD, jdGoods.getSkuId() + "", system); + List<GoodsEvaluate> queryExist = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_JD, jdGoods.getItemId() + "", system); if (queryExist == null || queryExist.size() == 0) { continue; } - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO); @@ -2559,7 +2752,7 @@ continue; } - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO); updateGoods(queryExist, goodsNew); @@ -2578,9 +2771,28 @@ continue; } - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertVIPGoods(goods, paramsDTO); + updateGoods(queryExist, goodsNew); + } + } + + @Override + public void updateDYGoods(DYGoodsDetail goods) { + if (goods == null) { + return; + } + for (SystemEnum system : SystemEnum.values()) { + List<GoodsEvaluate> queryExist = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_DY, + goods.getProduct_id()+"", system); + if (queryExist == null || queryExist.size() == 0) { + continue; + } + + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); + GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertDYGoods(goods, paramsDTO); updateGoods(queryExist, goodsNew); } } @@ -2596,7 +2808,7 @@ if (queryExist == null || queryExist.size() == 0) { continue; } - ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); + GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate(system)); GoodsDetailVO goodsNew = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO); updateGoods(queryExist, goodsNew); -- Gitblit v1.8.0