class ParameterUtils {

    public static String curingGlobalParams(Map<String, String> globalParamMap, List<Property> globalParamList,
                                            CommandType commandType, Date scheduleTime) {

        if (globalParamList == null || globalParamList.isEmpty()) {
            return null;
        }

        Map<String, String> globalMap = new HashMap<>();
        if (globalParamMap != null) {
            globalMap.putAll(globalParamMap);
        }
        Map<String, String> allParamMap = new HashMap<>();
        //If it is a complement, a complement time needs to be passed in, according to the task type
        Map<String, String> timeParams = BusinessTimeUtils
                .getBusinessTime(commandType, scheduleTime);

        if (timeParams != null) {
            allParamMap.putAll(timeParams);
        }

        allParamMap.putAll(globalMap);

        Set<Map.Entry<String, String>> entries = allParamMap.entrySet();

        Map<String, String> resolveMap = new HashMap<>();
        for (Map.Entry<String, String> entry : entries) {
            String val = entry.getValue();
            if (val.startsWith("$")) {
                String str = ParameterUtils.convertParameterPlaceholders(val, allParamMap);
                resolveMap.put(entry.getKey(), str);
            }
        }
        globalMap.putAll(resolveMap);

        for (Property property : globalParamList) {
            String val = globalMap.get(property.getProp());
            if (val != null) {
                property.setValue(val);
            }
        }
        return JSONUtils.toJsonString(globalParamList);
    }

    private  ParameterUtils();

}