Search in sources :

Example 11 with AjaxResult

use of com.ruoyi.common.core.domain.AjaxResult in project wumei-smart by kerwincui.

the class CacheController method getInfo.

@PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@GetMapping()
public AjaxResult getInfo() throws Exception {
    Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
    Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
    Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
    Map<String, Object> result = new HashMap<>(3);
    result.put("info", info);
    result.put("dbSize", dbSize);
    List<Map<String, String>> pieList = new ArrayList<>();
    commandStats.stringPropertyNames().forEach(key -> {
        Map<String, String> data = new HashMap<>(2);
        String property = commandStats.getProperty(key);
        data.put("name", StringUtils.removeStart(key, "cmdstat_"));
        data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
        pieList.add(data);
    });
    result.put("commandStats", pieList);
    return AjaxResult.success(result);
}
Also used : Properties(java.util.Properties) RedisCallback(org.springframework.data.redis.core.RedisCallback) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Autowired(org.springframework.beans.factory.annotation.Autowired) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) HashMap(java.util.HashMap) RestController(org.springframework.web.bind.annotation.RestController) AjaxResult(com.ruoyi.common.core.domain.AjaxResult) ArrayList(java.util.ArrayList) List(java.util.List) StringUtils(com.ruoyi.common.utils.StringUtils) Map(java.util.Map) RedisTemplate(org.springframework.data.redis.core.RedisTemplate) GetMapping(org.springframework.web.bind.annotation.GetMapping) HashMap(java.util.HashMap) RedisCallback(org.springframework.data.redis.core.RedisCallback) ArrayList(java.util.ArrayList) Properties(java.util.Properties) HashMap(java.util.HashMap) Map(java.util.Map) GetMapping(org.springframework.web.bind.annotation.GetMapping) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 12 with AjaxResult

use of com.ruoyi.common.core.domain.AjaxResult in project wumei-smart by kerwincui.

the class SysDeptController method roleDeptTreeselect.

/**
 * 加载对应角色部门列表树
 */
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
    List<SysDept> depts = deptService.selectDeptList(new SysDept());
    AjaxResult ajax = AjaxResult.success();
    ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
    ajax.put("depts", deptService.buildDeptTreeSelect(depts));
    return ajax;
}
Also used : AjaxResult(com.ruoyi.common.core.domain.AjaxResult) SysDept(com.ruoyi.common.core.domain.entity.SysDept) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 13 with AjaxResult

use of com.ruoyi.common.core.domain.AjaxResult in project wumei-smart by kerwincui.

the class SocialLoginServiceImpl method socialLogin.

@Override
public AjaxResult socialLogin(String loginId) {
    AjaxResult ajax = AjaxResult.success();
    String loginKey = LOGIN_SOCIAL_REDIS_KEY + loginId;
    LoginIdValue loginIdValue = redisCache.getCacheObject(loginKey);
    if (loginIdValue != null) {
        // login
        String token = sysLoginService.redirectLogin(loginIdValue.getUsername(), loginIdValue.getPassword());
        ajax.put(Constants.TOKEN, token);
    } else {
        log.info("loginId:{} ", loginId);
        return error(NO_MESSAGE_ALERT, "数据错误");
    }
    return ajax;
}
Also used : AjaxResult(com.ruoyi.common.core.domain.AjaxResult) LoginIdValue(com.ruoyi.iot.model.login.LoginIdValue)

Example 14 with AjaxResult

use of com.ruoyi.common.core.domain.AjaxResult in project RuoYi-Vue by yangzongzhuan.

the class SysMenuController method roleMenuTreeselect.

/**
 * 加载对应角色菜单列表树
 */
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
    List<SysMenu> menus = menuService.selectMenuList(getUserId());
    AjaxResult ajax = AjaxResult.success();
    ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
    ajax.put("menus", menuService.buildMenuTreeSelect(menus));
    return ajax;
}
Also used : AjaxResult(com.ruoyi.common.core.domain.AjaxResult) SysMenu(com.ruoyi.common.core.domain.entity.SysMenu) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 15 with AjaxResult

use of com.ruoyi.common.core.domain.AjaxResult in project RuoYi-Vue by yangzongzhuan.

the class SysProfileController method profile.

/**
 * 个人信息
 */
@GetMapping
public AjaxResult profile() {
    LoginUser loginUser = getLoginUser();
    SysUser user = loginUser.getUser();
    AjaxResult ajax = AjaxResult.success(user);
    ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
    ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
    return ajax;
}
Also used : AjaxResult(com.ruoyi.common.core.domain.AjaxResult) SysUser(com.ruoyi.common.core.domain.entity.SysUser) LoginUser(com.ruoyi.common.core.domain.model.LoginUser) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

AjaxResult (com.ruoyi.common.core.domain.AjaxResult)55 GetMapping (org.springframework.web.bind.annotation.GetMapping)25 PostMapping (org.springframework.web.bind.annotation.PostMapping)16 SysUser (com.ruoyi.common.core.domain.entity.SysUser)12 LoginUser (com.ruoyi.common.core.domain.model.LoginUser)10 Log (com.ruoyi.common.annotation.Log)8 StringUtils (com.ruoyi.common.utils.StringUtils)7 List (java.util.List)7 Autowired (org.springframework.beans.factory.annotation.Autowired)7 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)7 RestController (org.springframework.web.bind.annotation.RestController)7 MultipartFile (org.springframework.web.multipart.MultipartFile)7 SysUser (com.ruoyi.system.domain.SysUser)6 UserConstants (com.ruoyi.common.constant.UserConstants)5 BaseController (com.ruoyi.common.core.controller.BaseController)5 SysRole (com.ruoyi.common.core.domain.entity.SysRole)5 TableDataInfo (com.ruoyi.common.core.page.TableDataInfo)5 BusinessType (com.ruoyi.common.enums.BusinessType)5 SecurityUtils (com.ruoyi.common.utils.SecurityUtils)5