| | |
| | | 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; |
| | |
| | | import com.yeshi.fanli.entity.dynamic.SimpleGoods; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink; |
| | | import com.yeshi.goods.facade.entity.taobao.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.share.ShareGoodsException; |
| | | 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; |
| | |
| | | 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.fanli.service.inter.taobao.dataoke.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 com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.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.fanli.vo.msg.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 { |
| | |
| | | |
| | | @Resource |
| | | private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service; |
| | | |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | @Override |
| | | public void switchState(String id) throws GoodsEvaluateException { |
| | |
| | | } |
| | | } |
| | | } |
| | | if (oldGoodsVO != null) { |
| | | oldGoodsVO.setCreatetime(null); |
| | | } |
| | | |
| | | // 视频部分 |
| | | if (fileRequest != null) { |
| | |
| | | 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; |
| | |
| | | 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) { |
| | |
| | | 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, "该商品转链失败"); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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 { |
| | |
| | | PDDGoodsDetail goodsInfo = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); |
| | | goodsDetail = GoodsDetailVOFactory.convertPDDGoods(goodsInfo, params); |
| | | } |
| | | if (goodsDetail != null) |
| | | goodsDetail.setCreatetime(null); |
| | | return goodsDetail; |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | |
| | | } |
| | | } 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, "不包含可转链的口令与链接"); |
| | | } |
| | |
| | | } |
| | | |
| | | @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, "请保存第一部分信息"); |
| | |
| | | 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) { |
| | |
| | | |
| | | if (typeEnum != null && typeEnum == EvaluateEnum.single) { |
| | | GoodsDetailVO goods = evaluateNew.getGoods(); |
| | | goods.setCreatetime(null); |
| | | if (goods != null) { |
| | | String content = commentInfoNew.getContent(); |
| | | if (!StringUtil.isNullOrEmpty(content)) { |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | 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("评论验证下架"); |
| | | } |
| | |
| | | if (simpleGoods != null) { |
| | | simpleGoods.setState(1); |
| | | simpleGoods.setRemarks("评论验证下架"); |
| | | } |
| | | if (system == SystemEnum.yhqjx || system == SystemEnum.hsb) { |
| | | imgInfo.setGoods(null); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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; |
| | | } |
| | |
| | | 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(); |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | |
| | | } 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); |
| | | } |
| | |
| | | |
| | | TaoBaoGoodsBrief goodsBrief = null; |
| | | try { |
| | | goodsBrief = redisManager.getTaoBaoGoodsBrief(Long.parseLong(goodsId)); |
| | | goodsBrief = redisManager.getTaoBaoGoodsBrief(goodsId); |
| | | } catch (TaobaoGoodsDownException e) { |
| | | throw new GoodsEvaluateException(1, "商品已下架"); |
| | | } |
| | |
| | | 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); |
| | | |
| | |
| | | } |
| | | 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, "该商品已存在"); |
| | |
| | | } |
| | | |
| | | // 商品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(); |
| | |
| | | // 生成口令 |
| | | 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(); |
| | |
| | | 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; |
| | |
| | | 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); |
| | | |
| | |
| | | } |
| | | 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); |
| | |
| | | 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); |
| | | |
| | |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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); |