feat:多钱包、电子饭卡、饭卡充值
This commit is contained in:
1 parent
d684f1bc97
commit
0f6da3a679
40 files changed
+1781
-225
No files matched your search
+6
@@ -51,4 +51,10 @@ public class UserInfo implements Serializable {
|
||||
@Schema(description = "角色标识集合")
|
||||
private Long[] roles;
|
||||
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
@Schema(description = "角色标识集合")
|
||||
private String[] roleCodes;
|
||||
|
||||
}
|
||||
+99
-80
@@ -37,94 +37,113 @@ import java.util.List;
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UPMS_SERVICE)
|
||||
public interface RemoteUserService {
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户、角色信息
|
||||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/info/{username}")
|
||||
R<UserInfo> info(@PathVariable("username") String username);
|
||||
/**
|
||||
* 通过用户名查询用户、角色信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/info/{username}")
|
||||
R<UserInfo> info(@PathVariable("username") String username);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取用户
|
||||
* @param userIds ID
|
||||
* @return SysUser
|
||||
*/
|
||||
@GetMapping("/user/list")
|
||||
R<List<SysUser>> getUserById(@RequestParam("userIds") List<Long> userIds);
|
||||
/**
|
||||
* 通过用户id查询用户、角色信息
|
||||
*
|
||||
* @param userId 用户名
|
||||
* @return R
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/get-by-user-id")
|
||||
R<UserInfo> getByUserId(@RequestParam("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 通过社交账号或手机号查询用户、角色信息
|
||||
* @param inStr appid@code
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/social/info/{inStr}")
|
||||
R<UserInfo> social(@PathVariable("inStr") String inStr);
|
||||
/**
|
||||
* 根据用户ID获取用户
|
||||
*
|
||||
* @param userIds ID
|
||||
* @return SysUser
|
||||
*/
|
||||
@GetMapping("/user/list")
|
||||
R<List<SysUser>> getUserById(@RequestParam("userIds") List<Long> userIds);
|
||||
|
||||
/**
|
||||
* 查询上级部门的用户信息
|
||||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/user/ancestor/{username}")
|
||||
R<List<SysUser>> ancestorUsers(@PathVariable("username") String username);
|
||||
/**
|
||||
* 通过社交账号或手机号查询用户、角色信息
|
||||
*
|
||||
* @param inStr appid@code
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/social/info/{inStr}")
|
||||
R<UserInfo> social(@PathVariable("inStr") String inStr);
|
||||
|
||||
/**
|
||||
* 锁定用户
|
||||
* @param username 用户名
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@PutMapping("/user/lock/{username}")
|
||||
R<Boolean> lockUser(@PathVariable("username") String username);
|
||||
/**
|
||||
* 查询上级部门的用户信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/user/ancestor/{username}")
|
||||
R<List<SysUser>> ancestorUsers(@PathVariable("username") String username);
|
||||
|
||||
/**
|
||||
* 根据角色ID查询用户列表
|
||||
* @param roleIdList 角色ID列表
|
||||
* @return 用户ID列表
|
||||
*/
|
||||
@GetMapping("/user/getUserIdListByRoleIdList")
|
||||
R<List<Long>> getUserIdListByRoleIdList(@RequestParam("roleIdList") List<Long> roleIdList);
|
||||
/**
|
||||
* 锁定用户
|
||||
*
|
||||
* @param username 用户名
|
||||
* @return
|
||||
*/
|
||||
@NoToken
|
||||
@PutMapping("/user/lock/{username}")
|
||||
R<Boolean> lockUser(@PathVariable("username") String username);
|
||||
|
||||
/**
|
||||
* 根据部门ID列表获取用户ID列表接口
|
||||
* @param deptIdList 部门ID列表
|
||||
* @return 用户ID列表
|
||||
*/
|
||||
@GetMapping("/user/getUserIdListByDeptIdList")
|
||||
R<List<SysUser>> getUserIdListByDeptIdList(@RequestParam("deptIdList") List<Long> deptIdList);
|
||||
/**
|
||||
* 根据角色ID查询用户列表
|
||||
*
|
||||
* @param roleIdList 角色ID列表
|
||||
* @return 用户ID列表
|
||||
*/
|
||||
@GetMapping("/user/getUserIdListByRoleIdList")
|
||||
R<List<Long>> getUserIdListByRoleIdList(@RequestParam("roleIdList") List<Long> roleIdList);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户列表
|
||||
* @param userName 用户名
|
||||
* @return 用户列表
|
||||
*/
|
||||
@GetMapping("/user/getUserListByUserName")
|
||||
R<List<SysUser>> getUserListByUserName(@RequestParam("username") String userName);
|
||||
/**
|
||||
* 根据部门ID列表获取用户ID列表接口
|
||||
*
|
||||
* @param deptIdList 部门ID列表
|
||||
* @return 用户ID列表
|
||||
*/
|
||||
@GetMapping("/user/getUserIdListByDeptIdList")
|
||||
R<List<SysUser>> getUserIdListByDeptIdList(@RequestParam("deptIdList") List<Long> deptIdList);
|
||||
|
||||
/**
|
||||
* 注册用户
|
||||
* @param userDTO 用户信息
|
||||
* @return success/false
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/register/user")
|
||||
R<Boolean> registerUser(@RequestBody UserDTO userDTO);
|
||||
/**
|
||||
* 通过用户名查询用户列表
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户列表
|
||||
*/
|
||||
@GetMapping("/user/getUserListByUserName")
|
||||
R<List<SysUser>> getUserListByUserName(@RequestParam("username") String userName);
|
||||
|
||||
/**
|
||||
* 根据钉钉号和手机号查询用户信息
|
||||
* @param employeeCode 钉钉号
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/getUserByMobileOrEmployeeCode")
|
||||
R<List<SysUser>> getUserByMobileOrEmployeeCode(@RequestParam("employeeCode")String employeeCode,
|
||||
@RequestParam("mobile") String mobile);
|
||||
/**
|
||||
* 注册用户
|
||||
*
|
||||
* @param userDTO 用户信息
|
||||
* @return success/false
|
||||
*/
|
||||
@NoToken
|
||||
@PostMapping("/register/user")
|
||||
R<Boolean> registerUser(@RequestBody UserDTO userDTO);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/user/getUserByMobile")
|
||||
R<List<SysUser>> getUserByMobile(@RequestParam("mobile") String mobile);
|
||||
/**
|
||||
* 根据钉钉号和手机号查询用户信息
|
||||
*
|
||||
* @param employeeCode 钉钉号
|
||||
* @return 用户信息
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/user/getUserByMobileOrEmployeeCode")
|
||||
R<List<SysUser>> getUserByMobileOrEmployeeCode(@RequestParam("employeeCode") String employeeCode,
|
||||
@RequestParam("mobile") String mobile);
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/user/getUserByMobile")
|
||||
R<List<SysUser>> getUserByMobile(@RequestParam("mobile") String mobile);
|
||||
}
|
||||
+88
-59
@@ -3,84 +3,113 @@ package com.bsd.pjcloud.admin.api.utils;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysMenu;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@UtilityClass
|
||||
public class DataUtil {
|
||||
|
||||
/**
|
||||
* 根据当前部门id,向上查找所有的部门
|
||||
* @param deptId 当前部门id
|
||||
* @param allDeptList 所有部门列表
|
||||
* @return 返回包括自己部门在内的所有父级部门
|
||||
*/
|
||||
public List<SysDept> selectParentByDept(long deptId, List<SysDept> allDeptList) {
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
Optional<SysDept> optionalDept = allDeptList.stream().filter(w -> w.getDeptId() == deptId).findFirst();
|
||||
/**
|
||||
* 根据当前部门id,向上查找所有的部门
|
||||
*
|
||||
* @param deptId 当前部门id
|
||||
* @param allDeptList 所有部门列表
|
||||
* @return 返回包括自己部门在内的所有父级部门
|
||||
*/
|
||||
public List<SysDept> selectParentByDept(long deptId, List<SysDept> allDeptList) {
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
Optional<SysDept> optionalDept = allDeptList.stream().filter(w -> w.getDeptId() == deptId).findFirst();
|
||||
|
||||
optionalDept.ifPresent(dept -> {
|
||||
if (dept.getParentId() != null) {
|
||||
Long parentId = dept.getParentId();
|
||||
List<SysDept> depts = selectParentByDept(parentId, allDeptList);
|
||||
list.add(dept);
|
||||
list.addAll(depts);
|
||||
}
|
||||
});
|
||||
optionalDept.ifPresent(dept -> {
|
||||
if (dept.getParentId() != null) {
|
||||
Long parentId = dept.getParentId();
|
||||
List<SysDept> depts = selectParentByDept(parentId, allDeptList);
|
||||
list.add(dept);
|
||||
list.addAll(depts);
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前部门id,向下查找所有的部门
|
||||
* @param deptId 当前部门id
|
||||
* @param allDeptList 所有部门列表
|
||||
* @return 返回包括自己部门在内的所有子级部门
|
||||
*/
|
||||
public List<SysDept> selectChildrenByDept(long deptId, List<SysDept> allDeptList) {
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
Optional<SysDept> optionalDept = allDeptList.stream().filter(w -> w.getDeptId() == deptId).findFirst();
|
||||
/**
|
||||
* 根据当前部门id,向下查找所有的部门
|
||||
*
|
||||
* @param deptId 当前部门id
|
||||
* @param allDeptList 所有部门列表
|
||||
* @return 返回包括自己部门在内的所有子级部门
|
||||
*/
|
||||
public List<SysDept> selectChildrenByDept(long deptId, List<SysDept> allDeptList) {
|
||||
List<SysDept> list = new ArrayList<>();
|
||||
Optional<SysDept> optionalDept = allDeptList.stream().filter(w -> w.getDeptId() == deptId).findFirst();
|
||||
|
||||
optionalDept.ifPresent(list::add);
|
||||
optionalDept.ifPresent(list::add);
|
||||
|
||||
List<SysDept> collect = allDeptList.stream()
|
||||
.filter(w -> w.getParentId() == deptId)
|
||||
.collect(Collectors.toList());
|
||||
List<SysDept> collect = allDeptList.stream()
|
||||
.filter(w -> w.getParentId() == deptId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
|
||||
collect.forEach(dept -> {
|
||||
List<SysDept> depts = selectChildrenByDept(dept.getDeptId(), allDeptList);
|
||||
list.addAll(depts);
|
||||
});
|
||||
collect.forEach(dept -> {
|
||||
List<SysDept> depts = selectChildrenByDept(dept.getDeptId(), allDeptList);
|
||||
list.addAll(depts);
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前菜单id,向下查找所有的菜单
|
||||
* @param menuId 当前菜单id
|
||||
* @param allMenuList 所有菜单列表
|
||||
* @return 返回包括自己在内的所有子级菜单
|
||||
*/
|
||||
public List<SysMenu> selectChildrenByMenu(long menuId, List<SysMenu> allMenuList) {
|
||||
List<SysMenu> list = new ArrayList<>();
|
||||
list.add(allMenuList.stream().filter(w -> w.getMenuId() == menuId).findFirst().get());
|
||||
/**
|
||||
* 根据当前菜单id,向下查找所有的菜单
|
||||
*
|
||||
* @param menuId 当前菜单id
|
||||
* @param allMenuList 所有菜单列表
|
||||
* @return 返回包括自己在内的所有子级菜单
|
||||
*/
|
||||
public List<SysMenu> selectChildrenByMenu(long menuId, List<SysMenu> allMenuList) {
|
||||
List<SysMenu> list = new ArrayList<>();
|
||||
list.add(allMenuList.stream().filter(w -> w.getMenuId() == menuId).findFirst().get());
|
||||
|
||||
List<SysMenu> collect = allMenuList.stream()
|
||||
.filter(w -> w.getParentId() == menuId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
collect.forEach(dept -> list.addAll(selectChildrenByMenu(dept.getMenuId(), allMenuList)));
|
||||
return list;
|
||||
}
|
||||
List<SysMenu> collect = allMenuList.stream()
|
||||
.filter(w -> w.getParentId() == menuId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
return list;
|
||||
}
|
||||
collect.forEach(dept -> list.addAll(selectChildrenByMenu(dept.getMenuId(), allMenuList)));
|
||||
return list;
|
||||
}
|
||||
|
||||
public <T extends BaseUserInterface> List<T> convertUserList(List<T> list, Map<Long, SysUser> map) {
|
||||
return CollectionUtils.convertList(list, user -> convertUser(user, map.get(user.getUserId())));
|
||||
}
|
||||
|
||||
public <T extends BaseUserInterface> T convertUser(T v, SysUser user) {
|
||||
v.setUsername(user.getUsername());
|
||||
v.setUserMobile(user.getPhone());
|
||||
v.setUserAvatar(user.getAvatar());
|
||||
return v;
|
||||
}
|
||||
|
||||
public <T extends BaseDeptInterface> List<T> convertDeptList(List<T> list, Map<Long, SysDept> map) {
|
||||
return CollectionUtils.convertList(list, user -> convertDept(user, map.get(user.getDeptId())));
|
||||
}
|
||||
|
||||
public <T extends BaseDeptInterface> T convertDept(T v, SysDept dept) {
|
||||
v.setDeptId(dept.getDeptId());
|
||||
v.setDeptName(dept.getName());
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.bsd.pjcloud.admin.api.vo.base;
|
||||
|
||||
public interface BaseDeptInterface {
|
||||
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
Long getDeptId();
|
||||
|
||||
void setDeptId(Long deptId);
|
||||
|
||||
/**
|
||||
* 部门名
|
||||
*/
|
||||
String getDeptName();
|
||||
|
||||
void setDeptName(String deptName);
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.bsd.pjcloud.admin.api.vo.base;
|
||||
|
||||
|
||||
public interface BaseUserInterface {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
Long getUserId();
|
||||
|
||||
void setUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
String getUsername();
|
||||
|
||||
void setUsername(String username);
|
||||
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
String getUserMobile();
|
||||
|
||||
void setUserMobile(String userMobile);
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
String getUserAvatar();
|
||||
|
||||
void setUserAvatar(String userAvatar);
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user