Parcourir la source

Merge remote-tracking branch 'origin/dev' into dev

lyx il y a 3 semaines
Parent
commit
99b232855b

+ 6 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LawyerConsultationOrderVO.java

@@ -134,6 +134,9 @@ public class LawyerConsultationOrderVO implements Serializable {
     @ApiModelProperty(value = "头像")
     private String headImg;
 
+    @ApiModelProperty(value = "用户头像")
+    private String userImage;
+
     @ApiModelProperty(value = "昵称")
     private String nickName;
 
@@ -218,6 +221,9 @@ public class LawyerConsultationOrderVO implements Serializable {
     @ApiModelProperty(value = "是否已经评价(1-已评价,2-未评价)")
     private  String isHasCommon;
 
+    @ApiModelProperty(value = "用户申请退款时间")
+    private  Date applyRefundTime;
+
     @ApiModelProperty(value = "申请退款处理时间")
     private  Date applyRefundProcessTime;
 

+ 3 - 0
alien-entity/src/main/java/shop/alien/mapper/LawyerConsultationOrderMapper.java

@@ -313,6 +313,7 @@ public interface LawyerConsultationOrderMapper extends BaseMapper<LawyerConsulta
             "        lco.reject_refund_reason,\n" +
             "        lco.apply_refund_reason,\n" +
             "        lco.apply_refund_process_time,\n" +
+            "        lco.apply_refund_time,\n" +
             "        CASE\n" +
             "        WHEN EXISTS (SELECT 1 FROM lawyer_order_review lor WHERE lor.order_id = lco.id) THEN '1'\n" +
             "        ELSE '2'\n" +
@@ -345,6 +346,7 @@ public interface LawyerConsultationOrderMapper extends BaseMapper<LawyerConsulta
             "        lco.order_amount - lco.consultation_fee as lawyerEarnings,\n" +
             "        luv.processing_status,\n" +
             "        luv.processing_time,\n" +
+            "        lur.user_image,\n" +
             "        luv.report_result\n" +
             "        FROM lawyer_consultation_order lco\n" +
             "        LEFT JOIN lawyer_user lu ON lco.lawyer_user_id = lu.id AND lu.delete_flag = 0\n" +
@@ -484,6 +486,7 @@ public interface LawyerConsultationOrderMapper extends BaseMapper<LawyerConsulta
             "FROM " +
             "lawyer_consultation_order " +
             "WHERE order_status = 2 " +
+            " and delete_flag = 0 " +
             "<if test='clientUserId != null'>" +
             "AND client_user_id = #{clientUserId} " +
             "</if>" +

+ 22 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/controller/LawyerNoticeController.java

@@ -71,4 +71,26 @@ public class LawyerNoticeController {
         return lawyerNoticeService.getLawyerNoticeList(pageNum, pageSize, receiverId, noticeType);
     }
 
+    /**
+     * 查询接收人是否有未读通知
+     *
+     * @param receiverId 接收人ID,不能为空
+     * @return 是否有未读通知,true-有未读,false-无未读
+     */
+    @GetMapping("/hasUnread")
+    @ApiOperation("查询是否有未读通知")
+    @ApiOperationSupport(order = 2)
+    @ApiImplicitParam(name = "receiverId", value = "接收人ID", dataType = "String", paramType = "query", required = true)
+    public R<Boolean> hasUnreadNotice(@RequestParam String receiverId) {
+        log.info("LawyerNoticeController.hasUnreadNotice, receiverId={}", receiverId);
+        
+        // 参数校验
+        if (StringUtils.isBlank(receiverId)) {
+            log.warn("接收人ID为空");
+            return R.fail("接收人ID不能为空");
+        }
+        
+        return lawyerNoticeService.hasUnreadNotice(receiverId);
+    }
+
 }

+ 8 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/LawyerNoticeService.java

@@ -24,4 +24,12 @@ public interface LawyerNoticeService extends IService<LifeNotice> {
      */
     R<IPage<LifeNoticeVo>> getLawyerNoticeList(Integer pageNum, Integer pageSize, String receiverId, Integer noticeType);
 
+    /**
+     * 查询接收人是否有未读通知
+     *
+     * @param receiverId 接收人ID,不能为空
+     * @return 是否有未读通知,true-有未读,false-无未读
+     */
+    R<Boolean> hasUnreadNotice(String receiverId);
+
 }

+ 30 - 2
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerNoticeServiceImpl.java

@@ -13,14 +13,12 @@ import org.springframework.stereotype.Service;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.LawyerUserViolation;
 import shop.alien.entity.store.LifeNotice;
-import shop.alien.entity.store.LifeUserViolation;
 import shop.alien.entity.store.vo.LifeMessageVo;
 import shop.alien.entity.store.vo.LifeNoticeVo;
 import shop.alien.lawyer.service.LawyerNoticeService;
 import shop.alien.mapper.LawyerUserViolationMapper;
 import shop.alien.mapper.LifeMessageMapper;
 import shop.alien.mapper.LifeNoticeMapper;
-import shop.alien.mapper.LifeUserViolationMapper;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -56,6 +54,11 @@ public class LawyerNoticeServiceImpl extends ServiceImpl<LifeNoticeMapper, LifeN
     private static final Integer DELETE_FLAG_NOT_DELETED = 0;
 
     /**
+     * 未读标识:0-未读
+     */
+    private static final Integer IS_READ_UNREAD = 0;
+
+    /**
      * 发送者ID分隔符
      */
     private static final String SENDER_ID_SEPARATOR = "_";
@@ -319,4 +322,29 @@ public class LawyerNoticeServiceImpl extends ServiceImpl<LifeNoticeMapper, LifeN
             }
         }
     }
+
+    @Override
+    public R<Boolean> hasUnreadNotice(String receiverId) {
+        log.info("LawyerNoticeServiceImpl.hasUnreadNotice, receiverId={}", receiverId);
+        
+        // 参数校验
+        if (StringUtils.isBlank(receiverId)) {
+            log.warn("接收人ID为空");
+            return R.fail("接收人ID不能为空");
+        }
+        
+        // 构建查询条件:查询未读且未删除的通知,使用LIMIT 1优化性能
+        LambdaQueryWrapper<LifeNotice> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(LifeNotice::getReceiverId, receiverId)
+                .eq(LifeNotice::getIsRead, IS_READ_UNREAD)
+                .eq(LifeNotice::getDeleteFlag, DELETE_FLAG_NOT_DELETED)
+                .last("LIMIT 1");
+        
+        // 使用selectOne判断是否存在,数据库找到一条记录即返回,比selectCount更高效
+        LifeNotice notice = lifeNoticeMapper.selectOne(queryWrapper);
+        boolean hasUnread = notice != null;
+        
+        log.debug("LawyerNoticeServiceImpl.hasUnreadNotice, receiverId={}, hasUnread={}", receiverId, hasUnread);
+        return R.data(hasUnread);
+    }
 }