修改xispeak流程模块,配置文件,配置类以及流程表达式,适配前端选择sdw领导用于后续的审批
This commit is contained in:
@@ -41,5 +41,6 @@ public class XiSpeakConfig {
|
|||||||
private String temImplWorkerKey;
|
private String temImplWorkerKey;
|
||||||
private String temImplLeaderKey;
|
private String temImplLeaderKey;
|
||||||
private String temBgLeaderKey;
|
private String temBgLeaderKey;
|
||||||
|
private String sdwLeaderListKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+60
-2
@@ -61,8 +61,8 @@ public class XiSpeakFlow {
|
|||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSDWLeaderLength() {
|
public int getSDWLeaderLength(Object jsonData) {
|
||||||
return this.getSDWLeader().size();
|
return this.getSdwLeaderList(jsonData).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
//流程表达式内用法 ${xiSpeakFlow.getBgDeptLdUserIdListLength()}
|
//流程表达式内用法 ${xiSpeakFlow.getBgDeptLdUserIdListLength()}
|
||||||
@@ -108,6 +108,53 @@ public class XiSpeakFlow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> getListCodeValueFromData(Object jsonData, String codeName, String logLabel) {
|
||||||
|
// 1. 基础校验:如果入参为空或配置的 Key 为空,直接返回空列表
|
||||||
|
if (jsonData == null || org.apache.commons.lang.StringUtils.isBlank(codeName)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject data;
|
||||||
|
// 2. 统一转换为 JSONObject
|
||||||
|
if (jsonData instanceof JSONObject) {
|
||||||
|
data = (JSONObject) jsonData;
|
||||||
|
} else if (jsonData instanceof String) {
|
||||||
|
String jsonStr = (String) jsonData;
|
||||||
|
if (org.apache.commons.lang.StringUtils.isBlank(jsonStr)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
data = JSONObject.parseObject(jsonStr);
|
||||||
|
} else {
|
||||||
|
// 处理普通 POJO 对象
|
||||||
|
data = JSONObject.parseObject(JSONObject.toJSONString(jsonData));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 提取目标字段的字符串值
|
||||||
|
String rawValue = data.getString(codeName);
|
||||||
|
|
||||||
|
// 4. 转换逗号分隔的字符串为 List
|
||||||
|
List<String> resultList;
|
||||||
|
if (org.apache.commons.lang.StringUtils.isBlank(rawValue)) {
|
||||||
|
resultList = Collections.emptyList();
|
||||||
|
} else {
|
||||||
|
// 使用逗号分割,并过滤掉每个元素前后的空格
|
||||||
|
resultList = Arrays.stream(rawValue.split(","))
|
||||||
|
.map(String::trim)
|
||||||
|
.filter(org.apache.commons.lang.StringUtils::isNotBlank) // 过滤掉因连续逗号产生的空元素
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("{} 业务解析结果: {}", logLabel, resultList);
|
||||||
|
return resultList;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("JSON解析失败: 业务={}, codeKey={}, 数据={}", logLabel, codeName, jsonData, e);
|
||||||
|
// 异常情况下返回空列表,确保调用方不崩溃
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// --- 调用处 ---
|
// --- 调用处 ---
|
||||||
|
|
||||||
//流程表达式内用法${xiSpeakFlow.getNeedSdwApproval(jsonData)}
|
//流程表达式内用法${xiSpeakFlow.getNeedSdwApproval(jsonData)}
|
||||||
@@ -122,6 +169,17 @@ public class XiSpeakFlow {
|
|||||||
return getCodeValueFromData(jsonData, codeName, "立即反馈");
|
return getCodeValueFromData(jsonData, codeName, "立即反馈");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//流程表达式内用法${xiSpeakFlow.getSdwLeaderList(json_data)}
|
||||||
|
public List<String> getSdwLeaderList(Object jsonData) {
|
||||||
|
String codeName = xiSpeakConfig.getXiSpeak().getSdwLeaderListKey();
|
||||||
|
return getListCodeValueFromData(jsonData, codeName, "立即反馈");
|
||||||
|
}
|
||||||
|
|
||||||
|
//流程表达式内用法${xiSpeakFlow.getSdwLeaderListLength(json_data)}
|
||||||
|
public int getSdwLeaderListLength(Object jsonData) {
|
||||||
|
return this.getSdwLeaderList(jsonData).size();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程表达式内用法: ${xiSpeakFlow.getTemImplWorkerList(execution)}
|
* 流程表达式内用法: ${xiSpeakFlow.getTemImplWorkerList(execution)}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ flow-biz:
|
|||||||
tem-impl-worker-key: "tem_impl_worker"
|
tem-impl-worker-key: "tem_impl_worker"
|
||||||
tem-impl-leader-key: "tem_impl_leader"
|
tem-impl-leader-key: "tem_impl_leader"
|
||||||
tem-bg-leader-key: "tem_bg_leader"
|
tem-bg-leader-key: "tem_bg_leader"
|
||||||
|
sdw-leader-list-key: "sdwLeaderList"
|
||||||
xi-speak-fb:
|
xi-speak-fb:
|
||||||
dept-id: "x"
|
dept-id: "x"
|
||||||
business-id: "business_id"
|
business-id: "business_id"
|
||||||
|
|||||||
Reference in New Issue
Block a user