1
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package cn.van.business.controller.jd;
|
||||
|
||||
import cn.van.business.model.pl.TaobaoComment;
|
||||
import cn.van.business.repository.TaobaoCommentRepository;
|
||||
import cn.van.business.util.JDProductService;
|
||||
import cn.van.business.util.JDUtil;
|
||||
import cn.van.business.repository.CommentRepository;
|
||||
@@ -31,12 +33,14 @@ public class JDInnerController {
|
||||
private final JDProductService jdProductService;
|
||||
private final JDUtil jdUtil;
|
||||
private final CommentRepository commentRepository;
|
||||
private final TaobaoCommentRepository taobaoCommentRepository;
|
||||
|
||||
@Autowired
|
||||
public JDInnerController(JDProductService jdProductService, JDUtil jdUtil, CommentRepository commentRepository) {
|
||||
public JDInnerController(JDProductService jdProductService, JDUtil jdUtil, CommentRepository commentRepository, TaobaoCommentRepository taobaoCommentRepository) {
|
||||
this.jdProductService = jdProductService;
|
||||
this.jdUtil = jdUtil;
|
||||
this.commentRepository = commentRepository;
|
||||
this.taobaoCommentRepository = taobaoCommentRepository;
|
||||
}
|
||||
|
||||
@PostMapping("/generatePromotionContent")
|
||||
@@ -116,7 +120,7 @@ public class JDInnerController {
|
||||
// 获取本地可用的京东评论并统计
|
||||
List<Comment> available = commentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(productId, 1);
|
||||
List<Comment> used = commentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(productId, 0);
|
||||
|
||||
|
||||
canUseCommentCount = available.size();
|
||||
usedCommentCount = used.size();
|
||||
allCommentCount = canUseCommentCount + usedCommentCount;
|
||||
@@ -125,11 +129,11 @@ public class JDInnerController {
|
||||
HashMap<String, String> tbMap = jdUtil.getProductTypeMapForTB();
|
||||
String taobaoProductId = tbMap.getOrDefault(productId, productId);
|
||||
// 注意:这里需要注入TaobaoCommentRepository,暂时注释掉淘宝统计部分
|
||||
// List<TaobaoComment> availableTbComments = taobaoCommentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(taobaoProductId, 1);
|
||||
// List<TaobaoComment> usedTbComments = taobaoCommentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(taobaoProductId, 0);
|
||||
// canUseTbCommentCount = availableTbComments.size();
|
||||
// usedTbCommentCount = usedTbComments.size();
|
||||
// allTbCommentCount = canUseTbCommentCount + usedTbCommentCount;
|
||||
List<TaobaoComment> availableTbComments = taobaoCommentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(taobaoProductId, 1);
|
||||
List<TaobaoComment> usedTbComments = taobaoCommentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(taobaoProductId, 0);
|
||||
canUseTbCommentCount = availableTbComments.size();
|
||||
usedTbCommentCount = usedTbComments.size();
|
||||
allTbCommentCount = canUseTbCommentCount + usedTbCommentCount;
|
||||
|
||||
List<Comment> candidates = !available.isEmpty() ? available : used;
|
||||
if (candidates.isEmpty()) {
|
||||
@@ -157,7 +161,7 @@ public class JDInnerController {
|
||||
stats.put("used", usedCommentCount);
|
||||
stats.put("available", canUseCommentCount);
|
||||
stats.put("total", allCommentCount);
|
||||
stats.put("statisticsText",
|
||||
stats.put("statisticsText",
|
||||
"京东评论统计:\n" +
|
||||
"型号 " + productType + "\n" +
|
||||
"新增:" + addCommentCount + "\n" +
|
||||
|
||||
Reference in New Issue
Block a user