This commit is contained in:
2025-09-07 17:25:16 +08:00
parent 6e68591991
commit d74af8a07f

View File

@@ -1,5 +1,7 @@
package cn.van.business.controller.jd; 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.JDProductService;
import cn.van.business.util.JDUtil; import cn.van.business.util.JDUtil;
import cn.van.business.repository.CommentRepository; import cn.van.business.repository.CommentRepository;
@@ -31,12 +33,14 @@ public class JDInnerController {
private final JDProductService jdProductService; private final JDProductService jdProductService;
private final JDUtil jdUtil; private final JDUtil jdUtil;
private final CommentRepository commentRepository; private final CommentRepository commentRepository;
private final TaobaoCommentRepository taobaoCommentRepository;
@Autowired @Autowired
public JDInnerController(JDProductService jdProductService, JDUtil jdUtil, CommentRepository commentRepository) { public JDInnerController(JDProductService jdProductService, JDUtil jdUtil, CommentRepository commentRepository, TaobaoCommentRepository taobaoCommentRepository) {
this.jdProductService = jdProductService; this.jdProductService = jdProductService;
this.jdUtil = jdUtil; this.jdUtil = jdUtil;
this.commentRepository = commentRepository; this.commentRepository = commentRepository;
this.taobaoCommentRepository = taobaoCommentRepository;
} }
@PostMapping("/generatePromotionContent") @PostMapping("/generatePromotionContent")
@@ -125,11 +129,11 @@ public class JDInnerController {
HashMap<String, String> tbMap = jdUtil.getProductTypeMapForTB(); HashMap<String, String> tbMap = jdUtil.getProductTypeMapForTB();
String taobaoProductId = tbMap.getOrDefault(productId, productId); String taobaoProductId = tbMap.getOrDefault(productId, productId);
// 注意这里需要注入TaobaoCommentRepository暂时注释掉淘宝统计部分 // 注意这里需要注入TaobaoCommentRepository暂时注释掉淘宝统计部分
// List<TaobaoComment> availableTbComments = taobaoCommentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(taobaoProductId, 1); List<TaobaoComment> availableTbComments = taobaoCommentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(taobaoProductId, 1);
// List<TaobaoComment> usedTbComments = taobaoCommentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(taobaoProductId, 0); List<TaobaoComment> usedTbComments = taobaoCommentRepository.findByProductIdAndIsUseNotAndPictureUrlsIsNotNull(taobaoProductId, 0);
// canUseTbCommentCount = availableTbComments.size(); canUseTbCommentCount = availableTbComments.size();
// usedTbCommentCount = usedTbComments.size(); usedTbCommentCount = usedTbComments.size();
// allTbCommentCount = canUseTbCommentCount + usedTbCommentCount; allTbCommentCount = canUseTbCommentCount + usedTbCommentCount;
List<Comment> candidates = !available.isEmpty() ? available : used; List<Comment> candidates = !available.isEmpty() ? available : used;
if (candidates.isEmpty()) { if (candidates.isEmpty()) {