feat(REQ-3340) - 新增一些 API
This commit is contained in:
parent
9258f54c3f
commit
39057b4aae
@ -28,6 +28,10 @@ import static cn.axzo.workflow.common.enums.RpcInvokeModeEnum.SYNC;
|
||||
@WorkflowEngineFeignClient
|
||||
@Manageable
|
||||
public interface PrintAdminApi {
|
||||
@Operation(summary = "")
|
||||
@GetMapping("/api/print/admin/template/exists")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<Boolean> hasPrintTemplate(@NotBlank(message = "流程实例不能为空") @RequestParam String processInstanceId);
|
||||
|
||||
@Operation(summary = "获取打印模板中可打印的字段")
|
||||
@PostMapping("/api/print/admin/fields")
|
||||
|
||||
@ -185,4 +185,6 @@ public interface BpmnProcessInstanceService {
|
||||
* @param dto
|
||||
*/
|
||||
void overrideFormVariables(FormVariablesUpdateDTO dto);
|
||||
|
||||
boolean hasPrintTemplate(String processInstanceId, String processDefinitionId);
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ public interface ExtAxReModelService {
|
||||
* @param modelId
|
||||
* @return
|
||||
*/
|
||||
Boolean canPrint(String modelId);
|
||||
Boolean hasPrintTemplateConfig(String modelId);
|
||||
|
||||
PrintModelDTO getPrintTemplateConfig(String modelId);
|
||||
}
|
||||
|
||||
@ -1111,7 +1111,7 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
.supportBatchOperation(getProcessApproveConf(bpmnModel.getMainProcess()).orElse(new BpmnApproveConf()).getSupportBatchOperation())
|
||||
.userAgreeSignature(getProcessApproveConf(bpmnModel.getMainProcess()).orElse(new BpmnApproveConf()).getUserAgreeSignature())
|
||||
.workflowEngineVersion((String) variables.getOrDefault(WORKFLOW_ENGINE_VERSION, FLOW_SERVER_VERSION_121))
|
||||
.catPrint(hasPrintTemplate(historicProcessInstance.getProcessDefinitionId()))
|
||||
.catPrint(hasPrintTemplate(null, historicProcessInstance.getProcessDefinitionId()))
|
||||
.build();
|
||||
|
||||
|
||||
@ -1125,20 +1125,35 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
return logVO;
|
||||
}
|
||||
|
||||
private boolean hasPrintTemplate(String processDefinitionId) {
|
||||
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId);
|
||||
if (Objects.isNull(processDefinition)) {
|
||||
throw new WorkflowEngineException(PROCESS_DEFINITION_ID_NOT_EXISTS, processDefinitionId);
|
||||
@Override
|
||||
public boolean hasPrintTemplate(String processInstanceId, String processDefinitionId) {
|
||||
String key, tenantId;
|
||||
if (StringUtils.hasText(processDefinitionId)) {
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
.singleResult();
|
||||
if (Objects.isNull(historicProcessInstance)) {
|
||||
throw new WorkflowEngineException(PROCESS_INSTANCE_ID_NOT_EXISTS, processInstanceId);
|
||||
}
|
||||
key = historicProcessInstance.getProcessDefinitionKey();
|
||||
tenantId = historicProcessInstance.getTenantId();
|
||||
} else {
|
||||
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId);
|
||||
if (Objects.isNull(processDefinition)) {
|
||||
throw new WorkflowEngineException(PROCESS_DEFINITION_ID_NOT_EXISTS, processDefinitionId);
|
||||
}
|
||||
key = processDefinition.getKey();
|
||||
tenantId = processDefinition.getTenantId();
|
||||
}
|
||||
Model model = repositoryService.createModelQuery()
|
||||
.modelKey(processDefinition.getKey())
|
||||
.modelKey(key)
|
||||
.modelCategory(BPMN_FILE_SUFFIX)
|
||||
.modelTenantId(processDefinition.getTenantId())
|
||||
.modelTenantId(tenantId)
|
||||
.singleResult();
|
||||
if (Objects.isNull(model)) {
|
||||
throw new WorkflowEngineException(MODEL_NOT_EXISTS);
|
||||
}
|
||||
return extAxReModelService.canPrint(model.getId());
|
||||
return extAxReModelService.hasPrintTemplateConfig(model.getId());
|
||||
}
|
||||
|
||||
private void calcAuthorizedButtons(BpmnProcessInstanceLogVO logVO, BpmnTaskDelegateAssigner visitor) {
|
||||
|
||||
@ -93,7 +93,7 @@ public class ExtAxReModelServiceImpl implements ExtAxReModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean canPrint(String modelId) {
|
||||
public Boolean hasPrintTemplateConfig(String modelId) {
|
||||
ExtAxReModel model = extAxReModelMapper.selectOne(new QueryWrapper<ExtAxReModel>().eq("model_id", modelId));
|
||||
return Objects.equals(0, model.getPrintStatus()) && StringUtils.hasText(model.getPrintTemplateConfig());
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomGetFormInstanceLatestValuesCmd;
|
||||
import cn.axzo.workflow.core.engine.cmd.CustomGetProcessInstanceVariablesCmd;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessDefinitionService;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessInstanceService;
|
||||
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
|
||||
import cn.axzo.workflow.server.common.util.RpcExternalUtil;
|
||||
import cn.axzo.workflow.server.controller.web.bpmn.BpmnProcessInstanceController;
|
||||
@ -94,6 +95,13 @@ public class PrintAdminController implements PrintAdminApi {
|
||||
private OrganizationalNodeUserQueryApi organizationalNodeUserQueryApi;
|
||||
@Resource
|
||||
private BpmnProcessInstanceController bpmnProcessInstanceController;
|
||||
@Resource
|
||||
private BpmnProcessInstanceService bpmnProcessInstanceService;
|
||||
|
||||
@Override
|
||||
public CommonResponse<Boolean> hasPrintTemplate(String processInstanceId) {
|
||||
return CommonResponse.success(bpmnProcessInstanceService.hasPrintTemplate(processInstanceId, null));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取打印模板中可打印的字段")
|
||||
@PostMapping("/fields")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user