|
@@ -1,23 +1,12 @@
|
|
package com.fjhx.service.example.impl;
|
|
package com.fjhx.service.example.impl;
|
|
|
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
-import com.fjhx.constants.FlowConstant;
|
|
|
|
-import com.fjhx.constants.FlowExplainConstant;
|
|
|
|
-import com.fjhx.constants.StatusConstant;
|
|
|
|
import com.fjhx.entity.example.ExampleInfo;
|
|
import com.fjhx.entity.example.ExampleInfo;
|
|
-import com.fjhx.entity.process.ProcessInfo;
|
|
|
|
-import com.fjhx.entity.process.ProcessNodeButton;
|
|
|
|
-import com.fjhx.entity.process.ProcessTenant;
|
|
|
|
import com.fjhx.mapper.example.ExampleInfoMapper;
|
|
import com.fjhx.mapper.example.ExampleInfoMapper;
|
|
import com.fjhx.service.example.ExampleInfoService;
|
|
import com.fjhx.service.example.ExampleInfoService;
|
|
import com.fjhx.service.process.ProcessInfoService;
|
|
import com.fjhx.service.process.ProcessInfoService;
|
|
import com.fjhx.service.process.ProcessNodeButtonService;
|
|
import com.fjhx.service.process.ProcessNodeButtonService;
|
|
import com.fjhx.service.process.ProcessTenantService;
|
|
import com.fjhx.service.process.ProcessTenantService;
|
|
-import com.fjhx.utils.Assert;
|
|
|
|
-import com.fjhx.utils.ExampleAbstract;
|
|
|
|
-import org.springblade.core.secure.utils.AuthUtil;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -41,68 +30,4 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
|
|
@Autowired
|
|
@Autowired
|
|
private ProcessNodeButtonService processNodeButtonService;
|
|
private ProcessNodeButtonService processNodeButtonService;
|
|
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ExampleInfo create(Long businessId, ExampleAbstract exampleAbstract) {
|
|
|
|
-
|
|
|
|
- // 查看流程是否已发起
|
|
|
|
- Assert.notEmpty(
|
|
|
|
- getOne(Wrappers.<ExampleInfo>lambdaQuery()
|
|
|
|
- .eq(ExampleInfo::getBusinessId, businessId).eq(ExampleInfo::getComplete, StatusConstant.No)),
|
|
|
|
- FlowExplainConstant.EXPLAIN_NOT_EXIST);
|
|
|
|
-
|
|
|
|
- // 获取流程编码
|
|
|
|
- String code = exampleAbstract.getCode();
|
|
|
|
-
|
|
|
|
- // 查找通用流程
|
|
|
|
- ProcessInfo processInfo = processInfoService.getOne(ProcessInfo::getCode, code);
|
|
|
|
- Assert.notEmpty(processInfo, String.format(FlowExplainConstant.PROCESS_NOT_EXIST, code));
|
|
|
|
- Long processInfoId = processInfo.getId();
|
|
|
|
-
|
|
|
|
- // 获取租户流程
|
|
|
|
- ProcessTenant processTenant = processTenantService.getOne(Wrappers.<ProcessTenant>lambdaQuery()
|
|
|
|
- .eq(ProcessTenant::getProcessInfoId, processInfoId)
|
|
|
|
- .eq(ProcessTenant::getBindingTenantId, AuthUtil.getTenantId())
|
|
|
|
- .eq(ProcessTenant::getCurrentVersion, StatusConstant.YES)
|
|
|
|
- .last("limit 1"));
|
|
|
|
-
|
|
|
|
- ExampleInfo exampleInfo = new ExampleInfo();
|
|
|
|
- exampleInfo.setProcessInfoId(processInfoId);
|
|
|
|
- exampleInfo.setBusinessId(businessId);
|
|
|
|
- exampleInfo.setCacheData(exampleAbstract.getCacheData());
|
|
|
|
-
|
|
|
|
- // 如果租户流程为空,直接结束流程
|
|
|
|
- if (ObjectUtil.isEmpty(processTenant)) {
|
|
|
|
- exampleInfo.setProcessNodeId(FlowConstant.OVER_PROCESS_FLAG);
|
|
|
|
- exampleInfo.setComplete(StatusConstant.YES);
|
|
|
|
-
|
|
|
|
- // 执行流程结束方法
|
|
|
|
- exampleAbstract.end();
|
|
|
|
- } else {
|
|
|
|
- Long processTenantId = processTenant.getId();
|
|
|
|
- exampleInfo.setProcessTenantId(processTenantId);
|
|
|
|
-
|
|
|
|
- ProcessNodeButton processNodeButton = processNodeButtonService.getOne(
|
|
|
|
- Wrappers.<ProcessNodeButton>lambdaQuery()
|
|
|
|
- .eq(ProcessNodeButton::getProcessTenantId, processTenantId)
|
|
|
|
- .eq(ProcessNodeButton::getProcessNodeCode, FlowConstant.START_CODE));
|
|
|
|
-
|
|
|
|
- Long jumpNodeId = processNodeButton.getJumpNodeId();
|
|
|
|
-
|
|
|
|
- // 如果跳转id为空,则走到分支
|
|
|
|
- if (jumpNodeId == null) {
|
|
|
|
- String circulation = exampleAbstract.circulation(processNodeButton.getProcessNodeCode());
|
|
|
|
- Assert.notEmpty(circulation, FlowExplainConstant.SPECIFY_BRANCH_EMPTY);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- save(exampleInfo);
|
|
|
|
-
|
|
|
|
- return exampleInfo;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|