Browse Source

add esc

pull/2/head
baoliang 5 years ago
parent
commit
07e6095c77
  1. 17
      escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java

17
escheduler-dao/src/main/java/cn/escheduler/dao/ProcessDao.java

@ -20,6 +20,7 @@ import cn.escheduler.common.Constants;
import cn.escheduler.common.enums.*; import cn.escheduler.common.enums.*;
import cn.escheduler.common.model.DateInterval; import cn.escheduler.common.model.DateInterval;
import cn.escheduler.common.model.TaskNode; import cn.escheduler.common.model.TaskNode;
import cn.escheduler.common.process.Property;
import cn.escheduler.common.queue.ITaskQueue; import cn.escheduler.common.queue.ITaskQueue;
import cn.escheduler.common.queue.TaskQueueFactory; import cn.escheduler.common.queue.TaskQueueFactory;
import cn.escheduler.common.task.subprocess.SubProcessParameters; import cn.escheduler.common.task.subprocess.SubProcessParameters;
@ -43,6 +44,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import static cn.escheduler.common.Constants.*; import static cn.escheduler.common.Constants.*;
import static cn.escheduler.dao.datasource.ConnectionFactory.getMapper; import static cn.escheduler.dao.datasource.ConnectionFactory.getMapper;
@ -737,17 +739,16 @@ public class ProcessDao extends AbstractBaseDao {
* @return * @return
*/ */
private String joinGlobalParams(String parentGlobalParams, String subGlobalParams){ private String joinGlobalParams(String parentGlobalParams, String subGlobalParams){
Map<String, String> parentMap = JSONUtils.toMap(parentGlobalParams); List<Property> parentPropertyList = JSONUtils.toList(parentGlobalParams, Property.class);
Map<String, String> subMap = JSONUtils.toMap(subGlobalParams); List<Property> subPropertyList = JSONUtils.toList(subGlobalParams, Property.class);
Map<String,String> subMap = subPropertyList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue));
Set<String> parentKeySet = parentMap.keySet(); for(Property parent : parentPropertyList){
for(String parentKey : parentKeySet){ if(!subMap.containsKey(parent.getProp())){
if(subMap.containsKey(parentKey)){ subPropertyList.add(parent);
continue;
} }
subMap.put( parentKey, parentMap.get(parentKey));
} }
return JSONUtils.toJson(subMap); return JSONUtils.toJson(subPropertyList);
} }
/** /**

Loading…
Cancel
Save