|
@@ -1,5 +1,6 @@
|
|
|
package com.fjhx.feign;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fjhx.constants.FlowExplainConstant;
|
|
|
import com.fjhx.constants.StatusConstant;
|
|
@@ -7,6 +8,7 @@ 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.params.FlowInfo;
|
|
|
import com.fjhx.service.example.ExampleInfoService;
|
|
|
import com.fjhx.service.process.ProcessInfoService;
|
|
|
import com.fjhx.service.process.ProcessNodeButtonService;
|
|
@@ -34,49 +36,51 @@ public class FlowClient implements IFlowClient {
|
|
|
private ProcessNodeButtonService processNodeButtonService;
|
|
|
|
|
|
|
|
|
- @PostMapping(GET_PROCESS_TENANT)
|
|
|
+ @PostMapping(GET_FLOW_INFO)
|
|
|
@Override
|
|
|
- public R<ProcessTenant> getProcessTenant(Long businessId, String code) {
|
|
|
+ public R<FlowInfo> getProcessTenant(Long businessId, String code) {
|
|
|
|
|
|
- ExampleInfo exampleInfo = exampleInfoService.getOne(Wrappers.<ExampleInfo>lambdaQuery()
|
|
|
- .eq(ExampleInfo::getBusinessId, businessId).eq(ExampleInfo::getComplete, StatusConstant.No));
|
|
|
+ ExampleInfo exampleInfo = exampleInfoService.getOne(
|
|
|
+ Wrappers.<ExampleInfo>lambdaQuery()
|
|
|
+ .eq(ExampleInfo::getBusinessId, businessId)
|
|
|
+ .eq(ExampleInfo::getComplete, StatusConstant.No));
|
|
|
|
|
|
Assert.empty(exampleInfo, FlowExplainConstant.EXPLAIN_NOT_EXIST);
|
|
|
|
|
|
// 查找通用流程
|
|
|
ProcessInfo processInfo = processInfoService.getOne(ProcessInfo::getCode, code);
|
|
|
Assert.notEmpty(processInfo, String.format(FlowExplainConstant.PROCESS_NOT_EXIST, code));
|
|
|
- Long processInfoId = processInfo.getId();
|
|
|
+
|
|
|
+ FlowInfo flowInfo = BeanUtil.toBean(processInfo, FlowInfo.class);
|
|
|
|
|
|
// 获取租户流程
|
|
|
ProcessTenant processTenant = processTenantService.getOne(Wrappers.<ProcessTenant>lambdaQuery()
|
|
|
- .eq(ProcessTenant::getProcessInfoId, processInfoId)
|
|
|
+ .eq(ProcessTenant::getProcessInfoId, processInfo.getId())
|
|
|
.eq(ProcessTenant::getBindingTenantId, AuthUtil.getTenantId())
|
|
|
.eq(ProcessTenant::getCurrentVersion, StatusConstant.YES));
|
|
|
|
|
|
- if (processTenant == null) {
|
|
|
- processTenant = new ProcessTenant();
|
|
|
- processTenant.setProcessInfoId(processInfo.getId());
|
|
|
- }
|
|
|
+ flowInfo.setProcessTenant(processTenant);
|
|
|
|
|
|
- return R.success(processTenant);
|
|
|
+ return R.data(flowInfo);
|
|
|
}
|
|
|
|
|
|
- @PostMapping(GET_PROCESS_NODE_BUTTON_BY_PROCESS_TENANT_ID)
|
|
|
+ @PostMapping(GET_JUMP_NODE_ID)
|
|
|
@Override
|
|
|
- public R<ProcessNodeButton> getProcessNodeButtonByProcessTenantId(Long processTenantId, String processNodeCode) {
|
|
|
+ public R<Long> getJumpNodeId(Long processTenantId, String processNodeCode) {
|
|
|
ProcessNodeButton processNodeButton = processNodeButtonService.getOne(
|
|
|
Wrappers.<ProcessNodeButton>lambdaQuery()
|
|
|
.eq(ProcessNodeButton::getProcessTenantId, processTenantId)
|
|
|
.eq(ProcessNodeButton::getProcessNodeCode, processNodeCode));
|
|
|
- return R.success(processNodeButton);
|
|
|
+
|
|
|
+ Assert.notEmpty(processNodeButton, FlowExplainConstant.SPECIFY_BRANCH_EMPTY);
|
|
|
+ return R.data(processNodeButton.getJumpNodeId());
|
|
|
}
|
|
|
|
|
|
@PostMapping(EXAMPLE_INFO_SAVE)
|
|
|
@Override
|
|
|
public R<ExampleInfo> exampleInfoSave(ExampleInfo exampleInfo) {
|
|
|
exampleInfoService.save(exampleInfo);
|
|
|
- return R.success(exampleInfo);
|
|
|
+ return R.data(exampleInfo);
|
|
|
}
|
|
|
|
|
|
}
|