¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dncFlow; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.google.common.collect.Lists; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.flowable.apithird.entity.SysCategory; |
| | | import org.jeecg.modules.flowable.apithird.entity.SysRole; |
| | | import org.jeecg.modules.flowable.apithird.entity.SysUser; |
| | | import org.jeecg.modules.flowable.apithird.service.IFlowThirdService; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.jeecg.modules.system.service.impl.SysRoleServiceImpl; |
| | | import org.jeecg.modules.system.service.impl.SysUserServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * flowable模åå¿
éå®ç°ç±» |
| | | *@author PanMeiCheng |
| | | *@date 2021/11/22 |
| | | *@version 1.0 |
| | | */ |
| | | @Service |
| | | public class FlowThirdServiceImpl implements IFlowThirdService { |
| | | @Autowired |
| | | ISysBaseAPI sysBaseAPI; |
| | | @Autowired |
| | | SysUserServiceImpl sysUserService; |
| | | @Autowired |
| | | SysRoleServiceImpl sysRoleService; |
| | | @Autowired |
| | | ISysDictService sysDictService; |
| | | @Override |
| | | public SysUser getLoginUser() { |
| | | LoginUser sysUser = null; |
| | | SysUser copyProperties = null; |
| | | try { |
| | | sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | |
| | | |
| | | System.out.println( ); |
| | | copyProperties = BeanUtil.copyProperties(sysUser, SysUser.class); |
| | | } catch (Exception e) { |
| | | //e.printStackTrace(); |
| | | } |
| | | return copyProperties; |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUser> getAllUser() { |
| | | List<org.jeecg.modules.system.entity.SysUser> list = sysUserService.list(); |
| | | List<SysUser> userList = list.stream().map(o -> BeanUtil.copyProperties(o, SysUser.class)).collect(Collectors.toList()); |
| | | return userList; |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUser> getUsersByRoleId(String roleId) { |
| | | Page<org.jeecg.modules.system.entity.SysUser> page = new Page<>(1,Integer.MAX_VALUE); |
| | | IPage<org.jeecg.modules.system.entity.SysUser> userByRoleId = sysUserService.getUserByRoleId(page, roleId, null); |
| | | List<org.jeecg.modules.system.entity.SysUser> records = userByRoleId.getRecords(); |
| | | List<SysUser> userList = records.stream().map(o -> BeanUtil.copyProperties(o, SysUser.class)).collect(Collectors.toList()); |
| | | return userList; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public SysUser getUserByUsername(String username) { |
| | | LoginUser userByName = sysBaseAPI.getUserByName(username); |
| | | return userByName==null?null:BeanUtil.copyProperties(userByName, SysUser.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysRole> getAllRole() { |
| | | List<org.jeecg.modules.system.entity.SysRole> list = sysRoleService.list(); |
| | | List<SysRole> roleList = list.stream().map(o -> BeanUtil.copyProperties(o, SysRole.class)).collect(Collectors.toList()); |
| | | return roleList; |
| | | } |
| | | @Override |
| | | public List<SysCategory> getAllCategory() { |
| | | List<DictModel> list = sysDictService.getDictItems("flow_type"); |
| | | List<SysCategory> categoryList = Lists.newArrayList(); |
| | | if (list == null || list.isEmpty()) { |
| | | return null; |
| | | }else { |
| | | list.forEach(o -> { |
| | | SysCategory sysCategory = new SysCategory(); |
| | | sysCategory.setId(o.getValue()); |
| | | sysCategory.setName(o.getText()); |
| | | categoryList.add(sysCategory); |
| | | }); |
| | | } |
| | | return categoryList; |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getDepartNamesByUsername(String username) { |
| | | List<String> departNamesByUsername = sysBaseAPI.getDepartNamesByUsername(username); |
| | | return departNamesByUsername; |
| | | } |
| | | } |