Эх сурвалжийг харах

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

lyx 3 долоо хоног өмнө
parent
commit
3f9adc119b
16 өөрчлөгдсөн 542 нэмэгдсэн , 27 устгасан
  1. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/CommentAppealVo.java
  2. 6 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LawyerConsultationOrderVO.java
  3. 2 2
      alien-entity/src/main/java/shop/alien/mapper/CommentAppealMapper.java
  4. 9 0
      alien-entity/src/main/java/shop/alien/mapper/LawyerConsultationOrderMapper.java
  5. 6 5
      alien-entity/src/main/resources/mapper/CommentAppealMapper.xml
  6. 2 2
      alien-gateway/src/main/java/shop/alien/gateway/controller/LawyerUserLogInController.java
  7. 3 3
      alien-lawyer/src/main/java/shop/alien/lawyer/controller/CommentAppealController.java
  8. 74 0
      alien-lawyer/src/main/java/shop/alien/lawyer/controller/LawyerNoticeController.java
  9. 27 0
      alien-lawyer/src/main/java/shop/alien/lawyer/service/LawyerNoticeService.java
  10. 60 4
      alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/CommentAppealServiceImpl.java
  11. 1 1
      alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerClientConsultationOrderServiceImpl.java
  12. 1 1
      alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerConsultationOrderServiceImpl.java
  13. 322 0
      alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerNoticeServiceImpl.java
  14. 4 2
      alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerUserServiceImpl.java
  15. 4 4
      alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerUserViolationServiceImpl.java
  16. 18 3
      alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/OrderExpirationServiceImpl.java

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/CommentAppealVo.java

