use of com.sohu.cache.web.enums.SuccessEnum in project cachecloud by sohutv.
the class AppController method doCleanAppData.
/**
* 清理应用数据
*/
@RequestMapping(value = "/cleanAppData")
public ModelAndView doCleanAppData(HttpServletRequest request, HttpServletResponse response, Model model, long appId) {
AppUser appUser = getUserInfo(request);
logger.warn("{} start to clean appId={} data!", appUser.getName(), appId);
SuccessEnum successEnum = SuccessEnum.FAIL;
if (appId > 0) {
//验证用户对应用的权限 以及数据清理的结果
if (checkAppUserProvilege(request, appId) && appDeployCenter.cleanAppData(appId, getUserInfo(request))) {
successEnum = SuccessEnum.SUCCESS;
}
}
logger.warn("{} end to clean appId={} data, result is {}", appUser.getName(), appId, successEnum.info());
write(response, String.valueOf(successEnum.value()));
return null;
}
use of com.sohu.cache.web.enums.SuccessEnum in project cachecloud by sohutv.
the class AppController method doChangeAppAlertConfig.
/**
* 修改应用报警配置
*/
@RequestMapping(value = "/changeAppAlertConfig")
public ModelAndView doChangeAppAlertConfig(HttpServletRequest request, HttpServletResponse response, Model model) {
long appId = NumberUtils.toLong(request.getParameter("appId"), -1);
int memAlertValue = NumberUtils.toInt(request.getParameter("memAlertValue"), -1);
int clientConnAlertValue = NumberUtils.toInt(request.getParameter("clientConnAlertValue"), -1);
SuccessEnum result = appService.changeAppAlertConfig(appId, memAlertValue, clientConnAlertValue, getUserInfo(request));
write(response, String.valueOf(result.value()));
return null;
}
use of com.sohu.cache.web.enums.SuccessEnum in project cachecloud by sohutv.
the class InstanceAlertValueController method remove.
/**
* 删除配置
*/
@RequestMapping(value = "/remove")
public ModelAndView remove(HttpServletRequest request, HttpServletResponse response, Model model) {
AppUser appUser = getUserInfo(request);
String configKey = request.getParameter("configKey");
if (StringUtils.isBlank(configKey)) {
model.addAttribute("status", SuccessEnum.FAIL.value());
model.addAttribute("message", ErrorMessageEnum.PARAM_ERROR_MSG.getMessage() + "configKey=" + configKey);
return new ModelAndView("");
}
logger.warn("user {} want to delete configKey {}", appUser.getName(), configKey);
SuccessEnum successEnum;
try {
instanceAlertValueService.remove(configKey);
successEnum = SuccessEnum.SUCCESS;
} catch (Exception e) {
successEnum = SuccessEnum.FAIL;
model.addAttribute("message", ErrorMessageEnum.INNER_ERROR_MSG.getMessage());
logger.error(e.getMessage(), e);
}
logger.warn("user {} want to delete configKey {} , result is {}", appUser.getName(), configKey, successEnum.info());
model.addAttribute("status", successEnum.value());
return new ModelAndView("");
}
use of com.sohu.cache.web.enums.SuccessEnum in project cachecloud by sohutv.
the class RedisConfigTemplateController method remove.
/**
* 删除配置
*/
@RequestMapping(value = "/remove")
public ModelAndView remove(HttpServletRequest request, HttpServletResponse response, Model model) {
AppUser appUser = getUserInfo(request);
String idParam = request.getParameter("id");
long id = NumberUtils.toLong(idParam);
if (id <= 0) {
model.addAttribute("status", SuccessEnum.FAIL.value());
model.addAttribute("message", ErrorMessageEnum.PARAM_ERROR_MSG.getMessage() + "id=" + idParam);
return new ModelAndView("");
}
logger.warn("user {} want to delete id={}'s config", appUser.getName(), id);
SuccessEnum successEnum;
InstanceConfig instanceConfig = redisConfigTemplateService.getById(id);
try {
redisConfigTemplateService.remove(id);
successEnum = SuccessEnum.SUCCESS;
} catch (Exception e) {
successEnum = SuccessEnum.FAIL;
model.addAttribute("message", ErrorMessageEnum.INNER_ERROR_MSG.getMessage());
logger.error(e.getMessage(), e);
}
logger.warn("user {} want to delete id={}'s config, result is {}", appUser.getName(), id, successEnum.value());
//发送邮件通知
appEmailUtil.sendRedisConfigTemplateChangeEmail(appUser, instanceConfig, successEnum, RedisConfigTemplateChangeEnum.DELETE);
model.addAttribute("status", successEnum.value());
return new ModelAndView("");
}
use of com.sohu.cache.web.enums.SuccessEnum in project cachecloud by sohutv.
the class UserController method doAddUser.
/**
* 注册用户申请
*/
@RequestMapping(value = "/apply")
public ModelAndView doAddUser(HttpServletRequest request, HttpServletResponse response, Model model, String name, String chName, String email, String mobile, Integer type, Long userId) {
SuccessEnum success = SuccessEnum.SUCCESS;
try {
//保存用户(type=-1为无效用户,需要审批)
AppUser appUser = AppUser.buildFrom(userId, name, chName, email, mobile, type);
userService.save(appUser);
//提交审批
AppAudit appAudit = appService.saveRegisterUserApply(appUser, AppAuditType.REGISTER_USER_APPLY);
appEmailUtil.noticeUserResult(appUser, appAudit);
} catch (Exception e) {
success = SuccessEnum.FAIL;
logger.error(e.getMessage(), e);
}
return new ModelAndView("redirect:/user/register?success=" + success.value());
}
Aggregations