Search in sources :

Example 21 with SystemLog

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

the class LoginController method resetPwd.

@ResponseBody
@RequestMapping(value = "resetPwd")
@SystemLog(desc = "重置密码", opType = SysOpType.UPDATE, tableName = "sys_user")
public AjaxJson resetPwd(String oldPassWord, String newPassWord) {
    AjaxJson result = new AjaxJson();
    SysUser currenLoginUser = ShiroHelper.getPrincipal();
    // 判断用户是否为空,不为空,则清空session中的用户object
    if (currenLoginUser != null) {
        if (StringUtils.isNoneBlank(oldPassWord) && StringUtils.isNoneBlank(newPassWord)) {
            String password = PasswordUtil.encrypt(currenLoginUser.getUserName(), oldPassWord.trim());
            if (currenLoginUser.getPassword().equalsIgnoreCase(password)) {
                SysUser sysUser = new SysUser();
                sysUser.setId(currenLoginUser.getId());
                sysUser.setPassword(PasswordUtil.encrypt(currenLoginUser.getUserName(), newPassWord.trim()));
                try {
                    userService.update(sysUser);
                    result.setSuccess(true);
                    result.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
                } catch (Exception e) {
                    e.printStackTrace();
                    result.setSuccess(false);
                    result.setMsg(MessageConstant.MSG_OPERATION_FAILED);
                }
            } else {
                result.setSuccess(false);
                result.setMsg("错误提示:请输入正确的原密码");
            }
        } else {
            result.setSuccess(false);
            result.setMsg("错误提示:旧密码或新密码不能为空");
        }
    } else {
        result.setSuccess(false);
        result.setMsg("当前用户尚未登录,请重新登录");
    }
    return result;
}
Also used : SysUser(com.cdeledu.model.rbac.SysUser) 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 22 with SystemLog

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

the class MenuOperateController method createMenu.

/**
 * ----------------------------------------------------- Fields end
 */
@ResponseBody
@RequestMapping(value = "createMenu", method = RequestMethod.POST)
@SystemLog(desc = "创建权限菜单", opType = SysOpType.INSERT, tableName = "sys_menu")
public AjaxJson createMenu(ModelMap map, SysMenu menu) {
    AjaxJson ajaxJson = new AjaxJson();
    int resultCount = -1;
    try {
        if (menu.getType() == SysMenuType.BUTTON.getValue()) {
            SysMenu parentmMenu = new SysMenu();
            parentmMenu.setId(menu.getParentCode());
            if (sysMenuService.findOneForJdbc(parentmMenu).getType() == SysMenuType.MENU.getValue()) {
                resultCount = sysMenuService.insert(menu);
            } else {
                ajaxJson.setSuccess(false);
                ajaxJson.setMsg("禁止为菜单目录创建按钮权限");
            }
        } else {
            resultCount = sysMenuService.insert(menu);
        }
        if (resultCount == 1) {
            // 分配给超级管理员
            try {
                roleService.saveRoleAccess(1, menu.getId());
            } catch (Exception e) {
            }
        }
    } catch (Exception e) {
        ajaxJson.setSuccess(false);
        ajaxJson.setMsg(MessageConstant.MSG_OPERATION_SUCCESS);
    }
    return ajaxJson;
}
Also used : SysMenu(com.cdeledu.model.rbac.SysMenu) 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 23 with SystemLog

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

the class MenuOperateController method delDisable.

@ResponseBody
@RequestMapping(value = "updateMenu", params = "delDisable")
@SystemLog(desc = "禁止删除菜单", opType = SysOpType.UPDATE, tableName = "sys_menu")
public AjaxJson delDisable(SysMenu sysMenu) {
    AjaxJson ajaxJson = new AjaxJson();
    ajaxJson.setMsg(MessageConstant.SUCCESS_ENABLE_FALSE);
    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 24 with SystemLog

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

the class MenuOperateController method saveMenu.

@ResponseBody
@RequestMapping(value = "saveMenu")
@SystemLog(desc = "更新权限菜单", opType = SysOpType.INSERT, tableName = "sys_menu")
public AjaxJson saveMenu(SysMenu sysMenu) {
    AjaxJson ajaxJson = new AjaxJson();
    try {
        SysMenu menu = sysMenuService.findOneById(sysMenu.getId());
        if (menu != null && menu.getAllowEdit() == 1) {
            if (menu.getType() == sysMenu.getType()) {
                sysMenuService.update(sysMenu);
                ajaxJson.setMsg(MessageConstant.SUCCESS_UPDATE_MESSAGE);
            } else {
                if (!sysMenuService.hasChildren(sysMenu.getId())) {
                    sysMenuService.update(sysMenu);
                    ajaxJson.setMsg(MessageConstant.SUCCESS_UPDATE_MESSAGE);
                } else {
                    ajaxJson.setSuccess(false);
                    ajaxJson.setMsg(MessageConstant.MSG_HAS_CHILD);
                }
            }
        } else {
            ajaxJson.setSuccess(false);
            ajaxJson.setMsg("不支持更新操作");
        }
    } catch (Exception e) {
        ajaxJson.setMsg(MessageConstant.FAILURE_UPDATE_MESSAGE);
        ajaxJson.setSuccess(false);
    }
    return ajaxJson;
}
Also used : SysMenu(com.cdeledu.model.rbac.SysMenu) 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 25 with SystemLog

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

the class MenuOperateController method editDisable.

@ResponseBody
@RequestMapping(value = "updateMenu", params = "editDisable")
@SystemLog(desc = "禁止编辑菜单", opType = SysOpType.UPDATE, tableName = "sys_menu")
public AjaxJson editDisable(SysMenu sysMenu) {
    AjaxJson ajaxJson = new AjaxJson();
    ajaxJson.setMsg(MessageConstant.SUCCESS_ENABLE_FALSE);
    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)

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