package com.gkhy.safePlatform.specialWork.controller;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.gkhy.safePlatform.commons.co.ContextCacheUser;
|
import com.gkhy.safePlatform.commons.enums.E;
|
import com.gkhy.safePlatform.commons.enums.Module;
|
import com.gkhy.safePlatform.commons.enums.ResultCodes;
|
import com.gkhy.safePlatform.commons.exception.AusinessException;
|
import com.gkhy.safePlatform.commons.query.PageQuery;
|
import com.gkhy.safePlatform.commons.utils.PageUtils;
|
import com.gkhy.safePlatform.commons.vo.ResultVO;
|
import com.gkhy.safePlatform.specialWork.enums.WorkTypePathEnum;
|
import com.gkhy.safePlatform.specialWork.model.annotation.CommonLogEnable;
|
import com.gkhy.safePlatform.specialWork.model.dto.req.*;
|
import com.gkhy.safePlatform.specialWork.model.dto.resp.*;
|
import com.gkhy.safePlatform.specialWork.model.dto.resp.applicant.ApplicantWorkApprovedApplyDetailRespDTO;
|
import com.gkhy.safePlatform.specialWork.model.dto.resp.approver.ApproverWorkApprovedApplyDetailRespDTO;
|
import com.gkhy.safePlatform.specialWork.model.dto.resp.approver.ApproverWorkPendingApprovalDataRespDTO;
|
import com.gkhy.safePlatform.specialWork.model.dto.resp.others.OthersWorkApprovedApplyDetailRespDTO;
|
import com.gkhy.safePlatform.specialWork.model.query.AllWorkApplyPageQuery;
|
import com.gkhy.safePlatform.specialWork.model.query.WorkApplyApplyingPageQuery;
|
import com.gkhy.safePlatform.specialWork.model.query.WorkApplyPendingPageQuery;
|
import com.gkhy.safePlatform.specialWork.model.query.WorkApplyRecordListQuery;
|
import com.gkhy.safePlatform.specialWork.service.WorkApplyRecordService;
|
import com.gkhy.safePlatform.specialWork.service.WorkApplyService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.core.Authentication;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.List;
|
|
@RestController
|
@RequestMapping("/work")
|
public class WorkApplyController {
|
|
@Autowired
|
private WorkApplyService workApplyService;
|
@Autowired
|
private WorkApplyRecordService workApplyRecordService;
|
|
|
private void workApplyEightPathCheck(String path, Byte workType) {
|
WorkTypePathEnum typePathEnum = WorkTypePathEnum.parse(path);
|
if (typePathEnum == null) {
|
throw new AusinessException(E.DATA_PARAM_CHECK_INVALID, "申请路径非法");
|
}
|
if (!typePathEnum.type.equals(workType)) {
|
throw new AusinessException(E.DATA_PARAM_CHECK_INVALID, "申请作业与访问路径不匹配");
|
}
|
}
|
|
|
|
/**
|
* @Description: 动火作业申请
|
*/
|
@RequestMapping(value = "/apply/hot",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业申请-动火")
|
public ResultVO<String> workApplyHot(Authentication authentication, @RequestBody WorkApplyReqDTO<WorkApplyHotReqDTO> applyReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
this.workApplyEightPathCheck(WorkTypePathEnum.WORK_FIRE.path, applyReqDTO.getWorkType());
|
workApplyService.workApply(currentUser, applyReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
/**
|
* @Description: 受限空间作业申请
|
*/
|
@RequestMapping(value = "/apply/confinedspace",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业申请-受限空间作业")
|
public ResultVO<String> workApplyConfinedSpace(Authentication authentication, @RequestBody WorkApplyReqDTO<WorkApplyConfinedSpaceReqDTO> applyReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
this.workApplyEightPathCheck(WorkTypePathEnum.WORK_CLOSE_SPACE.path, applyReqDTO.getWorkType());
|
workApplyService.workApply(currentUser, applyReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
/**
|
* @Description: 盲板抽堵作业申请
|
*/
|
@RequestMapping(value = "/apply/blindPlatePlugging",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业申请-盲板抽堵作业")
|
public ResultVO<String> workApplyBlindPlatePlugging(Authentication authentication, @RequestBody WorkApplyReqDTO<WorkApplyBlindPlatePluggingReqDTO> applyReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
this.workApplyEightPathCheck(WorkTypePathEnum.WORK_BLIND_PLATE.path, applyReqDTO.getWorkType());
|
workApplyService.workApply(currentUser, applyReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
/**
|
* @Description: 高处安全作业申请
|
*/
|
@RequestMapping(value = "/apply/height",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业申请-高处安全作业")
|
public ResultVO<String> workApplyHeight(Authentication authentication, @RequestBody WorkApplyReqDTO<WorkApplyAtHighReqDTO> applyReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
this.workApplyEightPathCheck(WorkTypePathEnum.WORK_HIGH_SPACE.path, applyReqDTO.getWorkType());
|
workApplyService.workApply(currentUser, applyReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
/**
|
* @Description: 断路作业申请
|
*/
|
@RequestMapping(value = "/apply/brokenCircuit",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业申请-断路作业")
|
public ResultVO<String> workApplyBrokenCircuit(Authentication authentication, @RequestBody WorkApplyReqDTO<WorkApplyBrokenCircuitReqDTO> applyReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
this.workApplyEightPathCheck(WorkTypePathEnum.WORK_BROKE_ROAD.path, applyReqDTO.getWorkType());
|
workApplyService.workApply(currentUser, applyReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
/**
|
* @Description: 吊装作业申请
|
*/
|
@RequestMapping(value = "/apply/hoisting",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业申请-吊装作业")
|
public ResultVO<String> workApplyHoisting(Authentication authentication, @RequestBody WorkApplyReqDTO<WorkApplyHoistingReqDTO> applyReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
this.workApplyEightPathCheck(WorkTypePathEnum.WORK_HANG.path, applyReqDTO.getWorkType());
|
workApplyService.workApply(currentUser, applyReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
/**
|
* @Description: 临时用电作业申请
|
*/
|
@RequestMapping(value = "/apply/temporaryPower",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业申请-临时用电作业")
|
public ResultVO<String> workApplyTemporaryPower(Authentication authentication, @RequestBody WorkApplyReqDTO<WorkApplyTemporaryPowerReqDTO> applyReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
this.workApplyEightPathCheck(WorkTypePathEnum.WORK_TEMP_ELECTRIC.path, applyReqDTO.getWorkType());
|
workApplyService.workApply(currentUser, applyReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
/**
|
* @Description: 动土作业申请
|
*/
|
@RequestMapping(value = "/apply/groundBreaking",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业申请-动土作业")
|
public ResultVO<String> workApplyGroundBreaking(Authentication authentication, @RequestBody WorkApplyReqDTO<WorkApplyGroundBreakingReqDTO> applyReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
this.workApplyEightPathCheck(WorkTypePathEnum.WORK_DIF_SOLI.path, applyReqDTO.getWorkType());
|
workApplyService.workApply(currentUser, applyReqDTO);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
/**
|
* @Description: 取消申请
|
*/
|
@RequestMapping(value = "/apply/cancel",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业取消申请")
|
public ResultVO<String> workApplyCancel(Authentication authentication, @RequestBody JSONObject json){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
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<List<WorkApplyPageRespDTO>> workApplyApplyingPageList(Authentication authentication, @RequestBody PageQuery<WorkApplyApplyingPageQuery> pageQuery){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
PageUtils.checkCheck(pageQuery);
|
return workApplyService.listApplyingWorkApplyByPage(currentUser, pageQuery);
|
}
|
|
/**
|
* @Description: 已经审批的进度(申请人)
|
*/
|
@RequestMapping(value = "/apply/applicant/approved/view",method = RequestMethod.POST)
|
public ResultVO<ApplicantWorkApprovedApplyDetailRespDTO> workApplyApplyingViewForApplicant(Authentication authentication, @RequestBody JSONObject json){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
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<ApproverWorkApprovedApplyDetailRespDTO> workApplyApplyingViewForApprover(Authentication authentication, @RequestBody JSONObject json){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
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<ApproverWorkPendingApprovalDataRespDTO> getPendingApprovalData(Authentication authentication, @RequestBody JSONObject json){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
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<List<WorkApplyPendingPageRespDTO>> workApplyPendingPageList(Authentication authentication, @RequestBody PageQuery<WorkApplyPendingPageQuery> pageQuery){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
PageUtils.checkCheck(pageQuery);
|
return workApplyService.listPendingWorkApplyByPage(currentUser, pageQuery);
|
}
|
|
/**
|
* @Description: 审批
|
*/
|
|
@RequestMapping(value = "/apply/approve",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业审批")
|
public ResultVO<String> workApplyApprove(Authentication authentication, @RequestBody ApprovalItemDataReqDTO approvalItemData){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
workApplyService.approveItem(currentUser, approvalItemData);
|
return new ResultVO<>(ResultCodes.OK);
|
}
|
|
/**
|
* 终止
|
* @param authentication
|
* @param abordDataReqDTO
|
* @return
|
*/
|
|
@RequestMapping(value = "/apply/abord",method = RequestMethod.POST)
|
@CommonLogEnable(module = Module.SPECIAL_WORK,content = "作业终止")
|
public ResultVO<String> workApplyAbord(Authentication authentication, @RequestBody ApprovalItemAbordDataReqDTO abordDataReqDTO){
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
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 = (ContextCacheUser) authentication.getPrincipal();
|
workApplyService.printing(currentUser,applyWorkId,response);
|
}
|
/**
|
*
|
* 作业票导出
|
* @param authentication
|
* @param json
|
* @param response
|
*/
|
@RequestMapping(value = "/apply/printingPdf",method = RequestMethod.POST)
|
public void workApplyExportPdf(Authentication authentication, @RequestBody JSONObject json, HttpServletResponse response){
|
Long applyWorkId = json.getLong("applyWorkId");
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
workApplyService.printingPdf(currentUser,applyWorkId,response);
|
}
|
|
/**
|
* @Description: 所有申请记录 非仅对申请人查看
|
*/
|
@RequestMapping(value = "/apply/all/page/list",method = RequestMethod.POST)
|
public ResultVO<List<AllWorkApplyPageRespDTO>> workApplyAllPageList(Authentication authentication, @RequestBody PageQuery<AllWorkApplyPageQuery> pageQuery) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
PageUtils.checkCheck(pageQuery);
|
return workApplyService.listAllWorkApply(currentUser, pageQuery);
|
}
|
|
/**
|
* @Description: 所有申请记录的 单条记录详情查询
|
*/
|
@RequestMapping(value = "/apply/others/view",method = RequestMethod.POST)
|
public ResultVO<OthersWorkApprovedApplyDetailRespDTO> workApplyApplyingViewForOthers(Authentication authentication, @RequestBody JSONObject json) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
Long workApplyId = json.getLong("workApplyId");
|
OthersWorkApprovedApplyDetailRespDTO detail = workApplyService.getWorkApplyDetailForOthers(currentUser, workApplyId);
|
return new ResultVO<>(ResultCodes.OK, detail);
|
}
|
|
@RequestMapping(value = "/apply/log", method = RequestMethod.POST)
|
public ResultVO<List<WorkApplyRecordRespDTO>> workApplyLog(Authentication authentication,@RequestBody WorkApplyRecordListQuery query) {
|
ContextCacheUser currentUser = (ContextCacheUser) authentication.getPrincipal();
|
List<WorkApplyRecordRespDTO> list = workApplyRecordService.list(currentUser, query);
|
return new ResultVO<>(ResultCodes.OK,list);
|
}
|
}
|