切换mysql为达梦数据库-代码审查
1.userboot模块
This commit is contained in:
@@ -253,7 +253,6 @@ public class DeptController extends BaseController {
|
||||
/**
|
||||
* 功能描述: 根据区域索引获取部门索引
|
||||
*
|
||||
* @return
|
||||
* @author xy
|
||||
* @date 2022/2/14 15:04
|
||||
*/
|
||||
@@ -277,7 +276,6 @@ public class DeptController extends BaseController {
|
||||
/**
|
||||
* 功能描述: 根据区域索引获取部门索引
|
||||
*
|
||||
* @return
|
||||
* @author denghuajun
|
||||
* @date 2022/2/24 15:04
|
||||
*/
|
||||
@@ -451,8 +449,6 @@ public class DeptController extends BaseController {
|
||||
}
|
||||
/**
|
||||
* @Description: "获取当前部门的的下级子部门list,如果没子部门就是返回当前部门
|
||||
* @Param: [deptId]
|
||||
* @return: com.njcn.common.pojo.response.HttpResult<java.util.List<com.njcn.user.pojo.dto.DeptDTO>>
|
||||
* @Author: clam
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
@@ -483,8 +479,7 @@ public class DeptController extends BaseController {
|
||||
|
||||
/**
|
||||
* 根据部门id查询当前部门所有父级部门id
|
||||
* @param deptId
|
||||
* @return
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getUpByDeptIds")
|
||||
@@ -500,7 +495,6 @@ public class DeptController extends BaseController {
|
||||
/**
|
||||
* 根据单位集合查询对应部门
|
||||
* @param list code集合
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getDeptByCodeList")
|
||||
|
||||
@@ -8,13 +8,11 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.user.enums.UserResponseEnum;
|
||||
import com.njcn.user.pojo.param.FunctionParam;
|
||||
import com.njcn.user.pojo.param.RoleParam;
|
||||
import com.njcn.user.pojo.po.Function;
|
||||
import com.njcn.user.pojo.vo.FunctionVO;
|
||||
import com.njcn.user.service.IFunctionService;
|
||||
import com.njcn.user.service.IRoleFunctionService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -44,8 +42,6 @@ public class FunctionController extends BaseController {
|
||||
|
||||
private final IFunctionService functionService;
|
||||
|
||||
private final IRoleFunctionService roleFunctionService;
|
||||
|
||||
/**
|
||||
* 新增资源
|
||||
* @param functionParam 资源数据
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.njcn.user.controller;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||
import com.njcn.device.pq.pojo.vo.HomeostasisAreaVO;
|
||||
import com.njcn.device.pq.pojo.vo.UserScaleVO;
|
||||
import com.njcn.user.service.LargeScreenService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: zbj
|
||||
* @date: 2023/04/10
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "大屏")
|
||||
@RestController
|
||||
@RequestMapping("/largeScreen")
|
||||
@RequiredArgsConstructor
|
||||
public class LargeScreenController extends BaseController {
|
||||
|
||||
private final LargeScreenService largeScreenService;
|
||||
|
||||
/**
|
||||
* 灿能云用户规模
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getUserScale")
|
||||
@ApiOperation("灿能云用户规模")
|
||||
@ApiImplicitParam(name = "largeScreenParam", value = "灿能云用户规模", required = true)
|
||||
public HttpResult<List<UserScaleVO>> getUserScale(@RequestBody @Validated LargeScreenParam largeScreenParam) {
|
||||
String methodDescribe = getMethodDescribe("getUserScale");
|
||||
List<UserScaleVO> result = largeScreenService.getUserScale(largeScreenParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,9 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.user.pojo.param.RoleParam;
|
||||
import com.njcn.user.pojo.po.RoleComponent;
|
||||
import com.njcn.user.service.IRoleComponentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -49,7 +47,7 @@ public class RoleComponentController extends BaseController {
|
||||
@PostMapping("/selectRoleComponent")
|
||||
@ApiOperation("角色组件树")
|
||||
@ApiImplicitParam(name = "idList", value = "角色索引集合", required = true)
|
||||
public HttpResult<Object> selectRoleComponent(@RequestParam("idList") List<String> idList) {
|
||||
public HttpResult<List<String>> selectRoleComponent(@RequestParam("idList") List<String> idList) {
|
||||
String methodDescribe = getMethodDescribe("selectRoleComponent");
|
||||
LogUtil.njcnDebug(log, "{},传入的角色id集合:{}", methodDescribe, idList);
|
||||
List<String> result = roleComponentService.selectRoleComponent(idList);
|
||||
|
||||
@@ -11,10 +11,8 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.user.pojo.param.DeptParam;
|
||||
import com.njcn.user.pojo.param.RoleParam;
|
||||
import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.pojo.vo.RoleVO;
|
||||
import com.njcn.user.service.IRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@@ -3,10 +3,7 @@ package com.njcn.user.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.LogInfo;
|
||||
@@ -29,7 +26,6 @@ import com.njcn.user.pojo.dto.UserDTO;
|
||||
import com.njcn.user.pojo.param.UserInfoParm;
|
||||
import com.njcn.user.pojo.param.UserParam;
|
||||
import com.njcn.user.pojo.param.UserPasswordParam;
|
||||
import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.user.service.IUserService;
|
||||
@@ -52,7 +48,6 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -134,10 +129,8 @@ public class UserController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},用户数据为:{}", methodDescribe, addUserParam);
|
||||
boolean result = userService.addUser(addUserParam);
|
||||
|
||||
//更新redis数据
|
||||
userService.userRoleList();
|
||||
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
} else {
|
||||
@@ -376,7 +369,7 @@ public class UserController extends BaseController {
|
||||
String privateKey = keyMap.get("privateKey");
|
||||
String ip = request.getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP);
|
||||
|
||||
if(redisUtil.hasKey(loginName + ip)){
|
||||
if (redisUtil.hasKey(loginName + ip)) {
|
||||
//秘钥先删除再添加
|
||||
redisUtil.delete(loginName + ip);
|
||||
}
|
||||
@@ -385,7 +378,7 @@ public class UserController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, publicKey, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(operateType = OperateType.UPDATE,info = LogEnum.SYSTEM_SERIOUS)
|
||||
@OperateInfo(operateType = OperateType.UPDATE, info = LogEnum.SYSTEM_SERIOUS)
|
||||
@PutMapping("/updateUserLoginErrorTimes/{loginName}")
|
||||
@ApiOperation("更新用户登录认证密码错误次数")
|
||||
@ApiImplicitParam(name = "loginName", value = "登录名", required = true)
|
||||
@@ -403,7 +396,7 @@ public class UserController extends BaseController {
|
||||
*
|
||||
* @param password 确认密码
|
||||
*/
|
||||
@OperateInfo(operateType = OperateType.AUTHENTICATE,info = LogEnum.SYSTEM_SERIOUS)
|
||||
@OperateInfo(operateType = OperateType.AUTHENTICATE, info = LogEnum.SYSTEM_SERIOUS)
|
||||
@GetMapping("/passwordConfirm")
|
||||
@ApiOperation("密码二次确认")
|
||||
@ApiImplicitParam(name = "password", value = "确认密码")
|
||||
@@ -433,14 +426,17 @@ public class UserController extends BaseController {
|
||||
LogUtil.njcnDebug(log, "{},加密用户信息为:{}", methodDescribe, userPasswordParam);
|
||||
String ip = request.getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP);
|
||||
boolean result = userService.updateFirstPassword(userPasswordParam.getName(), userPasswordParam.getPassword(), ip);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于激活处于休眠、锁定、密码过期的用户
|
||||
*
|
||||
* @param id 用户ID
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PutMapping("/activateUser")
|
||||
@@ -535,9 +531,6 @@ public class UserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 根据部门ids查询用户信息
|
||||
*
|
||||
* @param deptId
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/getUserByDeptIds")
|
||||
@@ -636,12 +629,13 @@ public class UserController extends BaseController {
|
||||
|
||||
/**
|
||||
* 查询用户的角色
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2024/8/29
|
||||
*/
|
||||
@GetMapping("/userRoleList")
|
||||
@ApiOperation("获取所有用户角色")
|
||||
public HttpResult<Boolean> userRoleList(){
|
||||
public HttpResult<Boolean> userRoleList() {
|
||||
String methodDescribe = getMethodDescribe("userRoleList");
|
||||
userService.userRoleList();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
|
||||
@@ -19,11 +19,5 @@ import com.njcn.web.controller.BaseController;
|
||||
public class UserRoleController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2024/8/29
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.user.service.IAppUserService;
|
||||
import com.njcn.web.annotation.ReturnMsg;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.IpUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -20,8 +19,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -47,8 +44,6 @@ import java.util.Objects;
|
||||
@AllArgsConstructor
|
||||
public class AppUserController extends BaseController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AppUserController.class);
|
||||
|
||||
private final IAppUserService appUserService;
|
||||
|
||||
/**
|
||||
@@ -123,7 +118,7 @@ public class AppUserController extends BaseController {
|
||||
@ApiImplicitParam(name = "devCode", value = "设备码", required = true, paramType = "query")
|
||||
})
|
||||
public HttpResult<Object> resetPsd(String phone, String code,String password, String devCode, @ApiIgnore HttpServletRequest request) {
|
||||
String methodDescribe = getMethodDescribe("modifyPsd");
|
||||
String methodDescribe = getMethodDescribe("resetPsd");
|
||||
String ip = request.getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP);
|
||||
appUserService.resetPsd(phone,code,password,devCode,ip);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
@@ -31,15 +31,9 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
||||
*/
|
||||
Page<DeptVO> page(@Param("page")Page<DeptVO> page, @Param("ew") QueryWrapper<DeptVO> queryWrapper);
|
||||
|
||||
// /**
|
||||
// * 查询部门排序最后一位
|
||||
// * @return 排序最后一位
|
||||
// */
|
||||
// Integer getSortNum();
|
||||
|
||||
/**
|
||||
* 查询父节点的所有上层节点
|
||||
* @param id
|
||||
* @param id 部门id
|
||||
* @return 父节点的所有上层节点
|
||||
*/
|
||||
String getIdString(@Param("id")String id);
|
||||
@@ -74,14 +68,12 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
||||
/**
|
||||
* 删除部门和监测点的绑定
|
||||
* @param ids 部门集合
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteDeptLine(@Param("ids")List<String> ids);
|
||||
|
||||
/**
|
||||
* 删除部门和用户的绑定
|
||||
* @param ids 部门集合
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteUserDept(@Param("ids")List<String> ids);
|
||||
|
||||
@@ -116,13 +108,4 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
||||
* @date 2022/10/09
|
||||
*/
|
||||
List<String> getDeptSonId(@Param("deptId") String deptId);
|
||||
|
||||
/**
|
||||
* @Description: 查询所有父级部门
|
||||
* @param deptId
|
||||
* @return: java.util.List<java.lang.String>
|
||||
* @Author: wr
|
||||
* @Date: 2023/11/9 15:59
|
||||
*/
|
||||
List<String> selectUpByDeptIds(@Param("deptId") String deptId);
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.njcn.user.mapper;
|
||||
|
||||
|
||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||
import com.njcn.device.pq.pojo.vo.UserScaleVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: zbj
|
||||
* @date: 2023/04/10
|
||||
*/
|
||||
public interface LargeScreenMapper {
|
||||
|
||||
List<UserScaleVO> getUserScale (LargeScreenParam largeScreenParam);
|
||||
|
||||
}
|
||||
@@ -32,22 +32,19 @@ public interface RoleMapper extends BaseMapper<Role> {
|
||||
|
||||
/**
|
||||
* 删除角色和用户的绑定
|
||||
* @param ids
|
||||
* @return
|
||||
* @param ids 角色id
|
||||
*/
|
||||
Boolean deleteUserRole(@Param("ids")List<String> ids);
|
||||
|
||||
/**
|
||||
* 删除角色和资源的绑定
|
||||
* @param ids
|
||||
* @return
|
||||
* @param ids 角色id
|
||||
*/
|
||||
Boolean deleteFunctionRole(@Param("ids")List<String> ids);
|
||||
|
||||
/**
|
||||
* 删除角色和组件的绑定
|
||||
* @param ids
|
||||
* @return
|
||||
* @param ids 角色id
|
||||
*/
|
||||
Boolean deleteComponentRole(@Param("ids")List<String> ids);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,15 @@ public interface UserMapper extends BaseMapper<User> {
|
||||
*/
|
||||
List<UserExcel> queryExportUser(@Param("ew") QueryWrapper<UserExcel> queryWrapper);
|
||||
|
||||
/**
|
||||
* 根据用户id获取用户信息列表
|
||||
* @param ids 用户id集合
|
||||
* @return 用户信息列表
|
||||
*/
|
||||
List<UserVO> getUserVOByIdList(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* 查询用户角色列表
|
||||
*/
|
||||
List<UserRoleLogsDTO> userRoleList();
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@ import java.util.List;
|
||||
public interface UserRoleMapper extends BaseMapper<UserRole> {
|
||||
/**
|
||||
* 根据角色id集合查询是否绑定
|
||||
* @param ids
|
||||
* @return
|
||||
* @param ids 角色id集合
|
||||
*/
|
||||
List<UserRole> selectUserRole(@Param("ids")List<String> ids);
|
||||
|
||||
@@ -35,12 +34,16 @@ public interface UserRoleMapper extends BaseMapper<UserRole> {
|
||||
List<Role> getRoleListByUserId(String userId);
|
||||
|
||||
/**
|
||||
* 根据角色Code获取角色信息
|
||||
* @param roleCode
|
||||
* @return
|
||||
* 根据角色Code获取用户信息
|
||||
* @param roleCode 角色code
|
||||
*/
|
||||
List<User> selectUserRoleCode(@Param("roleCode")String roleCode);
|
||||
|
||||
|
||||
/**
|
||||
* 根据角色Code获取用户信息
|
||||
* @param roleType 角色等级
|
||||
*/
|
||||
List<User> getUserByRoleType(@Param("roleType")Integer roleType);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,13 +12,6 @@
|
||||
AND ${ew.sqlSegment}
|
||||
</select>
|
||||
|
||||
<!-- <!–查询排序–>-->
|
||||
<!-- <select id="getSortNum" resultType="int">-->
|
||||
<!-- SELECT MAX(sys_dept.sort) sort-->
|
||||
<!-- FROM sys_dept sys_dept-->
|
||||
<!-- WHERE sys_dept.state = 1-->
|
||||
<!-- </select>-->
|
||||
|
||||
<select id="getIdString" resultType="String">
|
||||
SELECT sys_dept.pids pids
|
||||
FROM sys_dept sys_dept
|
||||
@@ -164,15 +157,13 @@
|
||||
T3.sort ASC;
|
||||
</select>
|
||||
|
||||
|
||||
<select id="allDeptList" resultType="PvTerminalTreeVO">
|
||||
select
|
||||
id,name,pid,pids,code,
|
||||
LENGTH( pids ) - LENGTH(REPLACE ( pids, ',', '' )) +1 as `level`
|
||||
LENGTH( pids ) - LENGTH(REPLACE ( pids, ',', '' )) +1 as level
|
||||
from sys_dept where state = 1 order by sort
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getDeptSonIds" resultType="String">
|
||||
select id from sys_dept where find_in_set(#{deptId},pids) and state = 1
|
||||
</select>
|
||||
@@ -181,29 +172,9 @@
|
||||
select code from sys_dept where find_in_set(#{deptId},pids) and state = 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="getDeptSonId" resultType="String">
|
||||
select id from sys_dept where sys_dept.Pid=#{deptId} and state = 1
|
||||
</select>
|
||||
|
||||
<select id="selectUpByDeptIds" resultType="java.lang.String">
|
||||
SELECT
|
||||
T2.id
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
@r AS _id,
|
||||
( SELECT @r := Pid FROM sys_dept WHERE id = _id LIMIT 1 ) AS parent_id,
|
||||
@l := @l + 1 AS lvl
|
||||
FROM
|
||||
( SELECT @r := #{deptId}, @l := 0 ) vars,
|
||||
sys_dept h
|
||||
WHERE
|
||||
Pid >> 0
|
||||
) T1
|
||||
JOIN sys_dept T2 ON T1.parent_id = T2.id
|
||||
ORDER BY
|
||||
T1.lvl DESC;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.user.mapper.LargeScreenMapper">
|
||||
|
||||
<select id="getUserScale" resultType="com.njcn.device.pq.pojo.vo.UserScaleVO">
|
||||
SELECT DATE_FORMAT(REGISTER_TIME, '%Y-%m') AS `timeId`, COUNT(*) AS `monthIncrementNum`
|
||||
FROM app_user
|
||||
where STATE = '1'
|
||||
<if test="searchBeginTime != null and searchBeginTime != ''">
|
||||
and date_format(REGISTER_TIME,'%y%m%d') >= date_format(#{searchBeginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="searchEndTime != null and searchEndTime != ''">
|
||||
and date_format(REGISTER_TIME,'%y%m%d') <= date_format(#{searchEndTime},'%y%m%d')
|
||||
</if>
|
||||
GROUP BY `timeId`;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -26,7 +26,7 @@
|
||||
INNER JOIN sys_user_role usrRole ON usrRole.User_Id = usr.Id
|
||||
INNER JOIN sys_role role ON role.Id = usrRole.Role_Id
|
||||
WHERE
|
||||
role.`Code` = #{roleCode}
|
||||
role.Code = #{roleCode}
|
||||
</select>
|
||||
|
||||
<select id="getUserByRoleType" resultType="com.njcn.user.pojo.po.User">
|
||||
@@ -38,6 +38,6 @@
|
||||
INNER JOIN sys_user_role usrRole ON usrRole.User_Id = usr.Id
|
||||
INNER JOIN sys_role role ON role.Id = usrRole.Role_Id
|
||||
WHERE
|
||||
role.`type` = #{roleType}
|
||||
role.type = #{roleType}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -16,13 +16,11 @@ public interface IReferralCodeService {
|
||||
|
||||
/**
|
||||
* 查询角色推荐码
|
||||
* @return
|
||||
*/
|
||||
List<RoleReferralCodeVO> findReferralCode();
|
||||
|
||||
/**
|
||||
* 刷新角色推荐码
|
||||
* @return
|
||||
*/
|
||||
List<RoleReferralCodeVO> refreshReferralCode();
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ public interface IRoleComponentService extends IService<RoleComponent> {
|
||||
/**
|
||||
* 功能描述: 根据角色id获取组件
|
||||
*
|
||||
* @param idList
|
||||
* @return java.util.List<java.lang.String>
|
||||
* @author xy
|
||||
* @date 2022/1/24 12:41
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface IRoleFunctionService extends IService<RoleFunction> {
|
||||
/**
|
||||
* 功能描述: 根据角色集合获取菜单方法
|
||||
*
|
||||
* @param roleList
|
||||
* @param roleList 角色集合
|
||||
* @return java.util.List<java.lang.String>
|
||||
* @author xy
|
||||
* @date 2022/1/18 14:22
|
||||
|
||||
@@ -41,22 +41,20 @@ public interface IRoleService extends IService<Role> {
|
||||
|
||||
/**
|
||||
* 根据角色id获取角色code
|
||||
* @param list
|
||||
* @param list 角色id
|
||||
* @return 角色名集合
|
||||
*/
|
||||
List<String> getCodeByList(List<String> list);
|
||||
|
||||
/**
|
||||
* 分页查询角色列表
|
||||
* @param queryParam
|
||||
* @return
|
||||
* @param queryParam 查询参数
|
||||
*/
|
||||
Page<RoleVO> listRole(RoleParam.QueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 根据权限类型分页查询角色列表
|
||||
* @param id
|
||||
* @return
|
||||
* @param id 角色类型
|
||||
*/
|
||||
List<Role> selectRoleDetail(Integer id);
|
||||
|
||||
@@ -84,12 +82,15 @@ public interface IRoleService extends IService<Role> {
|
||||
*/
|
||||
boolean deleteRole(List<String> ids);
|
||||
|
||||
/**
|
||||
* 判断角色id是否有相关联的资源和组件
|
||||
* @param ids 角色id
|
||||
*/
|
||||
Boolean selectRelevance(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据角色code获取角色
|
||||
* @param code
|
||||
* @return
|
||||
* @param code 角色code
|
||||
*/
|
||||
Role getRoleByCode(String code);
|
||||
|
||||
|
||||
@@ -25,10 +25,9 @@ public interface IUserRoleService extends IService<UserRole> {
|
||||
|
||||
/**
|
||||
* 功能描述:新增用户和角色的关系
|
||||
* TODO
|
||||
*
|
||||
* @param id
|
||||
* @param roles
|
||||
* @param id 用户id
|
||||
* @param roles 角色id
|
||||
* @return boolean
|
||||
* @author xy
|
||||
* @date 2021/12/30 16:24
|
||||
@@ -39,8 +38,8 @@ public interface IUserRoleService extends IService<UserRole> {
|
||||
* 功能描述:修改用户和角色的关系
|
||||
* TODO
|
||||
*
|
||||
* @param id
|
||||
* @param roles
|
||||
* @param id 用户id
|
||||
* @param roles 角色id
|
||||
* @return boolean
|
||||
* @author xy
|
||||
* @date 2022/1/13 14:14
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface IUserSetService extends IService<UserSet> {
|
||||
* 功能描述:
|
||||
* 新增用户时,去用户配置表存储工作秘钥和SM4密码
|
||||
*
|
||||
* @param addUserParam
|
||||
* @param addUserParam 新增用户参数
|
||||
* @return com.njcn.user.pojo.po.UserSet
|
||||
* @author xy
|
||||
* @date 2021/12/30 16:03
|
||||
@@ -51,11 +51,10 @@ public interface IUserSetService extends IService<UserSet> {
|
||||
|
||||
/**
|
||||
* App用户忘记密码
|
||||
* @param id
|
||||
* @param newPassword
|
||||
* @param name
|
||||
* @param ip
|
||||
* @return
|
||||
* @param id 用户id
|
||||
* @param newPassword 新密码
|
||||
* @param name 用户名
|
||||
* @param ip ip
|
||||
*/
|
||||
String forgetPassword(String id, String newPassword, String name, String ip);
|
||||
|
||||
@@ -63,7 +62,7 @@ public interface IUserSetService extends IService<UserSet> {
|
||||
/**
|
||||
* 功能描述:
|
||||
*
|
||||
* @param password
|
||||
* @param password 密码
|
||||
* @return java.lang.String
|
||||
* @author xy
|
||||
* @date 2022/1/19 16:58
|
||||
@@ -82,7 +81,6 @@ public interface IUserSetService extends IService<UserSet> {
|
||||
|
||||
/**
|
||||
* 功能描述: 生成app用户的信息
|
||||
* @return
|
||||
*/
|
||||
UserSet addAppUserSet();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface IUserStrategyService extends IService<UserStrategy> {
|
||||
/**
|
||||
* 查询用户策略数据
|
||||
* @return 用户策略信息
|
||||
* @param casualUser
|
||||
* @param casualUser 是否为 casual用户
|
||||
*/
|
||||
UserStrategy getUserStrategy(Integer casualUser);
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.njcn.user.service;
|
||||
|
||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||
import com.njcn.device.pq.pojo.vo.UserScaleVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: zbj
|
||||
* @date: 2023/04/10
|
||||
*/
|
||||
public interface LargeScreenService {
|
||||
|
||||
List<UserScaleVO> getUserScale(LargeScreenParam largeScreenParam);
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.njcn.user.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.redis.pojo.enums.RedisKeyEnum;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
@@ -18,10 +17,8 @@ import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
@@ -44,35 +41,30 @@ public class AppRoleServiceImpl implements IAppRoleService {
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void roleUpdate(String userId, String referralCode, String devCode) {
|
||||
Object object = redisUtil.getObjectByKey(RedisKeyEnum.ROLE_REFERRAL_CODE_KEY.getKey());
|
||||
if (Objects.isNull(object)){
|
||||
if (Objects.isNull(object)) {
|
||||
throw new BusinessException(UserResponseEnum.REFERRAL_CODE_LAPSE);
|
||||
}
|
||||
Map<String, String> map = ( Map<String, String>) object;
|
||||
if (Objects.isNull(map.get(referralCode))){
|
||||
Map<String, String> map;
|
||||
if (!(object instanceof Map)) {
|
||||
throw new BusinessException(UserResponseEnum.REFERRAL_CODE_LAPSE);
|
||||
} else {
|
||||
map = (Map<String, String>) object;
|
||||
}
|
||||
if (Objects.isNull(map.get(referralCode))) {
|
||||
throw new BusinessException(UserResponseEnum.REFERRAL_CODE_ERROR);
|
||||
}
|
||||
Role roleByCode = roleService.getRoleByCode(map.get(referralCode));
|
||||
//修改用户和角色的关系
|
||||
LambdaUpdateWrapper<UserRole> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(UserRole::getUserId,userId).set(UserRole::getRoleId,roleByCode.getId());
|
||||
lambdaUpdateWrapper.eq(UserRole::getUserId, userId).set(UserRole::getRoleId, roleByCode.getId());
|
||||
userRoleService.update(lambdaUpdateWrapper);
|
||||
if(Objects.equals(roleByCode.getCode(), AppRoleEnum.ENGINEERING_USER)){
|
||||
if (Objects.equals(roleByCode.getCode(), AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||
iAppInfoSetService.lambdaUpdate().
|
||||
eq(AppInfoSet::getUserId,userId).
|
||||
set(AppInfoSet::getExFactoryBug,1).
|
||||
set(AppInfoSet::getFunctionBug,1).
|
||||
eq(AppInfoSet::getUserId, userId).
|
||||
set(AppInfoSet::getExFactoryBug, 1).
|
||||
set(AppInfoSet::getFunctionBug, 1).
|
||||
update();
|
||||
}
|
||||
//重新生成新的推荐码
|
||||
// LinkedHashMap<String,String> roleMap = new LinkedHashMap<>();
|
||||
// for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
// if (Objects.equals(entry.getKey(),referralCode)){
|
||||
// roleMap.put(PubUtils.getCode(6),entry.getValue());
|
||||
// } else {
|
||||
// roleMap.put(entry.getKey(),entry.getValue());
|
||||
// }
|
||||
// }
|
||||
// redisUtil.saveByKeyWithExpire("ROLE_REFERRAL_CODE",roleMap,120L);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -270,14 +270,14 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, User> impleme
|
||||
* 自定义获取验证码,固定为字母和数字的组合
|
||||
*/
|
||||
private String getMessageCode() {
|
||||
String result = "";
|
||||
StringBuilder result = new StringBuilder();
|
||||
char[] numbers = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||
//填充数字
|
||||
for (int i = 0; i < 6; i++) {
|
||||
int numberIndex = new Random().nextInt(10);
|
||||
result = result + numbers[numberIndex];
|
||||
result.append(numbers[numberIndex]);
|
||||
}
|
||||
return result;
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private void judgeCode(String phone, String code) {
|
||||
|
||||
@@ -19,17 +19,14 @@ import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.vo.ComponentVO;
|
||||
import com.njcn.user.service.IComponentService;
|
||||
import com.njcn.user.service.IRoleComponentService;
|
||||
import com.njcn.user.service.IRoleService;
|
||||
import com.njcn.user.service.IUserRoleService;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -45,8 +42,6 @@ public class ComponentServiceImpl extends ServiceImpl<ComponentMapper, Component
|
||||
|
||||
private final ComponentMapper componentMapper;
|
||||
|
||||
private final IRoleService roleService;
|
||||
|
||||
private final IUserRoleService iUserRoleService;
|
||||
|
||||
private final IRoleComponentService roleComponentService;
|
||||
|
||||
@@ -99,8 +99,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
BeanUtil.copyProperties(deptParam, dept);
|
||||
//进行先解绑,再新增
|
||||
Integer httpResult = deptLineFeignClient.removeBind(deptParam.getPid()).getData();
|
||||
|
||||
if (deptParam.getPid().equals("-1")) {
|
||||
if ("-1".equals(deptParam.getPid())) {
|
||||
//上层节点
|
||||
dept.setPids("0");
|
||||
} else {
|
||||
@@ -152,13 +151,9 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
}
|
||||
}
|
||||
allIds = allIds.stream().distinct().collect(Collectors.toList());
|
||||
/**
|
||||
* 删除部门和监测点的绑定
|
||||
*/
|
||||
// 删除部门和监测点的绑定
|
||||
this.baseMapper.deleteDeptLine(allIds);
|
||||
/**
|
||||
* 清空用户和部门的绑定关系
|
||||
*/
|
||||
// 清空用户和部门的绑定关系
|
||||
this.baseMapper.deleteUserDept(allIds);
|
||||
return this.lambdaUpdate().set(Dept::getState, DataStateEnum.DELETED.getCode()).in(Dept::getId, allIds).update();
|
||||
}
|
||||
@@ -224,8 +219,8 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
@Override
|
||||
public List<AreaTreeDTO> getAreaTree(String id, Integer type) {
|
||||
List<String> areaTreeVO = deptArea();
|
||||
HttpResult<List<AreaTreeDTO>> areaTreeDTOS = areaFeignClient.areaDeptTree(id, type);
|
||||
List<AreaTreeDTO> list = areaTreeDTOS.getData();
|
||||
HttpResult<List<AreaTreeDTO>> areaTreeDTOList = areaFeignClient.areaDeptTree(id, type);
|
||||
List<AreaTreeDTO> list = areaTreeDTOList.getData();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
@@ -234,7 +229,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
areaTreeVOList.setName(areaTreeVOList.getName() + "(已被绑定)");
|
||||
areaTreeVOList.setIsFalse(1);
|
||||
}
|
||||
if (areaTreeVOList.getChildren().size() != 0) {
|
||||
if (!areaTreeVOList.getChildren().isEmpty()) {
|
||||
for (AreaTreeDTO treeDTO : areaTreeVOList.getChildren()) {
|
||||
if (areaTreeVO.contains(treeDTO.getId())) {
|
||||
treeDTO.setName(treeDTO.getName() + "(已被绑定)");
|
||||
@@ -270,24 +265,13 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
|
||||
@Override
|
||||
public boolean selectPid(List<String> ids) {
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
// 判断是否有子节点
|
||||
List<Dept> dept = this.baseMapper.selectPid(ids, DataStateEnum.ENABLE.getCode());
|
||||
/**
|
||||
* 判断是否存在绑定关系
|
||||
*/
|
||||
// 判断是否存在绑定关系
|
||||
HttpResult<Boolean> deptLineVOHttpResult = deptLineFeignClient.selectDeptBindLines(ids);
|
||||
/**
|
||||
* 用户是否关联
|
||||
*/
|
||||
// 用户是否关联
|
||||
List<User> userList = userMapper.selectDeptsId(ids, DataStateEnum.ENABLE.getCode());
|
||||
|
||||
if (dept.size() > 0 || deptLineVOHttpResult.getData() != null || userList.size() > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return !dept.isEmpty() || deptLineVOHttpResult.getData() != null || !userList.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -442,12 +426,10 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
@Override
|
||||
public List<Dept> getDirectSonSelf(String deptId) {
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.and(Wrapper -> Wrapper.
|
||||
lambdaQueryWrapper.and(wrapper -> wrapper.
|
||||
eq(Dept::getPid, deptId).
|
||||
or().
|
||||
eq(Dept::getId, deptId)).eq(Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
// lambdaQueryWrapper.eq(Dept::getPid,deptId).eq(Dept::getState, DataStateEnum.ENABLE.getCode()).
|
||||
// or().eq(Dept::getId,deptId);
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -466,16 +448,12 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
}
|
||||
|
||||
/**
|
||||
* @param deptId
|
||||
* @param deptId 部门id
|
||||
* @Description: "获取当前部门的的下级子部门list,如果没子部门就是返回当前部门
|
||||
* @Param: [deptId]
|
||||
* @return: java.util.List<com.njcn.user.pojo.po.Dept>
|
||||
* @Author: clam
|
||||
* @Date: 2023/1/10
|
||||
*/
|
||||
@Override
|
||||
public List<DeptDTO> getDepSonDetailByDeptId(String deptId) {
|
||||
List<Dept> result = new ArrayList<>();
|
||||
List<Dept> result ;
|
||||
|
||||
LambdaQueryWrapper<Dept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Dept::getPid, deptId).
|
||||
@@ -487,19 +465,46 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
eq(Dept::getState, DataStateEnum.ENABLE.getCode());
|
||||
result = this.baseMapper.selectList(deptLambdaQueryWrapper);
|
||||
}
|
||||
List<DeptDTO> collect = result.stream().map(temp -> {
|
||||
return result.stream().map(temp -> {
|
||||
DeptDTO deptDTO = new DeptDTO();
|
||||
BeanUtils.copyProperties(temp, deptDTO);
|
||||
return deptDTO;
|
||||
}).collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUpByDeptIds(String deptId) {
|
||||
List<String> list = this.baseMapper.selectUpByDeptIds(deptId);
|
||||
list.add(deptId);
|
||||
return list;
|
||||
// 查询出所有的部门
|
||||
List<Dept> allDept = this.getAllDept();
|
||||
// 递归找出所有上级部门,排除根目录
|
||||
List<Dept> upDeptList = allDept.stream()
|
||||
.filter(dept -> dept.getId().equals(deptId))
|
||||
.collect(Collectors.toList());
|
||||
if(CollectionUtil.isEmpty(upDeptList)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
upDeptList.addAll(getParentDept(upDeptList, allDept));
|
||||
//递归出所有的上级部门
|
||||
return upDeptList.stream().map(Dept::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 找出当前部门的父级部门
|
||||
* @param upDeptList 当前部门
|
||||
* @param allDept 所有部门
|
||||
* @return 父级部门
|
||||
*/
|
||||
private List<Dept> getParentDept(List<Dept> upDeptList, List<Dept> allDept) {
|
||||
if(CollectionUtil.isEmpty(upDeptList)){
|
||||
return new ArrayList<>();
|
||||
} else {
|
||||
List<Dept> parentDeptList = new ArrayList<>();
|
||||
upDeptList.forEach(upDept -> {
|
||||
List<Dept> parentDept = allDept.stream().filter(dept -> dept.getId().equals(upDept.getPid())).collect(Collectors.toList());
|
||||
parentDeptList.addAll(parentDept);
|
||||
});
|
||||
return getParentDept(parentDeptList, allDept);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -87,13 +87,13 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
.list();
|
||||
//根据角色权限关系表获取权限的uri
|
||||
if (CollectionUtil.isEmpty(roleFunctions)) {
|
||||
roleFunctionInfo.put(SecurityConstants.AUTHORITY_PREFIX+role.getCode(), null);
|
||||
roleFunctionInfo.put(SecurityConstants.AUTHORITY_PREFIX + role.getCode(), null);
|
||||
} else {
|
||||
List<Function> functions = lambdaQuery()
|
||||
.in(Function::getId, roleFunctions.stream().map(RoleFunction::getFunctionId).collect(Collectors.toList()))
|
||||
.eq(Function::getState, DataStateEnum.ENABLE.getCode())
|
||||
.list();
|
||||
roleFunctionInfo.put(SecurityConstants.AUTHORITY_PREFIX+role.getCode(), functions.stream().map(Function::getPath).collect(Collectors.toList()));
|
||||
roleFunctionInfo.put(SecurityConstants.AUTHORITY_PREFIX + role.getCode(), functions.stream().map(Function::getPath).collect(Collectors.toList()));
|
||||
}
|
||||
});
|
||||
redisUtil.saveByKey(RedisKeyEnum.ROLE_FUNCTION_KEY.getKey(), roleFunctionInfo);
|
||||
@@ -101,23 +101,23 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
|
||||
@Override
|
||||
public boolean addFunction(FunctionParam functionParam) {
|
||||
checkFunctionParam(functionParam,false);
|
||||
checkFunctionParam(functionParam, false);
|
||||
Function function = new Function();
|
||||
BeanUtil.copyProperties(functionParam, function);
|
||||
function.setState(FunctionState.ENABLE);
|
||||
if (Objects.equals(functionParam.getPid(),FunctionState.FATHER_PID)){
|
||||
if (Objects.equals(functionParam.getPid(), FunctionState.FATHER_PID)) {
|
||||
function.setPids(FunctionState.FATHER_PID);
|
||||
} else {
|
||||
Function fatherFaction = this.lambdaQuery().eq(Function::getId,functionParam.getPid()).one();
|
||||
if (Objects.equals(fatherFaction.getPid(),FunctionState.FATHER_PID)){
|
||||
Function fatherFaction = this.lambdaQuery().eq(Function::getId, functionParam.getPid()).one();
|
||||
if (Objects.equals(fatherFaction.getPid(), FunctionState.FATHER_PID)) {
|
||||
function.setPids(functionParam.getPid());
|
||||
} else {
|
||||
String pidS = fatherFaction.getPids();
|
||||
function.setPids(pidS+","+functionParam.getPid());
|
||||
function.setPids(pidS + "," + functionParam.getPid());
|
||||
}
|
||||
}
|
||||
boolean result = this.save(function);
|
||||
if (result){
|
||||
if (result) {
|
||||
//刷新redis里面的资源权限
|
||||
refreshRolesFunctionsCache();
|
||||
}
|
||||
@@ -126,11 +126,11 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
|
||||
@Override
|
||||
public boolean updateFunction(FunctionParam.FunctionUpdateParam functionParam) {
|
||||
checkFunctionParam(functionParam,true);
|
||||
checkFunctionParam(functionParam, true);
|
||||
Function function = new Function();
|
||||
BeanUtil.copyProperties(functionParam, function);
|
||||
boolean result = this.updateById(function);
|
||||
if (result){
|
||||
if (result) {
|
||||
refreshRolesFunctionsCache();
|
||||
}
|
||||
return result;
|
||||
@@ -138,14 +138,14 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
|
||||
@Override
|
||||
public void deleteFunction(String id) {
|
||||
boolean result = false;
|
||||
List<Function> list = this.lambdaQuery().eq(Function::getState,FunctionState.ENABLE).eq(Function::getPid,id).list();
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
boolean result;
|
||||
List<Function> list = this.lambdaQuery().eq(Function::getState, FunctionState.ENABLE).eq(Function::getPid, id).list();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
result = this.lambdaUpdate()
|
||||
.set(Function::getState, FunctionState.DELETE)
|
||||
.in(Function::getId,id)
|
||||
.in(Function::getId, id)
|
||||
.update();
|
||||
if (result){
|
||||
if (result) {
|
||||
refreshRolesFunctionsCache();
|
||||
}
|
||||
} else {
|
||||
@@ -157,7 +157,7 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
public List<FunctionVO> getFunctionTree() {
|
||||
List<FunctionVO> list = functionMapper.getAllFunctions();
|
||||
return list.stream()
|
||||
.filter(fun -> Objects.equals(FunctionState.FATHER_PID,fun.getPid()))
|
||||
.filter(fun -> Objects.equals(FunctionState.FATHER_PID, fun.getPid()))
|
||||
.peek(funS -> funS.setChildren(getChildCategoryList(funS, list)))
|
||||
.sorted(Comparator.comparingInt(FunctionVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
@@ -165,32 +165,32 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
|
||||
@Override
|
||||
public Function getFunctionById(String id) {
|
||||
return this.lambdaQuery().eq(Function::getId,id).one();
|
||||
return this.lambdaQuery().eq(Function::getId, id).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Function> getButtonsById(String id) {
|
||||
List<Integer> typeList = Arrays.asList(FunctionState.BUTTON,FunctionState.PUBLIC,FunctionState.TAB);
|
||||
return this.lambdaQuery().eq(Function::getPid,id).in(Function::getType,typeList).eq(Function::getState,FunctionState.ENABLE).orderByAsc(Function::getSort).list();
|
||||
List<Integer> typeList = Arrays.asList(FunctionState.BUTTON, FunctionState.PUBLIC, FunctionState.TAB);
|
||||
return this.lambdaQuery().eq(Function::getPid, id).in(Function::getType, typeList).eq(Function::getState, FunctionState.ENABLE).orderByAsc(Function::getSort).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FunctionVO> getRouteMenu() {
|
||||
List<FunctionVO> result = new ArrayList<>();
|
||||
List<String> functionList = new ArrayList<>();
|
||||
if (Objects.equals(RequestUtil.getUsername(),UserType.SUPER_ADMIN)){
|
||||
List<String> functionList;
|
||||
if (Objects.equals(RequestUtil.getUsername(), UserType.SUPER_ADMIN)) {
|
||||
//查询所有菜单
|
||||
functionList = this.lambdaQuery().eq(Function::getState, FunctionState.ENABLE).list().stream().map(Function::getId).distinct().collect(Collectors.toList());
|
||||
} else {
|
||||
List<String> roleList = userRoleService.getUserRoleByUserId(RequestUtil.getUserIndex()).stream().map(UserRole::getRoleId).distinct().collect(Collectors.toList());
|
||||
functionList = roleFunctionService.getFunctionsByList(roleList);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(functionList)){
|
||||
if (CollectionUtils.isEmpty(functionList)) {
|
||||
return result;
|
||||
}
|
||||
List<FunctionVO> functionVOList = functionMapper.getFunctionsByList(functionList);
|
||||
result = functionVOList.stream()
|
||||
.filter(fun -> Objects.equals(FunctionState.FATHER_PID,fun.getPid().trim()))
|
||||
.filter(fun -> Objects.equals(FunctionState.FATHER_PID, fun.getPid().trim()))
|
||||
.peek(funS -> funS.setChildren(getChildCategoryList(funS, functionVOList)))
|
||||
.sorted(Comparator.comparingInt(FunctionVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
@@ -204,9 +204,9 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
@Override
|
||||
public Boolean updateRoleComponent(RoleParam.RoleFunctionComponent roleFunctionComponent) {
|
||||
deleteComponentsByRoleIndex(roleFunctionComponent.getId());
|
||||
if (!roleFunctionComponent.getIdList().isEmpty()){
|
||||
if (!roleFunctionComponent.getIdList().isEmpty()) {
|
||||
List<RoleFunction> list = new ArrayList<>();
|
||||
RoleFunction roleFunction = new RoleFunction();
|
||||
RoleFunction roleFunction;
|
||||
for (String pojo : roleFunctionComponent.getIdList()) {
|
||||
roleFunction = new RoleFunction();
|
||||
roleFunction.setRoleId(roleFunctionComponent.getId());
|
||||
@@ -221,9 +221,9 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
|
||||
@Override
|
||||
public List<FunctionVO> getUserFunctionTree() {
|
||||
List<FunctionVO> result = new ArrayList<>();
|
||||
List<String> functionList = new ArrayList<>();
|
||||
if (Objects.equals(RequestUtil.getUsername(), UserType.SUPER_ADMIN)){
|
||||
List<FunctionVO> result;
|
||||
List<String> functionList;
|
||||
if (Objects.equals(RequestUtil.getUsername(), UserType.SUPER_ADMIN)) {
|
||||
//查询所有菜单
|
||||
functionList = this.lambdaQuery().eq(Function::getState, FunctionState.ENABLE).list().stream().map(Function::getId).distinct().collect(Collectors.toList());
|
||||
} else {
|
||||
@@ -232,7 +232,7 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
}
|
||||
List<FunctionVO> functionVOList = functionMapper.getUserFunctionsByList(functionList);
|
||||
result = functionVOList.stream()
|
||||
.filter(fun -> Objects.equals(FunctionState.FATHER_PID,fun.getPid()))
|
||||
.filter(fun -> Objects.equals(FunctionState.FATHER_PID, fun.getPid()))
|
||||
.peek(funS -> funS.setChildren(getChildCategoryList(funS, functionVOList)))
|
||||
.sorted(Comparator.comparingInt(FunctionVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
@@ -243,16 +243,17 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
|
||||
@Override
|
||||
public List<Function> getFunctionByList(List<String> list) {
|
||||
return this.lambdaQuery().in(Function::getId,list).list();
|
||||
return this.lambdaQuery().in(Function::getId, list).list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色删除资源
|
||||
* @param roleIndex
|
||||
*
|
||||
* @param roleIndex 角色索引
|
||||
*/
|
||||
public void deleteComponentsByRoleIndex(String roleIndex) {
|
||||
QueryWrapper<RoleFunction> roleFunctionQueryWrapper = new QueryWrapper<>();
|
||||
roleFunctionQueryWrapper.eq("sys_role_function.role_id",roleIndex);
|
||||
roleFunctionQueryWrapper.eq("sys_role_function.role_id", roleIndex);
|
||||
roleFunctionMapper.delete(roleFunctionQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -260,7 +261,7 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
* 根据当前分类找出子类,递归找出子类的子类
|
||||
*/
|
||||
private List<FunctionVO> getChildCategoryList(FunctionVO currMenu, List<FunctionVO> categories) {
|
||||
return categories.stream().filter(o -> Objects.equals(o.getPid(),currMenu.getId()))
|
||||
return categories.stream().filter(o -> Objects.equals(o.getPid(), currMenu.getId()))
|
||||
.peek(o -> o.setChildren(getChildCategoryList(o, categories)))
|
||||
.sorted(Comparator.comparingInt(FunctionVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
@@ -268,19 +269,20 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
|
||||
/**
|
||||
* 组装驾驶舱子级
|
||||
* @param list
|
||||
*
|
||||
* @param list 菜单集合
|
||||
*/
|
||||
private void setDriverChildren(List<FunctionVO> list) {
|
||||
List<HomePage> homePages = homePageService.getHomePagesByUserId(RequestUtil.getUserIndex());
|
||||
list.forEach(item->{
|
||||
if (Objects.equals(item.getRoutePath(),FunctionState.DRIVER_NAME)){
|
||||
homePages.forEach(po->{
|
||||
list.forEach(item -> {
|
||||
if (Objects.equals(item.getRoutePath(), FunctionState.DRIVER_NAME)) {
|
||||
homePages.forEach(po -> {
|
||||
FunctionVO functionVO = new FunctionVO();
|
||||
functionVO.setId(po.getId());
|
||||
functionVO.setPid(item.getId());
|
||||
functionVO.setTitle(po.getName());
|
||||
functionVO.setCode(item.getCode());
|
||||
functionVO.setRouteName(po.getPath().substring(po.getPath().lastIndexOf("/")+1));
|
||||
functionVO.setRouteName(po.getPath().substring(po.getPath().lastIndexOf("/") + 1));
|
||||
functionVO.setRoutePath(po.getPath());
|
||||
functionVO.setIcon(po.getIcon());
|
||||
functionVO.setSort(po.getSort());
|
||||
@@ -294,18 +296,18 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理tab页
|
||||
* 处理tab页
|
||||
*/
|
||||
private void setTab(List<FunctionVO> list) {
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
list.forEach(item->{
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(item -> {
|
||||
List<FunctionVO> children = item.getChildren();
|
||||
if (!CollectionUtils.isEmpty(children)){
|
||||
if (!CollectionUtils.isEmpty(children)) {
|
||||
for (FunctionVO child : children) {
|
||||
List<FunctionVO> children2 = child.getChildren();
|
||||
if (!CollectionUtils.isEmpty(children2)){
|
||||
if (!CollectionUtils.isEmpty(children2)) {
|
||||
setTab(children2);
|
||||
} else if (Objects.equals(child.getType(),4)){
|
||||
} else if (Objects.equals(child.getType(), 4)) {
|
||||
item.setUserTab(item.getChildren());
|
||||
item.setChildren(new ArrayList<>());
|
||||
break;
|
||||
@@ -326,7 +328,7 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
functionLambdaQueryWrapper
|
||||
.eq(Function::getName, functionParam.getName())
|
||||
.eq(Function::getPath, functionParam.getPath())
|
||||
.eq(Function::getPid,functionParam.getPid())
|
||||
.eq(Function::getPid, functionParam.getPid())
|
||||
.eq(Function::getState, FunctionState.ENABLE);
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
package com.njcn.user.service.impl;
|
||||
|
||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||
import com.njcn.device.pq.pojo.vo.HomeostasisAreaVO;
|
||||
import com.njcn.device.pq.pojo.vo.UserScaleVO;
|
||||
import com.njcn.user.mapper.LargeScreenMapper;
|
||||
import com.njcn.user.service.LargeScreenService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Year;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: zbj
|
||||
* @date: 2023/04/10
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LargeScreenServiceImpl implements LargeScreenService {
|
||||
|
||||
private final LargeScreenMapper largeScreenMapper;
|
||||
|
||||
/**
|
||||
* 灿能云用户规模
|
||||
*/
|
||||
@Override
|
||||
public List<UserScaleVO> getUserScale(LargeScreenParam largeScreenParam) {
|
||||
//创建返回VO
|
||||
List<UserScaleVO> result = new ArrayList<>();
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
//获取当前年第一天日期
|
||||
Year year = Year.now();
|
||||
String firstDay = year.atDay(1).format(formatter);
|
||||
//获取当前天字符串日期
|
||||
LocalDate today = LocalDate.now();
|
||||
String endDay = today.format(formatter);
|
||||
//替换属性
|
||||
largeScreenParam.setSearchBeginTime(firstDay);
|
||||
largeScreenParam.setSearchEndTime(endDay);
|
||||
List<UserScaleVO> list = largeScreenMapper.getUserScale(largeScreenParam);
|
||||
//获取传入起始月结束月中所有月份
|
||||
List<String> monthList = selectDate(largeScreenParam.getSearchBeginTime(),
|
||||
largeScreenParam.getSearchEndTime());
|
||||
|
||||
for (String s : monthList) {
|
||||
UserScaleVO vo = new UserScaleVO();
|
||||
vo.setTimeId(s);
|
||||
result.add(vo);
|
||||
}
|
||||
//集合不为空
|
||||
if (list.size()>0){
|
||||
for (UserScaleVO userScaleVO : result) {
|
||||
for (UserScaleVO scaleVO : list) {
|
||||
if (Objects.equals(scaleVO.getTimeId(),userScaleVO.getTimeId())){
|
||||
userScaleVO.setMonthIncrementNum(scaleVO.getMonthIncrementNum());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (UserScaleVO vo : result) {
|
||||
if (vo.getMonthIncrementNum()==null){
|
||||
vo.setMonthIncrementNum(0);
|
||||
}
|
||||
}
|
||||
int count = 0;
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
count = count + result.get(i).getMonthIncrementNum();
|
||||
result.get(i).setIncrementNum(count);
|
||||
}
|
||||
return result;
|
||||
}else{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取传入起始月结束月中所有月份
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public List<String> selectDate(String startDate, String endDate) {
|
||||
LocalDate start = LocalDate.parse(startDate, DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
LocalDate end = LocalDate.parse(endDate, DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
|
||||
List<String> allMonths = new ArrayList<>();
|
||||
YearMonth current = YearMonth.from(start);
|
||||
|
||||
while (!current.isAfter(YearMonth.from(end))) {
|
||||
allMonths.add(current.format(DateTimeFormatter.ofPattern("yyyy-MM")));
|
||||
current = current.plusMonths(1);
|
||||
}
|
||||
return allMonths;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.user.service.impl;
|
||||
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.user.pojo.param.PassWordRuleParam;
|
||||
import com.njcn.user.pojo.po.AuthClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
@@ -28,7 +27,6 @@ public class PassWordRuleServiceImpl implements PassWordRuleService {
|
||||
private final IUserStrategyService iUserStrategyService;
|
||||
|
||||
private final IAuthClientService iAuthClientService;
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
private final IUserService userService;
|
||||
@Override
|
||||
|
||||
@@ -45,8 +45,7 @@ public class RoleComponentServiceImpl extends ServiceImpl<RoleComponentMapper, R
|
||||
|
||||
/**
|
||||
* 根据角色删除组件
|
||||
* @param roleIndex
|
||||
* @return
|
||||
* @param roleIndex 角色索引
|
||||
*/
|
||||
public boolean deleteComponentsByRoleIndex(String roleIndex) {
|
||||
QueryWrapper<RoleComponent> roleComponentQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
@@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.user.mapper.FunctionMapper;
|
||||
import com.njcn.user.mapper.RoleFunctionMapper;
|
||||
import com.njcn.user.pojo.po.Function;
|
||||
import com.njcn.user.pojo.po.RoleFunction;
|
||||
import com.njcn.user.pojo.vo.FunctionVO;
|
||||
import com.njcn.user.service.IFunctionService;
|
||||
import com.njcn.user.service.IRoleFunctionService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -136,8 +136,7 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
||||
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.ne("sys_role.state", DataStateEnum.DELETED.getCode());
|
||||
queryWrapper.in("sys_role.type", role).orderByAsc("sys_role.type");
|
||||
List<Role> roleVOList = this.baseMapper.selectList(queryWrapper);
|
||||
return roleVOList;
|
||||
return this.baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,43 +159,27 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
||||
|
||||
@Override
|
||||
public boolean deleteRole(List<String> ids) {
|
||||
/**
|
||||
* 删除角色和用户的绑定
|
||||
*/
|
||||
// 删除角色和用户的绑定
|
||||
this.baseMapper.deleteUserRole(ids);
|
||||
|
||||
/**
|
||||
* 删除角色和资源的绑定
|
||||
*/
|
||||
// 删除角色和资源的绑定
|
||||
this.baseMapper.deleteFunctionRole(ids);
|
||||
|
||||
/**
|
||||
* 删除角色和组件的绑定
|
||||
*/
|
||||
// 删除角色和组件的绑定
|
||||
this.baseMapper.deleteComponentRole(ids);
|
||||
return this.lambdaUpdate().set(Role::getState, DataStateEnum.DELETED.getCode()).in(Role::getId, ids).update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean selectRelevance(List<String> ids) {
|
||||
/**
|
||||
* 判断角色是否和用户绑定
|
||||
*/
|
||||
// 判断角色是否和用户绑定
|
||||
List<UserRole> userRoleList = this.userRoleMapper.selectUserRole(ids);
|
||||
/**
|
||||
* 判断角色是否和资源绑定
|
||||
*/
|
||||
// 判断角色是否和资源绑定
|
||||
List<RoleFunction> roleFunctionList = this.roleFunctionMapper.selectRoleFunction(ids);
|
||||
/**
|
||||
* 判断角色是否和组件绑定
|
||||
*/
|
||||
// 判断角色是否和组件绑定
|
||||
List<RoleComponent> roleComponentList = this.roleComponentMapper.selectRoleComponet(ids);
|
||||
|
||||
if (userRoleList.size() > 0 || roleComponentList.size() > 0 || roleFunctionList.size() > 0) {
|
||||
if (!userRoleList.isEmpty() || !roleComponentList.isEmpty() || !roleFunctionList.isEmpty()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,10 +2,7 @@ package com.njcn.user.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.njcn.user.mapper.UserMapper;
|
||||
import com.njcn.user.mapper.UserRoleMapper;
|
||||
import com.njcn.user.pojo.po.Role;
|
||||
import com.njcn.user.pojo.po.UserRole;
|
||||
@@ -58,7 +55,7 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
||||
public boolean updateUserRole(String id, List<String> roles) {
|
||||
//删除原有关系
|
||||
List<String> userRoleList= this.lambdaQuery().eq(UserRole::getUserId, id).list().stream().map(UserRole::getRoleId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<UserRole> lambdaQuery = Wrappers.<UserRole>lambdaQuery();
|
||||
LambdaQueryWrapper<UserRole> lambdaQuery = Wrappers.lambdaQuery();
|
||||
if (!CollectionUtils.isEmpty(userRoleList)){
|
||||
lambdaQuery.eq(UserRole::getUserId, id).in(UserRole::getRoleId,userRoleList);
|
||||
userRoleMapper.delete(lambdaQuery);
|
||||
@@ -70,29 +67,6 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
||||
userRole.setRoleId(role);
|
||||
this.save(userRole);
|
||||
});
|
||||
// //查出原有的关系
|
||||
// List<String> userRoleList= this.lambdaQuery().eq(UserRole::getUserId, id).list().stream().map(UserRole::getRoleId).collect(Collectors.toList());
|
||||
// //存储共有的集合
|
||||
// List<String> allRole = roles.stream().filter(userRoleList::contains).collect(Collectors.toList());
|
||||
// userRoleList.removeAll(allRole);
|
||||
// //要删除的的集合
|
||||
// Set<String> deleteRole = new HashSet<>(userRoleList);
|
||||
// roles.removeAll(allRole);
|
||||
// //要新增的集合
|
||||
// Set<String> addRole = new HashSet<>(roles);
|
||||
// LambdaQueryWrapper<UserRole> lambdaQuery = Wrappers.<UserRole>lambdaQuery();
|
||||
// if (!CollectionUtils.isEmpty(deleteRole)){
|
||||
// lambdaQuery.eq(UserRole::getUserId, id).in(UserRole::getRoleId,deleteRole);
|
||||
// userRoleMapper.delete(lambdaQuery);
|
||||
// }
|
||||
// if (!CollectionUtils.isEmpty(addRole)){
|
||||
// addRole.forEach(role->{
|
||||
// UserRole userRole = new UserRole();
|
||||
// userRole.setUserId(id);
|
||||
// userRole.setRoleId(role);
|
||||
// this.save(userRole);
|
||||
// });
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.redis.core.BoundHashOperations;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -90,9 +89,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
// private final PqsTerminalLogsClient pqsTerminalLogsClient;
|
||||
|
||||
private final AreaFeignClient areaFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
@@ -184,7 +182,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addUser(UserParam.UserAddParam addUserParam) {
|
||||
/**
|
||||
/*
|
||||
* 检查注册用户的数据是否有重复
|
||||
* 1.登录名不能相同
|
||||
* 2.手机号不能相同 但手机号可以不填
|
||||
@@ -205,21 +203,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
//获取用户信息
|
||||
String userName = RequestUtil.getUsername();
|
||||
String index = RequestUtil.getUserIndex();
|
||||
//String userName = "业务管理员";
|
||||
//String index = "1234567";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(userName).append("新增了").append(user.getName()).append("用户");
|
||||
String describe = userName + "新增了" + user.getName() + "用户";
|
||||
HttpResult<DictData> dicDataByCode = dicDataFeignClient.getDicDataByCode(DicDataEnum.WEB_ADD.getCode());
|
||||
DictData data = dicDataByCode.getData();
|
||||
//创建对象
|
||||
PqsTerminalLogs terminalLogsNew = new PqsTerminalLogs();
|
||||
terminalLogsNew.setObjIndex(user.getId());
|
||||
terminalLogsNew.setTerminalDescribe(sb.toString());
|
||||
terminalLogsNew.setTerminalDescribe(describe);
|
||||
terminalLogsNew.setCreateBy(index);
|
||||
terminalLogsNew.setCreateTime(LocalDateTime.now());
|
||||
terminalLogsNew.setTerminalType(data.getId());
|
||||
terminalLogsNew.setState(1);
|
||||
// pqsTerminalLogsClient.saveLogs(terminalLogsNew);
|
||||
terminalLogsNew.setState(DataStateEnum.ENABLE.getCode());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -296,9 +290,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
} else if (Objects.equals(UserType.ADMINISTRATOR, type) && !Objects.equals(user.getLoginName(), "njcnyw")) {
|
||||
type = UserType.USER;
|
||||
}
|
||||
// else if (Objects.equals(UserType.ADMINISTRATOR, type) && Objects.equals(user.getLoginName(), "njcnyw")) {
|
||||
// type = UserType.APP;
|
||||
// }
|
||||
else if (Objects.equals(UserType.USER, type) || Objects.equals(UserType.APP, type)) {
|
||||
return page;
|
||||
}
|
||||
@@ -490,8 +481,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
Role roleByCode = roleService.getRoleByCode(AppRoleEnum.MARKET_USER.getCode());
|
||||
List<UserRole> userRoles = userRoleMapper.selectUserRole(Stream.of(roleByCode.getId()).collect(Collectors.toList()));
|
||||
List<String> collect = userRoles.stream().map(UserRole::getUserId).collect(Collectors.toList());
|
||||
List<User> users = this.listByIds(collect);
|
||||
return users;
|
||||
return this.listByIds(collect);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -509,10 +499,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
|
||||
@Override
|
||||
public boolean updateAppUser(UserInfoParm userInfoParm) {
|
||||
boolean update = this.lambdaUpdate().eq(User::getId, RequestUtil.getUserIndex()).
|
||||
return this.lambdaUpdate().eq(User::getId, RequestUtil.getUserIndex()).
|
||||
set(StringUtils.isNotBlank(userInfoParm.getName()), User::getName, userInfoParm.getName()).
|
||||
set(StringUtils.isNotBlank(userInfoParm.getHeadSculpture()), User::getHeadSculpture, userInfoParm.getHeadSculpture()).update();
|
||||
return update;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -560,8 +549,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<UserVO> userVOList = this.baseMapper.getUserVOByIdList(ids);
|
||||
return userVOList;
|
||||
return this.baseMapper.getUserVOByIdList(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -727,7 +715,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
||||
*
|
||||
* @param addUserParam 新增用户信息
|
||||
* @param userSet 用户配置信息
|
||||
* @return
|
||||
*/
|
||||
private User cloneUserBoToUser(UserParam.UserAddParam addUserParam, UserSet userSet) {
|
||||
User user = new User();
|
||||
|
||||
@@ -112,9 +112,8 @@ public class UserSetServiceImpl extends ServiceImpl<UserSetMapper, UserSet> impl
|
||||
|
||||
/**
|
||||
* 修改密码公共方法
|
||||
* @param id
|
||||
* @param password
|
||||
* @return
|
||||
* @param id 用户id
|
||||
* @param password 密码
|
||||
*/
|
||||
private String updatePsd(String id, String password,Boolean result) {
|
||||
Sm4Utils sm4;
|
||||
@@ -184,7 +183,7 @@ public class UserSetServiceImpl extends ServiceImpl<UserSetMapper, UserSet> impl
|
||||
*/
|
||||
private String getSecretPassword(String password) {
|
||||
String loginName = RequestUtil.getUsername();
|
||||
String ip = RequestUtil.getRequest().getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP);
|
||||
String ip = Objects.requireNonNull(RequestUtil.getRequest()).getHeader(SecurityConstants.REQUEST_HEADER_KEY_CLIENT_REAL_IP);
|
||||
String privateKey = redisUtil.getStringByKey(loginName + ip);
|
||||
//秘钥用完即删
|
||||
redisUtil.delete(loginName + ip);
|
||||
|
||||
@@ -99,7 +99,6 @@ public class SmsUtil {
|
||||
* @param param 短信模板中定义的参数名称
|
||||
* @param value 参数实际值
|
||||
* @return sendSmsResponse 发送消息结果
|
||||
* @throws ClientException
|
||||
*/
|
||||
public SendSmsResponse sendSms(String phone, String template, String param, String value) throws ClientException {
|
||||
System.setProperty(DEFAULTCONNECTTIMEOUT, message.getTime());
|
||||
|
||||
Reference in New Issue
Block a user