use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class ScheduledController method create.
@ResponseBody
@RequestMapping("create")
@SystemLog(desc = "创建定时任务", opType = SysOpType.INSERT, tableName = "sys_schedule_job")
public AjaxJson create(@RequestBody ScheduleJob scheduleJob) {
AjaxJson ajaxJson = new AjaxJson();
scheduleJobService.save(scheduleJob);
return ajaxJson;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class ScheduledController method pause.
@ResponseBody
@RequestMapping("pause")
@SystemLog(desc = "暂停定时任务", opType = SysOpType.UPDATE, tableName = "sys_schedule_job")
public AjaxJson pause(@RequestBody Long[] jobIds) {
AjaxJson ajaxJson = new AjaxJson();
scheduleJobService.pause(jobIds);
return ajaxJson;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class GlobalExceptionHandler method defaultExceptionHandler.
/**
* @ExceptionHandler(value = Exception.class)
* public void defaultExceptionHandler(HttpServletRequest request, Exception e){
* if (logger.isDebugEnabled()) {
* logger.error(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), e);
* }
* }
*/
@ResponseBody
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ExceptionHandler(Exception.class)
public AjaxJson defaultExceptionHandler(final Exception e) {
AjaxJson result = new AjaxJson();
if (logger.isDebugEnabled()) {
logger.error(HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase(), e);
}
result.setSuccess(false);
result.setMsg(e.getMessage());
result.setResultCode(500);
return result;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class RoleOperateController method roleVisibleButton.
@ResponseBody
@RequestMapping("roleVisibleButton")
@SystemLog(desc = "启用、禁用账户", opType = SysOpType.UPDATE, tableName = "sys_role_menu")
public AjaxJson roleVisibleButton(@RequestParam(name = "id", required = true, defaultValue = "") int id, @RequestParam(name = "visible", required = true, defaultValue = "1") int visible) {
AjaxJson resultMsg = new AjaxJson();
SysRole role = new SysRole();
role.setId(id);
role.setIfVisible(visible);
try {
if (!roleService.hasMenuByRole(id) && !roleService.hasUserByRole(id) && id != 1) {
roleService.update(role);
resultMsg.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
} else {
resultMsg.setSuccess(false);
resultMsg.setMsg("错误提示:该角色下尚有用户未解除!");
}
} catch (Exception e) {
resultMsg.setSuccess(false);
resultMsg.setMsg(MessageConstant.MSG_OPERATION_FAILED);
}
return resultMsg;
}
use of com.cdeledu.common.base.AjaxJson in project wechat by dllwh.
the class RoleOperateController method delRole.
/**
* @方法描述: 删除角色,根据ID,但是删除角色的时候,需要查询是否有赋予给用户,如果有用户在使用,那么就不能删除
* @param role
* @return
*/
@ResponseBody
@RequestMapping(value = "delRole")
@SystemLog(desc = "角色删除", opType = SysOpType.DEL, tableName = "sys_role")
public AjaxJson delRole(@RequestParam(name = "delId", required = true, defaultValue = "-1") int roleId) {
AjaxJson resultMsg = new AjaxJson();
try {
if (roleId != 1) {
SysRole seacherRole = roleService.getRoleById(roleId);
if (seacherRole != null && seacherRole.getAllowDelete() == 1) {
// 角色允许删除
if (roleService.hasMenuByRole(roleId)) {
resultMsg.setSuccess(false);
resultMsg.setResultCode(201);
resultMsg.setMsg("该角色已经含有权限,无法直接删除!");
} else {
if (roleService.hasUserByRole(roleId)) {
resultMsg.setSuccess(false);
resultMsg.setResultCode(201);
resultMsg.setMsg("该角色已被使用,无法直接删除!");
} else {
roleService.delete(roleId);
resultMsg.setSuccess(true);
resultMsg.setResultCode(200);
resultMsg.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
}
}
} else {
resultMsg.setSuccess(false);
resultMsg.setResultCode(201);
resultMsg.setMsg("该角色不允许删除");
}
} else {
resultMsg.setSuccess(false);
resultMsg.setResultCode(201);
resultMsg.setMsg("无法删除超级管理员");
}
} catch (Exception e) {
resultMsg.setSuccess(false);
resultMsg.setResultCode(500);
resultMsg.setMsg(MessageConstant.MSG_OPERATION_FAILED);
}
return resultMsg;
}
Aggregations