Selaa lähdekoodia

优化举报接口

zhangchen 3 viikkoa sitten
vanhempi
commit
0e36ebc903

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

@@ -40,6 +40,41 @@ import java.util.stream.Collectors;
 @RequiredArgsConstructor
 public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolationMapper, LawyerUserViolation> implements LawyerUserViolationService {
 
+    /**
+     * 用户类型:商户用户
+     */
+    private static final String USER_TYPE_STORE = "1";
+
+    /**
+     * 用户类型:普通用户
+     */
+    private static final String USER_TYPE_LIFE = "2";
+
+    /**
+     * 用户类型:律师用户
+     */
+    private static final String USER_TYPE_LAWYER = "3";
+
+    /**
+     * 系统发送者ID
+     */
+    private static final String SYSTEM_SENDER_ID = "system";
+
+    /**
+     * 日期时间格式
+     */
+    private static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
+    /**
+     * 默认违规原因
+     */
+    private static final String DEFAULT_VIOLATION_REASON = "其他原因";
+
+    /**
+     * 默认通知消息
+     */
+    private static final String DEFAULT_NOTICE_MESSAGE = "平台已受理,感谢您的反馈!";
+
     private final LawyerUserViolationMapper lawyerUserViolationMapper;
 
     private final LawyerUserMapper lawyerUserMapper;
@@ -79,17 +114,15 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             return 0;
         }
 
-        log.info("开始处理用户举报,被举报用户ID:{},举报用户ID:{},违规类型:{}",
-                lawyerUserViolation.getReportedUserId(),
-                lawyerUserViolation.getReportingUserId());
+        String reportedUserId = lawyerUserViolation.getReportedUserId();
+        String reportingUserId = lawyerUserViolation.getReportingUserId();
+        log.info("开始处理用户举报,被举报用户ID:{},举报用户ID:{}", reportedUserId, reportingUserId);
 
         try {
             // 保存举报记录
             int result = lawyerUserViolationMapper.insert(lawyerUserViolation);
             if (result <= 0) {
-                log.warn("用户举报记录保存失败,被举报用户ID:{},举报用户ID:{}",
-                        lawyerUserViolation.getReportedUserId(),
-                        lawyerUserViolation.getReportingUserId());
+                log.warn("用户举报记录保存失败,被举报用户ID:{},举报用户ID:{}", reportedUserId, reportingUserId);
                 return 0;
             }
 
@@ -98,20 +131,18 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             // 向举报人发送受理通知
             sendReportNoticeToReporter(lawyerUserViolation);
 
-            // 根据举报内容类型,向被举报人发送通知
-            String reportContextType = lawyerUserViolation.getReportContextType();
-            if (StringUtils.isNotEmpty(reportContextType) && reportContextType.contains("6")) {
-                sendReportNoticeToReported(lawyerUserViolation);
-            }
+            // 根据举报内容类型,向被举报人发送通知(暂时注释)
+            // String reportContextType = lawyerUserViolation.getReportContextType();
+            // if (StringUtils.isNotEmpty(reportContextType) && reportContextType.contains("6")) {
+            //     sendReportNoticeToReported(lawyerUserViolation);
+            // }
 
             log.info("用户举报处理完成,举报ID:{}", lawyerUserViolation.getId());
             return result;
 
         } catch (Exception e) {
             log.error("用户举报处理异常,被举报用户ID:{},举报用户ID:{},异常信息:{}",
-                    lawyerUserViolation.getReportedUserId(),
-                    lawyerUserViolation.getReportingUserId(),
-                    e.getMessage(), e);
+                    reportedUserId, reportingUserId, e.getMessage(), e);
             throw new RuntimeException("用户举报处理失败:" + e.getMessage(), e);
         }
     }
@@ -138,7 +169,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             // 发送WebSocket消息
             WebSocketVo webSocketVo = buildWebSocketVo(lifeNotice);
             webSocketProcess.sendMessage(lifeNotice.getReceiverId(),
-                    com.alibaba.fastjson2.JSONObject.from(webSocketVo).toJSONString());
+                    JSONObject.from(webSocketVo).toJSONString());
 
             log.info("举报人通知发送成功,接收人ID:{}", lifeNotice.getReceiverId());
 
@@ -170,7 +201,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             // 发送WebSocket消息
             WebSocketVo webSocketVo = buildWebSocketVo(lifeNoticeReported);
             webSocketProcess.sendMessage(lifeNoticeReported.getReceiverId(),
-                    com.alibaba.fastjson2.JSONObject.from(webSocketVo).toJSONString());
+                    JSONObject.from(webSocketVo).toJSONString());
 
             log.info("被举报人通知发送成功,接收人ID:{}", lifeNoticeReported.getReceiverId());
 
@@ -188,12 +219,12 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
      */
     private WebSocketVo buildWebSocketVo(LifeNotice lifeNotice) {
         WebSocketVo webSocketVo = new WebSocketVo();
-        webSocketVo.setSenderId("system");
+        webSocketVo.setSenderId(SYSTEM_SENDER_ID);
         webSocketVo.setReceiverId(lifeNotice.getReceiverId());
         webSocketVo.setCategory("notice");
         webSocketVo.setNoticeType("1");
         webSocketVo.setIsRead(0);
-        webSocketVo.setText(com.alibaba.fastjson2.JSONObject.from(lifeNotice).toJSONString());
+        webSocketVo.setText(JSONObject.from(lifeNotice).toJSONString());
         return webSocketVo;
     }
 
@@ -211,7 +242,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
 
         try {
             LifeNotice lifeNotice = new LifeNotice();
-            lifeNotice.setSenderId("system");
+            lifeNotice.setSenderId(SYSTEM_SENDER_ID);
             lifeNotice.setBusinessId(lawyerUserViolation.getId());
             lifeNotice.setTitle("举报通知");
 
@@ -256,19 +287,19 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
         }
 
         String phone = null;
