package com.gkhy.safePlatform.doublePrevention.controller; import com.gkhy.safePlatform.commons.co.ContextCacheUser; import com.gkhy.safePlatform.commons.vo.ResultVO; import com.gkhy.safePlatform.doublePrevention.entity.PreventDangerCheckTaskUnit; import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventDangerCheckTaskUnitDeleteReqDTO; import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventDangerCheckTaskUnitQueryReqDTO; import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventDangerCheckTaskUnitSaveReqDTO; import com.gkhy.safePlatform.doublePrevention.entity.dto.req.PreventDangerCheckTaskUnitUpdateReqDTO; import com.gkhy.safePlatform.doublePrevention.service.DangerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.security.Principal; @RestController @RequestMapping("prevent/taskUnit") public class PreventDangerCheckTaskUnitController { @Autowired private DangerService dangerService; /** * 隐患排查任务单元-分页查询 */ @PostMapping("/select/getTaskUnitPage") public ResultVO getTaskUnitPage(Authentication authentication, @RequestBody PreventDangerCheckTaskUnitQueryReqDTO taskUnitQueryReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return dangerService.getTaskUnitPage(currentUser.getUid(), taskUnitQueryReqDTO); } /** * 隐患排查任务单元-任务单元列表 */ @PostMapping("/select/listTaskUnit") public ResultVO listTaskUnit(Authentication authentication) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return dangerService.listTaskUnit(currentUser.getUid()); } /** * 隐患排查任务单元-新增 */ @PostMapping("/insert/saveTaskUnit") public ResultVO saveTaskUnit(Authentication authentication, @RequestBody PreventDangerCheckTaskUnitSaveReqDTO taskUnitSaveReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return dangerService.saveTaskUnit(currentUser.getUid(), taskUnitSaveReqDTO); } /** * 隐患排查任务单元-修改 */ @PostMapping("/update/updateTaskUnit") public ResultVO updateTaskUnit(Authentication authentication, @RequestBody PreventDangerCheckTaskUnitUpdateReqDTO taskUnitUpdateReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return dangerService.updateTaskUnit(currentUser.getUid(), taskUnitUpdateReqDTO); } /** * 隐患排查任务单元-删除 */ @PostMapping("/delete/deleteTaskUnit") public ResultVO deleteTaskUnit(Authentication authentication, @RequestBody PreventDangerCheckTaskUnitDeleteReqDTO taskUnitDeleteReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return dangerService.deleteTaskUnit(currentUser.getUid(), taskUnitDeleteReqDTO); } }