Merge branch 'feature/REQ-5369' into dev

# Conflicts:
#	workflow-engine-common/src/main/java/cn/axzo/workflow/common/enums/PrintFieldCategoryEnum.java
This commit is contained in:
wangli 2025-09-15 11:46:58 +08:00
commit 917c0afea6
4 changed files with 105 additions and 1 deletions

View File

@ -3,16 +3,17 @@ package cn.axzo.workflow.client.feign.manage;
import cn.axzo.workflow.client.annotation.WorkflowEngineFeignClient;
import cn.axzo.workflow.common.annotation.InvokeMode;
import cn.axzo.workflow.common.annotation.Manageable;
import cn.axzo.workflow.common.model.dto.print.PrintFieldDTO;
import cn.axzo.workflow.common.model.request.form.definition.StartFormSearchDTO;
import cn.axzo.workflow.common.model.request.form.instance.FormDetailDTO;
import cn.axzo.workflow.common.model.request.form.instance.FormSearchDTO;
import cn.axzo.workflow.common.model.request.form.instance.FromDataSearchDTO;
import cn.axzo.workflow.common.model.request.form.model.WpsFileConfigVariableDTO;
import cn.axzo.workflow.common.model.response.form.FormVO;
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
import cn.axzo.workflow.common.model.response.form.instance.FormDataVO;
import cn.axzo.workflow.common.model.response.form.instance.FormInstanceVO;
import cn.azxo.framework.common.model.CommonResponse;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -69,4 +70,14 @@ public interface FormAdminApi {
@PostMapping("/api/form/admin/instance/form/data")
@InvokeMode(SYNC)
CommonResponse<List<FormDataVO>> getFormData(@Validated @RequestBody FromDataSearchDTO dto);
/**
* 获取 WPS 文档中所有可配置的流程相关变量
*
* @param dto
* @return
*/
@PostMapping("/api/wps/file/config/variables")
@InvokeMode(SYNC)
CommonResponse<List<PrintFieldDTO>> getWpsFileConfigVariables(WpsFileConfigVariableDTO dto);
}

View File

@ -23,6 +23,8 @@ public enum PrintFieldCategoryEnum {
signature,
// 签署业务自定义变量
sign,
// 审批业务的变量
biz_variable,
@JsonEnumDefaultValue
unknown,
;

View File

@ -0,0 +1,39 @@
package cn.axzo.workflow.common.model.request.form.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 查询用于 WPS 左侧变量列表的集合
*
* @author wangli
* @since 2025-09-15 10:07
*/
@ApiModel("查询用于 WPS 左侧变量列表的集合")
@Data
@Builder
public class WpsFileConfigVariableDTO {
/**
* 模板定义 KEY
*/
@ApiModelProperty(value = "流程模板 KEY")
@NotBlank(message = "流程模板 KEY 不能为空")
private String processDefinitionKey;
/**
* 租户 ID
*/
@ApiModelProperty(value = "租户 ID")
private String tenantId;
/**
* 是否抛出内部异常
*/
@ApiModelProperty(value = "是否报错内部异常")
@Builder.Default
private Boolean throwException = true;
}

View File

@ -1,20 +1,30 @@
package cn.axzo.workflow.server.controller.web.form;
import cn.axzo.workflow.client.feign.manage.FormAdminApi;
import cn.axzo.workflow.common.enums.PrintFieldCategoryEnum;
import cn.axzo.workflow.common.model.dto.BpmnFormRelationSearchDTO;
import cn.axzo.workflow.common.model.dto.print.FieldAttributeDTO;
import cn.axzo.workflow.common.model.dto.print.PrintFieldDTO;
import cn.axzo.workflow.common.model.request.bpmn.print.PrintFieldQueryDTO;
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarSearchDto;
import cn.axzo.workflow.common.model.request.form.definition.StartFormSearchDTO;
import cn.axzo.workflow.common.model.request.form.instance.FormDetailDTO;
import cn.axzo.workflow.common.model.request.form.instance.FormSearchDTO;
import cn.axzo.workflow.common.model.request.form.instance.FromDataSearchDTO;
import cn.axzo.workflow.common.model.request.form.model.WpsFileConfigVariableDTO;
import cn.axzo.workflow.common.model.response.category.CategoryGroupVarItemVo;
import cn.axzo.workflow.common.model.response.form.FormVO;
import cn.axzo.workflow.common.model.response.form.definition.FormDefinitionVO;
import cn.axzo.workflow.common.model.response.form.instance.FormDataVO;
import cn.axzo.workflow.common.model.response.form.instance.FormInstanceVO;
import cn.axzo.workflow.core.service.CategoryGroupService;
import cn.axzo.workflow.core.service.FormCoreService;
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
import cn.axzo.workflow.server.controller.web.manage.PrintAdminController;
import cn.azxo.framework.common.model.CommonResponse;
import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -22,6 +32,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import static cn.azxo.framework.common.model.CommonResponse.success;
@ -41,6 +52,10 @@ public class FormAdminController implements FormAdminApi {
@Resource
private FormCoreService formCoreService;
@Resource
private PrintAdminController printAdminController;
@Resource
private CategoryGroupService categoryGroupService;
@Operation(summary = "表单列表")
@PostMapping("/form/page")
@ -68,4 +83,41 @@ public class FormAdminController implements FormAdminApi {
public CommonResponse<List<FormDataVO>> getFormData(@Validated @RequestBody FromDataSearchDTO dto) {
return success(formCoreService.getFormData(dto));
}
@Override
public CommonResponse<List<PrintFieldDTO>> getWpsFileConfigVariables(@Validated @RequestBody WpsFileConfigVariableDTO dto) {
CommonResponse<List<PrintFieldDTO>> printFieldResponse = printAdminController.getPrintFields(PrintFieldQueryDTO.builder()
.processDefinitionKey(dto.getProcessDefinitionKey())
.tenantId(dto.getTenantId())
.throwException(dto.getThrowException())
.build());
List<PrintFieldDTO> result = printFieldResponse.getData();
List<CategoryGroupVarItemVo> categoryGroupVarItemVos = categoryGroupService.searchGroupAndVarList(CategoryGroupVarSearchDto.builder()
.category(dto.getProcessDefinitionKey())
.build());
if (CollectionUtils.isEmpty(categoryGroupVarItemVos)) {
return printFieldResponse;
}
categoryGroupVarItemVos.forEach(i -> {
PrintFieldDTO field = new PrintFieldDTO();
field.setName(i.getGroupName());
field.setFieldCategoryType(PrintFieldCategoryEnum.biz_variable);
field.setCode("");
field.setFieldFormType("");
List<FieldAttributeDTO> attributes = new ArrayList<>();
i.getVars().forEach(e -> {
FieldAttributeDTO attribute = new FieldAttributeDTO();
attribute.setCode(e.getCode());
attribute.setName(e.getName());
attribute.setFieldFormType(e.getType().getType());
attributes.add(attribute);
});
field.setAttributes(attributes);
result.add(field);
});
return success(result);
}
}