Search in sources :

Example 56 with SysUser

use of com.ruoyi.common.core.domain.entity.SysUser in project RuoYi-Flowable-Plus by KonBAI-Q.

the class SysProfileController method profile.

/**
 * 个人信息
 */
@ApiOperation("个人信息")
@GetMapping
public R<Map<String, Object>> profile() {
    SysUser user = userService.selectUserById(getUserId());
    Map<String, Object> ajax = new HashMap<>();
    ajax.put("user", user);
    ajax.put("roleGroup", userService.selectUserRoleGroup(user.getUserName()));
    ajax.put("postGroup", userService.selectUserPostGroup(user.getUserName()));
    return R.ok(ajax);
}
Also used : SysUser(com.ruoyi.common.core.domain.entity.SysUser) HashMap(java.util.HashMap) ApiOperation(io.swagger.annotations.ApiOperation)

Example 57 with SysUser

use of com.ruoyi.common.core.domain.entity.SysUser in project RuoYi-Flowable-Plus by KonBAI-Q.

the class SysUserController method export.

@ApiOperation("导出用户列表")
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:user:export")
@PostMapping("/export")
public void export(SysUser user, HttpServletResponse response) {
    List<SysUser> list = userService.selectUserList(user);
    List<SysUserExportVo> listVo = BeanUtil.copyToList(list, SysUserExportVo.class);
    for (int i = 0; i < list.size(); i++) {
        SysDept dept = list.get(i).getDept();
        SysUserExportVo vo = listVo.get(i);
        if (ObjectUtil.isNotEmpty(dept)) {
            vo.setDeptName(dept.getDeptName());
            vo.setLeader(dept.getLeader());
        }
    }
    ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response);
}
Also used : SysUser(com.ruoyi.common.core.domain.entity.SysUser) SysDept(com.ruoyi.common.core.domain.entity.SysDept) SysUserExportVo(com.ruoyi.system.domain.vo.SysUserExportVo) Log(com.ruoyi.common.annotation.Log) SaCheckPermission(cn.dev33.satoken.annotation.SaCheckPermission)

Example 58 with SysUser

use of com.ruoyi.common.core.domain.entity.SysUser in project RuoYi-Flowable-Plus by KonBAI-Q.

the class SysLoginController method getInfo.

/**
 * 获取用户信息
 *
 * @return 用户信息
 */
@ApiOperation("获取用户信息")
@GetMapping("getInfo")
public R<Map<String, Object>> getInfo() {
    SysUser user = userService.selectUserById(LoginHelper.getUserId());
    // 角色集合
    Set<String> roles = permissionService.getRolePermission(user);
    // 权限集合
    Set<String> permissions = permissionService.getMenuPermission(user);
    Map<String, Object> ajax = new HashMap<>();
    ajax.put("user", user);
    ajax.put("roles", roles);
    ajax.put("permissions", permissions);
    return R.ok(ajax);
}
Also used : SysUser(com.ruoyi.common.core.domain.entity.SysUser) HashMap(java.util.HashMap) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 59 with SysUser

use of com.ruoyi.common.core.domain.entity.SysUser in project RuoYi-Flowable-Plus by KonBAI-Q.

the class WfTaskServiceImpl method finishedList.

/**
 * 已办任务列表
 *
 * @return
 */
