自定义UI对象转流程节点

自定义UI对象转流程节点

activitiy学习 (动态加签,动态流程图,指定节点跳转,指定多人节点跳转)

前端页面仿的这个

提供一个思路

实体

  • ActivitiValueVo
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Map;

@Data
@ApiModel(value = "ActivitiValueVo对象", description = "流程设计主体对象")
public class ActivitiValueVo implements Serializable {
	private static final long serialVersionUID = -3200115152519475826L;

	private Integer tableId;
	/**
	 * 审批名称
	 */
	private String workFlowDef;
	private Integer directorMaxLevel;
	private String flowPermission;
	@ApiModelProperty("流程节点")
	private ChildNodeVo nodeConfig;
	@ApiModelProperty("发起人提交参数")
	private Map<String, Object> paramValueMap;
	@ApiModelProperty(value = "租户id")
	private Long tenantId;
}
  • ChildNodeVo

import cn.morimatsu.phegda.pojo.dto.activiti.ActivitiUserDTO;
import cn.morimatsu.phegda.pojo.vo.common.ActOrderTableFieldVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

@Data
@ApiModel(value = "ChildNodeVo对象", description = "流程节点对象")
public class ChildNodeVo implements Serializable {

	private static final long serialVersionUID = -5222393104041946672L;
	/**
	 * 前端展示唯一标识
	 */
	@ApiModelProperty("前端展示唯一标识")
	private String id;
	/**
	 * 节点Id
	 */
	@ApiModelProperty("节点Id")
	private String nodeId;
	/**
	 * 节点名称
	 */
	@ApiModelProperty("节点名称")
	private String nodeName;

	private String error;
	/**
	 * 类型 : 0,发起人;1,审核人;2,抄送人;3,条件;4,路由;5,条件默认
	 */
	@ApiModelProperty("类型 : 0,发起人;1,审核人;2,抄送人;3,条件;4,路由;5,条件默认")
	private Integer type;

	@ApiModelProperty("是否禁止编辑: true:禁止编辑")
	private Boolean disabled;

	private Integer priorityLevel;
	/**
	 * 操作类型:1,指定成员;5,发起人;2,部门负责人;
	 */
	@ApiModelProperty("操作类型:4,指定成员;5,发起人;2,部门负责人;3:报修人(仅工单验收);")
	private Integer settype;
	/**
	 * 部门负责人操作类型:null or 0,自动通过;1,指定审批人
	 */
	@ApiModelProperty("部门负责人找不到操作类型:null or 0,自动通过;1,指定审批人")
	private Integer deptDirectorTaskType;
	@ApiModelProperty("部门负责人找不到指定审批人")
	private ActivitiUserDTO deptDirectorTaskUser;

	private Integer selectMode;
	private Integer selectRange;
	private Integer directorLevel;
	/**
	 * 多人审批时采用的审批方式:0,会签(需所有审批人同意);1,或签(一名审批人同意或拒绝即可)
	 */
	@ApiModelProperty("多人审批时采用的审批方式:0,会签(需所有审批人同意);1,或签(一名审批人同意或拒绝即可)")
	private Integer examineMode;
	private Integer noHanderAction;
	private Integer examineEndDirectorLevel;
	/**
	 * 抄送标志 (弃用)
	 */
	@ApiModelProperty("抄送标志 (弃用)")
	private Integer ccSelfSelectFlag;
	/**
	 * 条件信息数据
	 */
	@ApiModelProperty("条件信息数据")
	private List<ConditionVo> conditionList;
	/**
	 * 当前节点操作人员信息
	 */
	@ApiModelProperty("当前节点操作人员信息")
	private List<ActivitiUserDTO> nodeUserList;
	/**
	 * 下一节点数据 null 为 指向结束节点
	 */
	@ApiModelProperty("下一节点数据 null 为 指向结束节点")
	private ChildNodeVo childNode;
	/**
	 * type=4时 存放分支数据
	 */
	@ApiModelProperty("type=4时 存放分支数据")
	private List<ChildNodeVo> conditionNodes;
	/**
	 * type=1时 存放编辑权限字段
	 */
	@ApiModelProperty("type=1时 编辑权限字段")
	private List<ActOrderTableFieldVO> editPermissionsFields;
	/**
	 * 节点更改数据项 (节点有编辑权限时且也变更了数据时,记录变更字段及数据)
	 */
	@ApiModelProperty("节点更改数据项")
	private List<Map<String, Object>> updateList;
	/**
	 * 条件为false or true
	 */
	@ApiModelProperty("条件为false or true")
	private Boolean conditionBoo;

}
  • ConditionVo

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
@ApiModel(value = "ConditionVo对象", description = "条件信息对象")
public class ConditionVo implements Serializable {
	private static final long serialVersionUID = -1597728589377233523L;

