| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.dto.ConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo.CommentInfoEnum; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | |
| | | import com.yeshi.fanli.entity.dynamic.ListComment; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | 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.exception.dynamic.GoodsEvaluateException; |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; |
| | |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | import com.yeshi.fanli.util.VersionUtil; |
| | | 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.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.vo.common.JumpDetailContentVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | import com.yeshi.fanli.vo.msg.TokenVO; |
| | | import com.yeshi.fanli.vo.search.GoodsDocParseResultVO; |
| | |
| | | |
| | | private CommonGoods commonGoods; |
| | | |
| | | |
| | | /** |
| | | * 修改状态 |
| | | * @param callback |
| | | * @param id |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "switchState") |
| | | public void switchState(String callback, String id, PrintWriter out) { |
| | | try { |
| | | goodsEvaluateService.switchState(id); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存信息 |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param special 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveGoodsCoupon") |
| | | public void saveGoodsCoupon(String callback, String pid, String content, PrintWriter out) { |
| | | try { |
| | | goodsEvaluateService.saveGoodsCoupon(pid, content); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param pid |
| | | * @param kind : 1单品 2多品 3活动 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveCurrencyCoupon") |
| | | public void saveCurrencyCoupon(String callback, String pid, int kind, CommentInfo commentInfo, PrintWriter out) { |
| | | try { |
| | | goodsEvaluateService.saveCurrencyCoupon(pid, kind, commentInfo); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取信息 |
| | | * |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取信息 |
| | | * |
| | | * @param callback |
| | | * @param special 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getCurrencyCoupon") |
| | | public void getCurrencyCoupon(String callback, String pid, PrintWriter out) { |
| | | try { |
| | | CommentInfo commentInfo = new CommentInfo(); |
| | | if (!StringUtil.isNullOrEmpty(pid)) { |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pid); |
| | | if (goodsEvaluate != null && goodsEvaluate.getComments() != null |
| | | && goodsEvaluate.getComments().size() > 0) { |
| | | for (CommentInfo info : goodsEvaluate.getComments()) { |
| | | if (info != null) |
| | | if (CommentInfoEnum.currencyCoupon == info.getTypeEnum()) { |
| | | commentInfo = info; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(commentInfo)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取信息 |
| | | * |
| | | * @param callback |
| | | * @param special 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getSingleGoodsCoupon") |
| | | public void getSingleGoodsCoupon(String callback, String pid, PrintWriter out) { |
| | | try { |
| | | CommentInfo commentInfo = new CommentInfo(); |
| | | if (!StringUtil.isNullOrEmpty(pid)) { |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pid); |
| | | if (goodsEvaluate != null && goodsEvaluate.getComments() != null |
| | | && goodsEvaluate.getComments().size() > 0) { |
| | | for (CommentInfo info : goodsEvaluate.getComments()) { |
| | | if (info != null) |
| | | if (CommentInfoEnum.goodsCoupon == info.getTypeEnum()) { |
| | | commentInfo = info; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(commentInfo)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存多个商品 |
| | | * |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveMultipleGoods") |
| | | public void saveMultipleGoods(String callback, String pid, String videoUrl, String goodsList, |
| | | HttpServletRequest request, PrintWriter out) { |
| | | try { |
| | | MultipartHttpServletRequest fileRequest = null; |
| | | if (request instanceof MultipartHttpServletRequest) { |
| | | fileRequest = (MultipartHttpServletRequest) request; |
| | | } |
| | | goodsEvaluateService.saveMultipleGoods(pid, videoUrl, goodsList, fileRequest); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | LogHelper.errorDetailInfo(e); |
| | | LogHelper.test(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存信息 |
| | | * |
| | | * @param callback |
| | | * @param pid |
| | | * @param kind : 1单品 2多品 3活动 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveCurrencyCoupon") |
| | | public void saveCurrencyCoupon(String callback, String pid, int kind, CommentInfo commentInfo, PrintWriter out) { |
| | | try { |
| | | goodsEvaluateService.saveCurrencyCoupon(pid, kind, commentInfo); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取信息 |
| | | * |
| | | * @param callback |
| | | * @param special 0a39676f138c4dcba722e321d43c4284 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getCurrencyCoupon") |
| | | public void getCurrencyCoupon(String callback, String pid, PrintWriter out) { |
| | | try { |
| | | CommentInfo commentInfo = new CommentInfo(); |
| | | if (!StringUtil.isNullOrEmpty(pid)) { |
| | | GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pid); |
| | | if (goodsEvaluate != null && goodsEvaluate.getComments() != null |
| | | && goodsEvaluate.getComments().size() > 0) { |
| | | for (CommentInfo info : goodsEvaluate.getComments()) { |
| | | if (info != null) |
| | | if (CommentInfoEnum.currencyCoupon == info.getTypeEnum()) { |
| | | commentInfo = info; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(commentInfo)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存多个商品 |
| | | * |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveMultipleGoods") |
| | | public void saveMultipleGoods(String callback, String pid, String videoUrl, String goodsList, |
| | | HttpServletRequest request, PrintWriter out) { |
| | | try { |
| | | MultipartHttpServletRequest fileRequest = null; |
| | | if (request instanceof MultipartHttpServletRequest) { |
| | | fileRequest = (MultipartHttpServletRequest) request; |
| | | } |
| | | goodsEvaluateService.saveMultipleGoods(pid, videoUrl, goodsList, fileRequest); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败")); |
| | | e.printStackTrace(); |
| | | LogHelper.errorDetailInfo(e); |
| | | LogHelper.test(e); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取多个商品信息 |
| | |
| | | GoodsDetailVO goodsDetail = null; |
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); |
| | | BigDecimal shareRate = hongBaoManageService.getShareRate(); |
| | | BigDecimal vipFanLiRate = hongBaoManageService.getVIPFanLiRate(); |
| | | BigDecimal vipFanLiRate = hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP); |
| | | ConfigParamsDTO params = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, vipFanLiRate); |
| | | |
| | | if (commonGoods.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { |