浏览代码

优化举报接口

zhangchen 3 周之前
父节点
当前提交
743f8f3198

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

@@ -60,10 +60,9 @@ public class LawyerUserViolationController {
     })
     @PostMapping("/userReporting")
     public R<String> userReporting(@RequestBody LawyerUserViolation lawyerUserViolation) {
-        log.info("用户举报请求,被举报用户ID:{},举报用户ID:{},违规类型:{}",
+        log.info("用户举报请求,被举报用户ID:{},举报用户ID:{}",
                 lawyerUserViolation.getReportedUserId(),
-                lawyerUserViolation.getReportingUserId(),
-                lawyerUserViolation.getViolationType());
+                lawyerUserViolation.getReportingUserId());
 
         try {
             int result = lawyerUserViolationService.userReporting(lawyerUserViolation);

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

@@ -79,8 +79,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
 
         log.info("开始处理用户举报,被举报用户ID:{},举报用户ID:{},违规类型:{}",
                 lawyerUserViolation.getReportedUserId(),
-                lawyerUserViolation.getReportingUserId(),
-                lawyerUserViolation.getViolationType());
+                lawyerUserViolation.getReportingUserId());
 
         try {
             // 保存举报记录
@@ -296,8 +295,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
 
         try {
             // 获取违规类型文本
-            String violationType = StringUtils.isNotEmpty(lawyerUserViolation.getViolationType())
-                    ? lawyerUserViolation.getViolationType() : "13";
+            String violationType =  "13";
             String violationText = EnumUtil.getStatusValue(Integer.parseInt(violationType));
 
             // 获取被举报用户名称
@@ -448,7 +446,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
     private String buildReportedMessage(LawyerUserViolation lawyerUserViolation) {
         try {
             // 获取违规类型文本
-            String violationType = lawyerUserViolation.getViolationType();
+            String violationType = lawyerUserViolation.getViolationReason();
             if (StringUtils.isEmpty(violationType)) {
                 log.warn("违规类型为空,无法构建被举报人消息");
                 return null;
@@ -511,7 +509,7 @@ public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolat
         }
         resultMap.put("message", lawyerUserViolation.getProcessingStatus() != null ? lawyerUserViolation.getProcessingStatus() : "");
         lawyerUserViolationVo.setReportObject(reportedUserName);
-        lawyerUserViolationVo.setViolationType(lawyerUserViolation.getViolationType());
+        lawyerUserViolationVo.setViolationReason(lawyerUserViolation.getViolationReason());
         lawyerUserViolationVo.setReportEvidenceImg(lawyerUserViolation.getReportEvidenceImg());
         lawyerUserViolationVo.setCreatedTime(lawyerUserViolation.getCreatedTime());
         resultMap.put("reportDetail", lawyerUserViolationVo);