|
@@ -3163,19 +3163,27 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
List<Map<String, Object>> formulas = null;
|
|
|
if (wbsTreePrivate != null) {
|
|
|
if (wbsTreePrivate.getInitTableId() != null) {
|
|
|
- formulas = jdbcTemplate.queryForList("SELECT a.e_name,b.rely FROM m_wbs_form_element a, m_formula b WHERE b.id in ( SELECT formula_id FROM m_element_formula_mapping WHERE scope = 0 AND element_id = a.id) and a.f_id = " +
|
|
|
+ formulas = jdbcTemplate.queryForList("SELECT a.e_name, b.rely, c.scope from m_wbs_form_element a , m_formula b, m_element_formula_mapping c WHERE b.id = c.formula_id and c.element_id = a.id and a.f_id = " +
|
|
|
wbsTreePrivate.getInitTableId() + " and b.rely like '%TBInfo:%'");
|
|
|
- }
|
|
|
- if (wbsTreePrivate.getInitTableName() != null) {
|
|
|
+ } else if (wbsTreePrivate.getInitTableName() != null) {
|
|
|
List<org.springblade.manager.entity.TableInfo> tableInfos = tableInfoService.list(Wrappers.<org.springblade.manager.entity.TableInfo>lambdaQuery().eq(org.springblade.manager.entity.TableInfo::getTabEnName, wbsTreePrivate.getInitTableName()));
|
|
|
if (!tableInfos.isEmpty()) {
|
|
|
- formulas = jdbcTemplate.queryForList("SELECT a.e_name,b.rely FROM m_wbs_form_element a, m_formula b WHERE b.id in ( SELECT formula_id FROM m_element_formula_mapping WHERE scope = 0 AND element_id = a.id) and a.f_id = " +
|
|
|
+ formulas = jdbcTemplate.queryForList("SELECT a.e_name, b.rely, c.scope from m_wbs_form_element a , m_formula b, m_element_formula_mapping c WHERE b.id = c.formula_id and c.element_id = a.id and a.f_id = " +
|
|
|
tableInfos.get(0).getId() + " and b.rely like '%TBInfo:%'");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (!ObjectUtil.isEmpty(formulas)) {
|
|
|
- for (Map<String, Object> formula : formulas) {
|
|
|
+ Map<Object, Map<String, Object>> collect = formulas.stream().peek(formula -> formula.putIfAbsent("scope", -1)).filter(formula -> formula.get("rely") != null && formula.get("e_name") != null)
|
|
|
+ .collect(toMap(k -> k.get("e_name"), v -> v, (v1, v2) -> {
|
|
|
+ Object o1 = v1.get("scope");
|
|
|
+ Object o2 = v2.get("scope");
|
|
|
+ if (o1 instanceof Integer && o2 instanceof Integer) {
|
|
|
+ return (Integer) o1 > (Integer) o2 ? v1 : v2;
|
|
|
+ }
|
|
|
+ return o1 instanceof Integer ? v1 : o2 instanceof Integer ? v2 : v1;
|
|
|
+ }));
|
|
|
+ for (Map<String, Object> formula : collect.values()) {
|
|
|
Object relyObj = formula.get("rely");
|
|
|
if (relyObj == null) {
|
|
|
continue;
|
|
@@ -3192,7 +3200,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
if (!rely.contains("TBInfo:")) {
|
|
|
continue;
|
|
|
}
|
|
|
- keyMap.put(rely, map.toString());
|
|
|
+ keyMap.put(map.toString(), rely);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -5243,7 +5251,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
|
|
|
TrialBaseInfo baseInfo = buildTrialBaseInfo(sampleInfo, entrustInfo, record, baseInfoDTO);
|
|
|
Map<String, String> keyMap = formulaTrialData(wbsTreePrivate);
|
|
|
keyMap.forEach((key, value) -> {
|
|
|
- setFirstData(doc,value,baseInfo.getValueByKey(key),reData,isCancelList);
|
|
|
+ setFirstData(doc,key,baseInfo.getValueByKey(value),reData,isCancelList);
|
|
|
});
|
|
|
if (record != null && record.getStandardId() != null && record.getStandardInfoIds() != null) {
|
|
|
String[] split = record.getStandardInfoIds().split(",");
|