songhuangfeng123
2022-07-27 c6f2b7fb231ff48e39ec71bd1de0dfacc75fa59d
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/controller/EmergencyPlanController.java
@@ -1,5 +1,6 @@
package com.gkhy.safePlatform.emergency.controller;
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
import com.gkhy.safePlatform.commons.query.PageQuery;
import com.gkhy.safePlatform.commons.utils.PageUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
@@ -9,6 +10,7 @@
import com.gkhy.safePlatform.emergency.query.EmergencyPlanQuery;
import com.gkhy.safePlatform.emergency.service.EmergencyPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
import java.security.Principal;
@@ -34,9 +36,9 @@
     * 应急预案新增
     */
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public ResultVO addEmergencyPlan(Principal principal, @RequestBody EmergencyPlanReqDTO emergencyPlanReqDTO) {
        String uid = principal.getName();
        return emergencyPlanService.addEmergencyPlan(Long.valueOf(uid), emergencyPlanReqDTO);
    public ResultVO addEmergencyPlan(Authentication authentication, @RequestBody EmergencyPlanReqDTO emergencyPlanReqDTO) {
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return emergencyPlanService.addEmergencyPlan(currentUser.getUid(), emergencyPlanReqDTO);
    }
    /**
@@ -46,4 +48,21 @@
    public ResultVO<EmergencyPlanDetailRespDTO> getEmergencyPlanById(@PathVariable("id")Long id){
        return emergencyPlanService.getEmergencyPlanById(id);
    }
    /**
     * 应急预案修改
     */
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public ResultVO updateEmergencyPlan(Authentication authentication, @RequestBody EmergencyPlanReqDTO emergencyPlanReqDTO) {
        ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
        return emergencyPlanService.updateEmergencyPlan(currentUser.getUid(), emergencyPlanReqDTO);
    }
    /**
     * 应急预案删除/批量删除
     */
    @RequestMapping(value = "/batchDelete/{ids}",method = RequestMethod.GET)
    public ResultVO batchDeleteEmergencyPlan(@PathVariable("ids")String ids){
        return emergencyPlanService.batchDeleteEmergencyPlan(ids);
    }
}