feat(REQ-3340) - 新增代运营重置打印模板配置内容的接口定义和实现
This commit is contained in:
parent
0b493e2d0e
commit
c6c010f4f9
@ -8,6 +8,7 @@ import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.print.PrintTemplateConfigQueryDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.print.PrintTemplateConfigUpsertDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.print.RestPrintTemplateConfigDTO;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelDetailVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelExtVO;
|
||||
@ -26,7 +27,6 @@ import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.axzo.workflow.common.enums.RpcInvokeModeEnum.SYNC;
|
||||
import static cn.azxo.framework.common.model.CommonResponse.success;
|
||||
|
||||
/**
|
||||
* 流程模型 API
|
||||
@ -211,6 +211,7 @@ public interface ProcessModelApi {
|
||||
|
||||
/**
|
||||
* 打印模板配置内容更新保存
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ -221,6 +222,7 @@ public interface ProcessModelApi {
|
||||
|
||||
/**
|
||||
* 获取打印模板配置内容
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ -228,4 +230,15 @@ public interface ProcessModelApi {
|
||||
@PostMapping("/api/process/model/print/template/config/query")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<String> getPrintTemplateConfig(@Validated @RequestBody PrintTemplateConfigQueryDTO dto);
|
||||
|
||||
/**
|
||||
* 代运营充值的打印模板
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "代运营重置打印模板")
|
||||
@PostMapping(value = "/api/process/model/print/template/config/reset")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<Boolean> resetPrintTemplateConfig(@Validated @RequestBody RestPrintTemplateConfigDTO dto);
|
||||
}
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package cn.axzo.workflow.common.model.request.bpmn.print;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 重置打印模型(代运营专用)
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2025-01-20 19:55
|
||||
*/
|
||||
@ApiModel("打印模板配置内容入参模型")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class RestPrintTemplateConfigDTO {
|
||||
|
||||
/**
|
||||
* 模板的定义 ID
|
||||
*/
|
||||
@ApiModelProperty(value = "模板的定义 ID")
|
||||
@NotBlank(message = "模型定义 ID 不能为空")
|
||||
private String processDefinitionKey;
|
||||
|
||||
/**
|
||||
* 代运营模型 ID
|
||||
*/
|
||||
@ApiModelProperty(value = "代运营模型 ID")
|
||||
@NotBlank(message = "代运营模板 ID不能为空")
|
||||
private String modelId;
|
||||
|
||||
}
|
||||
@ -175,4 +175,6 @@ public interface BpmnProcessInstanceService {
|
||||
* @return
|
||||
*/
|
||||
String getModelIdByProcessInstanceId(String processInstanceId);
|
||||
|
||||
String getModelIdByProcessDefinitionId(String processDefinitionId);
|
||||
}
|
||||
|
||||
@ -132,7 +132,6 @@ import static cn.axzo.workflow.client.config.WorkflowRequestInterceptor.HEADER_S
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_ID_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.PROCESS_INSTANCE_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.RUNNING_INSTANCE_ONLY_FORECAST;
|
||||
import static cn.axzo.workflow.common.code.BpmnModelRespCode.MODEL_ID_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnModelRespCode.MODEL_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnProcessDefinitionRespCode.PROCESS_DEFINITION_ID_NOT_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnProcessDefinitionRespCode.PROCESS_DEFINITION_IS_INVALID;
|
||||
@ -1439,12 +1438,17 @@ public class BpmnProcessInstanceServiceImpl implements BpmnProcessInstanceServic
|
||||
if (Objects.isNull(historicProcessInstance)) {
|
||||
throw new WorkflowEngineException(PROCESS_INSTANCE_ID_NOT_EXISTS, processInstanceId);
|
||||
}
|
||||
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(historicProcessInstance.getProcessDefinitionId());
|
||||
if(Objects.isNull(processDefinition)) {
|
||||
throw new WorkflowEngineException(PROCESS_DEFINITION_ID_NOT_EXISTS, historicProcessInstance.getProcessDefinitionId());
|
||||
return getModelIdByProcessDefinitionId(historicProcessInstance.getProcessDefinitionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelIdByProcessDefinitionId(String processDefinitionId) {
|
||||
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId);
|
||||
if (Objects.isNull(processDefinition)) {
|
||||
throw new WorkflowEngineException(PROCESS_DEFINITION_ID_NOT_EXISTS, processDefinitionId);
|
||||
}
|
||||
Model model = repositoryService.createModelQuery().deploymentId(processDefinition.getDeploymentId()).singleResult();
|
||||
if(Objects.isNull(model)) {
|
||||
if (Objects.isNull(model)) {
|
||||
throw new WorkflowEngineException(MODEL_NOT_EXISTS);
|
||||
}
|
||||
return model.getId();
|
||||
|
||||
@ -7,11 +7,13 @@ import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.print.PrintTemplateConfigQueryDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.print.PrintTemplateConfigUpsertDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.print.RestPrintTemplateConfigDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.task.BpmnTaskDelegateAssigner;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelDetailVO;
|
||||
import cn.axzo.workflow.common.model.response.bpmn.model.BpmnModelExtVO;
|
||||
import cn.axzo.workflow.core.service.AggregateModelService;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessDefinitionService;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessInstanceService;
|
||||
import cn.axzo.workflow.core.service.BpmnProcessModelService;
|
||||
import cn.axzo.workflow.core.service.ExtAxReModelService;
|
||||
@ -41,6 +43,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.code.OtherRespCode.ILLEGAL_PARAM_ERROR;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.NO_TENANT_ID;
|
||||
import static cn.azxo.framework.common.model.CommonResponse.success;
|
||||
|
||||
/**
|
||||
@ -56,6 +59,8 @@ public class BpmnProcessModelController implements ProcessModelApi {
|
||||
@Resource
|
||||
private BpmnProcessModelService bpmnProcessModelService;
|
||||
@Resource
|
||||
private BpmnProcessDefinitionService bpmnProcessDefinitionService;
|
||||
@Resource
|
||||
private AggregateModelService aggregateModelService;
|
||||
@Resource
|
||||
private ExtAxReModelService reModelService;
|
||||
@ -349,4 +354,16 @@ public class BpmnProcessModelController implements ProcessModelApi {
|
||||
}
|
||||
return success(bpmnProcessModelService.getPrintTemplateConfig(dto.getModelId()));
|
||||
}
|
||||
|
||||
@Operation(summary = "代运营重置打印模板")
|
||||
@PostMapping(value = "/print/template/config/reset")
|
||||
public CommonResponse<Boolean> resetPrintTemplateConfig(@Validated @RequestBody RestPrintTemplateConfigDTO dto) {
|
||||
String activeProcessDefinitionId = bpmnProcessDefinitionService.getActiveProcessDefinitionId(NO_TENANT_ID, dto.getProcessDefinitionKey());
|
||||
String modelId = bpmnProcessInstanceService.getModelIdByProcessDefinitionId(activeProcessDefinitionId);
|
||||
bpmnProcessModelService.printTemplateConfig(PrintTemplateConfigUpsertDTO.builder()
|
||||
.modelId(dto.getModelId())
|
||||
.printTemplateConfig(bpmnProcessModelService.getPrintTemplateConfig(modelId))
|
||||
.build());
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user