package com.gk.hotwork.specialWork.controller; import com.alibaba.fastjson.JSONObject; import com.gk.hotwork.Controller.Base.BaseController; import com.gk.hotwork.Domain.co.ContextCacheUser; import com.gk.hotwork.Domain.Enum.ResultCodes; import com.gk.hotwork.Domain.Vo.PageQuery; import com.gk.hotwork.Domain.Utils.PageUtils; import com.gk.hotwork.Domain.Vo.ResultVO; import com.gk.hotwork.doublePrevention.utils.CacheUserTransfer; import com.gk.hotwork.specialWork.model.dto.req.*; import com.gk.hotwork.specialWork.model.dto.resp.*; import com.gk.hotwork.specialWork.model.query.AllWorkApplyPageQuery; import com.gk.hotwork.specialWork.model.query.WorkApplyApplyingPageQuery; import com.gk.hotwork.specialWork.model.query.WorkApplyPendingPageQuery; import com.gk.hotwork.specialWork.service.WorkApplyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; import java.util.List; @RestController @RequestMapping("/work") public class WorkApplyController extends BaseController { @Autowired private WorkApplyService workApplyService; /** * @Description: 动火作业申请 */ @RequestMapping(value = "/apply/hot",method = RequestMethod.POST) public ResultVO workApplyHot(Authentication authentication, @RequestBody WorkApplyReqDTO applyReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.workApply(currentUser, applyReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 受限空间作业申请 */ @RequestMapping(value = "/apply/confinedspace",method = RequestMethod.POST) public ResultVO workApplyConfinedSpace(Authentication authentication, @RequestBody WorkApplyReqDTO applyReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.workApply(currentUser, applyReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 盲板抽堵作业申请 */ @RequestMapping(value = "/apply/blindPlatePlugging",method = RequestMethod.POST) public ResultVO workApplyBlindPlatePlugging(Authentication authentication, @RequestBody WorkApplyReqDTO applyReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.workApply(currentUser, applyReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 高处安全作业申请 */ @RequestMapping(value = "/apply/height",method = RequestMethod.POST) public ResultVO workApplyHeight(Authentication authentication, @RequestBody WorkApplyReqDTO applyReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.workApply(currentUser, applyReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 断路作业申请 */ @RequestMapping(value = "/apply/brokenCircuit",method = RequestMethod.POST) public ResultVO workApplyBrokenCircuit(Authentication authentication, @RequestBody WorkApplyReqDTO applyReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.workApply(currentUser, applyReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 吊装作业申请 */ @RequestMapping(value = "/apply/hoisting",method = RequestMethod.POST) public ResultVO workApplyHoisting(Authentication authentication, @RequestBody WorkApplyReqDTO applyReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.workApply(currentUser, applyReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 临时用电作业申请 */ @RequestMapping(value = "/apply/temporaryPower",method = RequestMethod.POST) public ResultVO workApplyTemporaryPower(Authentication authentication, @RequestBody WorkApplyReqDTO applyReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.workApply(currentUser, applyReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 动土作业申请 */ @RequestMapping(value = "/apply/groundBreaking",method = RequestMethod.POST) public ResultVO workApplyGroundBreaking(Authentication authentication, @RequestBody WorkApplyReqDTO applyReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.workApply(currentUser, applyReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 取消申请 */ @RequestMapping(value = "/apply/cancel",method = RequestMethod.POST) public ResultVO workApplyCancel(Authentication authentication, @RequestBody JSONObject json){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); Long workApplyId = json.getLong("workApplyId"); workApplyService.cancelWorkApply(currentUser, workApplyId); return new ResultVO<>(ResultCodes.OK); } /** * @Description: 申请中的作业 */ @RequestMapping(value = "/apply/applying/page/list",method = RequestMethod.POST) public ResultVO> workApplyApplyingPageList(Authentication authentication, @RequestBody PageQuery pageQuery){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); PageUtils.checkCheck(pageQuery); return workApplyService.listApplyingWorkApplyByPage(currentUser, pageQuery); } /** * @Description: 已经审批的进度(申请人) */ @RequestMapping(value = "/apply/applicant/approved/view",method = RequestMethod.POST) public ResultVO workApplyApplyingViewForApplicant(Authentication authentication, @RequestBody JSONObject json){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); Long workApplyId = json.getLong("workApplyId"); ApplicantWorkApprovedApplyDetailRespDTO data = workApplyService.getApprovedApplyDetailForApplicant(currentUser, workApplyId); return new ResultVO<>(ResultCodes.OK,data); } /** * @Description: 已经审批的进度(审批人) */ @RequestMapping(value = "/apply/approver/approved/view",method = RequestMethod.POST) public ResultVO workApplyApplyingViewForApprover(Authentication authentication, @RequestBody JSONObject json){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); Long workApplyId = json.getLong("workApplyId"); ApproverWorkApprovedApplyDetailRespDTO data = workApplyService.getApprovedApplyDetailForApprover(currentUser, workApplyId); return new ResultVO<>(ResultCodes.OK,data); } /** * @Description: 获取当前层级审批数据(审批人) */ @RequestMapping(value = "/approval/pending/data",method = RequestMethod.POST) public ResultVO getPendingApprovalData(Authentication authentication, @RequestBody JSONObject json){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); Long workApplyId = json.getLong("workApplyId"); ApproverWorkPendingApprovalDataRespDTO data = workApplyService.getPendingApprovalData(currentUser, workApplyId); return new ResultVO<>(ResultCodes.OK,data); } /** * @Description: 待审批的作业(给work所出层级的每个单元) */ @RequestMapping(value = "/apply/pending/page/list",method = RequestMethod.POST) public ResultVO> workApplyPendingPageList(Authentication authentication, @RequestBody PageQuery pageQuery){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); PageUtils.checkCheck(pageQuery); return workApplyService.listPendingWorkApplyByPage(currentUser, pageQuery); } /** * @Description: 审批 */ @RequestMapping(value = "/apply/approve",method = RequestMethod.POST) public ResultVO workApplyApprove(Authentication authentication, @RequestBody ApprovalItemDataReqDTO approvalItemData){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.approveItem(currentUser, approvalItemData); return new ResultVO<>(ResultCodes.OK); } @RequestMapping(value = "/apply/abord",method = RequestMethod.POST) public ResultVO workApplyAbord(Authentication authentication, @RequestBody ApprovalItemAbordDataReqDTO abordDataReqDTO){ ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.abordItem(currentUser, abordDataReqDTO); return new ResultVO<>(ResultCodes.OK); } /** * * 作业票导出 * @param authentication * @param json * @param response */ @RequestMapping(value = "/apply/printing",method = RequestMethod.POST) public void workApplyPrinting(Authentication authentication, @RequestBody JSONObject json, HttpServletResponse response){ Long applyWorkId = json.getLong("applyWorkId"); ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); workApplyService.printing(currentUser,applyWorkId,response); } /** * @Description: 所有申请记录 非仅对申请人查看 */ @RequestMapping(value = "/apply/all/page/list",method = RequestMethod.POST) public ResultVO> workApplyAllPageList(Authentication authentication, @RequestBody PageQuery pageQuery) { ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); PageUtils.checkCheck(pageQuery); return workApplyService.listAllWorkApply(currentUser, pageQuery); } /** * @Description: 所有申请记录的 单条记录详情查询 */ @RequestMapping(value = "/apply/others/view",method = RequestMethod.POST) public ResultVO workApplyApplyingViewForOthers(Authentication authentication, @RequestBody JSONObject json) { ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser()); Long workApplyId = json.getLong("workApplyId"); OthersWorkApprovedApplyDetailRespDTO detail = workApplyService.getWorkApplyDetailForOthers(currentUser, workApplyId); return new ResultVO<>(ResultCodes.OK, detail); } }