|
@@ -132,25 +132,26 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
Matcher matcher=P2.matcher(fd.getFormula().getFormula());
|
|
|
while (matcher.find()){
|
|
|
String[] arr = matcher.group().split(StringPool.COLON);
|
|
|
- List<WbsTreeContract> targets=this.wbsTreeContractService.list(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId,info.getId()).eq(WbsTreeContract::getId,Long.parseLong(arr[0])));
|
|
|
- /*暂时先只取第一个满足条件的*/
|
|
|
- if(Func.isNotEmpty(targets)){
|
|
|
- WbsTreeContract cross = targets.get(0);
|
|
|
- Map<String,Object> dataMap= this.env.crossDataMap.computeIfAbsent(cross.getPKeyId(),(k)->this.jdbcTemplate.queryForMap("select * from " + arr[1] + " where p_key_id=" + k));
|
|
|
- if(dataMap.size()>0){
|
|
|
- String v= StringUtils.handleNull(dataMap.get(arr[2]));
|
|
|
- if(StringUtils.isNotEmpty(v)){
|
|
|
- crossNodeFd.add(new FormData(matcher.group(), Arrays.stream(v.split("☆")).map(s->{
|
|
|
- String[] t = s.split("_\\^_");
|
|
|
- String[] c =t[1].split("_");
|
|
|
- return new ElementData(0,0,t[0],Func.toInt(c[1]),Func.toInt(c[0]));
|
|
|
- }).collect(Collectors.toList()), null,StringPool.EMPTY));
|
|
|
- }else{
|
|
|
- crossNodeFd.add(new FormData(matcher.group(),new ArrayList<>(),null,StringPool.EMPTY));
|
|
|
+ if(arr.length>=3){
|
|
|
+ List<WbsTreeContract> targets=this.wbsTreeContractService.list(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getContractId,info.getId()).eq(WbsTreeContract::getId,Long.parseLong(arr[0])));
|
|
|
+ /*暂时先只取第一个满足条件的*/
|
|
|
+ if(Func.isNotEmpty(targets)){
|
|
|
+ WbsTreeContract cross = targets.get(0);
|
|
|
+ Map<String,Object> dataMap= this.env.crossDataMap.computeIfAbsent(cross.getPKeyId(),(k)->this.jdbcTemplate.queryForMap("select * from " + arr[1] + " where p_key_id=" + k));
|
|
|
+ if(dataMap.size()>0){
|
|
|
+ String v= StringUtils.handleNull(dataMap.get(arr[2]));
|
|
|
+ if(StringUtils.isNotEmpty(v)){
|
|
|
+ crossNodeFd.add(new FormData(matcher.group(), Arrays.stream(v.split("☆")).map(s->{
|
|
|
+ String[] t = s.split("_\\^_");
|
|
|
+ String[] c =t[1].split("_");
|
|
|
+ return new ElementData(0,0,t[0],Func.toInt(c[1]),Func.toInt(c[0]));
|
|
|
+ }).collect(Collectors.toList()), null,StringPool.EMPTY));
|
|
|
+ }else{
|
|
|
+ crossNodeFd.add(new FormData(matcher.group(),new ArrayList<>(),null,StringPool.EMPTY));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -254,8 +255,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
List<WbsTreeContract> tableList= (List<WbsTreeContract>) this.env.getConstantMap().get(TABLE_LIST);
|
|
|
Optional<WbsTreeContract> wop=tableList.stream().filter(e->e.getTableType()==1||e.getTableType()==4).findAny();
|
|
|
if(wop.isPresent()){
|
|
|
- this.jdbcTemplate.queryForList("select *" +
|
|
|
- " from m_wbs_form_element");
|
|
|
+ this.jdbcTemplate.queryForList("select c.e_name name ,c.init_table_name tableName,c.e_key ekey from m_wbs_tree_contract a INNER JOIN m_wbs_tree b on (a.id=b.id or a.old_id=b.id) INNER join m_wbs_form_element c on b.init_table_id=c.f_id where a.id={} \n");
|
|
|
}
|
|
|
}
|
|
|
fd.getFormula().setFormula(tmp);
|
|
@@ -387,12 +387,12 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
|
|
|
|
|
|
@Override
|
|
|
public List<KeyMapper> getKeyMapperList(List<Long> ids) {
|
|
|
- List<Map<String,Object>> listMap = this.jdbcTemplate.queryForList("select b.init_table_name as tableName,c.p_key_id as pkId ,a.e_key as field,a.id as fieldId,d.scope,d.formula_id as formulaId " +
|
|
|
- "from m_wbs_form_element a " +
|
|
|
- "INNER JOIN m_wbs_tree b on a.f_id=b.init_table_id " +
|
|
|
- "INNER JOIN m_wbs_tree_contract c on (c.old_id=b.id or c.id=b.id) " +
|
|
|
- "INNER JOIN m_element_formula_mapping d on a.id=d.element_id " +
|
|
|
- "where c.p_key_id in("+ids.stream().map(String::valueOf).collect(Collectors.joining(","))+") " +
|
|
|
+ List<Map<String,Object>> listMap = this.jdbcTemplate.queryForList("select b.init_table_name as tableName,a.p_key_id as pkId ,c.e_key as field,a.id as fieldId,d.scope,d.formula_id as formulaId " +
|
|
|
+ "from m_wbs_tree_contract a " +
|
|
|
+ "INNER JOIN m_wbs_tree b on (a.old_id=b.id or a.id=b.id) " +
|
|
|
+ "INNER JOIN m_wbs_form_element c on c.f_id=b.init_table_id " +
|
|
|
+ "INNER JOIN m_element_formula_mapping d on c.id=d.element_id " +
|
|
|
+ "where a.p_key_id in("+ids.stream().map(String::valueOf).collect(Collectors.joining(","))+") " +
|
|
|
"ORDER BY b.init_table_name,d.scope");
|
|
|
if(Func.isNotEmpty(listMap)){
|
|
|
Map<Long,List<KeyMapper>> groupList= listMap.stream().map(m->BeanUtil.toBean(m, KeyMapper.class)).collect(Collectors.groupingBy(KeyMapper::getFormulaId,LinkedHashMap::new,Collectors.toList()));
|