feat(REQ-5965) - 调整 BPMN 协议,增加条件字段权限配置信息
This commit is contained in:
parent
936833b73e
commit
cdbe89c05a
@ -117,6 +117,7 @@ public interface BpmnConstants {
|
||||
String CONFIG_ACTIVITY_SIGNATURE = "signature";
|
||||
String CONFIG_FIELD_META = "field";
|
||||
String CONFIG_FIELD_PERMISSION = "fieldPermission";
|
||||
String CONFIG_CONDITION_PERMISSION = "conditionPermission";
|
||||
String CONFIG_FIELD_OPTION = "option";
|
||||
String CONFIG_NODE_TYPE = "nodeType";
|
||||
String CONFIG_BUTTON_TYPE_INITIATOR = "initiator";
|
||||
@ -126,6 +127,7 @@ public interface BpmnConstants {
|
||||
String CONFIG_SIGN_TYPE = "signType";
|
||||
String CONFIG_AREA_FILTER_ENABLE = "areaFilterEnable";
|
||||
String CONFIG_SPECIALTY_FILTER_ENABLE = "specialtyFilterEnable";
|
||||
String CONFIG_ONLY_IN_PROJECT_ENABLE = "onlyInProjectEnable";
|
||||
String ELEMENT_ATTRIBUTE_NAME = "name";
|
||||
String ELEMENT_ATTRIBUTE_VALUE = "value";
|
||||
String ELEMENT_ATTRIBUTE_DESC = "desc";
|
||||
|
||||
@ -54,7 +54,7 @@ public interface VariableConstants {
|
||||
String PRINT_VAR_PROCESS_LOG_ACTIVITY_NAME = "activityName";
|
||||
String PRINT_VAR_PROCESS_LOG_ACTIVITY_NAME_DESC = "节点名称";
|
||||
String PRINT_VAR_PROCESS_LOG_APPROVER_NAME = "approverName";
|
||||
String PRINT_VAR_PROCESS_LOG_APPROVER_NAME_DESC = "审批人";
|
||||
String PRINT_VAR_PROCESS_LOG_APPROVER_NAME_DESC = "姓名";
|
||||
String PRINT_VAR_PROCESS_LOG_UNIT = "unit";
|
||||
String PRINT_VAR_PROCESS_LOG_UNIT_DESC = "单位";
|
||||
String PRINT_VAR_PROCESS_LOG_POSITION = "position";
|
||||
@ -68,7 +68,7 @@ public interface VariableConstants {
|
||||
String PRINT_VAR_PROCESS_LOG_ACTIVITY_RESULT = "activityResult";
|
||||
String PRINT_VAR_PROCESS_LOG_ACTIVITY_RESULT_DESC = "审批结果";
|
||||
String PRINT_VAR_PROCESS_LOG_ACTIVITY_OPERATION_TIME = "activityOperationTime";
|
||||
String PRINT_VAR_PROCESS_LOG_ACTIVITY_OPERATION_TIME_DESC = "签名日期";
|
||||
String PRINT_VAR_PROCESS_LOG_ACTIVITY_OPERATION_TIME_DESC = "日期";
|
||||
String PRINT_VAR_PROCESS_LOG_OPERATION = "operationDesc";
|
||||
String PRINT_VAR_PROCESS_LOG_OPERATION_DESC = "操作描述";
|
||||
}
|
||||
|
||||
@ -40,6 +40,11 @@ public class CooperationOrgDTO implements Serializable {
|
||||
*/
|
||||
private List<String> includeSpecialtyCodes;
|
||||
|
||||
/**
|
||||
* 控制仅支持工程内人员参与审批
|
||||
*/
|
||||
private List<Long> projectIds;
|
||||
|
||||
/**
|
||||
* 企业组织架构范围
|
||||
**/
|
||||
|
||||
@ -41,13 +41,13 @@ public class CustomDocDTO implements Serializable {
|
||||
private String fileTag;
|
||||
|
||||
/**
|
||||
* 文件 wps code,如果有则传入
|
||||
* 如果业务是使用在线文档,则一定会有 wps code,如果有则传入
|
||||
* <p>
|
||||
* wps 文件的标识,通过{@link cn.axzo.nanopart.doc.api.anonymous.DocAnonymousDatabaseApi#createFile(cn.axzo.nanopart.doc.api.anonymous.request.AnonymousCreateFileRequest)} 接口创建文件后返回的 fileCode
|
||||
*/
|
||||
private String fileCode;
|
||||
/**
|
||||
* oss 地址的文件标识
|
||||
* 不管是在线文件还是本地上传,必须包含 oss 地址的文件标识
|
||||
*/
|
||||
@NotBlank(message = "业务自定义文件的 oss key 不能为空")
|
||||
private String fileKey;
|
||||
|
||||
@ -220,4 +220,9 @@ public class BpmnJsonNodeProperty {
|
||||
@ApiModelProperty(value = "专业过滤开关", notes = "true: 开启专业过滤, false: 关闭专业过滤")
|
||||
private Boolean specialtyFilterEnable;
|
||||
|
||||
/**
|
||||
* 工程内人员开关
|
||||
*/
|
||||
@ApiModelProperty(value = "仅工程内人员开关", notes = "true: 仅工程内人员, false: 非仅工程内人员")
|
||||
private Boolean onlyInProjectEnable;
|
||||
}
|
||||
|
||||
@ -59,8 +59,16 @@ public class ConditionPermissionMetaInfo implements Serializable {
|
||||
@Builder.Default
|
||||
private Boolean hidden = false;
|
||||
|
||||
/**
|
||||
* 前端回显字段,后端不做任何消费逻辑
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 类型是单选复选时的选项值
|
||||
*/
|
||||
private String options;
|
||||
|
||||
|
||||
// 将对象的属性转换为对应的整数表示
|
||||
public int toBinary() {
|
||||
@ -73,12 +81,12 @@ public class ConditionPermissionMetaInfo implements Serializable {
|
||||
}
|
||||
|
||||
// 从整数表示还原出对象
|
||||
public static ConditionPermissionMetaInfo fromBinary(String fieldId, String fieldName, int binaryValue) {
|
||||
public static ConditionPermissionMetaInfo fromBinary(String conditionCode, String conditionName, String conditionType, int binaryValue) {
|
||||
boolean required = ((binaryValue >> 3) & 1) == 1;
|
||||
boolean editable = ((binaryValue >> 2) & 1) == 1;
|
||||
boolean readonly = ((binaryValue >> 1) & 1) == 1;
|
||||
boolean hidden = (binaryValue & 1) == 1;
|
||||
return new ConditionPermissionMetaInfo(fieldId, fieldName, required, editable, readonly, hidden, null);
|
||||
return new ConditionPermissionMetaInfo(conditionCode, conditionName, conditionType, required, editable, readonly, hidden, null, null);
|
||||
}
|
||||
|
||||
public ConditionPermissionMetaInfo toReadonly() {
|
||||
|
||||
@ -31,6 +31,7 @@ import cn.axzo.workflow.common.model.request.bpmn.BpmnSignConf;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnSignPendingProperty;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnSmsProperty;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnUpgradeApprovalConf;
|
||||
import cn.axzo.workflow.common.model.request.form.ConditionPermissionMetaInfo;
|
||||
import cn.axzo.workflow.common.model.request.form.FormPermissionMetaInfo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
@ -82,6 +83,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPIE
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPY;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPY_OBJECT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPY_SPECIFY;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CONDITION_PERMISSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_META;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTION;
|
||||
@ -93,6 +95,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SP
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_RANGE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_NODE_TYPE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_NOTICE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_ONLY_IN_PROJECT_ENABLE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN_APPROVER_LIMIT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN_APPROVER_ORG_LIMIT;
|
||||
@ -648,6 +651,10 @@ public final class BpmnMetaParserHelper {
|
||||
return defaultValid(flowElement, CONFIG_SPECIALTY_FILTER_ENABLE).map(element -> Boolean.valueOf(element.getAttributeValue(null, ELEMENT_ATTRIBUTE_CHECKED))).orElse(false);
|
||||
}
|
||||
|
||||
public static Boolean getOnlyInProjectEnable(FlowElement flowElement) {
|
||||
return defaultValid(flowElement, CONFIG_ONLY_IN_PROJECT_ENABLE).map(element -> Boolean.valueOf(element.getAttributeValue(null, ELEMENT_ATTRIBUTE_CHECKED))).orElse(false);
|
||||
}
|
||||
|
||||
private static Optional<ExtensionElement> defaultValid(FlowElement flowElement, String elementName) {
|
||||
if (Objects.isNull(flowElement)) {
|
||||
return Optional.empty();
|
||||
@ -692,6 +699,10 @@ public final class BpmnMetaParserHelper {
|
||||
}.getType()));
|
||||
}
|
||||
|
||||
public static Optional<List<ConditionPermissionMetaInfo>> getConditionPermissionConf(FlowElement flowElement) {
|
||||
return defaultValid(flowElement, CONFIG_CONDITION_PERMISSION).map(element -> JSON.parseObject(element.getElementText(), new TypeReference<List<ConditionPermissionMetaInfo>>() {
|
||||
}.getType()));
|
||||
}
|
||||
public static Optional<ImmutableTable<String, String, Integer>> getFormFieldPermissionForCalc(FlowElement flowElement) {
|
||||
List<FormPermissionMetaInfo> fieldMetaInfos = getFormFieldPermissionConf(flowElement).orElse(new ArrayList<>());
|
||||
return getFormFieldPermissionForModel(fieldMetaInfos);
|
||||
|
||||
@ -25,6 +25,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPIE
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPY;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPY_OBJECT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPY_SPECIFY;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CONDITION_PERMISSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_PERMISSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_LEADER_RANGE_UNIT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_EXCLUDE_COOPERATE_TYPES;
|
||||
@ -68,6 +69,8 @@ public class ServiceTaskJsonConverter extends AbstractBpmnJsonConverter<ServiceT
|
||||
|
||||
// "表单权限设置"
|
||||
setFormFieldExtensionElement(node, serviceTask);
|
||||
// "条件权限设置"
|
||||
setConditionExtensionElement(node, serviceTask);
|
||||
return serviceTask;
|
||||
}
|
||||
|
||||
@ -399,6 +402,17 @@ public class ServiceTaskJsonConverter extends AbstractBpmnJsonConverter<ServiceT
|
||||
serviceTask.setImplementationType(IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
|
||||
}
|
||||
|
||||
private static void setConditionExtensionElement(BpmnJsonNode node, ServiceTask serviceTask) {
|
||||
if (Objects.isNull(node.getProperty())) {
|
||||
return;
|
||||
}
|
||||
ExtensionElement fieldElement = new ExtensionElement();
|
||||
fieldElement.setName(CONFIG_CONDITION_PERMISSION);
|
||||
fieldElement.setElementText(Objects.nonNull(node.getProperty().getConditionPermission()) ?
|
||||
JSON.toJSONString(node.getProperty().getConditionPermission()) : null);
|
||||
serviceTask.addExtensionElement(fieldElement);
|
||||
}
|
||||
|
||||
private static void setFormFieldExtensionElement(BpmnJsonNode node, ServiceTask serviceTask) {
|
||||
if (Objects.isNull(node.getProperty())) {
|
||||
return;
|
||||
|
||||
@ -45,12 +45,14 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_CURRENT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_HISTORY;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_INITIATOR;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CONDITION_PERMISSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_PERMISSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_LEADER_RANGE_UNIT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_EXCLUDE_COOPERATE_TYPES;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_EXCLUDE_IDENTITY_TYPES;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_FILTER;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_RANGE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_ONLY_IN_PROJECT_ENABLE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN_APPROVER_LIMIT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN_APPROVER_ORG_LIMIT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN_APPROVER_ROLE_LIMIT;
|
||||
@ -99,6 +101,8 @@ public class UserTaskJsonConverter extends AbstractBpmnJsonConverter<UserTask> {
|
||||
setApprovalExtensionElement(node, userTask);
|
||||
// "表单权限设置"
|
||||
setFormFieldExtensionElement(node, userTask);
|
||||
// "条件权限设置"
|
||||
setConditionExtensionElement(node, userTask);
|
||||
// "高级设置",包含按钮配置,自动过审配置
|
||||
setAdvancedExtensionElement(node, userTask);
|
||||
// "待办消息模板配置"
|
||||
@ -183,6 +187,14 @@ public class UserTaskJsonConverter extends AbstractBpmnJsonConverter<UserTask> {
|
||||
specialtyFilterEnableElement.addAttribute(specialtyFilterEnableAttribute);
|
||||
userTask.addExtensionElement(specialtyFilterEnableElement);
|
||||
|
||||
ExtensionElement onlyInProjectEnableElement = new ExtensionElement();
|
||||
onlyInProjectEnableElement.setName(CONFIG_ONLY_IN_PROJECT_ENABLE);
|
||||
ExtensionAttribute onlyInProjectEnableAttribute = new ExtensionAttribute();
|
||||
onlyInProjectEnableAttribute.setName(ELEMENT_ATTRIBUTE_CHECKED);
|
||||
onlyInProjectEnableAttribute.setValue(String.valueOf(Boolean.TRUE.equals(node.getProperty().getOnlyInProjectEnable())));
|
||||
onlyInProjectEnableElement.addAttribute(onlyInProjectEnableAttribute);
|
||||
userTask.addExtensionElement(onlyInProjectEnableElement);
|
||||
|
||||
//添加自动审批配置
|
||||
ExtensionElement autoApprovalExtensionElement = new ExtensionElement();
|
||||
ExtensionAttribute pendingMessageAttribute = new ExtensionAttribute();
|
||||
@ -191,6 +203,17 @@ public class UserTaskJsonConverter extends AbstractBpmnJsonConverter<UserTask> {
|
||||
userTask.addExtensionElement(autoApprovalExtensionElement);
|
||||
}
|
||||
|
||||
private static void setConditionExtensionElement(BpmnJsonNode node, UserTask userTask) {
|
||||
if (Objects.isNull(node.getProperty()) || CollectionUtils.isEmpty(node.getProperty().getConditionPermission())) {
|
||||
return;
|
||||
}
|
||||
ExtensionElement fieldElement = new ExtensionElement();
|
||||
fieldElement.setName(CONFIG_CONDITION_PERMISSION);
|
||||
fieldElement.setElementText(Objects.nonNull(node.getProperty().getConditionPermission()) ?
|
||||
JSON.toJSONString(node.getProperty().getConditionPermission()) : null);
|
||||
userTask.addExtensionElement(fieldElement);
|
||||
}
|
||||
|
||||
private static void setFormFieldExtensionElement(BpmnJsonNode node, UserTask userTask) {
|
||||
if (Objects.isNull(node.getProperty()) || CollectionUtils.isEmpty(node.getProperty().getFieldPermission())) {
|
||||
return;
|
||||
|
||||
@ -161,6 +161,7 @@ public class CustomApproveTaskCmd extends AbstractCommand<Void> implements Seria
|
||||
}
|
||||
task.setTransientVariable(TASK_COMPLETE_OPERATION_TYPE + taskId, APPROVED.getStatus());
|
||||
|
||||
// 更新流程内的变量
|
||||
runtimeService.setVariables(task.getProcessInstanceId(), variables);
|
||||
// 记录电子签名的图片
|
||||
recordSignature(task, runtimeService);
|
||||
|
||||
@ -180,6 +180,7 @@ public class CustomApproveTaskWithFormCmd extends AbstractCommand<Void> implemen
|
||||
nextApprover);
|
||||
}
|
||||
task.setTransientVariable(TASK_COMPLETE_OPERATION_TYPE + taskId, APPROVED.getStatus());
|
||||
// 更新流程实例变量
|
||||
runtimeService.setVariables(task.getProcessInstanceId(), variables);
|
||||
// 记录电子签名的图片
|
||||
recordSignature(task, runtimeService);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user