Răsfoiți Sursa

修复评分问题bug

liudongzhi 1 săptămână în urmă
părinte
comite
9237a00619

+ 3 - 3
alien-entity/src/main/java/shop/alien/entity/store/StoreInfo.java

@@ -371,8 +371,8 @@ public class StoreInfo {
     @TableField("alipay_smid")
     private String alipaySmid;
 
-    @ApiModelProperty(value = "评价首次突破10条  状态为1   未突破为 0  默认为0")
-    @TableField("break_ten")
-    private Integer breakTen;
+//    @ApiModelProperty(value = "评价首次突破10条  状态为1   未突破为 0  默认为0")
+//    @TableField("break_ten")
+//    private Integer breakTen;
 
 }

+ 5 - 7
alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java

@@ -449,7 +449,6 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                 storeInfo.setScoreOne(new BigDecimal(scoreOne).setScale(2, RoundingMode.HALF_UP).doubleValue());
                 storeInfo.setScoreTwo(new BigDecimal(scoreTwo).setScale(2, RoundingMode.HALF_UP).doubleValue());
                 storeInfo.setScoreThree(new BigDecimal(scoreThree).setScale(2, RoundingMode.HALF_UP).doubleValue());
-                storeInfo.setBreakTen(1);
                 storeInfoMapper.updateById(storeInfo);
             }
 
@@ -1158,7 +1157,11 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                 return;
             }
 
-            if (commentCount < 10 && storeInfoNew.getBreakTen()==1) {
+            if (commentCount < 10) {
+
+                if (storeInfoNew.getScoreAvg()==0.0){
+                    return;
+                }
                 // 没有评价,设置默认评分为0
                 StoreInfo storeInfo = new StoreInfo();
                 storeInfo.setId(businessId);
@@ -1170,11 +1173,6 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                 log.info("店铺有效评价被删除<10条,重置评分为3.5,businessId={}", businessId);
                 return;
             }
-            //如果没到10条有效评价,则不更新评分,还继续为0
-            if (commentCount < 10) {
-             return ;
-             }
-
 
 
             // 计算平均评分