From 179c4d64313c9b7572778da4aaaf6c6584fe457d Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期二, 20 五月 2025 23:48:08 +0800
Subject: [PATCH] 修改文件上传类型限制

---
 springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/EventApi.java |  264 ++++++++++++++++------------------------------------
 1 files changed, 82 insertions(+), 182 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/EventApi.java b/springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/EventApi.java
index 376fd6b..9c54932 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/EventApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/EventApi.java
@@ -1,23 +1,26 @@
 package com.panzhihua.grid_app.api;
 
+import javax.annotation.Resource;
+
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 
 import com.panzhihua.common.controller.BaseController;
 import com.panzhihua.common.model.dtos.grid.*;
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.R;
+import com.panzhihua.common.model.vos.community.ComActVO;
+import com.panzhihua.common.model.vos.grid.EventDetailsVO;
+import com.panzhihua.common.model.vos.grid.EventGridDataAreaVO;
+import com.panzhihua.common.model.vos.grid.EventSpecialPopulationVO;
+import com.panzhihua.common.service.grid.GridService;
 import com.panzhihua.common.utlis.ClazzUtils;
-import com.panzhihua.common.utlis.IdCardUtil;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-//import com.panzhihua.common.model.vos.IPageVO;
-import com.panzhihua.common.service.grid.GridService;
 
-import javax.annotation.Resource;
-import com.panzhihua.common.model.vos.grid.EventDetailsVO;
-import com.panzhihua.common.model.vos.grid.EventVO;
+// import com.panzhihua.common.model.vos.IPageVO;
 
 /**
  *
@@ -25,228 +28,125 @@
  * @version 1.0
  * @since 1.0
  * @date 2021-05-26
- * */
+ */
 @Slf4j
 @RestController
 @RequestMapping("/event")
