| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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) { |
| | |
| | | commentText = template.replace("[链接]", jumpLink); |
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) { |
| | | String sharePid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.share); |
| | | PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId), sharePid, "1"); |
| | | 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(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) { |
| | | 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 sharePid = pidManager.getPidCache(system, Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.share); |
| | | |
| | | PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsDetailVO.getGoodsId()), |
| | | PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(goodsDetailVO.getGoodsId(), |
| | | sharePid, "1"); |
| | | |
| | | String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsDetail.getGoodsSign(), |
| | |
| | | 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)); |
| | |
| | | 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; |
| | | } |
| | |
| | | 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) { |
| | |
| | | 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, "商品已下架"); |
| | | } |
| | |
| | | } |
| | | 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, "该商品已存在"); |
| | |
| | | |
| | | // 商品图片信息 |
| | | 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(system, 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(); |
| | |
| | | throw new GoodsEvaluateException(1, "线报已存在"); |
| | | |
| | | List<String> imgs = new ArrayList<>(); |
| | | if (dto.getImageList() != null && dto.getImageList().size() > 0) { |
| | | imgs.addAll(dto.getImageList()); |
| | | if (!StringUtil.isNullOrEmpty(dto.getPicUrls())) { |
| | | imgs.addAll(Arrays.asList(dto.getPicUrls().split(","))); |
| | | } |
| | | |
| | | GoodsDetailVO goods = null; |
| | | |
| | | //获取图片 |
| | | if (dto.getIdList() != null && dto.getIdList().size() > 0) { |
| | | if (!StringUtil.isNullOrEmpty( dto.getItemIds())) { |
| | | Set<String> imgSet = new HashSet<>(); |
| | | imgSet.addAll(imgs); |
| | | String id = dto.getIdList().get(0); |
| | | String source = dto.getPlatformType(); |
| | | String id = dto.getItemIds().split(",")[0]; |
| | | String source = dto.getPlatform(); |
| | | switch (source) { |
| | | case "tb": |
| | | case "淘宝": |
| | | try { |
| | | TaoBaoGoodsBrief goodsBrief = TaoKeApiUtil.searchGoodsDetail(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); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | break; |
| | | case "jd": { |
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(Long.parseLong(id)); |
| | | case "京东": { |
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); |
| | | if (jdGoods != null && jdGoods.getImageList() != null) { |
| | | GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); |
| | | goods = GoodsDetailVOFactory.convertJDGoods(jdGoods, params); |
| | |
| | | } |
| | | } |
| | | break; |
| | | case "pdd": { |
| | | PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(id)); |
| | | case "拼多多": { |
| | | PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(id); |
| | | if (goodsDetail != null && goodsDetail.getGoodsGalleryUrls() != null) { |
| | | GoodsMoneyConfigParamsDTO params = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55", system); |
| | | goods = GoodsDetailVOFactory.convertPDDGoods(goodsDetail, params); |
| | |
| | | } |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateSuningGoods(SuningGoodsInfo goods) { |
| | | if (goods == null) { |
| | | return; |