@@ -87,6 +87,9 @@ public class CommentAppealVo implements Serializable {
     @ApiModelProperty(value = "评价用户名称")
     private String reviewUserName;
 
+    @ApiModelProperty(value = "用户名称")
+    private String userName;
+
     @ApiModelProperty(value = "评价用户头像")
     private String reviewUserAvatar;
 

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

@@ -196,6 +196,9 @@ public class LawyerConsultationOrderVO implements Serializable {
     @TableField("accept_orders_status")
     private  Integer acceptOrdersStatus;
 
+    @ApiModelProperty(value = "申请退款原因")
+    private  String applyRefundReason;
+
     @ApiModelProperty(value = "申请退款状态,0-未申请,1-已申请,2-律师已拒绝,3-律师已同意")
     @TableField("apply_refund_status")
     private  String applyRefundStatus;
@@ -211,5 +214,8 @@ public class LawyerConsultationOrderVO implements Serializable {
 
     @ApiModelProperty(value = "是否可申请举报(1-可举报,2-不可举报)")
     private  String isCanApplyViolation;
+
+    @ApiModelProperty(value = "是否已经评价(1-已评价,2-未评价)")
+    private  String isHasCommon;
 }
 

+ 2 - 2
alien-entity/src/main/java/shop/alien/mapper/CommentAppealMapper.java

@@ -21,11 +21,11 @@ public interface CommentAppealMapper extends BaseMapper<CommentAppeal> {
      * 查询申诉历史列表(包含评价和用户信息)
      *
      * @param status    申诉状态
-     * @param userId 律师用户ID
+     * @param lawyerUserId 律师用户ID
      * @return 申诉历史列表
      */
     List<CommentAppealVo> getAppealHistoryList(@Param("status") Integer status,
-                                                @Param("userId") Integer userId);
+                                                @Param("lawyerUserId") Integer lawyerUserId);
 
     /**
      * 根据ID查询申诉详情(包含评价和用户信息)

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

@@ -311,6 +311,11 @@ public interface LawyerConsultationOrderMapper extends BaseMapper<LawyerConsulta
             "        lco.order_str,\n" +
             "        lco.apply_refund_status,\n" +
             "        lco.reject_refund_reason,\n" +
+            "        lco.apply_refund_reason,\n" +
+            "        CASE\n" +
+            "        WHEN EXISTS (SELECT 1 FROM lawyer_order_review lor WHERE lor.order_id = lco.id) THEN '1'\n" +
+            "        ELSE '2'\n" +
+            "        END AS isHasCommon,\n" +
             "        lu.name AS lawyer_name,\n" +
             "        lu.phone AS lawyer_phone,\n" +
             "        lu.email AS lawyer_email,\n" +
@@ -377,6 +382,10 @@ public interface LawyerConsultationOrderMapper extends BaseMapper<LawyerConsulta
             "        lco.alipay_no,\n" +
             "        lco.order_str,\n" +
             "        lco.apply_refund_status,\n" +
+            "        CASE\n" +
+            "        WHEN EXISTS (SELECT 1 FROM lawyer_order_review lor WHERE lor.order_id = lco.id) THEN '1'\n" +
+            "        ELSE '2'\n" +
+            "        END AS isHasCommon,\n" +
             "        lu.name AS lawyer_name,\n" +
             "        lu.phone AS lawyer_phone,\n" +
             "        lu.email AS lawyer_email,\n" +

+ 6 - 5
alien-entity/src/main/resources/mapper/CommentAppealMapper.xml

@@ -36,6 +36,7 @@
         <!-- 评价相关信息 -->
         <result column="review_user_id" property="reviewUserId" />
         <result column="review_user_name" property="reviewUserName" />
+        <result column="user_name" property="userName" />
         <result column="review_user_avatar" property="reviewUserAvatar" />
         <result column="overall_rating" property="overallRating" />
         <result column="service_attitude_rating" property="serviceAttitudeRating" />
@@ -73,7 +74,7 @@
             CASE
                 WHEN orv.is_anonymous = 1 THEN '匿名用户'
                 ELSE lu.user_name
-            END AS review_user_name,
+            END AS user_name,
             CASE
                 WHEN orv.is_anonymous = 1 THEN NULL
                 ELSE lu.user_image
@@ -86,13 +87,13 @@
             orv.created_time AS review_time,
             orv.review_images
         FROM comment_appeals ca
-        LEFT JOIN lawyer_order_review orv ON orv.id = ca.comment_id AND orv.delete_flag = 0
+        LEFT JOIN lawyer_order_review orv ON orv.id = ca.comment_id
         LEFT JOIN life_user lu ON lu.id = orv.user_id AND lu.delete_flag = 0
         WHERE ca.delete_flag = 0
         <if test="status != null">
             AND ca.status = #{status}
         </if>
-        <if test="userId != null">
+        <if test="lawyerUserId != null">
             AND orv.lawyer_user_id = #{lawyerUserId}
         </if>
         ORDER BY ca.appeal_time DESC
@@ -161,7 +162,7 @@
             CASE
                 WHEN orv.is_anonymous = 1 THEN '匿名用户'
                 ELSE lu.user_name
-            END AS userName,
+            END AS user_name,
             CASE
                 WHEN orv.is_anonymous = 1 THEN NULL
                 ELSE lu.user_image
@@ -178,7 +179,7 @@
             orv.created_time AS review_time,
             orv.review_images
         FROM comment_appeals ca
-        LEFT JOIN lawyer_order_review orv ON orv.id = ca.comment_id AND orv.delete_flag = 0
+        LEFT JOIN lawyer_order_review orv ON orv.id = ca.comment_id
         LEFT JOIN life_user lu ON lu.id = orv.user_id AND lu.delete_flag = 0
         LEFT JOIN lawyer_user lu2 ON lu2.id = orv.lawyer_user_id AND lu2.delete_flag = 0
         WHERE ca.delete_flag = 0

+ 2 - 2
alien-gateway/src/main/java/shop/alien/gateway/controller/LawyerUserLogInController.java

@@ -66,7 +66,7 @@ public class LawyerUserLogInController {
             return R.fail("账号被禁用");
         }
         return Optional.ofNullable(lawyerUser).
-                map(user -> lawyerUserDto.getIsPassword() ? checkPassword(user, lawyerUserDto.getPassWord()) : lawyerUserService.createToKen(user)).
+                map(user -> lawyerUserDto.getIsPassword() ? checkPassword(user, lawyerUserDto.getPassword()) : lawyerUserService.createToKen(user)).
                 orElseGet(() -> R.fail("手机号不存在"));
     }
 
@@ -85,7 +85,7 @@ public class LawyerUserLogInController {
                 return R.fail("账号被禁用");
             }
             LawyerUser update = new LawyerUser();
-            update.setPassword(lawyerUserDto.getPassWord());
+            update.setPassword(lawyerUserDto.getPassword());
             update.setId(lawyerUser.getId());
             lawyerUserMapper.updateById(update);
             return R.success("修改成功");

+ 3 - 3
alien-lawyer/src/main/java/shop/alien/lawyer/controller/CommentAppealController.java

@@ -108,12 +108,12 @@ public class CommentAppealController {
             @ApiImplicitParam(name = "pageNum", value = "页数(默认1)", dataType = "int", paramType = "query"),
             @ApiImplicitParam(name = "pageSize", value = "页容(默认10)", dataType = "int", paramType = "query"),
             @ApiImplicitParam(name = "status", value = "申诉状态:0-待处理,1-已通过,2-已驳回", dataType = "Integer", paramType = "query"),
-            @ApiImplicitParam(name = "userId", value = "律师用户ID", dataType = "Integer", paramType = "query")
+            @ApiImplicitParam(name = "lawyerUserId", value = "律师用户ID", dataType = "Integer", paramType = "query")
     })
     @GetMapping("/getAppealHistory")
     public R<List<CommentAppealVo>> getAppealHistory(
-            @RequestParam(defaultValue = "1") int pageNum,
-            @RequestParam(defaultValue = "10") int pageSize,
+            @RequestParam int pageNum,
+            @RequestParam int pageSize,
             @RequestParam(required = false) Integer status,
             @RequestParam(required = false) Integer lawyerUserId) {
         log.info("CommentAppealController.getAppealHistory?pageNum={}, pageSize={}, status={}, lawyerUserId={}",

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

@@ -0,0 +1,74 @@
+package shop.alien.lawyer.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.*;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.*;
+import shop.alien.entity.result.R;
+import shop.alien.entity.store.vo.LifeNoticeVo;
+import shop.alien.lawyer.service.LawyerNoticeService;
+
+/**
+ * 律师通知控制器
+ *
+ * @author system
+ */
+@Api(tags = {"律师模块-通知"})
+@Slf4j
+@RestController
+@CrossOrigin
+@RequestMapping("/lawyerNotice")
+@RequiredArgsConstructor
+public class LawyerNoticeController {
+
+    private final LawyerNoticeService lawyerNoticeService;
+
+    /**
+     * 获取律师通知列表
+     *
+     * @param pageNum    页码,从1开始
+     * @param pageSize   每页大小
+     * @param receiverId 接收人ID
+     * @param noticeType 通知类型:0-系统通知和订单提醒之外的类型,1-系统通知,2-订单提醒
+     * @return 分页通知列表
+     */
+    @GetMapping("/list")
+    @ApiOperation("律师通知列表")
+    @ApiOperationSupport(order = 1)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "Integer", paramType = "query", required = true, example = "1"),
+            @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "Integer", paramType = "query", required = true, example = "10"),
+            @ApiImplicitParam(name = "receiverId", value = "接收人ID", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "noticeType", value = "通知类型:0-系统通知和订单提醒之外的类型,1-系统通知,2-订单提醒", dataType = "Integer", paramType = "query", example = "0")})
+    public R<IPage<LifeNoticeVo>> getLawyerNoticeList(
+            @RequestParam Integer pageNum,
+            @RequestParam Integer pageSize,
+            @RequestParam String receiverId,
+            @RequestParam(defaultValue = "0") Integer noticeType) {
+        log.info("LawyerNoticeController.getLawyerNoticeList, pageNum={}, pageSize={}, receiverId={}, noticeType={}", 
+                pageNum, pageSize, receiverId, noticeType);
+        
+        // 参数校验
+        if (pageNum == null || pageNum < 1) {
+            log.warn("分页参数无效,pageNum={}", pageNum);
+            return R.fail("页码必须大于0");
+        }
+        if (pageSize == null || pageSize < 1) {
+            log.warn("分页参数无效,pageSize={}", pageSize);
+            return R.fail("每页大小必须大于0");
+        }
+        if (StringUtils.isBlank(receiverId)) {
+            log.warn("接收人ID为空");
+            return R.fail("接收人ID不能为空");
+        }
+        if (noticeType == null || noticeType < 0) {
+            log.warn("通知类型参数无效,noticeType={}", noticeType);
+            return R.fail("通知类型参数无效");
+        }
+        
+        return lawyerNoticeService.getLawyerNoticeList(pageNum, pageSize, receiverId, noticeType);
+    }
+
+}

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