	/**
	 * 字段key
	 */
	@ApiModelProperty("字段key")
	private String fieldKey;
	/**
	 * 字段类型 1:下拉; 2 :区间; 3:单选; 4:时间; 5:选择部门; 6:选择人员; 7 文本; 8 级联; 9 选择供应商; 10 地址; 11 下拉单选;
	 * 12 下拉多选; 13 起止日期; 14 数字; 15 设备分类; 16 员工选择; 17 部门选择; 18 周期; 999,额外挂载部门
	 */
	@ApiModelProperty("fieldDataType")
	private Integer fieldDataType;
	/**
	 * 字段名称
	 */
	@ApiModelProperty("字段名称")
	private String label;
	/**
	 * 连接符 1,or;2。and;
	 */
	@ApiModelProperty("连接符 1,or;2。and;")
	private Integer connectors;
	/**
	 * 文本
	 */
	@ApiModelProperty("文本  fieldDataType  1:下拉; 3:单选; 5:选择部门; 6:选择人员; 8 级联; 9 选择供应商; 14 数字; 999,额外挂载部门")
	private Object text;

	@ApiModelProperty("文本名称  fieldDataType  4:时间; 7 文本; 10 地址; 11 下拉单选; 13 起止日期; 16 员工选择; 17 部门选择; 18 周期;")
	private String textName;
	/**
	 * 数值 最小值
	 */
	@ApiModelProperty("数值 最小值 fieldDataType 2 :区间;")
	private String min;
	/**
	 * 数值 最大值
	 */
	@ApiModelProperty("数值 最大值 fieldDataType 2 :区间;")
	private String max;
	/**
	 * 集合值集
	 * {         <p/>
	 *     "123",<p/>
	 *     123   <p/>
	 * }
	 */
	@ApiModelProperty("集合值集 12:下拉多选; 15:设备分类;")
	private List<Object> list;

	private Object dataInfo;

}

