From 7d1c6e902de71861706d1933b59882592d889301 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期四, 27 二月 2025 09:51:52 +0800 Subject: [PATCH] 审批流 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java | 1 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessTemplateServiceImpl.java | 26 +++++++++---- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java | 35 +++++++++++++++-- 3 files changed, 48 insertions(+), 14 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java index c3eb121..58982f4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TContractController.java @@ -320,7 +320,6 @@ @PreAuthorize("@ss.hasPermi('system:contract:terminate')") public R terminateContract(@RequestBody TerminateContractDTO dto) { contractService.terminateContract(dto); - // 生成房屋验收记录 待验收 return R.ok(); } @ApiOperation(value = "根据合同id查看验收记录") diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessTemplateServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessTemplateServiceImpl.java index 72b02f5..9714146 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessTemplateServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StateProcessTemplateServiceImpl.java @@ -30,6 +30,7 @@ import com.ruoyi.common.utils.uuid.IdUtils; import com.ruoyi.system.bo.*; import com.ruoyi.system.mapper.StateProcessTemplateMapper; +import com.ruoyi.system.mapper.TContractMapper; import com.ruoyi.system.model.*; import com.ruoyi.system.service.*; import com.ruoyi.system.vo.ProcessDetailVO; @@ -74,7 +75,7 @@ @Autowired private ISysUserService sysUserService; @Autowired - private TContractService contractService; + private TContractMapper contractMapper; /** * 流程模版分页 @@ -361,7 +362,7 @@ // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 - TContract contract = contractService.getById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); + TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } @@ -484,6 +485,9 @@ if (ObjectUtil.isNotEmpty(startTime) && ObjectUtil.isNotEmpty(endTime)) { stateTaskQuery.between(StateTaskCenter::getCreateTime, startTime, endTime); } + if(Objects.isNull(processTaskListBO.getSortBy())){ + processTaskListBO.setSortBy(2); + } if (processTaskListBO.getSortBy() == 1) { stateTaskQuery.orderByAsc(BaseModel::getCreateTime); } @@ -500,7 +504,7 @@ // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 - TContract contract = contractService.getById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); + TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } @@ -595,7 +599,7 @@ // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 - TContract contract = contractService.getById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); + TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } @@ -715,6 +719,9 @@ if (ObjectUtil.isNotEmpty(startTime) && ObjectUtil.isNotEmpty(endTime)) { stateTaskQuery.between(StateTaskCenter::getCreateTime, startTime, endTime); } + if(Objects.isNull(processTaskListBO.getSortBy())){ + processTaskListBO.setSortBy(2); + } if (processTaskListBO.getSortBy() == 1) { stateTaskQuery.orderByAsc(BaseModel::getCreateTime); } @@ -730,7 +737,7 @@ // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 - TContract contract = contractService.getById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); + TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } @@ -1174,14 +1181,14 @@ if(Objects.nonNull(flwTask)){ instanceId = flwTask.getInstanceId(); // 查询合同信息 - contract = contractService.getById(JSONObject.parseObject(flwTask.getVariable()).getString("projectId")); + contract = contractMapper.selectById(JSONObject.parseObject(flwTask.getVariable()).getString("projectId")); }else { FlwHisTask flwHisTask = flwHisTaskMapper.selectById(Long.valueOf(taskId)); if(Objects.isNull(flwHisTask)){ throw new GlobalException("流程不存在"); } instanceId = flwHisTask.getInstanceId(); - contract = contractService.getById(Objects.requireNonNull(JSONObject.parseObject(flwHisTask.getVariable())).getString("projectId")); + contract = contractMapper.selectById(Objects.requireNonNull(JSONObject.parseObject(flwHisTask.getVariable())).getString("projectId")); } BeanUtil.copyProperties(contract, processDetailVO); @@ -1230,6 +1237,9 @@ if (ObjectUtil.isNotEmpty(startTime) && ObjectUtil.isNotEmpty(endTime)) { stateTaskQuery.between(FlwHisTask::getCreateTime, startTime, endTime); } + if(Objects.isNull(processTaskListBO.getSortBy())){ + processTaskListBO.setSortBy(2); + } if (processTaskListBO.getSortBy() == 1) { stateTaskQuery.orderByAsc(FlwHisTask::getCreateTime); } @@ -1246,7 +1256,7 @@ // 查询合同信息 for (ProcessTaskListVO processTaskListVO : processTaskListVOS) { // 查询合同信息 - TContract contract = contractService.getById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); + TContract contract = contractMapper.selectById(JSONObject.parseObject(processTaskListVO.getVariable()).getString("projectId")); processTaskListVO.setContract(contract); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java index 4084b2c..3e62453 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TContractServiceImpl.java @@ -5,8 +5,10 @@ import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.constant.DictConstants; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.enums.ProcessCategoryEnum; import com.ruoyi.common.utils.DictUtils; import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.system.bo.ProcessStartBO; import com.ruoyi.system.dto.SignContractDTO; import com.ruoyi.system.dto.TerminateContractDTO; import com.ruoyi.system.mapper.TBillMapper; @@ -17,6 +19,7 @@ import com.ruoyi.system.query.TContractAppletQuery; import com.ruoyi.system.query.TContractBillQuery; import com.ruoyi.system.query.TContractQuery; +import com.ruoyi.system.service.StateProcessTemplateService; import com.ruoyi.system.service.TBillService; import com.ruoyi.system.service.TContractRentTypeService; import com.ruoyi.system.service.TContractService; @@ -32,9 +35,7 @@ import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAdjusters; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; /** * <p> @@ -56,6 +57,8 @@ private TBillService billService; @Resource private TContractMapper contractMapper; + @Autowired + private StateProcessTemplateService stateProcessTemplateService; @Override public PageInfo<TContract> contractList(TContractQuery query) { @@ -101,6 +104,19 @@ contract.setTerminateRemark(dto.getTerminateRemark()); contract.setStatus("4"); this.baseMapper.updateById(contract); + + // 进入合同提前终止审批流程 + ProcessStartBO processStartBO = new ProcessStartBO(); + processStartBO.setCategory(ProcessCategoryEnum.CATEGORY3.getValue().toString()); + processStartBO.setModuleName("合同提前终止审批"); + processStartBO.setName(contract.getContractName()); + processStartBO.setRemark(""); + Map<String, Object> variable = new HashMap<>(); + variable.put("projectId", dto.getId()); + processStartBO.setVariable(variable); + //开启工作流程 + stateProcessTemplateService.start(processStartBO); + // 生成验收记录 TCheckAcceptRecord tCheckAcceptRecord = new TCheckAcceptRecord(); tCheckAcceptRecord.setContractId(dto.getId()); @@ -158,8 +174,17 @@ contract.setFirstPayTime(contract.getStartTime().plusDays(10)); contractMapper.updateById(contract); - // TODO 进入签订审批流程 - + // 进入签订审批流程 + ProcessStartBO processStartBO = new ProcessStartBO(); + processStartBO.setCategory(ProcessCategoryEnum.CATEGORY2.getValue().toString()); + processStartBO.setModuleName("合同签订审批"); + processStartBO.setName(contract.getContractName()); + processStartBO.setRemark(""); + Map<String, Object> variable = new HashMap<>(); + variable.put("projectId", dto.getId()); + processStartBO.setVariable(variable); + //开启工作流程 + stateProcessTemplateService.start(processStartBO); List<TContractRentType> contractRentTypes = contractRentTypeService.list(); // 生成第一笔账单 -- Gitblit v1.7.1