@@ -0,0 +1,27 @@
+package shop.alien.lawyer.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import shop.alien.entity.result.R;
+import shop.alien.entity.store.LifeNotice;
+import shop.alien.entity.store.vo.LifeNoticeVo;
+
+/**
+ * 律师通知服务接口
+ *
+ * @author system
+ */
+public interface LawyerNoticeService extends IService<LifeNotice> {
+
+    /**
+     * 获取律师通知列表
+     *
+     * @param pageNum    页码,从1开始
+     * @param pageSize   每页大小
+     * @param receiverId 接收人ID
+     * @param noticeType 通知类型:0-系统通知和订单提醒之外的类型,1-系统通知,2-订单提醒
+     * @return 分页通知列表
+     */
+    R<IPage<LifeNoticeVo>> getLawyerNoticeList(Integer pageNum, Integer pageSize, String receiverId, Integer noticeType);
+
+}

+ 60 - 4
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/CommentAppealServiceImpl.java

@@ -47,6 +47,7 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
     private final LifeUserMapper lifeUserMapper;
     private final LawyerUserMapper lawyerUserMapper;
 
+
     @Override
     public R<CommentAppeal> submitAppeal(CommentAppeal commentAppeal) {
         log.info("CommentAppealServiceImpl.submitAppeal?commentAppeal={}", commentAppeal);
@@ -79,6 +80,10 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
         boolean result = this.save(commentAppeal);
         if (result) {
             log.info("提交申诉成功,id={}", commentAppeal.getId());
+            
+            // 发送通知给评价用户,告知其评价被申诉了
+            sendSubmitAppealNotification(commentAppeal);
+            
             return R.data(commentAppeal, "申诉提交成功");
         } else {
             return R.fail("申诉提交失败");
@@ -159,6 +164,57 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
     }
 
     /**
+     * 发送提交申诉通知(给评价用户)
+     *
+     * @param appeal 申诉记录
+     */
+    private void sendSubmitAppealNotification(CommentAppeal appeal) {
+        try {
+            // 查询律师用户信息
+            LambdaQueryWrapper<LawyerUser> lawyerUser = new LambdaQueryWrapper<>();
+            lawyerUser.eq(LawyerUser :: getId, appeal.getLawyerUserId());
+            LawyerUser lifeUser = lawyerUserMapper.selectOne(lawyerUser);
+            if (lifeUser == null) {
+                log.warn("评价用户不存在,userId={}", lifeUser.getId());
+                return;
+            }
+            LambdaQueryWrapper<OrderReview> orderReviewLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            orderReviewLambdaQueryWrapper.eq(OrderReview ::  getId, appeal.getCommentId());
+            OrderReview orderReview = orderReviewMapper.selectOne(orderReviewLambdaQueryWrapper);
+            String orderNumber = "";
+            if(orderReview != null){
+                orderNumber = orderReview.getOrderNumber();
+            }
+            String receiverId = "user_" + lifeUser.getPhone();
+            String message = String.format("您提交的差评申诉信息,订单编号为"+ orderNumber +",已提交至平台审核,1-3个工作日会发送您审核结果,请注意查收。");
+
+            LifeNotice lifeNotice = new LifeNotice();
+            lifeNotice.setReceiverId(receiverId);
+            lifeNotice.setBusinessId(appeal.getId());
+            lifeNotice.setTitle("申诉通知");
+            lifeNotice.setSenderId("system");
+            lifeNotice.setIsRead(0);
+            lifeNotice.setNoticeType(1);
+            lifeNotice.setDeleteFlag(0);
+
+            com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
+            jsonObject.put("message", message);
+            jsonObject.put("orderNumber", orderReview.getOrderNumber());
+            jsonObject.put("appealId", appeal.getId());
+            jsonObject.put("status", "pending"); // 待审核状态
+            lifeNotice.setContext(jsonObject.toJSONString());
+
+            lifeNoticeMapper.insert(lifeNotice);
+
+            // 发送 WebSocket 消息
+            sendWebSocketNotification(receiverId, lifeNotice);
+            log.info("提交申诉通知发送成功,receiverId={}, appealId={}", receiverId, appeal.getId());
+        } catch (Exception e) {
+            log.error("发送提交申诉通知失败,appealId={}, error={}", appeal.getId(), e.getMessage(), e);
+        }
+    }
+
+    /**
      * 发送审核通知
      *
      * @param appeal      申诉记录
@@ -196,7 +252,7 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
             }
 
             String receiverId = "user_" + lifeUser.getUserPhone();
-            String message = String.format("您对订单编号为"+ orderReview.getOrderNumber() +"的评价,律师已进行申诉,经核实,您的评价不实,平台已删除此条评价及回复。触发条件:平台审核同意时触发",
+            String message = String.format("您对订单编号为"+ orderReview.getOrderNumber() +"的评价,律师已进行申诉,经核实,您的评价不实,平台已删除此条评价及回复。",
                     orderReview.getOrderNumber());
 
             LifeNotice lifeNotice = new LifeNotice();
@@ -243,8 +299,8 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
             String receiverId = "lawyer_" + lawyerUser.getPhone();
             String title = isSuccess ? "申诉成功通知" : "申诉失败通知";
             String message = isSuccess 
-                    ? String.format("您的编号"+ orderReview.getOrderNumber() +"的订单,提交的差评申诉信息,经核实,评价内容不实,平台已删除此条评价。触发条件:平台审核,点击同意按钮时触发。")
-                    : String.format("您的编号"+ orderReview.getOrderNumber() +"的订单,提交的差评申诉信息,经核实,评价内容属实。失败原因:评价属实。触发条件:平台审核,输入拒绝原因,点击确定按钮时触发");
+                    ? String.format("您的编号"+ orderReview.getOrderNumber() +"的订单,提交的差评申诉信息,经核实,评价内容不实,平台已删除此条评价。")
+                    : String.format("您的编号"+ orderReview.getOrderNumber() +"的订单,提交的差评申诉信息,经核实,评价内容属实。失败原因:"+ appeal.getReviewReasons() +"。");
 
             LifeNotice lifeNotice = new LifeNotice();
             lifeNotice.setReceiverId(receiverId);
@@ -471,7 +527,7 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
 
     @Override
     public List<CommentAppealVo> getAppealHistory(Integer pageNum, Integer pageSize, Integer status, Integer lawyerUserId) {
-        log.info("CommentAppealServiceImpl.getAppealHistory?pageNum={}, pageSize={}, status={}, userId={}",
+        log.info("CommentAppealServiceImpl.getAppealHistory?pageNum={}, pageSize={}, status={}, lawyerUserId={}",
                 pageNum, pageSize, status, lawyerUserId);
         List<CommentAppealVo> appealList = new ArrayList<>();
         //status 3 查全部

+ 1 - 1
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerClientConsultationOrderServiceImpl.java

@@ -1122,7 +1122,7 @@ public class LawyerClientConsultationOrderServiceImpl extends ServiceImpl<Lawyer
                     orderNumber, rejectReason);
 
             // 创建并保存通知
-            LifeNotice lifeNotice = createRefundNotice(order.getId(), receiverId, "退款申请处理通知", message);
+            LifeNotice lifeNotice = createRefundNotice(order.getId(), receiverId, "拒绝退款通知", message);
             int noticeResult = lifeNoticeMapper.insert(lifeNotice);
             if (noticeResult <= 0) {
                 log.warn("发送拒绝退款通知失败:保存通知失败,订单ID={}", order.getId());

+ 1 - 1
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerConsultationOrderServiceImpl.java

@@ -1672,7 +1672,7 @@ public class LawyerConsultationOrderServiceImpl extends ServiceImpl<LawyerConsul
                     orderNumber != null ? orderNumber : "");
 
             JSONObject jsonObject = new JSONObject();
-            jsonObject.put("title", "退款申请通知");
+            jsonObject.put("title", "申请退款通知");
             jsonObject.put("message", message);
             lifeNotice.setContext(jsonObject.toJSONString());
             lifeNotice.setNoticeType(1);

+ 322 - 0
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerNoticeServiceImpl.java

@@ -0,0 +1,322 @@
+package shop.alien.lawyer.service.impl;
+
+import cn.hutool.core.collection.CollectionUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+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;
+
+/**
+ * 律师通知服务实现类
+ *
+ * @author system
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class LawyerNoticeServiceImpl extends ServiceImpl<LifeNoticeMapper, LifeNotice> implements LawyerNoticeService {
+
+    /**
+     * 系统发送者标识
+     */
+    private static final String SYSTEM_SENDER = "system";
+
+    /**
+     * 平台类型:1-平台
+     */
+    private static final String PLATFORM_TYPE_ONE = "1";
+
+    /**
+     * 店铺审核通知标题
+     */
+    private static final String STORE_AUDIT_NOTICE_TITLE = "店铺审核通知";
+
+    /**
+     * 删除标识:0-未删除
+     */
+    private static final Integer DELETE_FLAG_NOT_DELETED = 0;
+
+    /**
+     * 发送者ID分隔符
+     */
+    private static final String SENDER_ID_SEPARATOR = "_";
+
+    /**
+     * 店铺类型标识
+     */
+    private static final String STORE_TYPE = "store";
+
+    /**
+     * 用户类型标识
+     */
+    private static final String USER_TYPE = "user";
+
+    /**
+     * 报告上下文类型范围
+     */
+    private static final String REPORT_CONTEXT_TYPE_RANGE = "1,2,3,6";
+
+    private final LifeNoticeMapper lifeNoticeMapper;
+
+    private final LifeMessageMapper lifeMessageMapper;
+
+    private final LawyerUserViolationMapper lawyerUserViolationMapper;
+
+    @Override
+    public R<IPage<LifeNoticeVo>> getLawyerNoticeList(Integer pageNum, Integer pageSize, String receiverId, Integer noticeType) {
+        // 构建查询条件
+        LambdaQueryWrapper<LifeNotice> queryWrapper = buildQueryWrapper(receiverId, noticeType);
+        
+        // 使用分页查询,避免查询全部数据
+        IPage<LifeNotice> noticePage = new Page<>(pageNum, pageSize);
+        IPage<LifeNotice> noticeResult = lifeNoticeMapper.selectPage(noticePage, queryWrapper);
+        
+        List<LifeNotice> lifeNoticeList = noticeResult.getRecords();
+        if (CollectionUtil.isEmpty(lifeNoticeList)) {
+            return R.data(createEmptyPageResult(pageNum, pageSize));
+        }
+
+        // 提取业务ID列表
+        List<Integer> businessIdList = extractBusinessIdList(lifeNoticeList);
+        
+        // 获取违规信息映射
+        Map<Integer, String> lawyerUserViolationMap = getLifeUserViolationMap(businessIdList);
+        
+        // 提取发送者ID并按类型分组
+        Map<String, List<String>> senderIdGroupMap = extractSenderIdGroupMap(lifeNoticeList);
+        
+        // 获取用户信息列表
+        List<LifeMessageVo> userList = getUserList(senderIdGroupMap);
+        
+        // 转换为VO列表
+        List<LifeNoticeVo> noticeVoList = convertToNoticeVoList(lifeNoticeList, userList);
+        
+        // 设置平台类型
+        setPlatformType(noticeVoList, lawyerUserViolationMap);
+        
+        // 构建分页结果
+        IPage<LifeNoticeVo> result = new Page<>(pageNum, pageSize);
+        result.setRecords(noticeVoList);
+        result.setTotal(noticeResult.getTotal());
+        result.setPages(noticeResult.getPages());
+        result.setCurrent(noticeResult.getCurrent());
+        result.setSize(noticeResult.getSize());
+        
+        return R.data(result);
+    }
+
+    /**
+     * 构建查询条件
+     *
+     * @param receiverId 接收人ID
+     * @param noticeType 通知类型
+     * @return 查询条件包装器
+     */
+    private LambdaQueryWrapper<LifeNotice> buildQueryWrapper(String receiverId, Integer noticeType) {
+        LambdaQueryWrapper<LifeNotice> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(LifeNotice::getReceiverId, receiverId)
+                .eq(LifeNotice::getNoticeType, noticeType)
+                .eq(LifeNotice::getDeleteFlag, DELETE_FLAG_NOT_DELETED)
+                .orderByDesc(LifeNotice::getCreatedTime);
+        return queryWrapper;
+    }
+
+    /**
+     * 创建空的分页结果
+     *
+     * @param pageNum  页码
+     * @param pageSize 每页大小
+     * @return 空的分页结果
+     */
+    private IPage<LifeNoticeVo> createEmptyPageResult(Integer pageNum, Integer pageSize) {
+        IPage<LifeNoticeVo> result = new Page<>(pageNum, pageSize);
+        result.setRecords(Collections.emptyList());
+        result.setTotal(0L);
+        result.setPages(0);
+        return result;
+    }
+
+    /**
+     * 提取业务ID列表
+     *
+     * @param lifeNoticeList 通知列表
+     * @return 业务ID列表
+     */
+    private List<Integer> extractBusinessIdList(List<LifeNotice> lifeNoticeList) {
+        return lifeNoticeList.stream()
+                .map(LifeNotice::getBusinessId)
+                .filter(Objects::nonNull)
+                .distinct()
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * 获取违规信息映射
+     *
+     * @param businessIdList 业务ID列表
+     * @return 违规信息映射,key为业务ID,value为报告上下文类型
+     */
+    private Map<Integer, String> getLifeUserViolationMap(List<Integer> businessIdList) {
+        if (CollectionUtil.isEmpty(businessIdList)) {
+            return Collections.emptyMap();
+        }
+        
+        List<LawyerUserViolation> lawyerUserViolationList = lawyerUserViolationMapper.selectBatchIds(businessIdList);
+        if (CollectionUtil.isEmpty(lawyerUserViolationList)) {
+            return Collections.emptyMap();
+        }
+        
+        return lawyerUserViolationList.stream()
+                .filter(violation -> violation != null && violation.getId() != null)
+                .collect(Collectors.toMap(
+                        LawyerUserViolation::getId,
+                        violation -> StringUtils.defaultString(violation.getReportContextType(), ""),
+                        (existing, replacement) -> existing
+                ));
+    }
+
+    /**
+     * 提取发送者ID并按类型分组
+     *
+     * @param lifeNoticeList 通知列表
+     * @return 发送者ID分组映射,key为类型(store/user),value为ID列表
+     */
+    private Map<String, List<String>> extractSenderIdGroupMap(List<LifeNotice> lifeNoticeList) {
+        return lifeNoticeList.stream()
+                .map(LifeNotice::getSenderId)
+                .filter(senderId -> StringUtils.isNotBlank(senderId) 
+                        && !SYSTEM_SENDER.equals(senderId) 
+                        && senderId.contains(SENDER_ID_SEPARATOR))
+                .collect(Collectors.groupingBy(
+                        senderId -> senderId.split(SENDER_ID_SEPARATOR)[0],
+                        Collectors.mapping(
+                                senderId -> senderId.split(SENDER_ID_SEPARATOR)[1],
+                                Collectors.toList()
+                        )
+                ));
+    }
+
+    /**
+     * 获取用户信息列表
+     *
+     * @param senderIdGroupMap 发送者ID分组映射
+     * @return 用户信息列表
+     */
+    private List<LifeMessageVo> getUserList(Map<String, List<String>> senderIdGroupMap) {
+        String storePhones = buildPhoneString(senderIdGroupMap.get(STORE_TYPE));
+        String userPhones = buildPhoneString(senderIdGroupMap.get(USER_TYPE));
+        return lifeMessageMapper.getLifeUserAndStoreUserByPhone(storePhones, userPhones);
+    }
+
+    /**
+     * 构建手机号字符串
+     *
+     * @param phoneList 手机号列表
+     * @return 手机号字符串,格式:'phone1','phone2'
+     */
+    private String buildPhoneString(List<String> phoneList) {
+        if (CollectionUtil.isEmpty(phoneList)) {
+            return "''";
+        }
+        return "'" + String.join("','", phoneList) + "'";
+    }
+
+    /**
+     * 转换为通知VO列表
+     *
+     * @param lifeNoticeList 通知列表
+     * @param userList       用户信息列表
+     * @return 通知VO列表
+     */
+    private List<LifeNoticeVo> convertToNoticeVoList(List<LifeNotice> lifeNoticeList, List<LifeMessageVo> userList) {
+        if (CollectionUtil.isEmpty(userList)) {
+            return lifeNoticeList.stream()
+                    .map(this::convertToNoticeVo)
+                    .collect(Collectors.toList());
+        }
+        
+        Map<String, LifeMessageVo> userMap = userList.stream()
+                .filter(user -> user != null && StringUtils.isNotBlank(user.getPhoneId()))
+                .collect(Collectors.toMap(
+                        LifeMessageVo::getPhoneId,
+                        user -> user,
+                        (existing, replacement) -> existing
+                ));
+        
+        return lifeNoticeList.stream()
+                .map(notice -> {
+                    LifeNoticeVo noticeVo = convertToNoticeVo(notice);
+                    LifeMessageVo userInfo = userMap.get(notice.getSenderId());
+                    if (userInfo != null && !SYSTEM_SENDER.equals(noticeVo.getSenderId())) {
+                        noticeVo.setUserName(userInfo.getUserName());
+                        noticeVo.setUserImage(userInfo.getUserImage());
+                    }
+                    return noticeVo;
+                })
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * 转换为通知VO
+     *
+     * @param notice 通知实体
+     * @return 通知VO
+     */
+    private LifeNoticeVo convertToNoticeVo(LifeNotice notice) {
+        LifeNoticeVo noticeVo = new LifeNoticeVo();
+        BeanUtils.copyProperties(notice, noticeVo);
+        return noticeVo;
+    }
+
+    /**
+     * 设置平台类型
+     *
+     * @param noticeVoList           通知VO列表
+     * @param lawyerUserViolationMap   违规信息映射
+     */
+    private void setPlatformType(List<LifeNoticeVo> noticeVoList, Map<Integer, String> lawyerUserViolationMap) {
+        for (LifeNoticeVo noticeVo : noticeVoList) {
+            if (noticeVo == null) {
+                continue;
+            }
+            
+            // 业务ID为空时设置为平台类型
+            if (noticeVo.getBusinessId() == null) {
+                noticeVo.setPlatformType(PLATFORM_TYPE_ONE);
+                continue;
+            }
+            
+            // 店铺审核通知设置为平台类型
+            if (STORE_AUDIT_NOTICE_TITLE.equals(noticeVo.getTitle())) {
+                noticeVo.setPlatformType(PLATFORM_TYPE_ONE);
+                continue;
+            }
+            
+            // 根据违规信息设置平台类型
+            String reportContextType = lawyerUserViolationMap.get(noticeVo.getBusinessId());
+            if (StringUtils.isNotBlank(reportContextType) 
+                    && REPORT_CONTEXT_TYPE_RANGE.contains(reportContextType)) {
+                noticeVo.setPlatformType(PLATFORM_TYPE_ONE);
+            }
+        }
+    }
+}

+ 4 - 2
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerUserServiceImpl.java

@@ -308,7 +308,7 @@ public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerU
 
         // 如果昵称不为空,添加昵称模糊查询条件
         if (nickName != null && !nickName.trim().isEmpty()) {
-            queryWrapper.like("nick_name", nickName.trim());
+            queryWrapper.like("name", nickName.trim());
         }
 
         // 排序:优先推荐律师 -> 在线律师 -> 注册时间
@@ -466,7 +466,7 @@ public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerU
             resultMap.put("orderReceivingStatus", 1);
         }
 
-        if (CollectionUtils.isEmpty( list) || lawyerUser.getStatus() == 0){
+        if (CollectionUtils.isEmpty( list) && lawyerUser.getStatus() == 0){
             // 设置注销相关字段
             lawyerUser.setLogoutFlag(1); // 注销标记:1-已注销
             lawyerUser.setLogoutTime(new Date()); // 注销时间
@@ -474,6 +474,8 @@ public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerU
             lawyerUser.setOrderReceivingStatus(0); // 接单状态设置为不接单
             lawyerUser.setIsOnline(0); // 在线状态设置为离线
             lawyerUser.setIsRecommended(0); // 推荐状态设置为不推荐
+            lawyerUser.setIsOnline(0);
+            lawyerUser.setDeleteFlag(1);
             lawyerUser.setLastOnlineTime(new Date());
 
             // 执行更新操作

+ 4 - 4
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/LawyerUserViolationServiceImpl.java

@@ -388,7 +388,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             // 构建通知消息内容
             String message = buildReporterMessage(lawyerUserViolation);
             JSONObject jsonObject = new JSONObject();
-            jsonObject.put("title", "平台已受理");
+            jsonObject.put("title", "举报通知");
             jsonObject.put("message", message);
             lifeNotice.setContext(jsonObject.toJSONString());
             lifeNotice.setNoticeType(1);
@@ -1079,7 +1079,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             if (REPORT_CONTEXT_TYPE_ORDER.equals(reportContextType)) {
                 notificationInfo.setMessage("您举报律师服务态度差,经核实,确实存在此行为,"
                         + "订单金额将在1-3个工作日原路返还,请注意查收。");
-                notificationInfo.setTitle("订单举报成功通知");
+                notificationInfo.setTitle("举报成功通知");
             }
         } else {
             // 审批驳回
@@ -1089,7 +1089,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
                     message += "拒绝原因:" + reportResult;
                 }
                 notificationInfo.setMessage(message);
-                notificationInfo.setTitle("用户举报失败通知");
+                notificationInfo.setTitle("举报失败通知");
             }
         }
 