自定义对象转bpmn

	/**
	 * 递归 转 bpmnModel
	 * @param childNode 数据节点
	 * @param process process
	 * @param paramMap 流程参数
	 * @param nodeId 路由节点 下游节点id (非路由节点传 null)
	 * @param paramValueMap 启动流程参数 非启动时 null
	 * @param keys 非启动流程时 不能为null 获取全部动态参数
	 */
	String recursionToBpmnModel(ChildNodeVo childNode, Process process, Map<String, Object> paramMap, String nodeId, Map<String, Object> paramValueMap, Set<String> keys);


	@Override
	public String recursionToBpmnModel(ChildNodeVo childNode, Process process, Map<String, Object> paramMap, String nodeId, Map<String, Object> paramValueMap, Set<String> keys) {
		//主线 结束 拼接 end节点
		if ((childNode == null || ObjectUtils.isEmpty(childNode.getType())) && ObjectUtils.isEmpty(nodeId)) {
			EndEvent endEvent = new EndEvent();
			endEvent.setId(String.format("end_%s", RandomStringUtils.randomAlphabetic(10)));
			endEvent.setName("结束");
			process.addFlowElement(endEvent);
			return endEvent.getId();
		} else if (childNode == null || ObjectUtils.isEmpty(childNode.getType())) { //&& routing != null
			//分支线 结束 回归主线
			return nodeId;
		}

		switch (childNode.getType()) {
			//发起人节点
			case 0:
				StartEvent startEvent = new StartEvent();
				startEvent.setId(String.format("start_%s", RandomStringUtils.randomAlphabetic(10)));
				startEvent.setName(childNode.getNodeName());
				childNode.setNodeId(startEvent.getId());
				childNode.setConditionBoo(Boolean.TRUE);
				process.addFlowElement(startEvent);
				SequenceFlow sequenceFlow = new SequenceFlow();
				sequenceFlow.setId(String.format("flow_%s", RandomStringUtils.randomAlphabetic(10)));
				sequenceFlow.setSourceRef(startEvent.getId());
				sequenceFlow.setTargetRef(this.recursionToBpmnModel(childNode.getChildNode(), process, paramMap, nodeId, paramValueMap, keys));
				if (childNode.getChildNode() == null || ObjectUtils.isEmpty(childNode.getChildNode().getType()))
					childNode.setChildNode(null);
				process.addFlowElement(sequenceFlow);
				return startEvent.getId();
			//审核人
			case 1:
				UserTask userTask = new UserTask();
				userTask.setName(childNode.getNodeName());
				String randomStr = RandomStringUtils.randomAlphabetic(5);
				//固定格式
				userTask.setAssignee(String.format("${userId_%s}", randomStr));
				//报修人节点 允许为空 验证阶段
				if (ObjectUtils.isEmpty(childNode.getNodeUserList())
						&& !childNode.getSettype().equals(3)) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_NOT_SET_APPROVE,childNode.getNodeName()));
				//多人会签
				final MultiInstanceLoopCharacteristics loopCharacteristics = new MultiInstanceLoopCharacteristics();
				String str = "userTask"; //userList_是否会签_是否或签
				//是否会签
				if (childNode.getExamineMode() == null) {
					str = String.format("%s_%s", str, 0);
				} else {
					str = String.format("%s_%s", str, 1);
					//固定格式
					if (Objects.equals(childNode.getExamineMode(), 0)) {
						//0,会签(需所有审批人同意)
						loopCharacteristics.setCompletionCondition("${nrOfCompletedInstances/nrOfInstances==1}");
						str = String.format("%s_%s", str, 0);
					} else {
						//或签(一名审批人同意或拒绝即可)
						loopCharacteristics.setCompletionCondition("${nrOfCompletedInstances==1}");
						str = String.format("%s_%s", str, 1);
					}
				}
				userTask.setId(String.format("%s_%s", str, RandomStringUtils.randomAlphabetic(10)));
				childNode.setNodeId(userTask.getId());
				childNode.setConditionBoo(Boolean.TRUE);
				final String userStr = String.format("userList_%s", randomStr);
				final List<String> users = childNode.getNodeUserList().stream()
						.map(ActivitiUserDTO::getEmployeeNumber)
						.collect(Collectors.toList());
				paramMap.put(userStr, users);
				loopCharacteristics.setInputDataItem(String.format("${%s}", userStr));
				//固定格式
				loopCharacteristics.setElementVariable(String.format("userId_%s", randomStr));
				userTask.setLoopCharacteristics(loopCharacteristics);

				//部门负责人找不到操作类型:null or 0,自动通过;1,指定审批人
				if (Objects.equals(childNode.getSettype(), 2)) {
					final ActivitiListener activitiListener = new ActivitiListener();
					activitiListener.setEvent("create");
					activitiListener.setImplementationType("class");
					activitiListener.setImplementation("cn.morimatsu.phegda.config.activitiListener.MakeDeptDirectorTask");
					userTask.setTaskListeners(Collections.singletonList(activitiListener));
				}

				process.addFlowElement(userTask);
				sequenceFlow = new SequenceFlow();
				sequenceFlow.setId(String.format("flow_%s", RandomStringUtils.randomAlphabetic(10)));
				sequenceFlow.setSourceRef(userTask.getId());
				sequenceFlow.setTargetRef(this.recursionToBpmnModel(childNode.getChildNode(), process, paramMap, nodeId, paramValueMap, keys));
				if (childNode.getChildNode() == null || ObjectUtils.isEmpty(childNode.getChildNode().getType()))
					childNode.setChildNode(null);
				process.addFlowElement(sequenceFlow);
				return userTask.getId();
			//抄送人
			case 2:
				userTask = new UserTask();
				userTask.setId(String.format("carbonCopy_%s", RandomStringUtils.randomAlphabetic(10)));
				userTask.setName(childNode.getNodeName());
				childNode.setNodeId(userTask.getId());
				childNode.setConditionBoo(Boolean.TRUE);
				randomStr = RandomStringUtils.randomAlphabetic(5);
				//固定格式
				userTask.setAssignee(String.format("${copyUserId_%s}", randomStr));
				if (ObjectUtils.isEmpty(childNode.getNodeUserList())) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_NOT_SET_CC_PERSON,childNode.getNodeName()));
				//多人会签
				final MultiInstanceLoopCharacteristics loop = new MultiInstanceLoopCharacteristics();
				final String copyUser = String.format("carbonCopyUserList_%s", randomStr);
				final List<String> copyUsers = childNode.getNodeUserList().stream()
						.map(ActivitiUserDTO::getEmployeeNumber)
						.collect(Collectors.toList());
				paramMap.put(copyUser, copyUsers);
				loop.setInputDataItem(String.format("${%s}", copyUser));
				//固定格式 抄送人
				loop.setElementVariable(String.format("copyUserId_%s", randomStr));
				loop.setCompletionCondition("${nrOfCompletedInstances/nrOfInstances==1}");
				userTask.setLoopCharacteristics(loop);
				//抄送
				final ActivitiListener activitiListener = new ActivitiListener();
				activitiListener.setEvent("create");
				activitiListener.setImplementationType("class");
				activitiListener.setImplementation("cn.morimatsu.phegda.config.activitiListener.MakeCopyUserTask");
				userTask.setTaskListeners(Collections.singletonList(activitiListener));
				process.addFlowElement(userTask);
				sequenceFlow = new SequenceFlow();
				sequenceFlow.setId(String.format("flow_%s", RandomStringUtils.randomAlphabetic(10)));
				sequenceFlow.setSourceRef(userTask.getId());
				sequenceFlow.setTargetRef(this.recursionToBpmnModel(childNode.getChildNode(), process, paramMap, nodeId, paramValueMap, keys));
				if (childNode.getChildNode() == null || ObjectUtils.isEmpty(childNode.getChildNode().getType()))
					childNode.setChildNode(null);
				process.addFlowElement(sequenceFlow);
				return userTask.getId();
			//路由
			case 4:
				ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
				exclusiveGateway.setId(String.format("exclusiveGateway_%s", RandomStringUtils.randomAlphabetic(10)));
				childNode.setNodeId(exclusiveGateway.getId());
				childNode.setConditionBoo(Boolean.TRUE);
				process.addFlowElement(exclusiveGateway);
				if (ObjectUtils.isEmpty(childNode.getConditionNodes())) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_BRANCH_NOT_SET_CONDITION, childNode.getNodeName()));
				String nodeKey = this.recursionToBpmnModel(childNode.getChildNode(), process, paramMap, nodeId, paramValueMap, keys);
				if (childNode.getChildNode() == null || ObjectUtils.isEmpty(childNode.getChildNode().getType()))
					childNode.setChildNode(null);
				final long count = childNode.getConditionNodes().stream()
						.filter(item -> Objects.equals(item.getType(), 5))
						.count();
				if (count > 1) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_BRANCH_DEFAULT_CONDITION_EXCEED_ONE));

				final Boolean[] bol = new Boolean[]{false};
				final SequenceFlow[] flows = new SequenceFlow[1];
				childNode.getConditionNodes()
						//分支数据
						.forEach(item -> {
					//条件节点类型 为 3 or 5
					if (!Arrays.asList(3, 5).contains(item.getType())) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_BRANCH_CONDITION_NODE_ERROR));
					//非默认条件 判断分支
					if (Objects.equals(item.getType(), 3) && ObjectUtils.isEmpty(item.getConditionList())) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_BRANCH_NOT_SET_CONDITION, item.getNodeName()));
					if (Objects.equals(item.getType(), 3)) {
						if (ObjectUtils.isEmpty(item.getConditionList())) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_BRANCH_NOT_SET_CONDITION, item.getNodeName()));
						long c = item.getConditionList().stream().filter(i -> StringUtils.isBlank(i.getFieldKey())).count();
						if (c > 0) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_BRANCH_NOT_SET_CONDITION, item.getNodeName()));
						c = item.getConditionList().stream().filter(i -> {
							switch (i.getFieldDataType()) {
								case 12: //12:下拉多选
								case 15: //15:设备分类
									if (ObjectUtils.isEmpty(i.getList())) return Boolean.TRUE;
									else return Boolean.FALSE;
								case 1: //1:下拉;
								case 3: //3:单选;
								case 5: //5:选择部门;
								case 6: //6:选择人员;
								case 8: //8,级联
								case 9: //9:选择供应商
								case 14: //14:数字
								case 999: //999,额外挂载部门
									if (ObjectUtils.isEmpty(i.getText())) return Boolean.TRUE;
									else return Boolean.FALSE;
								case 4: //4:时间;
								case 7: //7 文本;
								case 10: //10:地址
								case 11: //11:下拉单选
								case 13: //13:起止日期
								case 16: //16:员工选择
								case 17: //17:部门选择
								case 18: //18:周期
									if (StringUtils.isBlank(i.getTextName())) return Boolean.TRUE;
									else return Boolean.FALSE;
								case 2: //区间
									if (ObjectUtils.isEmpty(i.getMin()) || ObjectUtils.isEmpty(i.getMax())) return Boolean.TRUE;
									else return Boolean.FALSE;
								default: throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_UNKNOWN_COMPUTE_SYMBOL));
							}
						}).count();
						if (c > 0) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_BRANCH_NOT_SET_CONDITION, item.getNodeName()));
					}

					SequenceFlow flow = new SequenceFlow();
					Boolean symbol = false;
					//顺序 第一条true后 不判断其他分支
					if (Objects.equals(item.getType(), 3)) {
						final List<ConditionVo> list = new ArrayList<>(item.getConditionList());
						//倒叙 因为前台是按照顺序传入 计算也要 顺序计算 迭代器是倒叙计算的。 所以需要倒叙
						Collections.reverse(list);
						//非默认条件分支 做判断处理
						symbol = getSymbol(0, list, paramValueMap, keys);
					}
					flow.setId(String.format("flow_%s", RandomStringUtils.randomAlphabetic(10)));
					//分支条件结果 true 保存对应的节点id
					//顺序 第一条true后 不判断其他分支
					item.setNodeId(flow.getId());
					if (symbol && !bol[0]) {
						//是否存在true的条件
						bol[0] = symbol;
						item.setConditionBoo(Boolean.TRUE);
						flow.setConditionExpression(String.format("${%s}", symbol));
					} else {
						item.setConditionBoo(Boolean.FALSE);
						flow.setConditionExpression("${false}");
					}
					if (Objects.equals(item.getType(), 5)) item.setNodeId(flow.getId());

					flow.setSourceRef(exclusiveGateway.getId());
					flow.setTargetRef(this.recursionToBpmnModel(item.getChildNode(), process, paramMap, nodeKey, paramValueMap, keys));
					if (item.getChildNode() == null || ObjectUtils.isEmpty(item.getChildNode().getType()))
						item.setChildNode(null);
					//排除默认线
					if (Objects.equals(item.getType(), 5)) {
						flows[0] = flow;
					} else {
						//条件分支有true时 移除 默认分支的nodeId
						childNode.getConditionNodes().stream()
								.filter(i -> Objects.equals(i.getType(), 5))
								.forEach(i -> i.setConditionBoo(Boolean.FALSE));
						process.addFlowElement(flow);
					}
				});
				//条件中 没有true条件 讲默认置为true条件
				if (flows[0] == null) throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_BRANCH_CONDITION_NOT_DEFAULT));
				if (bol[0] == null || !bol[0]) {
					flows[0].setConditionExpression("${true}");
					//将默认的条件boo 改为true
					childNode.getConditionNodes()
							.stream().filter(item -> Objects.equals(item.getType(), 5))
							.forEach(item -> item.setConditionBoo(Boolean.TRUE));
				} else {
					//将默认条件对应的 nodeId 置空
					childNode.getConditionNodes()
							.stream().filter(item -> Objects.equals(item.getType(), 5))
							.forEach(item -> item.setConditionBoo(Boolean.FALSE));
				}
				//连默认线
				process.addFlowElement(flows[0]);
				return exclusiveGateway.getId();
			default:
				throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_UNKNOWN_LABEL_TYPE));
		}
	}

