mitao
2025-05-20 179c4d64313c9b7572778da4aaaf6c6584fe457d
springcloud_k8s_panzhihuazhihuishequ/grid_app/src/main/java/com/panzhihua/grid_app/api/SpecialPopulationEventApi.java
@@ -1,22 +1,22 @@
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.ComMngPopulationVO;
import com.panzhihua.common.model.vos.grid.EventVO;
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 javax.annotation.Resource;
/**
 *
@@ -24,7 +24,7 @@
 * @version 1.0
 * @since 1.0
 * @date 2021-05-26
 * */
 */
@Slf4j
@RestController
@RequestMapping("/event/special")
@@ -36,12 +36,14 @@
    /**
     * 添加特殊人群
     * @param specialEventAddDTO 特殊人群信息
     *
     * @param specialEventAddDTO
     *            特殊人群信息
     * @return 查找结果
     */
    @PostMapping()
    @ApiOperation(value = "发布特殊人群事件", response = R.class)
    R addSpecial(@Validated @RequestBody SpecialEventAddDTO specialEventAddDTO){
    R addSpecial(@Validated @RequestBody SpecialEventAddDTO specialEventAddDTO) {
        ClazzUtils.setIfStringIsEmpty(specialEventAddDTO);
        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
        specialEventAddDTO.setUserId(loginUserInfoVO.getUserId());
@@ -52,12 +54,14 @@
    /**
     * 保存特殊人群草稿
     * @param specialEventEditDTO 保存草稿传递对象
     *
     * @param specialEventEditDTO
     *            保存草稿传递对象
     * @return 新增结果
     */
    @PostMapping("/draft")
    @ApiOperation(value = "保存特殊人群事件草稿", response = R.class)
    R saveSpecialDraft(@Validated @RequestBody SpecialEventEditDTO specialEventEditDTO){
    R saveSpecialDraft(@Validated @RequestBody SpecialEventEditDTO specialEventEditDTO) {
        ClazzUtils.setIfStringIsEmpty(specialEventEditDTO);
        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
        specialEventEditDTO.setUserId(loginUserInfoVO.getUserId());
@@ -66,13 +70,12 @@
        return gridService.saveSpecialDraft(specialEventEditDTO);
    }
    @GetMapping("/{idCard}")
    @ApiOperation(value = "查询特殊人群信息", response = ComMngPopulationVO.class)
    R getSpecialByIdCard(@PathVariable String idCard){
        if(idCard!=null){
    R getSpecialByIdCard(@PathVariable String idCard) {
        if (idCard != null) {
            boolean verified = IdCardUtil.strongVerifyIdNumber(idCard);
            if(!verified){
            if (!verified) {
                return R.fail("身份证格式错误");
            }
            return gridService.getSpecialPopulation(idCard);
@@ -82,12 +85,14 @@
    /**
     * 上报社区
     * @param commonEventReportDTO 上报社区传递对象
     *
     * @param commonEventReportDTO
     *            上报社区传递对象
     * @return 上报结果
     */
    @PutMapping("/report")
    @ApiOperation(value = "上报社区", response = R.class)
    R report(@Validated @RequestBody CommonEventReportDTO commonEventReportDTO){
    R report(@Validated @RequestBody CommonEventReportDTO commonEventReportDTO) {
        LoginUserInfoVO loginUserInfoVO = getLoginUserInfo();
        ClazzUtils.setIfStringIsEmpty(commonEventReportDTO);
        commonEventReportDTO.setUserId(loginUserInfoVO.getUserId());
@@ -98,12 +103,14 @@
    /**
     * 处理事件
     * @param commonEventDealDTO 修改事件传递对象
     *
     * @param commonEventDealDTO
     *            修改事件传递对象
     * @return 处理结果
     */
    @PutMapping("/deal")
    @ApiOperation(value = "处理事件", response = R.class)
    R deal(@Validated @RequestBody CommonEventDealDTO commonEventDealDTO){
    R deal(@Validated @RequestBody CommonEventDealDTO commonEventDealDTO) {
        ClazzUtils.setIfStringIsEmpty(commonEventDealDTO);
        LoginUserInfoVO loginUserInfoVO = new LoginUserInfoVO();
        commonEventDealDTO.setUserId(loginUserInfoVO.getUserId());
@@ -115,12 +122,14 @@
    /**
     * 验证事件
     * @param commonEventVerifyDTO 验证事件传递对象
     *
     * @param commonEventVerifyDTO
     *            验证事件传递对象
     * @return 验证结果
     */
    @PutMapping("/verify")
    @ApiOperation(value = "验证事件", response = R.class)
    R verify(@Validated @RequestBody CommonEventVerifyDTO commonEventVerifyDTO){
    R verify(@Validated @RequestBody CommonEventVerifyDTO commonEventVerifyDTO) {
        ClazzUtils.setIfStringIsEmpty(commonEventVerifyDTO);
        LoginUserInfoVO loginUserInfoVO = this.getLoginUserInfo();
        commonEventVerifyDTO.setUserId(loginUserInfoVO.getUserId());
@@ -130,12 +139,14 @@
    /**
     * 直接上报社区
     * @param commonEventDirectReportDTO 上报社区传递对象
     *
     * @param commonEventDirectReportDTO
     *            上报社区传递对象
     * @return 上报结果
     */
    @PostMapping("/reportDirect")
    @ApiOperation(value = "直接上报社区", response = R.class)
    R reportDirect(@Validated @RequestBody CommonEventDirectReportDTO commonEventDirectReportDTO){
    R reportDirect(@Validated @RequestBody CommonEventDirectReportDTO commonEventDirectReportDTO) {
        LoginUserInfoVO loginUserInfoVO = getLoginUserInfo();
        ClazzUtils.setIfStringIsEmpty(commonEventDirectReportDTO);
        commonEventDirectReportDTO.setUserId(loginUserInfoVO.getUserId());
@@ -143,6 +154,5 @@
        commonEventDirectReportDTO.setCommunityId(loginUserInfoVO.getCommunityId());
        return gridService.reportDirect(commonEventDirectReportDTO);
    }
}