Commit 4a3e1500 authored by fangxinjiang's avatar fangxinjiang

登录服务相关调整-fxj

parent 7c44e233
......@@ -89,7 +89,7 @@ public class FileUploadServiceImpl implements FileUploadService {
true,
"1", authorities, "1",
null, null,
null);
null,null);
attaInfo.setCreateBy(user.getId());
attaInfo.setCreateName(user.getNickname());
attaInfo = tAttaInfoService.add(attaInfo);
......
......@@ -1719,7 +1719,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
true,
"1", authorities, "1",
null, null,
null);
null,null);
}
/**
......
......@@ -117,7 +117,7 @@ public class YifuTokenEndpoint {
CommonConstants.STATUS_NORMAL.equals(user.getLockFlag()),
user.getUserGroup(),authorities, user.getLdapDn(),
info.getClientRoleMap(),info.getSettleIdList(),
user.getType());
user.getType(),info.getCspPermMap());
thisUser.setClientRoleMap(info.getClientRoleMap());
return thisUser;
}
......
......@@ -5,6 +5,8 @@ import cn.hutool.core.util.CharsetUtil;
import cn.hutool.http.HttpStatus;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.yifu.cloud.plus.v1.yifu.auth.constants.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......
......@@ -597,7 +597,7 @@ public class TCheckIdCardServiceImpl extends ServiceImpl<TCheckIdCardMapper, TCh
true,
"1", authorities, "1",
null, null,
null);
null,null);
// 调用以前的批量校验
R<List<TCheckIdCard>> returnR = this.checkSalaryIdCard(list, user);
if (returnR != null) {
......
package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
package com.yifu.cloud.plus.v1.yifu.common.core.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
......@@ -33,7 +32,13 @@ public class UserPermissionVo implements Serializable {
* 用户ID
*/
private String userId;
/**
* 关联项目编码 fxj 2025-02-25
*/
private String projectNo;
private Map<String,UserPermissionVo> permissionVoMap;
/**
* 关联项目名称 fxj 2025-02-25
*/
private String projectName;
}
......@@ -92,9 +92,18 @@ public class YifuUser extends User {
@Getter
@Setter
private List<String> settleIdList;
/**
* @Author fxj
* @Description 客户服务平台 项目权限及项目对应的数据权限
* @Date 14:48 2025/2/25
**/
@Getter
@Setter
private List<UserPermissionVo> cspPermMap;
/**
* @Author fxj
* @Description 员工类型
* @Description 员工类型 0 系统用户 1 LDAP用户 2 B端用户 3.微信用户 默认系统用户 4.甲方客户端
**/
@Getter
private String type;
......@@ -104,7 +113,8 @@ public class YifuUser extends User {
boolean credentialsNonExpired, boolean accountNonLocked,
String userGroup, Collection<? extends GrantedAuthority> authorities, String ldapDn,
Map<String, List<Long>> clientRoleMap,
List<String> settleIdList,String type) {
List<String> settleIdList,String type,
List<UserPermissionVo> cspPermMap) {
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
this.id = id;
this.deptId = deptId;
......@@ -117,5 +127,6 @@ public class YifuUser extends User {
this.clientRoleMap=clientRoleMap;
this.settleIdList=settleIdList;
this.type=type;
this.cspPermMap=cspPermMap;
}
}
......@@ -94,6 +94,6 @@ public class WxUserDetailService implements UserDetailsService {
user.getPhone(), true, true, true,
StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL),
user.getUserGroup(),authorities, user.getLdapDn(),info.getClientRoleMap(),
info.getSettleIdList(),user.getType());
info.getSettleIdList(),user.getType(),null);
}
}
......@@ -72,7 +72,7 @@ public interface YifuUserDetailsService extends UserDetailsService, Ordered {
user.getPhone(), true, true, true,
StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL),
user.getUserGroup(),authorities, user.getLdapDn(),info.getClientRoleMap(),
info.getSettleIdList(),user.getType());
info.getSettleIdList(),user.getType(),info.getCspPermMap());
}
/**
......
......@@ -53,10 +53,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-core</artifactId>
</dependency>
</dependencies>
......
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.api.dto;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysPost;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo;
import lombok.Data;
import java.io.Serializable;
......@@ -76,4 +77,11 @@ public class UserInfo implements Serializable {
* @Date 13:53 2023/1/3
**/
private List<String> settleIdList;
/**
* @Author fxj
* @Description 客户服务平台 项目权限及项目对应的数据权限
* @Date 14:48 2025/2/25
**/
private List<UserPermissionVo> cspPermMap;
}
......@@ -23,6 +23,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
/**
* 项目下用户部门及权限
*
......@@ -39,18 +41,26 @@ public class SysUserDeptPermission extends Model<SysUserDeptPermission> {
@Schema(description = "主键id")
private String id;
@NotBlank(message = "用户id 不能为空")
@Schema(description = "用户id")
private String userId;
@NotBlank(message = "部门id 不能为空")
@Schema(description = "部门id")
private Long deptId;
@NotBlank(message = "关联项目编码 不能为空")
@Schema(description = "关联项目编码")
private String projectNo;
@NotBlank(message = "关联项目名称 不能为空")
@Schema(description = "关联项目名称")
private String projectName;
@Schema(description = "归属系统 0 mvp 1 甲方客户端")
private String client;
@NotBlank(message = "账号类型 不能为空")
@Schema(description = "账号类型:0 管理员, 1 普通成员")
private String userType;
......
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysPost;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author lengleng
* @date 2019/2/1
*/
@Data
public class UserCspVO extends SysUser implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户Id
*/
private String userId;
/**
* 用户名
*/
@NotBlank(message = "用户名 不能为空")
private String username;
/**
* 用户昵称
*/
@NotBlank(message = "用户昵称 不能为空")
private String nickname;
/**
* 手机号码
*/
@NotBlank(message = "手机号码 不能为空")
private String phone;
/**
* 部门ID
*/
@NotBlank(message = "部门ID 不能为空")
private Long deptId;
//关系表数据开始
@NotBlank(message = "关联项目编码 不能为空")
@Schema(description = "关联项目编码")
private String projectNo;
@NotBlank(message = "关联项目名称 不能为空")
@Schema(description = "关联项目名称")
private String projectName;
@Schema(description = "归属系统 0 mvp 1 甲方客户端")
private String client;
@NotBlank(message = "账号类型 不能为空")
@Schema(description = "账号类型:0 管理员, 1 普通成员")
private String userType;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.admin.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.icbc.api.request.ErrorHandlingProRequestV1;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUserDeptPermission;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.HcmRoleInfoVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserCspVO;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleMenuService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserDeptPermissionService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @Author fxj
* @Description 客户服务平台 账号 部门 项目 关系表
* @Date 18:38 2025/2/25
* @Param
* @return
**/
@RestController
@RequiredArgsConstructor
@RequestMapping("/userDeprtPermission")
@Tag(name = "客户服务平台账号授权")
public class SysUserDeptPermissionController {
private final SysUserDeptPermissionService sysUserDeptPermissionService;
private final SysUserService sysUserService;
/**
* 新增
* @Description 新增用户
* @return success、false
*/
@SysLog("新增用户")
@PostMapping("add")
public R<Boolean> save(@Valid @RequestBody UserCspVO entity) {
long check = sysUserDeptPermissionService.count(Wrappers.<SysUserDeptPermission>query().lambda()
.eq(SysUserDeptPermission::getProjectNo,entity.getProjectNo())
.eq(SysUserDeptPermission::getUserId,entity.getUserId()));
if ( check > CommonConstants.ZERO_INT) {
return R.failed("已存在对应账户数据,请勿重复配置!");
}
long count = sysUserService.count(Wrappers.<SysUser>query().lambda()
.eq(SysUser::getUsername,entity.getUsername())
.eq(SysUser::getDelFlag, CommonConstants.ZERO_STRING));
if ( count > CommonConstants.ZERO_INT) {
return R.failed("已存在对应用户数据,请勿重复配置!");
}
return sysUserDeptPermissionService.saveAsso(entity);
}
/**
* 收回用户
* @param entity 角色信息
* @return success/false
*/
@SysLog("修改用户")
@PostMapping("/update")
public R<Boolean> update(@Valid @RequestBody UserCspVO entity) {
return sysUserDeptPermissionService.updateByIdAsso(entity);
}
/**
* 收回用户
* @param userId
* @return
*/
@SysLog("删除角色")
@DeleteMapping("/{userId}")
public R<Boolean> removeById(@PathVariable int userId) {
return sysUserDeptPermissionService.removeUserDeptPermissionById(userId);
}
}
......@@ -18,10 +18,14 @@ package com.yifu.cloud.plus.v1.yifu.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUserDeptPermission;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserPermissionVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserCspVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo;
import java.util.List;
import java.util.Map;
/**
* 项目下用户部门及权限
*
......@@ -47,4 +51,11 @@ public interface SysUserDeptPermissionService extends IService<SysUserDeptPermis
*/
Map<String, UserPermissionVo> getUserPermissionFlush(String userId);
List<UserPermissionVo> getUserPermission(String userId);
R<Boolean> saveAsso(UserCspVO entity);
R<Boolean> updateByIdAsso(UserCspVO entity);
R<Boolean> removeUserDeptPermissionById(int userId);
}
......@@ -36,6 +36,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.util.ParamResolver;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.*;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.*;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysMenuService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserDeptPermissionService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
......@@ -100,6 +101,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
private final PermissionDaprUtil permissionDaprUtil;
private final SysUserDeptPermissionService userDeptPermissionService;
@Value("${hrms.id}")
private String hcmId;
......@@ -186,6 +189,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
userInfo.setSettleIdList(sdRes.getData().getDeptIds());
}
userInfo.setClientRoleMap(clientRoleMap);
// 客户服务平台的项目权限及对应项目的数据权限
userInfo.setCspPermMap(userDeptPermissionService.getUserPermission(sysUser.getUserId()));
return userInfo;
}
/**
......
......@@ -6,8 +6,8 @@ spring:
activate:
on-profile: test
redis:
host: 192.168.1.65
port: 22379
host: 127.0.0.1
port: 6379
password: '@yf_2017'
datasource:
type: com.zaxxer.hikari.HikariDataSource
......
......@@ -24,6 +24,7 @@
<result column="user_id" property="userId"/>
<result column="dept_id" property="deptId"/>
<result column="project_no" property="projectNo"/>
<result column="project_name" property="projectName"/>
<result column="client" property="client"/>
<result column="user_type" property="userType"/>
<result column="permissions_type" property="permissionsType"/>
......@@ -35,6 +36,7 @@
a.user_id,
a.dept_id,
a.project_no,
a.project_name,
a.client,
a.user_type,
a.permissions_type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment