2 Commits 43e97dd059 ... fbe9c3d8ea

Auteur SHA1 Message Date
  qinxuyang fbe9c3d8ea 店铺评分修改 默认3分 评价数大于10条 计算店铺平均分 il y a 1 semaine
  liudongzhi f3933b47a5 解决bug 消息(提测0401):消息搜索,输入律师姓名查询不到和律师的聊天记录 il y a 1 semaine

+ 10 - 3
alien-store/src/main/java/shop/alien/store/controller/LifeMessageController.java

@@ -27,11 +27,18 @@ public class LifeMessageController {
 
     @ApiOperation("消息列表")
     @ApiOperationSupport(order = 1)
-    @ApiImplicitParams({@ApiImplicitParam(name = "receiverId", value = "当前登录人", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "friendType", value = "聊天类型  0-搜索 1-聊过 2-未聊过", dataType = "Integer", paramType = "query"), @ApiImplicitParam(name = "search", value = "搜索字段", dataType = "Integer", paramType = "query")})
+    @ApiImplicitParams(
+            {
+                    @ApiImplicitParam(name = "receiverId", value = "当前登录人", dataType = "String", paramType = "query"),
+                    @ApiImplicitParam(name = "friendType", value = "聊天类型  0-搜索 1-聊过 2-未聊过", dataType = "Integer", paramType = "query"),
+                    @ApiImplicitParam(name = "userName", value = "用户名", dataType = "String", paramType = "query"),
+                    @ApiImplicitParam(name = "search", value = "搜索字段", dataType = "Integer", paramType = "query")
+            }
+                      )
     @GetMapping("/getMessageList")
-    public R<List<LifeMessageVo>> getMessageList(@RequestParam String receiverId, @RequestParam int friendType, String search) throws Exception {
+    public R<List<LifeMessageVo>> getMessageList(@RequestParam String receiverId, @RequestParam int friendType, String search, String userName) throws Exception {
         log.info("LifeMessageController.getMessageList?receiverId={}, friendType={}, search={}", receiverId, friendType, search);
-        return R.data(lifeMessageService.getMessageList(receiverId, friendType, search));
+        return R.data(lifeMessageService.getMessageList(receiverId, friendType, search, userName));
     }
 
     @ApiOperation("未读消息与通知数量")

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/LifeMessageService.java

@@ -11,7 +11,7 @@ import java.util.List;
 
 public interface LifeMessageService extends IService<LifeMessage> {
 
-    List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search) throws Exception;
+    List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search,String userName) throws Exception;
 
     LifeMessageVo getStrangerMessageNum(String receiverId) throws Exception ;
 

+ 12 - 10
alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java

@@ -419,17 +419,19 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
             // 更新门店评价信息
             StoreInfoScoreVo storeInfoScoreVo = commonRatingMapper.getCommentCountAndScoreInfo(commonRating.getBusinessType(),businessId);
             double total = storeInfoScoreVo.getTotal();
-            double scoreAvg = (total == 0 ? 0 : storeInfoScoreVo.getScore() / total);
-            double scoreOne = (total == 0 ? 0 : storeInfoScoreVo.getScoreOne() / total);
-            double scoreTwo = (total == 0 ? 0 : storeInfoScoreVo.getScoreTwo() / total);
-            double scoreThree = (total == 0 ? 0 : storeInfoScoreVo.getScoreThree() / total);
             StoreInfo storeInfo = new StoreInfo();
-            storeInfo.setId(businessId);
-            storeInfo.setScoreAvg(new BigDecimal(scoreAvg).setScale(2, RoundingMode.HALF_UP).doubleValue());
-            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());
-            storeInfoMapper.updateById(storeInfo);
+            if(total >= 10){
+                double scoreAvg = (total == 0 ? 0 : storeInfoScoreVo.getScore() / total);
+                double scoreOne = (total == 0 ? 0 : storeInfoScoreVo.getScoreOne() / total);
+                double scoreTwo = (total == 0 ? 0 : storeInfoScoreVo.getScoreTwo() / total);
+                double scoreThree = (total == 0 ? 0 : storeInfoScoreVo.getScoreThree() / total);
+                storeInfo.setId(businessId);
+                storeInfo.setScoreAvg(new BigDecimal(scoreAvg).setScale(2, RoundingMode.HALF_UP).doubleValue());
+                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());
+                storeInfoMapper.updateById(storeInfo);
+            }
             StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>().eq(StoreUser::getStoreId, storeInfo.getId()).eq(StoreUser::getDeleteFlag, 0));
 
             // 如果差评,则发送差评提醒

+ 5 - 1
alien-store/src/main/java/shop/alien/store/service/impl/LifeMessageServiceImpl.java

@@ -48,7 +48,7 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
     private final LawyerConsultationOrderMapper lawyerConsultationOrderMapper;
 
     @Override
-    public List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search) throws Exception {
+    public List<LifeMessageVo> getMessageList(String receiverId, int friendType, String search ,String userName) throws Exception {
         try {
             if (receiverId == null) {
                 return new ArrayList<>();
@@ -191,7 +191,11 @@ public class LifeMessageServiceImpl extends ServiceImpl<LifeMessageMapper, LifeM
                     lifeMessagePageResultList.add(messageVo);
                 }
             }
+            if (userName == null){
+                return lifeMessagePageResultList;
+            }
 
+            lifeMessagePageResultList = lifeMessagePageResultList.stream().filter(item -> item.getUserName().contains(userName)).collect(Collectors.toList());
             return lifeMessagePageResultList;
         } catch (Exception e) {
             log.error("LifeMessageServiceImpl.getMessageList Error Mgs={}", e.getMessage());