| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.core.task.TaskExecutor; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.common.JumpDetailV2; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo.CommentInfoEnum; |
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate.EvaluateEnum; |
| | |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum; |
| | | 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.fanli.exception.goods.ConvertLinkExceptionException; |
| | | import com.yeshi.fanli.exception.share.ShareGoodsException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.count.DailyCountMomentsService; |
| | | import com.yeshi.fanli.service.inter.dynamic.ArticleOfficialService; |
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService; |
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; |
| | |
| | | |
| | | @Resource |
| | | private ShareGoodsService shareGoodsService; |
| | | |
| | | @Resource |
| | | private DailyCountMomentsService dailyCountMomentsService; |
| | | |
| | | @Resource(name = "taskExecutor") |
| | | private TaskExecutor executor; |
| | | |
| | | |
| | | private final static long TYPE_REXIAO = 1;// 热销 |
| | | private final static long TYPE_TUIJIAN = 2;// 推荐 |
| | |
| | | else if (imgInfo.getType() == ImgEnum.activity) |
| | | if (!StringUtil.isNullOrEmpty(imgInfo.getActivityPic())) { |
| | | list.add(imgInfo.getActivityPic()); |
| | | }else if(!StringUtil.isNullOrEmpty(imgInfo.getUrl())){ |
| | | list.add(imgInfo.getUrl()); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (type == 3) { |
| | | shareCount++; |
| | | goodsEvaluateService.addShareNum(id); |
| | | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { // 添加每日统计 |
| | | dailyCountMomentsService.addShareClick(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (list.size() == 0) { |
| | |
| | | } |
| | | |
| | | String text = ""; |
| | | CommentInfo comment = null; |
| | | List<CommentInfo> comments = goodsEvaluate.getComments(); |
| | | if (comments != null) { |
| | | for (CommentInfo commentInfo : comments) { |
| | | if (cid.equals(commentInfo.getId())) { |
| | | text = commentInfo.getContent(); |
| | | comment = commentInfo; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | String newText = text; |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | String newText = text; // 非通用券需要验证 |
| | | if ((comment != null && comment.getTypeEnum() != CommentInfoEnum.currencyCoupon) |
| | | || goodsEvaluate.getType() == EvaluateEnum.activity) { |
| | | try { |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | // 替换价格 |
| | | if (goodsEvaluate.getType() == EvaluateEnum.single) { |
| | | GoodsDetailVO goods = goodsEvaluate.getGoods(); |
| | | newText = newText.replace("[原价]", MoneyBigDecimalUtil.getWithNoZera(goods.getZkPrice()) +""); |
| | | if (!goods.isHasCoupon()) { |
| | | newText = newText.replace("领券抢购", "抢购"); |
| | | newText = newText.replace("【券后价】[券后价]元", ""); |
| | | } else { |
| | | newText = newText.replace("[券后价]", MoneyBigDecimalUtil.getWithNoZera(goods.getCouponPrice())+""); |
| | | } |
| | | newText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); |
| | | } |
| | | |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("text", newText); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { // 添加每日统计 |
| | | dailyCountMomentsService.addCopyComment(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |