Commit b8cbe22a authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.7.7' into MVP1.7.7

parents a473f29e 4a046d41
......@@ -18,4 +18,5 @@ public class EmpProjectStatusVo implements Serializable {
private String empIdcard;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
private LocalDateTime projectTime;
private String empProjectId;
}
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysCspDeptVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectBelongDeptService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectScpVO;
......@@ -29,6 +30,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -98,6 +100,7 @@ public class TEmployeeProjectBelongDeptController {
}
if (Common.isEmpty(tEmployeeProjectBelongDept.getEmpDeptid())) {
tEmployeeProjectBelongDeptService.removeById(tEmployeeProjectBelongDept.getId());
return R.ok(CommonConstants.SAVE_SUCCESS);
} else if (Common.isEmpty(tEmployeeProjectBelongDept.getEmpDeptname())) {
return R.failed("所属部门名称必填");
}
......@@ -182,4 +185,17 @@ public class TEmployeeProjectBelongDeptController {
return R.ok(tEmployeeProjectBelongDeptService.getNoneDeptCount(tEmployeeProjectBelongDept));
}
/**
* @Author huych
* @Description 根据项目id和用户id查询csp部门信息
* @Date 14:27 2025/3/10
* @Param
* @return
**/
@Inner
@PostMapping("/inner/saveOrDeleteDeptRelation")
public R<Boolean> saveOrDeleteDeptRelation(@RequestBody SysCspDeptVo vo) {
return R.ok(tEmployeeProjectBelongDeptService.saveOrDeleteDeptRelation(vo));
}
}
......@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysCspDeptVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectScpVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeProjectBelongDeptSearchVo;
......@@ -76,4 +77,6 @@ public interface TEmployeeProjectBelongDeptService extends IService<TEmployeePro
*/
Integer getNoneDeptCount(TEmployeeProjectBelongDeptSearchVo tEmployeeProjectBelongDept);
Boolean saveOrDeleteDeptRelation(SysCspDeptVo vo);
}
......@@ -22,6 +22,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysCspDeptVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectBelongDeptMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectBelongDeptService;
......@@ -81,6 +82,9 @@ public class TEmployeeProjectBelongDeptServiceImpl extends ServiceImpl<TEmployee
if (Common.isNotNull(tEmployeeProjectBelongDept.getEmpDeptId()) && !"-1".equals(tEmployeeProjectBelongDept.getEmpDeptId())) {
tEmployeeProjectBelongDept.setEmpDeptIdArray(tEmployeeProjectBelongDept.getEmpDeptId().split(","));
}
if (Common.isEmpty(tEmployeeProjectBelongDept.getEmpDeptId())) {
tEmployeeProjectBelongDept.setEmpDeptId("不查数据");
}
}
/**
......@@ -191,4 +195,18 @@ public class TEmployeeProjectBelongDeptServiceImpl extends ServiceImpl<TEmployee
public Integer getNoneDeptCount(TEmployeeProjectBelongDeptSearchVo tEmployeeProjectBelongDept) {
return baseMapper.getNoneDeptCount(tEmployeeProjectBelongDept);
}
@Override
public Boolean saveOrDeleteDeptRelation(SysCspDeptVo vo) {
if (Common.isNotNull(vo.getDepartName())) {
TEmployeeProjectBelongDept dept = new TEmployeeProjectBelongDept();
dept.setId(vo.getProjectId());
dept.setEmpDeptid(vo.getDepartId().toString());
dept.setEmpDeptname(vo.getDepartName());
this.save(dept);
} else {
this.removeById(vo.getProjectId());
}
return true;
}
}
......@@ -152,9 +152,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getEmpIdcard, vo.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, vo.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT).last(CommonConstants.LAST_ONE_SQL));
.and(obj -> obj.ne(TEmployeeProject::getProjectSource, CommonConstants.ONE_STRING)
.or().eq(TEmployeeProject::getProjectSource, CommonConstants.ONE_STRING)
.eq(TEmployeeProject::getStatus, CommonConstants.ONE_INT))
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(employeeProject)) {
vo.setProjectTime(employeeProject.getCreateTime());
vo.setEmpProjectId(employeeProject.getId());
return vo;
}
return null;
......@@ -169,6 +173,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ONE_INT).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(employeeProject)) {
vo.setProjectTime(employeeProject.getLeaveTime());
vo.setEmpProjectId(employeeProject.getId());
return vo;
}
return null;
......
......@@ -36,9 +36,15 @@
<if test="tEmployeeProjectBelongDept.deptId != null and tEmployeeProjectBelongDept.deptId.trim() != ''">
AND a.DEPT_ID = #{tEmployeeProjectBelongDept.deptId}
</if>
<if test="tEmployeeProjectBelongDept.empDeptId != null and tEmployeeProjectBelongDept.empDeptId.trim() != ''
and tEmployeeProjectBelongDept.empDeptId.trim() == '-1'">
AND b.id is null
<if test="tEmployeeProjectBelongDept.empDeptId != null and tEmployeeProjectBelongDept.empDeptId.trim() != ''">
<if test="tEmployeeProjectBelongDept.empDeptId.trim() == '-1'">
/* 查询未关联的 */
AND b.id is null
</if>
<if test="tEmployeeProjectBelongDept.empDeptId.trim() == '不查数据'">
/* 不查数据 */
AND b.id = '不查数据'
</if>
</if>
<if test="tEmployeeProjectBelongDept.empName != null and tEmployeeProjectBelongDept.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{tEmployeeProjectBelongDept.empName},'%')
......
......@@ -886,7 +886,7 @@
FROM t_employee_project a left join t_employee_info b on a.EMP_ID = b.id
where
a.DELETE_FLAG = '0' and a.DEPT_NO = #{tEmployeeProject.deptNo}
and a.PROJECT_STATUS = 0
and ((a.PROJECT_SOURCE = '1' and a.STATUS = 1) or a.PROJECT_SOURCE != '1')
<if test="tEmployeeProject.empIdcard != null and tEmployeeProject.empIdcard.trim() != ''">
AND (a.EMP_IDCARD like concat('%',#{tEmployeeProject.empIdcard},'%') or a.EMP_NAME like concat('%',#{tEmployeeProject.empIdcard}))
</if>
......
......@@ -2,6 +2,7 @@ package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysCspDeptVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TBusinessEmployeeExtendInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
......@@ -518,4 +519,15 @@ public class ArchivesDaprUtil {
public R<Boolean> selectExitEmpProject(TInsuranceUnpurchasePersonCardVo cardVo) {
return HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/temployeeproject/inner/selectExitEmpProject", JSON.toJSONString(cardVo), Boolean.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 新增或者删除项目档案与所属部门的关联表
* @Date 17:07 2025/3/10
* @Param
* @return
**/
public R<Boolean> saveOrDeleteDeptRelation(SysCspDeptVo vo) {
return HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/temployeeprojectbelongdept/inner/saveOrDeleteDeptRelation", JSON.toJSONString(vo), Boolean.class, SecurityConstants.FROM_IN);
}
}
package com.yifu.cloud.plus.v1.yifu.common.dapr.util;
import com.alibaba.fastjson.JSON;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
......@@ -129,4 +130,15 @@ public class UpmsDaprUtils {
public R<Boolean> selectExitDeptCompany(String deptId) {
return HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(),"/user/inner/selectExitDeptCompany", deptId, Boolean.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 判断部门是否属于分公司
* @Date 10:38 2025/1/20
* @Param
* @return
**/
public R<SysCspDeptVo> selectCspDeptByUserDeptId(SysCspDeptVo vo) {
return HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(),"/user/inner/selectInnerCspDeptByUserDeptId", vo, SysCspDeptVo.class, SecurityConstants.FROM_IN);
}
}
......@@ -98,6 +98,10 @@ public class EmployeeRegistration extends BaseEntity {
@TableField(exist = false)
private int outNum;
@Schema(description = "项目档案id")
@TableField(exist = false)
private String empProjectId;
}
......@@ -17,7 +17,7 @@ import java.util.Date;
* @date 2025-02-25 14:48:11
*/
@Data
@ColumnWidth(15)
@ColumnWidth(17)
public class EmployeeRegistrationExportVo implements Serializable {
@ExcelAttribute(name = "员工姓名")
......
......@@ -17,7 +17,7 @@ import java.util.Date;
* @date 2025-02-25 14:48:11
*/
@Data
@ColumnWidth(15)
@ColumnWidth(17)
public class EmployeeRegistrationHrExportVo implements Serializable {
@ExcelAttribute(name = "项目编码")
......
......@@ -24,6 +24,7 @@ import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationHrExportVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationSearchVo;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysCspDeptVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpProjectStatusVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeProjectBelongDeptSearchCspVo;
......@@ -372,7 +373,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
exit = getOutEmpProjectStatus(vo);
}
if (Common.isNotNull(exit)) {
return R.ok(exit.getProjectTime());
return R.ok(exit);
}
registrationNow.setProcessStatus(CommonConstants.ZERO_STRING);
baseMapper.updateById(registrationNow);
......@@ -393,6 +394,13 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.MESSAGE_FINISH, registration.getProjectCreateTime(),
user.getNickname(),CommonConstants.ONE_STRING.equals(registrationNow.getFeedbackType())
? RegistConstants.BEFORE_IN_PROJECT :RegistConstants.BEFORE_OUT_PROJECT);
SysCspDeptVo vo = new SysCspDeptVo();
if (CommonConstants.ONE_STRING.equals(registrationNow.getFeedbackType())) {
vo.setDepartName(registrationNow.getEmpDeptname());
vo.setDepartId(Long.valueOf(registrationNow.getEmpDeptid()));
}
vo.setProjectId(registration.getEmpProjectId());
archivesDaprUtil.saveOrDeleteDeptRelation(vo);
baseMapper.updateById(registrationNow);
return R.ok();
}
......@@ -459,12 +467,26 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
//数据初始化
private void initRegistInfo(EmployeeRegistration insert,YifuUser user,TSettleDomainSelectVo selectVo) {
insert.setRegistorDeptname(user.getDeptName());
insert.setRegistorDeptid(user.getDeptId().toString());
SysCspDeptVo vo = new SysCspDeptVo();
vo.setUserId(user.getId());
vo.setProjectId(selectVo.getId());
R<SysCspDeptVo> booleanR = upmsDaprUtils.selectCspDeptByUserDeptId(vo);
log.info("SysCsp:" + booleanR + "ProjectId:" + selectVo.getId() + "userId:" + user.getId());
if (Common.isNotNull(booleanR) && Common.isNotNull(booleanR.getData())
&& Common.isNotNull(booleanR.getData().getDepartId()) && Common.isNotNull(booleanR.getData().getDepartName())) {
vo = booleanR.getData();
insert.setRegistorDeptname(vo.getDepartName());
insert.setRegistorDeptid(vo.getDepartId().toString());
insert.setEmpDeptid(vo.getDepartId().toString());
insert.setEmpDeptname(vo.getDepartName());
} else {
insert.setRegistorDeptname(user.getDeptName());
insert.setRegistorDeptid(user.getDeptId().toString());
insert.setEmpDeptid(user.getDeptId().toString());
insert.setEmpDeptname(user.getDeptName());
}
insert.setRegistorUsername(user.getNickname());
insert.setRegistorPhone(user.getPhone());
insert.setEmpDeptid(user.getDeptId().toString());
insert.setEmpDeptname(user.getDeptName());
insert.setCustomerPhone(selectVo.getCsPhone());
insert.setCustomerUsername(selectVo.getCsName());
insert.setCustomerUserLoginname(selectVo.getCsLoginName());
......@@ -606,7 +628,11 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
if (Common.isNotNull(authority) && !authority.isHaveAll()) {
searchVo.setDepartIdSet(authority.getDepartIdSet());
if (Common.isNotNull(authority.getDepartIdSet())) {
searchVo.setDepartIdSet(authority.getDepartIdSet());
} else {
searchVo.setId(CommonConstants.ONE_STRING_NEGATE);
}
}
}
}
......
package com.yifu.cloud.plus.v1.yifu.admin.api.vo;
import lombok.Data;
/**
* csp部门信息
*
* @author huych
* @since 1.9.7
*/
@Data
public class SysCspDeptVo {
/**
* 部门名称
*/
private String departName;
/**
* 部门id
*/
private Long departId;
/**
* 用户id
*/
private String userId;
/**
* 项目id
*/
private String projectId;
}
......@@ -665,4 +665,29 @@ public class UserController {
@RequestParam(required = false) String nickname) {
return userService.cspUserPage(page, deptId,username,nickname);
}
/**
* @Author huych
* @Description 根据项目id和用户id查询csp部门信息
* @Date 14:27 2025/3/10
* @Param
* @return
**/
@Inner
@PostMapping("/inner/selectInnerCspDeptByUserDeptId")
public SysCspDeptVo selectInnerCspDeptByUserDeptId(@RequestBody SysCspDeptVo vo) {
return userService.selectCspDeptByUserDeptId(vo);
}
/**
* @Author huych
* @Description 根据项目id和用户id查询csp部门信息
* @Date 14:27 2025/3/10
* @Param
* @return
**/
@PostMapping("/selectCspDeptByUserDeptId")
public R<SysCspDeptVo> selectCspDeptByUserDeptId(@RequestBody SysCspDeptVo vo) {
return R.ok(userService.selectCspDeptByUserDeptId(vo));
}
}
......@@ -51,6 +51,8 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
List<SysDept> getDeptListByDeptId(@Param("deptIdSplit") String deptIdSplit, @Param("deptId") Long deptId);
List<SysDept> getDeptListByDeptIdSet(@Param("departIdSet") Set<String> departIdSet);
/**
* 客户服务平台——查询部门管理数据
*
......
......@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.yifu.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUserDeptPermission;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysCspDeptVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -36,4 +37,6 @@ public interface SysUserDeptPermissionMapper extends BaseMapper<SysUserDeptPermi
List<SysUserDeptPermission> getUserDeptPermissionList(@Param("userId")String userId);
SysCspDeptVo selectCasDeptVo(@Param("userId") String userId, @Param("projectId") String projectId);
}
......@@ -18,6 +18,7 @@ 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.SysCspDeptVo;
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;
......@@ -64,4 +65,6 @@ public interface SysUserDeptPermissionService extends IService<SysUserDeptPermis
R<Boolean> updateByIdAsso(UserCspVO entity);
R<Boolean> removeUserDeptPermissionById(String userId, String projectNo);
SysCspDeptVo selectCasDeptVo(String userId, String projectId);
}
......@@ -23,10 +23,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserDTO;
import com.yifu.cloud.plus.v1.yifu.admin.api.dto.UserInfo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.BusinessUserVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserExcelVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserPasswordVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult;
......@@ -215,4 +212,6 @@ public interface SysUserService extends IService<SysUser> {
R<IPage<SysUser>> cspUserPage(Page page, String deptId, String userName, String nickName);
SysCspDeptVo selectCspDeptByUserDeptId(SysCspDeptVo vo);
}
......@@ -345,6 +345,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
// 获取用户部门集合
Set<String> allDepartIdSet = new HashSet<>();
Set<String> departIdSet = authority.getDepartIdSet();
if(Common.isEmpty(departIdSet)){
return cspDeptTree;
}
List<SysDeptVo> deptVoList = baseMapper.cspDeptListByDeptIdSet(dept, departIdSet);
if(Common.isNotNull(deptVoList)){
// 将指定部门和祖级部门都存到一个集合里
......@@ -629,7 +632,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
List<DeptSortVo> moveVos = dept.getDeptSortList();
baseMapper.batchUpdateSort(moveVos);
// 清理用户权限
// List<String> userNames = sysUserMapper.getCspUserByDeptId(dept.getDeptId());
List<String> userNames = sysUserMapper.getCspUserByProjectNo(updateEntity.getProjectNo());
if (Common.isNotNull(userNames)){
for (String us:userNames){
......
......@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept;
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.SysCspDeptVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.UserCspVO;
import com.yifu.cloud.plus.v1.yifu.admin.constants.UserDeptPermConstants;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDeptMapper;
......@@ -217,16 +218,22 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer
if (CommonConstants.ZERO_STRING.equals(tPermissionInfo.getPermissionsType())) {
// 全部数据
authority.setHaveAll(true);
// redisUtil.set(CacheConstants.PROJECT_USER_PERMISSION + projectNoStr +"_"+ userId, authority);
} else if (CommonConstants.THREE_STRING.equals(tPermissionInfo.getPermissionsType())) {
// 指定部门权限
if (Common.isNotKong(tPermissionInfo.getAppointDeptScope())) {
authority.setHaveAll(false);
String[] appointDeptIdArr = tPermissionInfo.getAppointDeptScope().split(CommonConstants.COMMA_STRING);
Set<String> appointDeptIdSet = Arrays.stream(appointDeptIdArr).collect(Collectors.toSet());
authority.setDepartIdSet(appointDeptIdSet);
// 过滤被删除的数据
sysDeptList = sysDeptMapper.getDeptListByDeptIdSet(appointDeptIdSet);
Set<String> normalDeptIdSet = new HashSet<>();
if(Common.isNotNull(sysDeptList)){
for(SysDept dept : sysDeptList){
normalDeptIdSet.add(dept.getDeptId().toString());
}
}
authority.setDepartIdSet(normalDeptIdSet);
authority.setUserId(userId);
// redisUtil.set(CacheConstants.PROJECT_USER_PERMISSION + projectNoStr +"_"+ userId, authority);
} else {
log.error("获取用户权限失败,该用户指定部门权限为空{}", userId);
authority.setHaveAll(false);
......@@ -408,4 +415,9 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer
}
return R.failed(Boolean.FALSE,CommonConstants.RESULT_DATA_FAIL);
}
@Override
public SysCspDeptVo selectCasDeptVo(String userId, String projectId) {
return baseMapper.selectCasDeptVo(userId,projectId);
}
}
......@@ -1012,4 +1012,16 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return R.ok(baseMapper.cspUserPage(page,deptId,userName,nickName,dept.getProjectNo()));
}
@Override
public SysCspDeptVo selectCspDeptByUserDeptId(SysCspDeptVo vo) {
SysCspDeptVo returnVo = userDeptPermissionService.selectCasDeptVo(vo.getUserId(),vo.getProjectId());
if (Common.isNotNull(returnVo) && Common.isNotNull(returnVo.getDepartName()) && Common.isNotNull(returnVo.getDepartId())) {
vo.setDepartName(returnVo.getDepartName());
vo.setDepartId(returnVo.getDepartId());
} else {
return null;
}
return vo;
}
}
......@@ -63,6 +63,23 @@
and (dept_id = #{deptId} or ancestors like concat(#{deptIdSplit}, '%'))
</select>
<select id="getDeptListByDeptIdSet" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept">
select
dept_id as deptId,
name as deptName
from
sys_dept
where
del_flag = '0'
<if test="departIdSet != null and departIdSet.size > 0">
AND dept_id in
<foreach item="idStr" index="index" collection="departIdSet" open="(" separator=","
close=")">
#{idStr}
</foreach>
</if>
</select>
<select id="cspDeptList" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo">
select d.dept_id, d.name, d.parent_id,d.ancestors,sort_order
from sys_dept d
......
......@@ -59,4 +59,14 @@
FROM sys_user_dept_permission a
WHERE a.user_id = #{userId}
</select>
<select id="selectCasDeptVo" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysCspDeptVo">
SELECT
b.name as departName,
a.dept_id as departId
FROM sys_user_dept_permission a
inner join sys_dept b on a.dept_id = b.dept_id
WHERE a.user_id = #{userId} and a.project_id = #{projectId}
limit 1
</select>
</mapper>
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