| | |
| | | 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.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.CommentInfo; |
| | |
| | | public GoodsEvaluate getById(String id) { |
| | | return goodsEvaluateDao.getById(id); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<GoodsEvaluate> listByStartTime(Date date) { |
| | | return goodsEvaluateDao.listByStartTime(date); |
| | | } |
| | | |
| | | @Override |
| | | public List<GoodsEvaluate> queryValidSortASC(int start, int count, EvaluateEnum tyepEnum, boolean sortDesc) { |
| | | return goodsEvaluateDao.queryValidSortASC(start, count, tyepEnum, sortDesc); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void saveComment(String pid, CommentInfo commentInfo) throws GoodsEvaluateException { |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateDao.getById(pid); |
| | |
| | | throw new GoodsEvaluateException(1, "相关参数不能为空"); |
| | | } |
| | | |
| | | List<GoodsEvaluate> evaluateList = goodsEvaluateDao.queryExist(Constant.SOURCE_TYPE_TAOBAO, goodsId); |
| | | Date limitDate = DateUtil.reduceDay(new Date(), 7); |
| | | |
| | | List<GoodsEvaluate> evaluateList = goodsEvaluateDao.queryExistLimitTime(Constant.SOURCE_TYPE_TAOBAO, goodsId, limitDate); |
| | | if (evaluateList != null && evaluateList.size() > 0) |
| | | return; |
| | | throw new GoodsEvaluateException(1, "该商品已存在"); |
| | | |
| | | TaoBaoGoodsBrief goodsBrief = null; |
| | | try { |
| | |
| | | |
| | | // 白底图 |
| | | List<String> imgs = new ArrayList<>(); |
| | | if (!StringUtil.isNullOrEmpty(goodsBrief.getPictUrlWhite())) { |
| | | imgs.add(goodsBrief.getPictUrlWhite()); |
| | | } |
| | | imgs.addAll(goodsBrief.getImgList()); |
| | | |
| | | // 商品VO |
| | |
| | | |
| | | // 商品图片信息 |
| | | int i = 0; |
| | | if (imgList == null || imgList.size() == 0) |
| | | if (imgList == null) |
| | | imgList = new ArrayList<ImgInfo>(); |
| | | |
| | | if (imgList.size() == 0) |
| | | for (String img : imgs) { |
| | | ImgInfo imgInfo = new ImgInfo(); |
| | | imgInfo.setH(1); |
| | |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | boolean cerateGoods = cerateGoods(list.get(i)); |
| | | boolean cerateGoods = addByDaTaoKeGoods(list.get(i)); |
| | | if (cerateGoods) { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | private boolean cerateGoods(DaTaoKeDetailV2 daTaoKe) { |
| | | |
| | | @Override |
| | | public boolean addByDaTaoKeGoods(DaTaoKeDetailV2 daTaoKe) { |
| | | try { |
| | | Date limitDate = DateUtil.reduceDay(new Date(), 7); |
| | | |
| | | List<GoodsEvaluate> evaluateList = goodsEvaluateDao.queryExistLimitTime(Constant.SOURCE_TYPE_TAOBAO, |
| | | daTaoKe.getGoodsId()+"", limitDate); |
| | | if (evaluateList != null && evaluateList.size() > 0) |
| | | return false; |
| | | |
| | | TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(daTaoKe.getGoodsId()); |
| | | if (goodsBrief == null) { |
| | | return false; |
| | |
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate("android", "55"); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); |
| | | GoodsDetailVO goodsVO = GoodsDetailVOFactory.convertTaoBao(goodsBrief, paramsDTO); |
| | | // 发布用户 |
| | | ActivityUser user = activityUserService.getRandomByDaTaoKeCid(daTaoKe.getCid()); |
| | | |
| | | ActivityUser user = null; |
| | | if(daTaoKe.getCid() != null) { |
| | | user = activityUserService.getRandomByDaTaoKeCid(daTaoKe.getCid()); |
| | | } else { |
| | | List<ActivityRuleUser> ruleList = activityUserService.listByRuleCode(ActivityRuleUser.RULE_HAOHUO, 1, 20); |
| | | user = ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser(); |
| | | } |
| | | |
| | | |
| | | String desc = daTaoKe.getDesc().replace(",", ","); |
| | | String[] split = desc.split(","); |
| | |
| | | goodsEvaluate.setState(1); |
| | | goodsEvaluate.setDynamicType(1); |
| | | goodsEvaluate.setType(EvaluateEnum.single); |
| | | |
| | | goodsEvaluate.setShareNum((int) (Math.random() * 5000) + 1000); |
| | | goodsEvaluate.setShareNumReal(0); |
| | | goodsEvaluate.setWeight(0.0); |
| | |
| | | List<String> goodsimgs = goodsBrief.getImgList(); |
| | | |
| | | List<String> imgs = new ArrayList<>(); |
| | | if (!StringUtil.isNullOrEmpty(goodsBrief.getPictUrlWhite())) { |
| | | imgs.add(goodsBrief.getPictUrlWhite()); |
| | | } |
| | | imgs.addAll(goodsimgs); |
| | | |
| | | int i = 0; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public GoodsEvaluate queryExistSingle(String goodsId, int goodsType) { |
| | | List<GoodsEvaluate> list = goodsEvaluateDao.queryExistSingle(goodsType, goodsId); |
| | | if (list != null && list.size() > 0) |
| | | return list.get(0); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |