package com.gk.hotwork.doublePrevention.controller; import com.gk.hotwork.Controller.Base.BaseController; import com.gk.hotwork.Domain.co.ContextCacheUser; import com.gk.hotwork.Domain.Vo.ResultVO; import com.gk.hotwork.doublePrevention.entity.PreventDangerCheckTaskUnit; import com.gk.hotwork.doublePrevention.entity.PreventRiskAnaUnit; import com.gk.hotwork.doublePrevention.entity.dto.req.*; import com.gk.hotwork.doublePrevention.service.DangerService; import com.gk.hotwork.doublePrevention.utils.CacheUserTransfer; 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; @RestController @RequestMapping("prevent/taskUnit") public class PreventDangerCheckTaskUnitController extends BaseController { @Autowired private DangerService dangerService; /** * 隐患排查任务单元-分页查询 */ @PostMapping("/select/getTaskUnitPage") public ResultVO getTaskUnitPage(Authentication authentication, @RequestBody PreventDangerCheckTaskUnitQueryReqDTO taskUnitQueryReqDTO) { //获取用户信息 ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); return dangerService.getTaskUnitPage(currentUser.getUid(), taskUnitQueryReqDTO); } /** * 隐患排查任务单元-任务单元列表 */ @PostMapping("/select/listTaskUnit") public ResultVO listTaskUnit(Authentication authentication) { //获取用户信息 ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); return dangerService.listTaskUnit(currentUser.getUid()); } /** * 隐患排查任务单元-新增 */ @PostMapping("/insert/saveTaskUnit") public ResultVO saveTaskUnit(Authentication authentication, @RequestBody PreventDangerCheckTaskUnitSaveReqDTO taskUnitSaveReqDTO) { //获取用户信息 ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); return dangerService.saveTaskUnit(currentUser.getUid(), taskUnitSaveReqDTO); } /** * 隐患排查任务单元-修改 */ @PostMapping("/update/updateTaskUnit") public ResultVO updateTaskUnit(Authentication authentication, @RequestBody PreventDangerCheckTaskUnitUpdateReqDTO taskUnitUpdateReqDTO) { //获取用户信息 ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); return dangerService.updateTaskUnit(currentUser.getUid(), taskUnitUpdateReqDTO); } /** * 隐患排查任务单元-删除 */ @PostMapping("/delete/deleteTaskUnit") public ResultVO deleteTaskUnit(Authentication authentication, @RequestBody PreventDangerCheckTaskUnitDeleteReqDTO taskUnitDeleteReqDTO) { //获取用户信息 ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); return dangerService.deleteTaskUnit(currentUser.getUid(), taskUnitDeleteReqDTO); } /** * 隐患排查任务单元-批量删除 */ @PostMapping("/delete/deleteBatchTaskUnit") public ResultVO deleteBatchTaskUnit(Authentication authentication, @RequestBody DeleteBatchReqDTO deleteBatchReqDTO) { //获取用户信息 ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); return dangerService.deleteBatchTaskUnit(currentUser, deleteBatchReqDTO); } }