@Override
public TableDataInfo<WfTaskVo> finishedList(PageQuery pageQuery) {
    Page<WfTaskVo> page = new Page<>();
    Long userId = LoginHelper.getUserId();
    HistoricTaskInstanceQuery taskInstanceQuery = historyService.createHistoricTaskInstanceQuery().includeProcessVariables().finished().taskAssignee(userId.toString()).orderByHistoricTaskInstanceEndTime().desc();
    int offset = pageQuery.getPageSize() * (pageQuery.getPageNum() - 1);
    List<HistoricTaskInstance> historicTaskInstanceList = taskInstanceQuery.listPage(offset, pageQuery.getPageSize());
    List<WfTaskVo> hisTaskList = Lists.newArrayList();
    for (HistoricTaskInstance histTask : historicTaskInstanceList) {
        WfTaskVo flowTask = new WfTaskVo();
        // 当前流程信息
        flowTask.setTaskId(histTask.getId());
        // 审批人员信息
        flowTask.setCreateTime(histTask.getCreateTime());
        flowTask.setFinishTime(histTask.getEndTime());
        flowTask.setDuration(getDate(histTask.getDurationInMillis()));
        flowTask.setProcDefId(histTask.getProcessDefinitionId());
        flowTask.setTaskDefKey(histTask.getTaskDefinitionKey());
        flowTask.setTaskName(histTask.getName());
        // 流程定义信息
        ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(histTask.getProcessDefinitionId()).singleResult();
        flowTask.setDeployId(pd.getDeploymentId());
        flowTask.setProcDefName(pd.getName());
        flowTask.setProcDefVersion(pd.getVersion());
        flowTask.setProcInsId(histTask.getProcessInstanceId());
        flowTask.setHisProcInsId(histTask.getProcessInstanceId());
        // 流程发起人信息
        HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(histTask.getProcessInstanceId()).singleResult();
        SysUser startUser = sysUserService.selectUserById(Long.parseLong(historicProcessInstance.getStartUserId()));
        flowTask.setStartUserId(startUser.getNickName());
        flowTask.setStartUserName(startUser.getNickName());
        flowTask.setStartDeptName(startUser.getDept().getDeptName());
        hisTaskList.add(flowTask);
    }
    page.setTotal(taskInstanceQuery.count());
    page.setRecords(hisTaskList);
    // result.put("finished",true);
    return TableDataInfo.build(page);
}
Also used : HistoricTaskInstance(org.flowable.task.api.history.HistoricTaskInstance) SysUser(com.ruoyi.common.core.domain.entity.SysUser) HistoricProcessInstance(org.flowable.engine.history.HistoricProcessInstance) WfTaskVo(com.ruoyi.workflow.domain.vo.WfTaskVo) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) ProcessDefinition(org.flowable.engine.repository.ProcessDefinition) HistoricTaskInstanceQuery(org.flowable.task.api.history.HistoricTaskInstanceQuery)

Example 60 with SysUser

use of com.ruoyi.common.core.domain.entity.SysUser in project RuoYi-Flowable-Plus by KonBAI-Q.

the class SysLoginService method recordLoginInfo.

/**
 * 记录登录信息
 *
 * @param userId 用户ID
 */
public void recordLoginInfo(Long userId, String username) {
    SysUser sysUser = new SysUser();
    sysUser.setUserId(userId);
    sysUser.setLoginIp(ServletUtils.getClientIP());
    sysUser.setLoginDate(DateUtils.getNowDate());
    sysUser.setUpdateBy(username);
    userService.updateUserProfile(sysUser);
}
Also used : SysUser(com.ruoyi.common.core.domain.entity.SysUser)

Aggregations

SysUser (com.ruoyi.common.core.domain.entity.SysUser)78 Log (com.ruoyi.common.annotation.Log)16 SysRole (com.ruoyi.common.core.domain.entity.SysRole)13 LoginUser (com.ruoyi.common.core.domain.model.LoginUser)13 GetMapping (org.springframework.web.bind.annotation.GetMapping)11 AjaxResult (com.ruoyi.common.core.domain.AjaxResult)10 ServiceException (com.ruoyi.common.exception.ServiceException)10 SaCheckPermission (cn.dev33.satoken.annotation.SaCheckPermission)8 ExcelUtil (com.ruoyi.common.utils.poi.ExcelUtil)8 Transactional (org.springframework.transaction.annotation.Transactional)8 UserConstants (com.ruoyi.common.constant.UserConstants)7 BaseController (com.ruoyi.common.core.controller.BaseController)7 TableDataInfo (com.ruoyi.common.core.page.TableDataInfo)7 BusinessType (com.ruoyi.common.enums.BusinessType)7 StringUtils (com.ruoyi.common.utils.StringUtils)7 ISysPostService (com.ruoyi.system.service.ISysPostService)7 ISysRoleService (com.ruoyi.system.service.ISysRoleService)7 ISysUserService (com.ruoyi.system.service.ISysUserService)7 List (java.util.List)7 Collectors (java.util.stream.Collectors)7