-@Api(tags = {"事件-突发/矛盾纠纷事件/治安隐患/不稳定因素/公共服务 @陈东"})
+@Api(tags = {"网格综治事件管理 @chendong", "宣传教育 @chendong", "特殊人群上报(开发中..) @chendong"})
 public class EventApi extends BaseController {
-
 
     @Resource
     private GridService gridService;
 
-    private boolean isDefaultType(Integer eventType){
-        if(eventType==null){
-            return false;
-        }
-        boolean inType = eventType==1 | eventType==2 |eventType==3| eventType==4| eventType==5;
-        return inType;
-    }
-
-    /**
-     * 事件列表
-     * @param pageEventDTO 查找事件
-     * @return 查找结果
-     */
-    @GetMapping("/usersList")
-    @ApiOperation(value = "事件列表", response= EventVO.class)
-    R usersList(@Validated @ModelAttribute PageEventDTO pageEventDTO){
-        ClazzUtils.setIfStringIsEmpty(pageEventDTO);
-        if(!isDefaultType(pageEventDTO.getEventType())){
-            return R.fail(400, "事件类型错误");
-        }
-        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
-        pageEventDTO.setUserId(loginUserInfoVO.getUserId());
-        return gridService.query(pageEventDTO);
-    }
-
-    /**
-     * 新增事件
-     * @param {classNameFirstLower}AddDTO 添加事件传递对象
-     * @return 新增结果
-     */
-    @PostMapping("/release")
-    @ApiOperation(value = "发布事件(直接)", response = R.class)
-    R add(@Validated @RequestBody CommonEventAddDTO commonEventAddDTO){
-        ClazzUtils.setIfStringIsEmpty(commonEventAddDTO);
-        if(!isDefaultType(commonEventAddDTO.getEventType())){
-            return R.fail(400, "事件类型错误");
-        }
-        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
-        commonEventAddDTO.setUserId(loginUserInfoVO.getUserId());
-        commonEventAddDTO.setUserName(loginUserInfoVO.getName());
-        commonEventAddDTO.setPhone(loginUserInfoVO.getPhone());
-        return gridService.addCommon(commonEventAddDTO);
-    }
-
-    /**
-     * 保存草稿
-     * @param commonEventEditDTO 保存草稿传递对象
-     * @return 新增结果
-     */
-    @PostMapping("/draft")
-    @ApiOperation(value = "保存草稿", response = R.class)
-    R saveDraft(@Validated @RequestBody CommonEventEditDTO commonEventEditDTO){
-        ClazzUtils.setIfStringIsEmpty(commonEventEditDTO);
-        ClazzUtils.setIfStringIsEmpty(commonEventEditDTO);
-        if(!isDefaultType(commonEventEditDTO.getEventType())){
-            return R.fail(400, "事件类型错误");
-        }
-        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
-        commonEventEditDTO.setUserId(loginUserInfoVO.getUserId());
-        commonEventEditDTO.setUserName(loginUserInfoVO.getName());
-        commonEventEditDTO.setPhone(loginUserInfoVO.getPhone());
-        return gridService.saveDraft(commonEventEditDTO);
-    }
-
-    /**
-     * 上报社区
-     * @param commonEventReportDTO 上报社区传递对象
-     * @return 上报结果
-     */
-    @PutMapping("/report")
-    @ApiOperation(value = "上报社区", response = R.class)
-    R report(@Validated @RequestBody CommonEventReportDTO commonEventReportDTO){
-        LoginUserInfoVO loginUserInfoVO = getLoginUserInfo();
-        ClazzUtils.setIfStringIsEmpty(commonEventReportDTO);
-        commonEventReportDTO.setUserId(loginUserInfoVO.getUserId());
-        commonEventReportDTO.setUserName(loginUserInfoVO.getName());
-        return gridService.report(commonEventReportDTO);
-    }
-
-
     /**
      * 撤销事件
-     * @param eventRevokeDTO 修改事件传递对象
+     * 
+     * @param eventRevokeDTO
+     *            修改事件传递对象
      * @return 修改结果
      */
     @PutMapping("/revoke")
     @ApiOperation(value = "撤销事件", response = R.class)
-    R revoke(@Validated @RequestBody EventRevokeDTO eventRevokeDTO){
+    R revoke(@Validated @RequestBody EventRevokeDTO eventRevokeDTO) {
         ClazzUtils.setIfStringIsEmpty(eventRevokeDTO);
-        eventRevokeDTO.setUserId(getUserId());
+        LoginUserInfoVO loginUserInfoVO = getLoginUserInfo();
+        eventRevokeDTO.setUserId(loginUserInfoVO.getUserId());
+        eventRevokeDTO.setUserName(loginUserInfoVO.getNickName());
+        eventRevokeDTO.setRevokeType(1);
+        eventRevokeDTO.setRevokeId(loginUserInfoVO.getUserId());
         return gridService.emergenciesRevoke(eventRevokeDTO);
     }
 
     /**
-     * 处理事件
-     * @param commonEventDealDTO 修改事件传递对象
-     * @return 处理结果
-     */
-    @PutMapping("/deal")
-    @ApiOperation(value = "处理事件", response = R.class)
-    R deal(@Validated @RequestBody CommonEventDealDTO commonEventDealDTO){
-        ClazzUtils.setIfStringIsEmpty(commonEventDealDTO);
-        LoginUserInfoVO loginUserInfoVO = new LoginUserInfoVO();
-        commonEventDealDTO.setUserId(loginUserInfoVO.getUserId());
-        commonEventDealDTO.setUserName(loginUserInfoVO.getName());
-        return gridService.dealEvent(commonEventDealDTO);
-    }
-
-    /**
-     * 验证事件
-     * @param commonEventVerifyDTO 验证事件传递对象
-     * @return 验证结果
-     */
-    @PutMapping("/verify")
-    @ApiOperation(value = "验证事件", response = R.class)
-    R verify(@Validated @RequestBody CommonEventVerifyDTO commonEventVerifyDTO){
-        ClazzUtils.setIfStringIsEmpty(commonEventVerifyDTO);
-        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
-        commonEventVerifyDTO.setUserId(loginUserInfoVO.getUserId());
-        commonEventVerifyDTO.setUserName(loginUserInfoVO.getName());
-        return gridService.verifyEvent(commonEventVerifyDTO);
-    }
-
-    /**
-     * 重新发布事件
-     * @param commonEventRepublicDTO 重新发布事件传递对象
-     * @return 修改结果
-     */
-    @PutMapping("/republish")
-    @ApiOperation(value = "重新发布事件", response = R.class)
-    R republish(@Validated @RequestBody CommonEventRepublicDTO commonEventRepublicDTO){
-        ClazzUtils.setIfStringIsEmpty(commonEventRepublicDTO);
-        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
-        commonEventRepublicDTO.setUserId(loginUserInfoVO.getUserId());
-        commonEventRepublicDTO.setUserName(loginUserInfoVO.getName());
-        return gridService.republishEvent(commonEventRepublicDTO);
-    }
-
-    /**
      * 查询事件详细信息
-     * @param id 事件 id
+     * 
+     * @param id
+     *            事件 id
      * @return 查找结果
      */
     @GetMapping("/{id}")
     @ApiOperation(value = "查询事件详细信息")
-    R<EventDetailsVO> details(@PathVariable("id") Long id){
+    R<EventDetailsVO> details(@PathVariable("id") Long id) {
         return gridService.eventDetails(id);
     }
 
     /**
+     * 删除
+     * 
+     * @param commonEventDeleteDTO
+     *            删除事件传递对象
+     * @return 删除结果
+     */
+    @DeleteMapping()
+    @ApiOperation(value = "删除事件", response = R.class)
+    R delete(@Validated @RequestBody CommonEventDeleteDTO commonEventDeleteDTO) {
+        ClazzUtils.setIfStringIsEmpty(commonEventDeleteDTO);
+        return gridService.delete(commonEventDeleteDTO);
+    }
+
+    /**
+     * 重新发布事件
+     * 
+     * @param commonEventRepublishDTO
+     *            重新发布事件传递对象
+     * @return 修改结果
+     */
+    @PutMapping("/republish")
+    @ApiOperation(value = "重新发布事件", response = R.class)
+    R republish(@Validated @RequestBody CommonEventRepublishDTO commonEventRepublishDTO) {
+        ClazzUtils.setIfStringIsEmpty(commonEventRepublishDTO);
+        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
+        commonEventRepublishDTO.setUserId(loginUserInfoVO.getUserId());
+        commonEventRepublishDTO.setUserName(loginUserInfoVO.getNickName());
+        return gridService.republishEvent(commonEventRepublishDTO);
+    }
+
+    /**
      * 发布草稿
-     * @param commonEventPublicDTO 添加事件传递对象
+     * 
+     * @param commonEventPublicDTO
+     *            添加事件传递对象
      * @return 新增结果
      */
     @PutMapping("/draft/release")
     @ApiOperation(value = "发布草稿", response = R.class)
-    R release(@Validated @RequestBody CommonEventPublicDTO commonEventPublicDTO){
+    R release(@Validated @RequestBody CommonEventPublicDTO commonEventPublicDTO) {
         ClazzUtils.setIfStringIsEmpty(commonEventPublicDTO);
         LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
         commonEventPublicDTO.setUserId(loginUserInfoVO.getUserId());
-        commonEventPublicDTO.setUserName(loginUserInfoVO.getName());
+        commonEventPublicDTO.setUserName(loginUserInfoVO.getNickName());
         return gridService.draftRelease(commonEventPublicDTO);
     }
 
-    //---
-    //---
-
     /**
-     * 添加特殊人群
-     * @param specialEventAddDTO 特殊人群信息
+     * 查询社区列表
+     * 
      * @return 查找结果
      */
-    @PostMapping("/special")
-    @ApiOperation(value = "添加特殊人群")
-    R addSpecial(@Validated @RequestBody SpecialEventAddDTO specialEventAddDTO){
-        ClazzUtils.setIfStringIsEmpty(specialEventAddDTO);
-        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
-        specialEventAddDTO.setUserId(loginUserInfoVO.getUserId());
-        specialEventAddDTO.setUserName(loginUserInfoVO.getName());
-        specialEventAddDTO.setPhone(loginUserInfoVO.getPhone());
-        return gridService.addSpecial(specialEventAddDTO);
+    @GetMapping("/actList")
+    @ApiOperation(value = "查询社区列表", response = ComActVO.class)
+    R actList() {
+        return gridService.actList();
     }
 
     /**
-     * 保存特殊人群草稿
-     * @param specialEventEditDTO 保存草稿传递对象
-     * @return 新增结果
+     * 查询距离当前事件最近的网格数据
+     * 
+     * @param pageEventGridNearbyDTO
+     * @return
      */
-    @PostMapping("/special/draft")
-    @ApiOperation(value = "保存特殊人群草稿", response = R.class)
-    R saveSpecialDraft(@Validated @RequestBody SpecialEventEditDTO specialEventEditDTO){
-        ClazzUtils.setIfStringIsEmpty(specialEventEditDTO);
-        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
-        specialEventEditDTO.setUserId(loginUserInfoVO.getUserId());
-        specialEventEditDTO.setUserName(loginUserInfoVO.getName());
-        specialEventEditDTO.setPhone(loginUserInfoVO.getPhone());
-        return gridService.saveSpecialDraft(specialEventEditDTO);
+    @PostMapping("/grid/nearby")
+    @ApiOperation(value = "查询经纬度所在的网格", response = EventGridDataAreaVO.class)
+    R getNearByGrid(@Validated @RequestBody PageEventGridNearbyDTO pageEventGridNearbyDTO) {
+        return gridService.getNearByGrid(pageEventGridNearbyDTO);
     }
 
-
-    @GetMapping("/special/{idCard}")
-    @ApiOperation(value = "查询特殊人群信息")
-    R getSpecialByIdCard(@PathVariable String idCard){
-        if(idCard!=null){
-            boolean verified = IdCardUtil.strongVerifyIdNumber(idCard);
-            if(!verified){
-                return R.fail("身份证格式错误");
-            }
-            return gridService.getSpecialPopulation(idCard);
-        }
-        return R.fail();
+    @ApiOperation(value = "查询社区特殊人群列表", response = EventSpecialPopulationVO.class)
+    @PostMapping("/special/population/list")
+    public R specialPopulationList(@RequestBody PageEventSpecialPopulationDTO specialPopulationDTO) {
+        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
+        specialPopulationDTO.setCommunityId(loginUserInfoVO.getCommunityId());
+        return gridService.specialPopulationList(specialPopulationDTO);
     }
 
 }
\ No newline at end of file

--
Gitblit v1.7.1