@@ -1108,7 +1108,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
         String message = String.format("用户对编号为%s的订单进行申诉,经核实,用户举报属实,"
                 + "订单金额将会退还给用户。", orderId);
         notificationInfo.setMessage(message);
-        notificationInfo.setTitle("咨询订单被举报成功通知");
+        notificationInfo.setTitle("被举报成功通知");
         return notificationInfo;
     }
 

+ 18 - 3
alien-lawyer/src/main/java/shop/alien/lawyer/service/impl/OrderExpirationServiceImpl.java

@@ -153,7 +153,7 @@ public class OrderExpirationServiceImpl implements OrderExpirationService, Comma
                 log.info("訂單退款成功,訂單no: {}", orderNo);
 
                 //通知
-                LifeNotice lifeNotice = buildLifeNotice(order, title, message);
+                LifeNotice lifeNotice = buildUserLifeNotice(order, title, message);
                 WebSocketVo webSocketVo = buildWebSocketVo(lifeNotice);
 
                 lifeNoticeMapper.insert(lifeNotice);
@@ -185,14 +185,14 @@ public class OrderExpirationServiceImpl implements OrderExpirationService, Comma
                 log.info("訂單退款成功,訂單no: {}", orderNo);
 
                 //同意退款通知
-                LifeNotice lifeNotice = buildLifeNotice(order, "同意退款通知", "您的编号为" + orderNo + "的订单,律师已同意您的退款申请,订单金额将在1-3个工作日原路返还,请注意查收。");
+                LifeNotice lifeNotice = buildUserLifeNotice(order, "同意退款通知", "您的编号为" + orderNo + "的订单,律师已同意您的退款申请,订单金额将在1-3个工作日原路返还,请注意查收。");
                 WebSocketVo webSocketVo = buildWebSocketVo(lifeNotice);
 
                 lifeNoticeMapper.insert(lifeNotice);
                 webSocketProcess.sendMessage(lifeNotice.getReceiverId(), JSONObject.from(webSocketVo).toJSONString());
 
                 //退款到账通知
