| | |
| | | import com.yeshi.fanli.entity.goods.jd.NYouHuiGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.entity.taobao.haodanku.HDKGoodsDetail;
|
| | | import com.yeshi.fanli.exception.dynamic.GoodsEvaluateException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | |
| | | String itemid = hdkGoods.getItemid();
|
| | | List<String> pics = hdkGoods.getItempic();
|
| | | String copy_content = hdkGoods.getCopy_content();
|
| | | |
| | | String showtitle = StringEscapeUtils.unescapeHtml(copy_content);
|
| | | showtitle = showtitle.replace("<br>", "\r\n");
|
| | |
|
| | | List<ActivityRuleUser> ruleList = activityUserService.listByRuleCode(ActivityRuleUser.RULE_HAOHUO, 1, 20);
|
| | | ActivityUser user = ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser();
|
| | | |
| | | HDKGoodsDetail itemDetail = HaoDanKuApiUtil.getInstance().getItemDetail(itemid);
|
| | | if (itemDetail == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | |
| | | |
| | | goodsEvaluateService.addGoodsEvaluate2(itemid, pics, user, showtitle, null);
|
| | | addResult = true;
|
| | | break;
|
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void addGoodsEvaluate2(String goodsId, List<String> imgs, ActivityUser user, String title, String comment) throws GoodsEvaluateException { |
| | | if (goodsId == null || user == null || StringUtil.isNullOrEmpty(title)) { |
| | | public void addGoodsEvaluate2(TaoBaoGoodsBrief goodsBrief, List<String> imgs, ActivityUser user, String title, String comment) throws GoodsEvaluateException { |
| | | if (goodsBrief == null || user == null || StringUtil.isNullOrEmpty(title)) { |
| | | throw new GoodsEvaluateException(1, "相关参数不能为空"); |
| | | } |
| | | |
| | | Date limitDate = DateUtil.reduceDay(new Date(), 7); |
| | | |
| | | List<GoodsEvaluate> evaluateList = goodsEvaluateDao.queryExistLimitTime(Constant.SOURCE_TYPE_TAOBAO, goodsId, limitDate); |
| | | Long goodsId = goodsBrief.getAuctionId(); |
| | | List<GoodsEvaluate> evaluateList = goodsEvaluateDao.queryExistLimitTime(Constant.SOURCE_TYPE_TAOBAO, goodsId + "", limitDate); |
| | | if (evaluateList != null && evaluateList.size() > 0) |
| | | throw new GoodsEvaluateException(1, "该商品已存在"); |
| | | |
| | | TaoBaoGoodsBrief goodsBrief = null; |
| | | try { |
| | | goodsBrief = redisManager.getTaoBaoGoodsBrief(Long.parseLong(goodsId)); |
| | | } catch (TaobaoGoodsDownException e) { |
| | | throw new GoodsEvaluateException(1, "商品已下架"); |
| | | } |
| | | |
| | | if (goodsBrief == null) { |
| | | throw new GoodsEvaluateException(1, "未找到商品信息"); |
| | | } |
| | | |
| | | BigDecimal couponAmount = goodsBrief.getCouponAmount(); |
| | | if (couponAmount == null || couponAmount.compareTo(new BigDecimal(0)) < 1) { |
| | | throw new GoodsEvaluateException(1, "该商品无券"); |
| | | } |
| | | |
| | | if (imgs == null) { |
| | | imgs = new ArrayList<>(); |
| | |
| | | public boolean addByDaTaoKeGoods(DaTaoKeDetailV2 daTaoKe); |
| | | |
| | | |
| | | public void addGoodsEvaluate2(String goodsId, List<String> imgs, ActivityUser user, String title, String comment) |
| | | public void addGoodsEvaluate2(TaoBaoGoodsBrief goodsBrief, List<String> imgs, ActivityUser user, String title, String comment) |
| | | throws GoodsEvaluateException; |
| | | |
| | | } |
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void getGoodsDetail(Long auctionId) {
|
| | | List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>();
|
| | | params.add(new ParamsKeyValue("itemid", auctionId + ""));
|
| | | String result = baseGetRequest("item_detail", params);
|
| | | JSONObject resultJSON = JSONObject.fromObject(result);
|
| | | System.out.println(resultJSON.optJSONObject("data").optString("coupon_share_url"));
|
| | | System.out.println(resultJSON.optJSONObject("data").optString("couponurl"));
|
| | | }
|
| | |
|
| | |
|
| | | public HDKGoodsListResultDTO listSelected(Integer minId) {
|
| | | if (minId == null)
|
| | |
| | | }
|
| | |
|
| | |
|
| | | public HDKGoodsListResultDTO getItemDetail(String itemid) {
|
| | | public HDKGoodsDetail getItemDetail(String itemid) {
|
| | | List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>();
|
| | | params.add(new ParamsKeyValue("itemid", itemid));
|
| | | String result = baseGetRequest("item_detail", params);
|
| | |
|
| | | JSONObject resultData = JSONObject.fromObject(result);
|
| | | if (resultData.optInt("code") == 1) {
|
| | | Integer newMinId = resultData.optInt("min_id");
|
| | | Type type = new TypeToken<ArrayList<HDKGoodsDetail>>() {
|
| | | }.getType();
|
| | | List<HDKGoodsDetail> list = new Gson().fromJson(resultData.optJSONArray("data").toString(), type);
|
| | | return new HDKGoodsListResultDTO(list, newMinId);
|
| | | Type type = new TypeToken<HDKGoodsDetail>() {}.getType();
|
| | | HDKGoodsDetail goodsDetail = new Gson().fromJson(resultData.optJSONObject("data").toString(), type);
|
| | | return goodsDetail;
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | | }
|