class ConfigManageController extends BaseController {

    @Resource(name = "configService")
    private ConfigService configService;
    
    @Resource(name = "appEmailUtil")
    private AppEmailUtil appEmailUtil;

    /**
     * 初始化配置
     * 
     * @param request
     * @param response
     * @param model
     * @return
     */
    @RequestMapping(value = "/init")
    public ModelAndView init(HttpServletRequest request, HttpServletResponse response, Model model) {
        List<SystemConfig> configList = configService.getConfigList(1);
        model.addAttribute("configList", configList);
        model.addAttribute("success", request.getParameter("success"));
        model.addAttribute("configActive", SuccessEnum.SUCCESS.value());
        return new ModelAndView("manage/config/init");
    }

    /**
     * 修改配置
     * 
     * @param request
     * @param response
     * @param model
     * @return
     */
    @RequestMapping(value = "/update")
    public ModelAndView update(HttpServletRequest request, HttpServletResponse response, Model model) {<FILL_FUNCTION_BODY>}

    private Map<String, String> getDifConfigMap(List<SystemConfig> oldConfigList, Map<String, String> configMap) {
        Map<String, String> systemDifConfigMap = new HashMap<String, String>();
        for (SystemConfig systemConfig : oldConfigList) {
            String key = systemConfig.getConfigKey();
            String oldValue = systemConfig.getConfigValue();
            String newValue = configMap.get(key);
            if (newValue != null && !oldValue.equals(newValue)) {
                systemDifConfigMap.put(systemConfig.getInfo(), String.format("old value: %s, new value: %s", oldValue, newValue));
            }
        }
        return systemDifConfigMap;
    }

}

        AppUser appUser = getUserInfo(request);
        logger.warn("user {} want to change config!", appUser.getName());
        List<SystemConfig> oldConfigList = configService.getConfigList(1);
        SuccessEnum successEnum;
        Map<String, String> configMap = new HashMap<String, String>();
        try {
            Map<String, String[]> paramMap = request.getParameterMap();
            for (Entry<String, String[]> entry : paramMap.entrySet()) {
                String key = entry.getKey();
                String value = entry.getValue()[0];
                if (StringUtils.isNotBlank(key)) {
                    configMap.put(key, value);
                }
            }
            if (MapUtils.isEmpty(configMap)) {
                logger.error("params {} may be empty!!", paramMap);
            }
            successEnum = configService.updateConfig(configMap);
            if (successEnum.equals(SuccessEnum.SUCCESS)) {
                configService.reloadSystemConfig();
            }
        } catch (Exception e) {
            successEnum = SuccessEnum.FAIL;
            logger.error(e.getMessage(), e);
        }
        Map<String, String> systemDifConfigMap = getDifConfigMap(oldConfigList, configMap);
        appEmailUtil.sendSystemConfigDifEmail(appUser, systemDifConfigMap, successEnum);
        logger.warn("user {} change config result is {}!", appUser.getName(), successEnum.value());
        return new ModelAndView("redirect:/manage/config/init?success=" + successEnum.value());
    
<methods>public non-sealed void <init>() ,public boolean clearTempResource(java.lang.String) ,public java.lang.String getTempResource(java.lang.String) ,public com.sohu.cache.entity.AppUser getUserInfo(javax.servlet.http.HttpServletRequest) ,public java.lang.String markdown2html(java.lang.String, java.lang.String) throws java.lang.Exception,public byte[] read(java.io.InputStream) throws java.io.IOException,public java.lang.Boolean saveTempResource(java.lang.String, java.lang.String) ,public void sendMessage(javax.servlet.http.HttpServletResponse, java.lang.String) <variables>protected com.sohu.cache.dao.AppAuditDao appAuditDao,protected com.sohu.cache.dao.AppAuditLogDao appAuditLogDao,protected com.sohu.cache.stats.app.AppDeployCenter appDeployCenter,protected com.sohu.cache.web.util.AppEmailUtil appEmailUtil,protected com.sohu.cache.dao.AppImportDao appImportDao,protected com.sohu.cache.web.service.AppService appService,protected com.sohu.cache.stats.app.AppStatsCenter appStatsCenter,com.sohu.cache.redis.AssistRedisService assistRedisService,protected com.sohu.cache.async.AsyncService asyncService,protected com.sohu.cache.dao.InstanceDao instanceDao,protected com.sohu.cache.stats.instance.InstanceDeployCenter instanceDeployCenter,protected final org.slf4j.Logger logger,protected com.sohu.cache.machine.MachineCenter machineCenter,protected com.sohu.cache.redis.RedisCenter redisCenter,protected com.sohu.cache.redis.RedisConfigTemplateService redisConfigTemplateService,protected com.sohu.cache.redis.RedisDeployCenter redisDeployCenter,protected com.sohu.cache.web.service.ResourceService resourceService,protected com.sohu.cache.web.service.UserLoginStatusService userLoginStatusService,protected com.sohu.cache.web.service.UserService userService