|
@@ -105,16 +105,7 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
|
|
|
commonRating.setScoreThree(parse.getDouble("scoreThree"));
|
|
commonRating.setScoreThree(parse.getDouble("scoreThree"));
|
|
|
}
|
|
}
|
|
|
int i = this.save(commonRating) ? 0 : 1;
|
|
int i = this.save(commonRating) ? 0 : 1;
|
|
|
- if (i == 0 && commonRating.getBusinessType() != null && commonRating.getBusinessType() == RatingBusinessTypeEnum.STORE_RATING.getBusinessType()) {
|
|
|
|
|
- Double score = commonRating.getScore();
|
|
|
|
|
- if (score != null && score >= 4.5 && commonRating.getUserId() != null && commonRating.getBusinessId() != null) {
|
|
|
|
|
- try {
|
|
|
|
|
- lifeDiscountCouponStoreFriendService.issueCouponForGoodRating(Math.toIntExact(commonRating.getUserId()), commonRating.getBusinessId());
|
|
|
|
|
- } catch (Exception ex) {
|
|
|
|
|
- log.warn("CommonRatingService.saveCommonRating 好评送券异常 userId={}, storeId={}, msg={}", commonRating.getUserId(), commonRating.getBusinessId(), ex.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 好评发券改为仅在 AI 审核通过后执行,见 doBusinessWithType 中逻辑
|
|
|
// 一次遍历完成分类,避免多次流式处理
|
|
// 一次遍历完成分类,避免多次流式处理
|
|
|
Map<String, List<String>> urlCategoryMap = StoreRenovationRequirementServiceImpl.classifyUrls(Arrays.asList(commonRating.getImageUrls().split(",")));
|
|
Map<String, List<String>> urlCategoryMap = StoreRenovationRequirementServiceImpl.classifyUrls(Arrays.asList(commonRating.getImageUrls().split(",")));
|
|
|
AiContentModerationUtil.AuditResult auditResult = new AiContentModerationUtil.AuditResult(true, "");
|
|
AiContentModerationUtil.AuditResult auditResult = new AiContentModerationUtil.AuditResult(true, "");
|
|
@@ -230,6 +221,26 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
|
|
|
websocketVo.setText(JSONObject.from(lifeMessage).toJSONString());
|
|
websocketVo.setText(JSONObject.from(lifeMessage).toJSONString());
|
|
|
webSocketProcess.sendMessage("store_" + storeUser.getPhone(), JSONObject.from(websocketVo).toJSONString());
|
|
webSocketProcess.sendMessage("store_" + storeUser.getPhone(), JSONObject.from(websocketVo).toJSONString());
|
|
|
}
|
|
}
|
|
|
|
|
+ // 用户好评且 AI 审核通过后:按商家配置的参与次数限制,将优惠券/代金券发到用户券包,通知按优惠券/代金券分别发送
|
|
|
|
|
+ if (score != null && score >= 4.5 && commonRating.getUserId() != null && commonRating.getBusinessId() != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ StoreInfo store = storeInfoMapper.selectById(businessId);
|
|
|
|
|
+ Integer limit = (store != null && store.getGoodRatingParticipationLimit() != null)
|
|
|
|
|
+ ? store.getGoodRatingParticipationLimit() : null;
|
|
|
|
|
+ if (limit != null && limit <= 0) {
|
|
|
|
|
+ limit = null; // 0 或负数视为不限制
|
|
|
|
|
+ }
|
|
|
|
|
+ int passedCount = commonRatingMapper.countPassedGoodRatingsByUserAndStore(commonRating.getUserId(), businessId);
|
|
|
|
|
+ if (limit == null || passedCount <= limit) {
|
|
|
|
|
+ lifeDiscountCouponStoreFriendService.issueCouponForGoodRating(Math.toIntExact(commonRating.getUserId()), businessId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.info("CommonRatingService 好评送券跳过:已达商家指定参与次数上限 userId={}, storeId={}, limit={}, count={}",
|
|
|
|
|
+ commonRating.getUserId(), businessId, limit, passedCount);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
|
+ log.warn("CommonRatingService 好评送券异常 userId={}, storeId={}, msg={}", commonRating.getUserId(), businessId, ex.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|