-        if ("3".equals(reportingUserType)) {
+        if (USER_TYPE_LAWYER.equals(reportingUserType)) {
             LawyerUser lawyerUser = lawyerUserMapper.selectById(reportingUserId);
             if (lawyerUser != null && StringUtils.isNotEmpty(lawyerUser.getPhone())) {
                 phone = lawyerUser.getPhone();
                 return "lawyer_" + phone;
             }
-        } else if ("1".equals(reportingUserType)) {
+        } else if (USER_TYPE_STORE.equals(reportingUserType)) {
             StoreUser storeUser = storeUserMapper.selectById(reportingUserId);
             if (storeUser != null && StringUtils.isNotEmpty(storeUser.getPhone())) {
                 phone = storeUser.getPhone();
                 return "store_" + phone;
             }
-        } else {
+        } else if (USER_TYPE_LIFE.equals(reportingUserType)) {
             LifeUser lifeUser = lifeUserMapper.selectById(reportingUserId);
             if (lifeUser != null && StringUtils.isNotEmpty(lifeUser.getUserPhone())) {
                 phone = lifeUser.getUserPhone();
@@ -288,35 +319,60 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
      */
     private String buildReporterMessage(LawyerUserViolation lawyerUserViolation) {
         String reportContextType = lawyerUserViolation.getReportContextType();
-        String defaultMessage = "平台已受理,感谢您的反馈!";
 
-        // 如果举报内容类型包含"6",需要构建详细消息
+        // 如果举报内容类型不包含"6",返回默认消息
         if (StringUtils.isEmpty(reportContextType) || !reportContextType.contains("6")) {
-            return defaultMessage;
+            return DEFAULT_NOTICE_MESSAGE;
         }
 
         try {
-            // 获取违规类型文本
-            String violationType =  "13";
-            String violationText = EnumUtil.getStatusValue(Integer.parseInt(violationType));
-
             // 获取被举报用户名称
             String reportedUserName = getReportedUserName(lawyerUserViolation);
             if (StringUtils.isEmpty(reportedUserName)) {
                 log.warn("获取被举报用户名称失败,使用默认消息");
-                return defaultMessage;
+                return DEFAULT_NOTICE_MESSAGE;
             }
 
             // 格式化时间
-            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_TIME_FORMAT);
             String reportDate = dateFormat.format(new Date());
 
-            return String.format("您在%s举报用户%s,涉嫌%s,已提交至平台审核,1-3个工作日会将审核结果发送到您应用内的消息-通知中,请注意查收。",
-                    reportDate, reportedUserName, violationText);
+            // 获取违规原因
+            String violationReason = getViolationReason(lawyerUserViolation);
+
+            return String.format("您%s举报%s律师%s,已提交至平台审核,1-3个工作日会发送您审核结果,请注意查收。",
+                    reportDate, reportedUserName, violationReason);
 
         } catch (Exception e) {
             log.error("构建举报人消息异常,使用默认消息,异常信息:{}", e.getMessage(), e);
-            return defaultMessage;
+            return DEFAULT_NOTICE_MESSAGE;
+        }
+    }
+
+    /**
+     * 获取违规原因
+     *
+     * @param lawyerUserViolation 举报信息对象
+     * @return 违规原因文本
+     */
+    private String getViolationReason(LawyerUserViolation lawyerUserViolation) {
+        String violationReasonId = lawyerUserViolation.getViolationReason();
+        if (StringUtils.isEmpty(violationReasonId)) {
+            return DEFAULT_VIOLATION_REASON;
+        }
+
+        try {
+            StoreDictionary storeDictionary = storeDictionaryMapper.selectById(violationReasonId);
+            if (storeDictionary != null && !DEFAULT_VIOLATION_REASON.equals(storeDictionary.getDictDetail())) {
+                return storeDictionary.getDictDetail();
+            } else {
+                // 如果是"其他原因",返回其他原因内容
+                String otherReason = lawyerUserViolation.getOtherReasonContent();
+                return StringUtils.isNotEmpty(otherReason) ? otherReason : DEFAULT_VIOLATION_REASON;
+            }
+        } catch (Exception e) {
+            log.error("获取违规原因异常,使用默认原因,异常信息:{}", e.getMessage(), e);
+            return DEFAULT_VIOLATION_REASON;
         }
     }
 
@@ -334,10 +390,10 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             return null;
         }
 
-        if ("3".equals(reportedUserType)) {
+        if (USER_TYPE_LAWYER.equals(reportedUserType)) {
             LawyerUser lawyerUser = lawyerUserMapper.selectById(reportedUserId);
             return lawyerUser != null ? lawyerUser.getName() : null;
-        } else if ("1".equals(reportedUserType)) {
+        } else if (USER_TYPE_STORE.equals(reportedUserType)) {
             StoreUser storeUser = storeUserMapper.selectById(reportedUserId);
             return storeUser != null ? storeUser.getNickName() : null;
         } else {
@@ -358,9 +414,9 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             return null;
         }
 
-        // 只有举报内容类型为"1"时才需要向被举报人发送通知
+        // 只有举报内容类型为"6"时才需要向被举报人发送通知
         String reportContextType = lawyerUserViolation.getReportContextType();
-        if (!"1".equals(reportContextType)) {
+        if (!"6".equals(reportContextType)) {
             return null;
         }
 
@@ -374,7 +430,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
 
             // 构建通知消息
             LifeNotice lifeNotice = new LifeNotice();
-            lifeNotice.setSenderId("system");
+            lifeNotice.setSenderId(SYSTEM_SENDER_ID);
             lifeNotice.setBusinessId(lawyerUserViolation.getId());
             lifeNotice.setTitle("举报通知");
             lifeNotice.setReceiverId(receiverId);
@@ -415,13 +471,13 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
         }
 
         String phone = null;
-        if ("3".equals(reportedUserType)) {
+        if (USER_TYPE_LAWYER.equals(reportedUserType)) {
             LawyerUser lawyerUser = lawyerUserMapper.selectById(reportedUserId);
             if (lawyerUser != null && StringUtils.isNotEmpty(lawyerUser.getPhone())) {
                 phone = lawyerUser.getPhone();
                 return "lawyer_" + phone;
             }
-        } else if ("1".equals(reportedUserType)) {
+        } else if (USER_TYPE_STORE.equals(reportedUserType)) {
             StoreUser storeUser = storeUserMapper.selectById(reportedUserId);
             if (storeUser != null && StringUtils.isNotEmpty(storeUser.getPhone())) {
                 phone = storeUser.getPhone();
@@ -457,7 +513,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
             String violationText = EnumUtil.getStatusValue(Integer.parseInt(violationType));
 
             // 格式化时间
-            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_TIME_FORMAT);
             String reportDate = dateFormat.format(new Date());
 
             return String.format("您在%s被举报涉嫌%s,平台将会进行核实。如确实存在违规行为,平台将禁用您的账号**天,到期后账号可恢复使用,应用内的环境需要我们共同维护。",
@@ -565,96 +621,210 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
         });
     }
 
+    /**
+     * 处理状态:通过
+     */
+    private static final String PROCESSING_STATUS_APPROVED = "1";
+
+    /**
+     * 举报内容类型:服务态度差
+     */
+    private static final String REPORT_CONTEXT_TYPE_SERVICE_ATTITUDE = "6";
+
+    /**
+     * 审批举报记录
+     * <p>
+     * 处理举报记录的审批,包括:
+     * 1. 更新举报记录的处理状态、处理时间和处理结果
+     * 2. 根据处理结果构建通知消息
+     * 3. 向举报人发送审批结果通知
+     * </p>
+     *
+     * @param id               举报记录ID,必须大于0
+     * @param processingStatus 处理状态,"1"表示通过,其他表示驳回
+     * @param reportResult     处理结果说明,驳回时必填
+     * @throws RuntimeException 当举报记录不存在或处理失败时抛出
+     * @author system
+     * @since 2025-01-XX
+     */
     @Override
     public void approve(int id, String processingStatus, String reportResult) {
-        if(id==0 || StringUtils.isBlank(processingStatus)){
+        // 参数校验
+        if (id <= 0 || StringUtils.isBlank(processingStatus)) {
+            log.warn("审批举报记录参数无效,ID:{},处理状态:{}", id, processingStatus);
             return;
         }
-        LawyerUserViolation v = lawyerUserViolationMapper.selectById(id);
-        v.setProcessingStatus(processingStatus);
-        v.setProcessingTime(new Date());
-        v.setReportResult(reportResult);
-
-        // 举报时间
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String violationTime = simpleDateFormat.format(v.getCreatedTime());
-        // 被举报人信息
-        String reportedUserName = "";
-        if(StringUtils.isNotEmpty(v.getReportedUserId())){
-            if ("3".equals(v.getReportedUserType())) {
-                LawyerUser lawyerUser = lawyerUserMapper.selectById(v.getReportedUserId());
-                if(lawyerUser != null){
-                    reportedUserName = lawyerUser.getName();
-                }
-            } else if ("1".equals(v.getReportedUserType())) {
-                StoreUser storeUser = storeUserMapper.selectById(v.getReportedUserId());
-                if(storeUser != null){
-                    reportedUserName = storeUser.getNickName();
-                }
-            } else{
-                LifeUser lifeUser = lifeUserMapper.selectById(v.getReportedUserId());
-                if(lifeUser != null) {
-                    reportedUserName = lifeUser.getUserName();
-                }
+
+        log.info("开始审批举报记录,ID:{},处理状态:{}", id, processingStatus);
+
+        try {
+            // 查询举报记录
+            LawyerUserViolation violation = lawyerUserViolationMapper.selectById(id);
+            if (violation == null) {
+                log.warn("举报记录不存在,ID:{}", id);
+                return;
+            }
+
+            // 更新举报记录
+            violation.setProcessingStatus(processingStatus);
+            violation.setProcessingTime(new Date());
+            violation.setReportResult(reportResult);
+            int updateResult = lawyerUserViolationMapper.updateById(violation);
+            if (updateResult <= 0) {
+                log.warn("更新举报记录失败,ID:{}", id);
+                return;
             }
+
+            log.info("举报记录更新成功,ID:{}", id);
+
+            // 构建并发送通知
+            sendApprovalNotice(violation, processingStatus, reportResult);
+
+            log.info("审批举报记录完成,ID:{}", id);
+
+        } catch (Exception e) {
+            log.error("审批举报记录异常,ID:{},异常信息:{}", id, e.getMessage(), e);
+            throw new RuntimeException("审批举报记录失败:" + e.getMessage(), e);
         }
+    }
 
-        // 举报通知信息
-        String message = "";
-        String title = "";
-        if (processingStatus.equals("1")) {
-            // 通过
-            if (v.getReportContextType().equals("1")) {
-                // 用户
-                message = "您在"+violationTime+"举报用户"+reportedUserName+",涉嫌违法违规,经核实,确实存在违规行为,平台已将用户禁用,感谢您为此做出的贡献。";
-                title = "用户举报成功通知";
+    /**
+     * 发送审批结果通知
+     *
+     * @param violation        举报记录对象
+     * @param processingStatus 处理状态
+     * @param reportResult     处理结果说明
+     */
+    private void sendApprovalNotice(LawyerUserViolation violation, String processingStatus, String reportResult) {
+        try {
+            // 构建通知消息
+            ApprovalNoticeContent noticeContent = buildApprovalNoticeContent(violation, processingStatus, reportResult);
+            if (noticeContent == null || StringUtils.isBlank(noticeContent.getMessage())) {
+                log.warn("构建审批通知消息失败,举报ID:{}", violation.getId());
+                return;
             }
-        } else {
-            // 驳回
-            switch (v.getReportContextType()) {
-                case "1":
-                    message = "您在"+violationTime+"举报用户"+reportedUserName+",涉嫌违法违规,经核实,不存在违规行为,感谢您为此做出的贡献。";
-                    title = "用户举报失败通知";
-                    break;
+
+            // 获取举报人接收ID
+            String receiverId = getReporterReceiverId(violation);
+            if (StringUtils.isBlank(receiverId)) {
+                log.warn("获取举报人接收ID失败,举报ID:{}", violation.getId());
+                return;
             }
-        }
-        lawyerUserViolationMapper.updateById(v);
-        LifeNotice LifeMessage = new LifeNotice();
-        com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
-        jsonObject.put("message", message);
-        LifeMessage.setContext(jsonObject.toJSONString());
-        LifeMessage.setSenderId("system");
-        LifeMessage.setIsRead(0);
-        LifeMessage.setTitle(title);
-        LifeMessage.setNoticeType(1);
-        LifeMessage.setBusinessId(id);
-        if ("3".equals(v.getReportingUserType())) {
-            LawyerUser lawyerUser = lawyerUserService.getById(v.getReportingUserId());
-            LifeMessage.setReceiverId("lawyer_" + lawyerUser.getPhone());
-        } else if ("1".equals(v.getReportingUserType())) {
-            StoreUser storeUser = storeUserMapper.selectById(v.getReportingUserId());
-            if (storeUser != null) {
-                LifeMessage.setReceiverId("store_" + storeUser.getPhone());
+
+            // 创建通知记录
+            LifeNotice lifeNotice = createApprovalLifeNotice(violation.getId(), receiverId, noticeContent);
+            int noticeResult = lifeNoticeMapper.insert(lifeNotice);
+            if (noticeResult <= 0) {
+                log.warn("保存审批通知失败,举报ID:{}", violation.getId());
+                return;
             }
+
+            log.info("审批通知保存成功,接收人ID:{}", receiverId);
+
+            // 发送WebSocket消息
+            sendApprovalWebSocketMessage(lifeNotice, receiverId);
+
+            log.info("审批通知发送成功,接收人ID:{}", receiverId);
+
+        } catch (Exception e) {
+            log.error("发送审批结果通知异常,举报ID:{},异常信息:{}",
+                    violation.getId(), e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 构建审批通知消息内容
+     *
+     * @param violation        举报记录对象
+     * @param processingStatus 处理状态
+     * @param reportResult     处理结果说明
+     * @return 通知内容对象,如果无法构建返回null
+     */
+    private ApprovalNoticeContent buildApprovalNoticeContent(LawyerUserViolation violation,
+                                                             String processingStatus,
+                                                             String reportResult) {
+        String reportContextType = violation.getReportContextType();
+        if (!REPORT_CONTEXT_TYPE_SERVICE_ATTITUDE.equals(reportContextType)) {
+            log.debug("当前举报内容类型无需发送通知,举报ID:{},类型:{}", violation.getId(), reportContextType);
+            return null;
+        }
+
+        ApprovalNoticeContent content = new ApprovalNoticeContent();
+        if (PROCESSING_STATUS_APPROVED.equals(processingStatus)) {
+            // 审批通过
+            content.setMessage("您举报律师服务态度差,经核实,确实存在此行为,订单金额将在1-3个工作日原路返还,请注意查收。");
+            content.setTitle("用户举报成功通知");
         } else {
-            LifeUser lifeUser = lifeUserMapper.selectById(v.getReportingUserId());
-            if (lifeUser != null) {
-                LifeMessage.setReceiverId("user_" + lifeUser.getUserPhone());
-            }
+            // 审批驳回
+            String rejectReason = StringUtils.isNotBlank(reportResult) ? reportResult : "无";
+            content.setMessage("您举报律师服务态度差,经核实,不存在此行为,订单金额不予退还。拒绝原因:" + rejectReason);
+            content.setTitle("用户举报失败通知");
         }
-        lifeNoticeMapper.insert(LifeMessage);
 
-        WebSocketVo websocketVo = new WebSocketVo();
-        websocketVo.setSenderId("system");
-        websocketVo.setReceiverId(LifeMessage.getReceiverId());
-        websocketVo.setCategory("notice");
-        websocketVo.setNoticeType("1");
-        websocketVo.setIsRead(0);
-        websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(LifeMessage).toJSONString());
+        return content;
+    }
+
+    /**
+     * 创建审批通知对象
+     *
+     * @param businessId  业务ID(举报记录ID)
+     * @param receiverId  接收人ID
+     * @param noticeContent 通知内容
+     * @return 通知对象
+     */
+    private LifeNotice createApprovalLifeNotice(Integer businessId, String receiverId,
+                                                 ApprovalNoticeContent noticeContent) {
+        LifeNotice lifeNotice = new LifeNotice();
+        lifeNotice.setSenderId(SYSTEM_SENDER_ID);
+        lifeNotice.setBusinessId(businessId);
+        lifeNotice.setTitle(noticeContent.getTitle());
+        lifeNotice.setReceiverId(receiverId);
+        lifeNotice.setNoticeType(1);
+        lifeNotice.setIsRead(0);
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("message", noticeContent.getMessage());
+        lifeNotice.setContext(jsonObject.toJSONString());
+
+        return lifeNotice;
+    }
+
+    /**
+     * 发送审批结果WebSocket消息
+     *
+     * @param lifeNotice 通知对象
+     * @param receiverId 接收人ID
+     */
+    private void sendApprovalWebSocketMessage(LifeNotice lifeNotice, String receiverId) {
         try {
-            webSocketProcess.sendMessage(LifeMessage.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
+            WebSocketVo webSocketVo = buildWebSocketVo(lifeNotice);
+            webSocketProcess.sendMessage(receiverId, JSONObject.from(webSocketVo).toJSONString());
         } catch (Exception e) {
-            log.error("LawyerUserViolationServiceImpl_approve Error Stack={}", e.getMessage());
+            log.error("发送审批结果WebSocket消息异常,接收人ID:{},异常信息:{}", receiverId, e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 审批通知内容内部类
+     */
+    private static class ApprovalNoticeContent {
+        private String message;
+        private String title;
+
+        public String getMessage() {
+            return message;
+        }
+
+        public void setMessage(String message) {
+            this.message = message;
+        }
+
+        public String getTitle() {
+            return title;
+        }
+
+        public void setTitle(String title) {
+            this.title = title;
         }
     }