Ver código fonte

判断已经处罚过的数据 不进行处理

fangqing 1 mês atrás
pai
commit
e37fb18737

+ 16 - 4
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunityReportController.java

@@ -124,14 +124,14 @@ public class CommunityReportController {
     @ApiOperation("管理员查看界面")
     @GetMapping("/adminReport")
     //@Anonymous
-    public AjaxResult adminReport() {
+    public AjaxResult adminReport(Long id) {
         List<CommunityReportUserVo> communityReportUsers = null;
         try {
             int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
             int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
             int offset = (pageNum - 1) * pageSize;
             int searchType = Convert.toInt(ServletUtils.getParameter("searchType"), 0);
-            communityReportUsers = communityReportUserMapper.selectCommunityReportUser(offset, pageSize, searchType);
+            communityReportUsers = communityReportUserMapper.selectCommunityReportUser(offset, pageSize, searchType,id);
         } catch (Exception e) {
             System.out.println(e.getMessage());
             throw new ProjectException();
@@ -151,7 +151,20 @@ public class CommunityReportController {
         if (communityReportPunishVo.getId() == null) {
             return AjaxResult.error("ID不能为空");
         }
+        List<CommunityReportUserVo> communityReportUsers = null;
         try {
+            //判断已经处罚过的数据 不进行处理
+            communityReportUsers = communityReportUserMapper.selectCommunityReportUser(0, 100, 0,communityReportPunishVo.getId());
+            if (!communityReportUsers.isEmpty()) {
+                CommunityReportUserVo firstUser = communityReportUsers.get(0);
+                Long updateBy = firstUser.getUpdateBy();
+                if (updateBy != null) {
+                    return AjaxResult.success("当前举报数据已经被处理!");
+                }
+            }
+
+
+
             String disposalType = communityReportPunishVo.getDisposalType().toString(); //封禁类型
             Long disposalTime = communityReportPunishVo.getDisposalTime();              //封禁时间
             String dispositionReason = communityReportPunishVo.getDispositionReason();  //封禁理由
@@ -221,8 +234,7 @@ public class CommunityReportController {
             }
 
         } catch (Exception e) {
-            System.out.println(e.getMessage());
-            throw new ProjectException();
+            e.printStackTrace();
         }
         return AjaxResult.success(communityReportPunishVo);
     }

+ 2 - 1
ruoyi-generator/src/main/java/com/ruoyi/generator/mapper/community/CommunityReportUserMapper.java

@@ -20,5 +20,6 @@ public interface CommunityReportUserMapper extends BaseMapper<CommunityReportUse
      */
     List<CommunityReportUserVo> selectCommunityReportUser          (@Param("offset") int offset,
                                                                       @Param("limit") int limit,
-                                                                      @Param("searchType") int searchType);
+                                                                      @Param("searchType") int searchType,
+                                                                      @Param("id") Long  id);
 }

+ 5 - 0
ruoyi-generator/src/main/resources/mapper/community/CommunityReportUserMapper.xml

@@ -68,6 +68,11 @@
         and (b.is_delete != 1 or b.is_delete is null)
         ), '[]') AS images
         from community_report_user a
+       <where>
+            <if test="id != null and id != ''">
+                AND id = #{id}
+            </if>
+       </where>
         <if test="searchType == 1">
             order by a.create_time desc
         </if>