作者 雷海东

合同变更重启流程

... ... @@ -14,4 +14,6 @@ import org.apache.ibatis.annotations.Param;
public interface TblBusinessWorkflowMapper extends BaseMapperPlus<TblBusinessWorkflowMapper, TblBusinessWorkflow, TblBusinessWorkflowVo> {
boolean updateByProcInsId(@Param("procInsId") String procInsId, @Param("processStatus") String processStatus);
TblBusinessWorkflow queryByOne(Long id);
}
... ...
package com.ruoyi.common.businessworkflow.service;
import com.ruoyi.common.businessworkflow.domain.TblBusinessWorkflow;
import com.ruoyi.common.businessworkflow.domain.bo.TblBusinessWorkflowBo;
import com.ruoyi.common.businessworkflow.domain.vo.TblBusinessWorkflowVo;
import com.ruoyi.common.core.page.TableDataInfo;
... ... @@ -47,4 +48,9 @@ public interface ITblBusinessWorkflowService {
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
Boolean updateByProcInsId(String procInsId,String processStatus);
/**
* 根据businessId查业务和工作流关联的数据
*/
TblBusinessWorkflow queryByOne(Long id);
}
... ...
... ... @@ -111,4 +111,9 @@ public class TblBusinessWorkflowServiceImpl implements ITblBusinessWorkflowServi
public Boolean updateByProcInsId(String procInsId, String processStatus) {
return baseMapper.updateByProcInsId(procInsId, processStatus);
}
@Override
public TblBusinessWorkflow queryByOne(Long id) {
return baseMapper.queryByOne(id);
}
}
... ...
... ... @@ -20,4 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateByProcInsId" parameterType="String">
update tbl_business_workflow set process_status = #{processStatus} where proc_ins_id = #{procInsId}
</update>
<select id="queryByOne" resultType="com.ruoyi.common.businessworkflow.domain.TblBusinessWorkflow">
select * from tbl_business_workflow where business_id=#{id}
</select>
</mapper>
... ...
... ... @@ -8,7 +8,9 @@ import java.util.Map;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ruoyi.common.businessworkflow.domain.TblBusinessWorkflow;
import com.ruoyi.common.businessworkflow.domain.bo.TblBusinessWorkflowBo;
import com.ruoyi.common.businessworkflow.domain.vo.TblBusinessWorkflowVo;
import com.ruoyi.common.businessworkflow.service.ITblBusinessWorkflowService;
import com.ruoyi.compliancemanagement.domain.TblContract;
import com.ruoyi.compliancemanagement.model.TblContractModel;
... ... @@ -133,6 +135,7 @@ public class TblContractController extends BaseController {
@Validated(AddGroup.class) @RequestBody TblContractBo bo) {
// Matter matter = new Matter();
String procDefId = "Process_1721195856340:1:7aca8265-489a-11ef-a778-421c839c76ba";
bo.setStatus("0");
iTblContractService.insertByBo(bo);
Long id = bo.getId();
//Long id = sLeaveService.create(studentLeave,matterKey);
... ... @@ -144,7 +147,7 @@ public class TblContractController extends BaseController {
// 合同名称
variables.put("contractName",bo.getContractName());
// 合同类型
variables.put("contractType",Long.valueOf(bo.getContractType()));
variables.put("contractType",bo.getContractType());
// 合同金额
variables.put("contractAmount", bo.getContractAmount());
// 生效日期
... ... @@ -215,17 +218,94 @@ public class TblContractController extends BaseController {
/**
* 修改【请填写功能名称】
*/
@Transactional(rollbackFor = Exception.class)
@SaCheckPermission("system:contract:edit")
@Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody TblContractBo bo) {
return toAjax(iTblContractService.updateByBo(bo));
public R<Void> edit(@RequestParam(value = "procDefId")String procDefId,@Validated(EditGroup.class) @RequestBody TblContractBo bo) {
bo.setStatus("0");
iTblContractService.updateByBo(bo);
Long id = bo.getId();
//Long id = sLeaveService.create(studentLeave,matterKey);
if (id > 0 || id != null){
Map<String, Object> variables = new HashMap<>();
// fromSource用来标识此事项是提交来源是客户端还是移动端
//合同编号
variables.put("contractno", bo.getContractno());
// 合同名称
variables.put("contractName",bo.getContractName());
// 合同类型
variables.put("contractType",bo.getContractType());
// 合同金额
variables.put("contractAmount", bo.getContractAmount());
// 生效日期
variables.put("effectiveDate", bo.getEffectiveDate());
// 到期日期
variables.put("expirationDate", bo.getExpirationDate());
// 甲方
variables.put("partyA", bo.getPartyA());
// 甲方链接地址
variables.put("partyAAddress", bo.getPartyAAddress());
// 乙方
variables.put("partyB", bo.getPartyB());
// 乙方链接地址
variables.put("partyBAddress", bo.getPartyBAddress());
// 付款方式
variables.put("paymentMethod", bo.getPaymentMethod());
// 签订日期
variables.put("signingDate", bo.getSigningDate());
// 标的物信息
variables.put("subjectInformation", bo.getSubjectInformation());
// 附件
variables.put("attachments", bo.getAttachments());
// 变更原因
variables.put("reasonChange", bo.getReasonChange());
// 变更内容
variables.put("reasonText", bo.getReasonText());
// 启动流程
ProcessInstance processInstance = iWfProcessService.startProcessByDefId(procDefId, variables);
if(null != processInstance){
// 获取流程状态
HistoricVariableInstance processStatusVariable = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processInstance.getProcessInstanceId())
.variableName(ProcessConstants.PROCESS_STATUS_KEY)
.singleResult();
String processStatus = null;
if (ObjectUtil.isNotNull(processStatusVariable)) {
processStatus = Convert.toStr(processStatusVariable.getValue());
}
HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery()
.processDefinitionId(procDefId);
List<HistoricProcessInstance> historicProcessInstances = historicProcessInstanceQuery.list();
// 兼容旧流程
if (processStatus == null) {
processStatus = ObjectUtil.isNull(historicProcessInstances.get(0).getEndTime()) ? ProcessStatus.RUNNING.getStatus() : ProcessStatus.COMPLETED.getStatus();
}
TblBusinessWorkflow tblBusinessWorkflow = iTblBusinessWorkflowService.queryByOne(id);
TblBusinessWorkflowBo tblBusinessWorkflowBo = new TblBusinessWorkflowBo();
tblBusinessWorkflowBo.setBusinessId(id);
tblBusinessWorkflowBo.setId(tblBusinessWorkflow.getId());
tblBusinessWorkflowBo.setProcInsId(processInstance.getProcessInstanceId());
tblBusinessWorkflowBo.setProcDefId(procDefId);
tblBusinessWorkflowBo.setDeployId(processInstance.getDeploymentId());
tblBusinessWorkflowBo.setProcessStatus(processStatus);
TableName table = TblContract.class.getAnnotation(TableName.class);
tblBusinessWorkflowBo.setTableName(table.value());
iTblBusinessWorkflowService.updateByBo(tblBusinessWorkflowBo);
// iTblContractService.updateProcInsIdById(processInstance.getProcessInstanceId(),id);
}
return R.ok("成功");
}else{
return R.fail("系统故障!");
}
}
@RepeatSubmit()
@PostMapping("/updateSealByContractno")
public R<Void> updateSealByContractno( @RequestBody TblContractBo bo) {
public R<Void> updateSealByContractno(@RequestBody TblContractBo bo) {
String contractno = bo.getContractno();
String sealContract = bo.getSealContract();
return toAjax(iTblContractService.updateSealByContractno(contractno,sealContract));
... ...