|
@@ -22,6 +22,7 @@ import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.manager.bean.TableInfo;
|
|
|
import org.springblade.manager.dto.*;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
+import org.springblade.manager.enums.ExecuteType;
|
|
|
import org.springblade.manager.formula.*;
|
|
|
import org.springblade.manager.formula.impl.CompositeDataAccess;
|
|
|
import org.springblade.manager.formula.impl.Measurement;
|
|
@@ -1142,8 +1143,18 @@ public List<ElementData> setScale(Integer scale,List<ElementData> data){
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<KeyMapper> getKeyMapperList(List<Long> ids,String projectId,String nodeId) {
|
|
|
+ public List<KeyMapper> getKeyMapperList(List<Long> ids, String projectId, String nodeId, ExecuteType executeType) {
|
|
|
/*表名,pkeyId,元素名,元素id 映射对象*/
|
|
|
+ if(executeType.equals(ExecuteType.INSPECTION)){
|
|
|
+ return listForContract(ids,projectId,nodeId);
|
|
|
+ }else if(executeType.equals(ExecuteType.TESTING)){
|
|
|
+ return listForPrivate(ids,projectId,nodeId);
|
|
|
+ }
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<KeyMapper> listForContract(List<Long> ids,String projectId,String nodeId){
|
|
|
String pkIds=ids.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
List<Map<String,Object>> listMap = this.jdbcTemplate.queryForList(" select a.init_table_name as tableName,a.p_key_id as pkId ,c.e_key as field,c.e_name as eName,c.id as fieldId ,c.e_type eType , e_allow_deviation as eAllowDeviation " +
|
|
|
"from m_wbs_tree_contract a " +
|
|
@@ -1196,15 +1207,15 @@ public List<ElementData> setScale(Integer scale,List<ElementData> data){
|
|
|
}
|
|
|
}
|
|
|
if(Func.isNotEmpty(total)){
|
|
|
- List<ElementFormulaMapping> mappingList = this.elementFormulaMappingService.list(Wrappers.<ElementFormulaMapping>lambdaQuery().in(ElementFormulaMapping::getParamId,total.stream().map(WbsParam::getId).collect(Collectors.toList())));
|
|
|
- if(Func.isNotEmpty(mappingList)){
|
|
|
- list.forEach(e->{
|
|
|
- mappingList.stream().filter(m->StringUtils.isEquals(m.getElementId(),e.getFieldId())).findAny().ifPresent(d->{
|
|
|
- e.setFormulaId(d.getFormulaId());
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
+ List<ElementFormulaMapping> mappingList = this.elementFormulaMappingService.list(Wrappers.<ElementFormulaMapping>lambdaQuery().in(ElementFormulaMapping::getParamId,total.stream().map(WbsParam::getId).collect(Collectors.toList())));
|
|
|
+ if(Func.isNotEmpty(mappingList)){
|
|
|
+ list.forEach(e->{
|
|
|
+ mappingList.stream().filter(m->StringUtils.isEquals(m.getElementId(),e.getFieldId())).findAny().ifPresent(d->{
|
|
|
+ e.setFormulaId(d.getFormulaId());
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1215,6 +1226,21 @@ public List<ElementData> setScale(Integer scale,List<ElementData> data){
|
|
|
return Collections.emptyList();
|
|
|
}
|
|
|
|
|
|
+ private List<KeyMapper> listForPrivate(List<Long> ids,String projectId,String nodeId){
|
|
|
+ /**/
|
|
|
+ String pkIds=ids.stream().map(String::valueOf).collect(Collectors.joining(","));
|
|
|
+ List<Map<String,Object>> listMap = this.jdbcTemplate.queryForList(" select a.init_table_name as tableName,a.p_key_id as pkId ,c.e_key as field,c.e_name as eName,c.id as fieldId ,c.e_type eType , e_allow_deviation as eAllowDeviation " +
|
|
|
+ "from m_wbs_tree_private a " +
|
|
|
+ "inner join m_table_info b on a.init_table_name=b.tab_en_name " +
|
|
|
+ "INNER JOIN m_wbs_form_element c on b.id=c.f_id " +
|
|
|
+ "where a.p_key_id in("+pkIds+") ORDER BY field(a.p_key_id,"+pkIds+")");
|
|
|
+ if(Func.isNotEmpty(listMap)){
|
|
|
+
|
|
|
+ }
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<Formula> getFormulaList(List<KeyMapper> keyMapperList) {
|
|
|
if(Func.isNotEmpty(keyMapperList)){
|