feat(REQ-3340) - 调整打印标题和模板内容的 API 定义
This commit is contained in:
parent
5766a74de2
commit
0b493e2d0e
@ -209,18 +209,6 @@ public interface ProcessModelApi {
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<List<String>> getModelTenantIds();
|
||||
|
||||
/**
|
||||
* 打印模板文档标题设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "打印模板文档标题设置")
|
||||
@PostMapping("/api/process/model/print/setting")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<Boolean> printDocumentSetting(@NotBlank(message = "模型 ID 不能为空") @RequestParam String modelId,
|
||||
@NotBlank(message = "标题不能为空") @RequestParam String fileName,
|
||||
@NotBlank(message = "模板名称不能为空") @RequestParam String templateName);
|
||||
|
||||
/**
|
||||
* 打印模板配置内容更新保存
|
||||
* @param dto
|
||||
@ -229,7 +217,7 @@ public interface ProcessModelApi {
|
||||
@Operation(summary = "打印模板配置内容更新保存")
|
||||
@PostMapping("/api/process/model/print/template/upsert")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<String> printTemplateConfig(@Validated @RequestBody PrintTemplateConfigUpsertDTO dto);
|
||||
CommonResponse<Void> printTemplateConfig(@Validated @RequestBody PrintTemplateConfigUpsertDTO dto);
|
||||
|
||||
/**
|
||||
* 获取打印模板配置内容
|
||||
|
||||
@ -19,7 +19,8 @@ public enum OtherRespCode implements IModuleRespCode {
|
||||
CLIENT_VERSION_SUPPORT("004", "客户端 JAR 包版本不支持,请升级到 {} 版本, 当前版本 {}"),
|
||||
MICRO_SERVER_NEED_REBUILD("005", "微服务 {} 需要重新编译发布, 如果是本地调用,请访问 WebApi 接口,在现有的接口地址前加上“web/v1/”即可"),
|
||||
MESSAGE_PUSH_EVENT_BUILD_ERROR("006", "不能使用 createEvent 函数创建`发送待办`的事件, 请调用 createPendingPushEvent 函数"),
|
||||
ASYNC_JOB_EXECUTION_ERROR("007", "获取指定实例 ID【{}】的锁失败")
|
||||
ASYNC_JOB_EXECUTION_ERROR("007", "获取指定实例 ID【{}】的锁失败"),
|
||||
ILLEGAL_PARAM_ERROR("008", "非法的参数:【{}】"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@ -26,6 +26,18 @@ public class PrintTemplateConfigUpsertDTO {
|
||||
@ApiModelProperty("审批模型 ID")
|
||||
private String modelId;
|
||||
|
||||
/**
|
||||
* 打印文件名称
|
||||
*/
|
||||
@ApiModelProperty(value = "打印文件名称")
|
||||
private String printFileName;
|
||||
|
||||
/**
|
||||
* 打印模板名称
|
||||
*/
|
||||
@ApiModelProperty(value = "打印模板名称")
|
||||
private String printTemplateName;
|
||||
|
||||
/**
|
||||
* 打印模板配置内容
|
||||
*/
|
||||
|
||||
@ -72,7 +72,7 @@ public interface BpmnProcessModelService {
|
||||
|
||||
List<String> getTenantIds();
|
||||
|
||||
void printDocumentSetting(String modelId, String fileName, String templateName);
|
||||
void printTemplateConfig(PrintTemplateConfigUpsertDTO dto);
|
||||
|
||||
String printTemplateConfig(PrintTemplateConfigUpsertDTO dto);
|
||||
String getPrintTemplateConfig(String modelId);
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ public interface ExtAxReModelService {
|
||||
|
||||
BpmnModelExtVO getStatusByModelId(String modelId);
|
||||
|
||||
void printDocumentSetting(String modelId, String fileName, String templateName);
|
||||
void printTemplateConfig(PrintTemplateConfigUpsertDTO dto);
|
||||
|
||||
String printTemplateConfig(PrintTemplateConfigUpsertDTO dto);
|
||||
String getPrintTemplateConfig(String modelId);
|
||||
}
|
||||
|
||||
@ -511,13 +511,13 @@ public class BpmnProcessModelServiceImpl implements BpmnProcessModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDocumentSetting(String modelId, String fileName, String templateName) {
|
||||
extAxReModelService.printDocumentSetting(modelId, fileName, templateName);
|
||||
public void printTemplateConfig(PrintTemplateConfigUpsertDTO dto) {
|
||||
extAxReModelService.printTemplateConfig(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String printTemplateConfig(PrintTemplateConfigUpsertDTO dto) {
|
||||
return extAxReModelService.printTemplateConfig(dto);
|
||||
public String getPrintTemplateConfig(String modelId) {
|
||||
return extAxReModelService.getPrintTemplateConfig(modelId);
|
||||
}
|
||||
|
||||
private void updateProcessDefinitionSuspended(String deploymentId) {
|
||||
|
||||
@ -74,27 +74,28 @@ public class ExtAxReModelServiceImpl implements ExtAxReModelService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printDocumentSetting(String modelId, String fileName, String templateName) {
|
||||
ExtAxReModel model = extAxReModelMapper.selectOne(new QueryWrapper<ExtAxReModel>().eq("model_id", modelId));
|
||||
if (Objects.isNull(model)) {
|
||||
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, model.getModelId());
|
||||
}
|
||||
|
||||
model.setPrintFileName(fileName);
|
||||
model.setPrintTemplateName(templateName);
|
||||
extAxReModelMapper.updateById(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String printTemplateConfig(PrintTemplateConfigUpsertDTO dto) {
|
||||
public void printTemplateConfig(PrintTemplateConfigUpsertDTO dto) {
|
||||
ExtAxReModel model = extAxReModelMapper.selectOne(new QueryWrapper<ExtAxReModel>().eq("model_id", dto.getModelId()));
|
||||
if (Objects.isNull(model)) {
|
||||
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, model.getModelId());
|
||||
}
|
||||
if (StringUtils.hasText(dto.getPrintFileName())) {
|
||||
model.setPrintFileName(dto.getPrintFileName());
|
||||
}
|
||||
if (StringUtils.hasText(dto.getPrintTemplateName())) {
|
||||
model.setPrintTemplateName(dto.getPrintTemplateName());
|
||||
}
|
||||
if (StringUtils.hasText(dto.getPrintTemplateConfig())) {
|
||||
model.setPrintTemplateConfig(dto.getPrintTemplateConfig());
|
||||
extAxReModelMapper.updateById(model);
|
||||
return dto.getPrintTemplateConfig();
|
||||
}
|
||||
extAxReModelMapper.updateById(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrintTemplateConfig(String modelId) {
|
||||
ExtAxReModel model = extAxReModelMapper.selectOne(new QueryWrapper<ExtAxReModel>().eq("model_id", modelId));
|
||||
if (Objects.isNull(model)) {
|
||||
throw new WorkflowEngineException(MODEL_ID_NOT_EXISTS, model.getModelId());
|
||||
}
|
||||
return model.getPrintTemplateConfig();
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.axzo.workflow.server.controller.web.bpmn;
|
||||
|
||||
import cn.axzo.workflow.client.feign.bpmn.ProcessModelApi;
|
||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.model.BpmnModelUpdateDTO;
|
||||
@ -39,6 +40,7 @@ import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.axzo.workflow.common.code.OtherRespCode.ILLEGAL_PARAM_ERROR;
|
||||
import static cn.azxo.framework.common.model.CommonResponse.success;
|
||||
|
||||
/**
|
||||
@ -324,23 +326,14 @@ public class BpmnProcessModelController implements ProcessModelApi {
|
||||
return success(bpmnProcessModelService.getTenantIds());
|
||||
}
|
||||
|
||||
@Operation(summary = "打印模板文档标题设置")
|
||||
@PostMapping("/print/setting")
|
||||
@Override
|
||||
public CommonResponse<Boolean> printDocumentSetting(@NotBlank(message = "模型 ID 不能为空") @RequestParam String modelId,
|
||||
@NotBlank(message = "标题不能为空") @RequestParam String fileName,
|
||||
@NotBlank(message = "模板名称不能为空") @RequestParam String templateName) {
|
||||
log.info("设置打印模板标题");
|
||||
bpmnProcessModelService.printDocumentSetting(modelId, fileName, templateName);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@Operation(summary = "打印模板配置内容")
|
||||
@PostMapping("/print/template/upsert")
|
||||
@Override
|
||||
public CommonResponse<String> printTemplateConfig(@Validated @RequestBody PrintTemplateConfigUpsertDTO dto) {
|
||||
public CommonResponse<Void> printTemplateConfig(@Validated @RequestBody PrintTemplateConfigUpsertDTO dto) {
|
||||
log.info("操作打印模板配置内容");
|
||||
return success(bpmnProcessModelService.printTemplateConfig(dto));
|
||||
bpmnProcessModelService.printTemplateConfig(dto);
|
||||
return success();
|
||||
}
|
||||
|
||||
@Operation(summary = "获取打印模板配置内容")
|
||||
@ -348,9 +341,12 @@ public class BpmnProcessModelController implements ProcessModelApi {
|
||||
@Override
|
||||
public CommonResponse<String> getPrintTemplateConfig(@Validated @RequestBody PrintTemplateConfigQueryDTO dto) {
|
||||
log.info("获取打印模板配置内容");
|
||||
if (!StringUtils.hasText(dto.getModelId()) && !StringUtils.hasText(dto.getProcessInstanceId())) {
|
||||
throw new WorkflowEngineException(ILLEGAL_PARAM_ERROR, "模型 ID 和实例 ID 不能同时为空");
|
||||
}
|
||||
if (!StringUtils.hasText(dto.getModelId())) {
|
||||
dto.setModelId(bpmnProcessInstanceService.getModelIdByProcessInstanceId(dto.getProcessInstanceId()));
|
||||
}
|
||||
return success(bpmnProcessModelService.printTemplateConfig(PrintTemplateConfigUpsertDTO.builder().modelId(dto.getModelId()).build()));
|
||||
return success(bpmnProcessModelService.getPrintTemplateConfig(dto.getModelId()));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user