-                LifeNotice lifeNotice2 = buildLifeNotice(order, "退款到账通知", "您的编号为" + orderNo + "的订单,订单金额已原路返还至您的支付渠道,请查收。");
+                LifeNotice lifeNotice2 = buildUserLifeNotice(order, "退款到账通知", "您的编号为" + orderNo + "的订单,订单金额已原路返还至您的支付渠道,请查收。");
                 WebSocketVo webSocketVo2 = buildWebSocketVo(lifeNotice);
                 lifeNotice2.setCreatedTime(DateUtils.calcMinute(lifeNotice.getCreatedTime(), 2));
 
@@ -375,5 +375,20 @@ public class OrderExpirationServiceImpl implements OrderExpirationService, Comma
 
         return lifeNotice;
     }
+
+    private LifeNotice buildUserLifeNotice(LawyerConsultationOrder lawyerConsultationOrder,String title,String message){
+        LifeNotice lifeNotice = new LifeNotice();
+        lifeNotice.setSenderId(SYSTEM_SENDER_ID);
+        lifeNotice.setBusinessId(lawyerConsultationOrder.getId());
+        lifeNotice.setTitle(title);
+        lifeNotice.setReceiverId("user_" + lifeUserMapper.selectById(lawyerConsultationOrder.getClientUserId()).getUserPhone());
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("message", message);
+        lifeNotice.setContext(jsonObject.toJSONString());
+        lifeNotice.setNoticeType(1);
+
+        return lifeNotice;
+    }
 }