Explorar el Código

维护审核条件,获取最新审核

lutong hace 1 mes
padre
commit
6b95360a50

+ 9 - 4
alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java

@@ -343,7 +343,8 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                                     rating.setAuditStatus(1);
                                     this.saveOrUpdate(rating);
                                     // 对不同的businessType进行不同的处理,
-                                    doBusinessWithType(commonRating);
+                                    // 使用更新后的rating对象,确保auditStatus正确
+                                    doBusinessWithType(rating);
                                     log.info("视频审核通过,已更新状态为通过,ratingID:{}", rating.getId());
                                 } else if (rating.getAuditStatus() == 2) {
                                     // 之前因为小票/打卡不通过,即使视频通过,也保持为不通过
@@ -360,7 +361,8 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                                 if (rating.getAuditStatus() == null || rating.getAuditStatus() == 0) {
                                     rating.setAuditStatus(1);
                                     this.saveOrUpdate(rating);
-                                    doBusinessWithType(commonRating);
+                                    // 使用更新后的rating对象,确保auditStatus正确
+                                    doBusinessWithType(rating);
                                     log.info("无视频或视频审核结果为空,文本/图片已通过,设置为审核通过,ratingID:{}", rating.getId());
                                 } else if (rating.getAuditStatus() == 2) {
                                     // 之前因为小票/打卡不通过,保持为不通过
@@ -388,7 +390,8 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                     if (rating.getAuditStatus() == null || rating.getAuditStatus() == 0) {
                         rating.setAuditStatus(1);
                         this.saveOrUpdate(rating);
-                        doBusinessWithType(commonRating);
+                        // 使用更新后的rating对象,确保auditStatus正确
+                        doBusinessWithType(rating);
                         log.info("无视频,文本/图片审核已通过,设置为审核通过,ratingID:{}", rating.getId());
                     } else if (rating.getAuditStatus() == 2) {
                         // 之前因为小票/打卡不通过,保持为不通过
@@ -455,7 +458,9 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
             }
             // 用户好评且 AI 审核通过后:按运营活动表(评论有礼)配置的 coupon_id/voucher_id 发放,用 participation_limit 限制参与次数,发放成功后扣减库存,按优惠券/代金券发对应通知
             // 支持多个活动同时生效:如果一个商家有多个正在开启的活动(如一个送优惠券,一个送代金券),都会执行
-            if (score != null && score >= 4.5 && commonRating.getUserId() != null && commonRating.getBusinessId() != null) {
+            // 重要:只有在审核通过(auditStatus == 1)的情况下才送券
+            if (score != null && score >= 4.5 && commonRating.getUserId() != null && commonRating.getBusinessId() != null 
+                    && commonRating.getAuditStatus() != null && commonRating.getAuditStatus() == 1) {
                 try {
                     Date now = new Date();
                     // 查询所有符合条件的活动(不再限制为1个)