package com.gk.hotwork.doublePrevention.controller;
|
|
import com.gk.hotwork.Controller.Base.BaseController;
|
import com.gk.hotwork.Domain.Enum.ResultCodes;
|
import com.gk.hotwork.Domain.Utils.Msg;
|
import com.gk.hotwork.Domain.Utils.Properties;
|
import com.gk.hotwork.Domain.Utils.UploadUtil;
|
import com.gk.hotwork.Domain.co.ContextCacheUser;
|
import com.gk.hotwork.Domain.Vo.ResultVO;
|
import com.gk.hotwork.doublePrevention.entity.PreventDangerManage;
|
import com.gk.hotwork.doublePrevention.entity.PreventRiskAnaUnit;
|
import com.gk.hotwork.doublePrevention.entity.dto.req.*;
|
import com.gk.hotwork.doublePrevention.entity.dto.resp.PreventDangerManageQueryRespDTO;
|
import com.gk.hotwork.doublePrevention.service.RectifyService;
|
|
import com.gk.hotwork.doublePrevention.utils.CacheUserTransfer;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.core.Authentication;
|
import org.springframework.util.MultiValueMap;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
|
import java.time.LocalDate;
|
|
@RestController
|
@RequestMapping("prevent/dangerManage")
|
public class PreventDangerManageController extends BaseController{
|
|
|
|
@Autowired
|
private RectifyService rectifyService;
|
|
/**
|
* 隐患治理清单-分页查询
|
*/
|
@PostMapping("/select/getDangerManagePage")
|
public ResultVO<PreventDangerManage> getDangerManagePage(Authentication authentication, @RequestBody PreventDangerManageQueryReqDTO manageQueryReqDTO) {
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return rectifyService.getDangerManagePage(currentUser.getUid(), manageQueryReqDTO);
|
}
|
|
/**
|
* 隐患治理清单-列表
|
*/
|
@PostMapping("/select/listDangerManage")
|
public ResultVO<PreventDangerManage> listDangerManage(Authentication authentication) {
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return rectifyService.listDangerManage(currentUser.getUid());
|
}
|
|
/**
|
* 隐患治理清单-新增
|
*/
|
@PostMapping("/insert/saveDangerManage")
|
public ResultVO<PreventDangerManage> saveDangerManage(Authentication authentication, @RequestBody PreventDangerManageSaveReqDTO manageSaveReqDTO) {
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return rectifyService.saveDangerManage(currentUser.getUid(), manageSaveReqDTO);
|
}
|
|
/**
|
* 隐患治理清单-修改
|
*/
|
@PostMapping("/update/updateDangerManage")
|
public ResultVO<PreventDangerManage> updateDangerManage(Authentication authentication, @RequestBody PreventDangerManageUpdateReqDTO manageUpdateReqDTO) {
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return rectifyService.updateDangerManage(currentUser.getUid(), manageUpdateReqDTO);
|
}
|
|
/**
|
* 隐患治理清单-删除
|
*/
|
@PostMapping("/delete/deleteDangerManage")
|
public ResultVO<PreventDangerManage> deleteDangerManage(Authentication authentication, @RequestBody PreventDangerManageDeleteReqDTO manageDeleteReqDTO) {
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return rectifyService.deleteDangerManage(currentUser.getUid(), manageDeleteReqDTO);
|
}
|
|
/**
|
* 隐患管理-手工上报-配置
|
*/
|
@PostMapping("/update/updateReport")
|
public ResultVO<PreventRiskAnaUnit> updateDangerManagerReport(Authentication authentication, @RequestBody PreventHandReportConfigReqDTO preventHandReportConfigReqDTO) {
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return rectifyService.updateDangerManagerReport(currentUser.getUid(), preventHandReportConfigReqDTO);
|
}
|
|
/**
|
* 隐患管理-关闭隐患单
|
*/
|
@PostMapping("/update/closeDanger")
|
public ResultVO<PreventRiskAnaUnit> closeDanger(Authentication authentication, @RequestBody PreventCloseDangerReqDTO closeDangerReqDTO) {
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return rectifyService.closeDanger(currentUser.getUid(), closeDangerReqDTO);
|
}
|
@GetMapping("/count/byCreateDate")
|
public ResultVO getDangerCountByCreateDate(String date){
|
ResultVO resultVO = new ResultVO<>();
|
LocalDate localDate = null;
|
if(date == null || date.isEmpty()){
|
resultVO.setCode(ResultCodes.CLIENT_PARAM_ERROR.getCode());
|
resultVO.setMsg(ResultCodes.CLIENT_PARAM_ERROR.getDesc());
|
return resultVO;
|
}
|
try {
|
localDate = LocalDate.parse(date);
|
} catch (Exception e) {
|
resultVO.setCode(ResultCodes.CLIENT_PARAM_ERROR.getCode());
|
resultVO.setMsg(ResultCodes.CLIENT_PARAM_ERROR.getDesc());
|
return resultVO;
|
}
|
return rectifyService.countDangerByDate(localDate);
|
}
|
|
@GetMapping("/find/serialCode")
|
public ResultVO findDangerManageBySerialCode(String serialCode){
|
ResultVO<PreventDangerManageQueryRespDTO> resultVO = new ResultVO<>();
|
resultVO.setCode(ResultCodes.OK.getCode());
|
if(serialCode == null || serialCode.length() < 13){
|
return resultVO;
|
}
|
resultVO = rectifyService.findByDangerSerialCode(serialCode);
|
return resultVO;
|
}
|
|
}
|