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.PreventDangerRectify; import com.gkhy.safePlatform.doublePrevention.entity.dto.req.*; import com.gkhy.safePlatform.doublePrevention.service.RectifyService; 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/dangerRectify") public class PreventDangerRectifyController { @Autowired private RectifyService rectifyService; /** * 隐患整改清单-分页查询 */ @PostMapping("/select/getDangerRectifyPage") public ResultVO getDangerRectifyPage(Authentication authentication, @RequestBody PreventDangerRectifyQueryReqDTO rectifyQueryReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return rectifyService.getDangerRectifyPage(currentUser.getUid(), rectifyQueryReqDTO); } /** * 隐患整改清单-查询:待验收与已验收 */ @PostMapping("/select/getRectifyOverPage") public ResultVO getRectifyOverPage(Authentication authentication, @RequestBody PreventRectifyOverQueryReqDTO rectifyOverQueryReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return rectifyService.getRectifyOverPage(currentUser.getUid(), rectifyOverQueryReqDTO); } // /** // * 隐患整改清单-新增 // */ // @PostMapping("/insert/saveDangerRectify") // public ResultVO saveDangerRectify(Principal principal, @RequestBody PreventDangerRectifySaveReqDTO rectifySaveReqDTO) { // // //此处principal.getName就是id // String userId =principal.getName(); // return rectifyService.saveDangerRectify(Long.valueOf(userId), rectifySaveReqDTO); // } /** * 隐患整改清单-修改 */ @PostMapping("/update/updateDangerRectify") public ResultVO updateDangerRectify(Authentication authentication, @RequestBody PreventDangerRectifyUpdateReqDTO rectifyUpdateReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return rectifyService.updateDangerRectify(currentUser.getUid(), rectifyUpdateReqDTO); } /** * 隐患整改清单-删除 */ @PostMapping("/delete/deleteDangerRectify") public ResultVO deleteDangerRectify(Authentication authentication, @RequestBody PreventDangerRectifyDeleteReqDTO rectifyDeleteReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return rectifyService.deleteDangerRectify(currentUser.getUid(), rectifyDeleteReqDTO); } /** * 隐患整改清单--验收 */ @PostMapping("/update/reportRectify") public ResultVO reportRectify(Authentication authentication, @RequestBody PreventDangerReportRectifyReqDTO reportRectiity) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return rectifyService.reportRectify(currentUser.getUid(), reportRectiity); } /** * 隐患整改清单-填报--整改 */ @PostMapping("/update/applyReport") public ResultVO applyReport(Authentication authentication, @RequestBody PreventDangerReportRectifyReqDTO reportRectiity) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return rectifyService.applyReport(currentUser.getUid(), reportRectiity); } /** * 隐患整改--延期 */ @PostMapping("/update/timeOutRectify") public ResultVO timeOutRectify(Authentication authentication, @RequestBody PreventDangerRectifyUpdateReqDTO updateReqDTO) { //获取用户信息 ContextCacheUser currentUser = (ContextCacheUser)authentication.getPrincipal(); return rectifyService.timeOutRectify(currentUser.getUid(), updateReqDTO); } }