### Question:
ParamUtils { public static Map<String,Property> convert(Map<String,Property> globalParams, Map<String,String> globalParamsMap, Map<String,Property> localParams, CommandType commandType, Date scheduleTime){ if (globalParams == null && localParams == null){ return null; } Map<String,String> timeParams = BusinessTimeUtils .getBusinessTime(commandType, scheduleTime); if (globalParamsMap != null){ timeParams.putAll(globalParamsMap); } if (globalParams != null && localParams != null){ globalParams.putAll(localParams); }else if (globalParams == null && localParams != null){ globalParams = localParams; } Iterator<Map.Entry<String, Property>> iter = globalParams.entrySet().iterator(); while (iter.hasNext()){ Map.Entry<String, Property> en = iter.next(); Property property = en.getValue(); if (StringUtils.isNotEmpty(property.getValue()) && property.getValue().startsWith("$")){ String val = property.getValue(); val = ParameterUtils.convertParameterPlaceholders(val, timeParams); property.setValue(val); } } return globalParams; }  static Map<String,Property> convert(Map<String,Property> globalParams,
                                                           Map<String,String> globalParamsMap,
                                                           Map<String,Property> localParams,
                                                           CommandType commandType,
                                                           Date scheduleTime); static Map<String,String> convert(Map<String,Property> paramsMap); static Map<String,Property> getUserDefParamsMap(Map<String,String> definedParams);  }### Answer:
@Test public void testConvert() { String expected = "{\"global_param\":{\"prop\":\"global_param\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"20191229\"},\"local_param\":{\"prop\":\"local_param\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"20191229\"}}"; String expected1 = "{\"local_param\":{\"prop\":\"local_param\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"20191229\"}}"; Calendar calendar = Calendar.getInstance(); calendar.set(2019,11,30); Date date = calendar.getTime(); Map<String, Property> paramsMap = ParamUtils.convert(globalParams, globalParamsMap, localParams, CommandType.START_PROCESS, date); String result = JSONUtils.toJsonString(paramsMap); assertEquals(expected, result); for (Map.Entry<String, Property> entry : paramsMap.entrySet()) { String key = entry.getKey(); Property prop = entry.getValue(); logger.info(key + " : " + prop.getValue()); } Map<String, Property> paramsMap1 = ParamUtils.convert(null, globalParamsMap, localParams, CommandType.START_PROCESS, date); String result1 = JSONUtils.toJsonString(paramsMap1); assertEquals(expected1, result1); Map<String, Property> paramsMap2 = ParamUtils.convert(null, globalParamsMap, null, CommandType.START_PROCESS, date); assertNull(paramsMap2); }
@Test public void testConvert1() { String expected = "{\"global_param\":\"${system.biz.date}\"}"; Map<String, String> paramsMap = ParamUtils.convert(globalParams); String result = JSONUtils.toJsonString(paramsMap); assertEquals(expected, result); logger.info(result); Map<String, String> paramsMap1 = ParamUtils.convert(null); assertNull(paramsMap1); }