Search in sources :

Example 11 with SystemLog

use of com.cdeledu.core.annotation.SystemLog in project wechat by dllwh.

the class ScheduledController method resume.

@ResponseBody
@RequestMapping("resume")
@SystemLog(desc = "恢复定时任务", opType = SysOpType.UPDATE, tableName = "sys_schedule_job")
public AjaxJson resume(@RequestBody Long[] jobIds) {
    AjaxJson ajaxJson = new AjaxJson();
    scheduleJobService.resume(jobIds);
    return ajaxJson;
}
Also used : AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with SystemLog

use of com.cdeledu.core.annotation.SystemLog 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;
}
Also used : AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 13 with SystemLog

use of com.cdeledu.core.annotation.SystemLog 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;
}
Also used : AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 14 with SystemLog

use of com.cdeledu.core.annotation.SystemLog 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;
}
Also used : SysRole(com.cdeledu.model.rbac.SysRole) AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 15 with SystemLog

use of com.cdeledu.core.annotation.SystemLog 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;
}
Also used : SysRole(com.cdeledu.model.rbac.SysRole) AjaxJson(com.cdeledu.common.base.AjaxJson) SystemLog(com.cdeledu.core.annotation.SystemLog) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SystemLog (com.cdeledu.core.annotation.SystemLog)26 AjaxJson (com.cdeledu.common.base.AjaxJson)25 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)25 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)25 SysUser (com.cdeledu.model.rbac.SysUser)7 SysRole (com.cdeledu.model.rbac.SysRole)4 SysMenu (com.cdeledu.model.rbac.SysMenu)3 SysUserRole (com.cdeledu.model.rbac.SysUserRole)1 SysLogEntity (com.cdeledu.model.system.SysLogEntity)1 Method (java.lang.reflect.Method)1 JoinPoint (org.aspectj.lang.JoinPoint)1 MethodSignature (org.aspectj.lang.reflect.MethodSignature)1