@Override
	public Boolean getSymbol(Integer i, List<ConditionVo> conditionVo, Map<String, Object> paramValueMap, Set<String> keys) {
		if (paramValueMap == null) {
			//验证流程时写入参数
			keys.addAll(conditionVo.stream().map(ConditionVo::getFieldKey).collect(Collectors.toSet()));
			return Boolean.TRUE;
		}
		boolean b;
		//未传参数 条件当 false 处理
		if (paramValueMap.containsKey(conditionVo.get(i).getFieldKey())) {
			switch (conditionVo.get(i).getFieldDataType()) {
				case 12: //12:下拉多选
				case 15: //15:设备分类
					final List<String> list = conditionVo.get(i).getList().stream()
							.filter(ObjectUtils::isNotEmpty)
							.map(Object::toString).collect(Collectors.toList());
					final List<String> list1 = JSONArray.parseArray(paramValueMap.get(conditionVo.get(i).getFieldKey()).toString(), String.class);
					//无提交数据 false
					if (ObjectUtils.isEmpty(list1)) {
						b = false;
						break;
					}
					list1.removeAll(list);
					//条件全包含提交内容 差集为空 不为空则非全包含
					b = ObjectUtils.isEmpty(list1);
					break;
				case 1: //1:下拉;
				case 3: //3:单选;
				case 5: //5:选择部门;
				case 6: //6:选择人员;
				case 8: //8,级联
				case 9: //9:选择供应商
				case 999: //999,额外挂载部门
					String value = String.valueOf(paramValueMap.get(conditionVo.get(i).getFieldKey()));
					if (StringUtils.isNotBlank(value)) {
						b = Objects.equals(value, String.valueOf(conditionVo.get(i).getText()));
					} else b = false;
					break;
				case 14: //14:数字
					value = String.valueOf(paramValueMap.get(conditionVo.get(i).getFieldKey()));
					if (StringUtils.isNotBlank(value)) {
						b = new BigDecimal(value)
								.compareTo(new BigDecimal(String.valueOf(conditionVo.get(i).getText()))) == 0;
					} else b = false;
					break;
				case 4: //4:时间;
				case 7: //7 文本;
				case 11: //11:下拉单选
				case 13: //13:起止日期
				case 18: //18:周期
					value = String.valueOf(paramValueMap.get(conditionVo.get(i).getFieldKey()));
					if (StringUtils.isNotBlank(value)) {
						b = Objects.equals(value, conditionVo.get(i).getTextName());
					} else b = false;
					break;
				case 16: //16:员工选择
					Map<String, String> hashMap = JSONObject.<HashMap<String, String>>parseObject(
							conditionVo.get(i).getTextName(), HashMap.class);
					value = String.valueOf(hashMap.get("managerId"));
					if (!paramValueMap.containsKey(conditionVo.get(i).getFieldKey())) {
						b = false;
						break;
					}
					Map<String, String> hashMap1 = JSONObject.<HashMap<String, String>>parseObject(
							String.valueOf(paramValueMap.get(conditionVo.get(i).getFieldKey())), HashMap.class);
					String value1 = String.valueOf(hashMap1.get("managerId"));
					b = Objects.equals(value, value1);
					break;
				case 17: //17:部门选择
					hashMap = JSONObject.<HashMap<String, String>>parseObject(
							conditionVo.get(i).getTextName(), HashMap.class);
					value = String.valueOf(hashMap.get("userDepartmentId"));
					if (!paramValueMap.containsKey(conditionVo.get(i).getFieldKey())
							|| ObjectUtils.isEmpty(paramValueMap.get(conditionVo.get(i).getFieldKey()))) {
						b = false;
						break;
					}
					hashMap1 = JSONObject.<HashMap<String, String>>parseObject(
							String.valueOf(paramValueMap.get(conditionVo.get(i).getFieldKey())), HashMap.class);
					value1 = String.valueOf(hashMap1.get("userDepartmentId"));
					b = Objects.equals(value, value1);
					break;
				case 10: //10:地址
					hashMap = JSONObject.<HashMap<String, String>>parseObject(
							conditionVo.get(i).getTextName(), HashMap.class);
					List<String> city = JSONArray.parseArray(String.valueOf(hashMap.get("city")), String.class);
					if (!paramValueMap.containsKey(conditionVo.get(i).getFieldKey())
							|| ObjectUtils.isEmpty(paramValueMap.get(conditionVo.get(i).getFieldKey()))) {
						b = false;
						break;
					}
					hashMap1 = JSONObject.<HashMap<String, String>>parseObject(
							String.valueOf(paramValueMap.get(conditionVo.get(i).getFieldKey())), HashMap.class);
					List<String> city1 = JSONArray.parseArray(JSONObject.toJSONString(hashMap1.get("city")), String.class);
					if (ObjectUtils.isEmpty(city1)) {
						b = false;
						break;
					}
					city.removeAll(city1);
					b = city.size() == 0;
					break;
				case 2: //区间
					final BigDecimal decimal = new BigDecimal(paramValueMap.get(conditionVo.get(i).getFieldKey()).toString());
					final BigDecimal min = new BigDecimal(conditionVo.get(i).getMin());
					final BigDecimal max = new BigDecimal(conditionVo.get(i).getMax());
					// 原型 数值 min <= decimal <= max
					b = min.compareTo(decimal) <= 0 && max.compareTo(decimal) >= 0;
					break;
				default: throw new BusinessException(MessageUtils.message(MessagesConstants.ACT_ORDER_UNKNOWN_COMPUTE_SYMBOL));
			}
		} else {
			b = false;
		}

		//最后一条 跳出
		if (i >= conditionVo.size() - 1) {
			return b;
		} else {
			if (conditionVo.get(i).getConnectors() == null || Objects.equals(conditionVo.get(i).getConnectors(), 1)) {
				i++;
				return b || getSymbol(i, conditionVo, paramValueMap, keys);
			} else {
				i++;
				return b && getSymbol(i, conditionVo, paramValueMap, keys);
			}
		}
	}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值