Commit 1e74e2d5 authored by hongguangwu's avatar hongguangwu

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

parents 5fa3b3eb 1bd9be40
...@@ -8,6 +8,7 @@ import lombok.Data; ...@@ -8,6 +8,7 @@ import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 入离职登记表 * 入离职登记表
...@@ -74,4 +75,8 @@ public class EmployeeRegistrationSearchVo extends EmployeeRegistration { ...@@ -74,4 +75,8 @@ public class EmployeeRegistrationSearchVo extends EmployeeRegistration {
@TableField(exist = false) @TableField(exist = false)
private List<String> typeList; private List<String> typeList;
@Schema(description = "部门权限数组")
@TableField(exist = false)
private Set<String> departIdSet;
} }
...@@ -7,7 +7,6 @@ import com.yifu.cloud.plus.v1.csp.service.EmployeeRegistrationService; ...@@ -7,7 +7,6 @@ import com.yifu.cloud.plus.v1.csp.service.EmployeeRegistrationService;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationSearchVo; import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeProjectBelongDeptSearchCspVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TEmployeeProjectBelongDeptSearchCspVo;
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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...@@ -52,6 +51,19 @@ public class EmployeeRegistrationController { ...@@ -52,6 +51,19 @@ public class EmployeeRegistrationController {
return new R<>(employeeRegistrationService.getEmployeeRegistrationPage(page, employeeRegistration)); return new R<>(employeeRegistrationService.getEmployeeRegistrationPage(page, employeeRegistration));
} }
/**
* 入离职登记表代办列表简单分页查询
*
* @param page 分页对象
* @param employeeRegistration 入离职登记表
* @return
*/
@Operation(description = "入离职登记表代办列表简单分页查询")
@GetMapping("/hrPage")
public R<IPage<EmployeeRegistration>> getHrEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration) {
return new R<>(employeeRegistrationService.getHrEmployeeRegistrationPage(page, employeeRegistration));
}
/** /**
* 通过id查询入离职登记表 * 通过id查询入离职登记表
* *
......
...@@ -28,6 +28,13 @@ public interface EmployeeRegistrationService extends IService<EmployeeRegistrati ...@@ -28,6 +28,13 @@ public interface EmployeeRegistrationService extends IService<EmployeeRegistrati
*/ */
IPage<EmployeeRegistration> getEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration); IPage<EmployeeRegistration> getEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration);
/**
* 入离职登记表简单分页查询
* @param employeeRegistration 入离职登记表
* @return
*/
IPage<EmployeeRegistration> getHrEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration);
/** /**
* 入离职登记表导入 * 入离职登记表导入
* @param inputStream 文件流 * @param inputStream 文件流
......
...@@ -31,6 +31,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo; ...@@ -31,6 +31,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
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.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties; import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
...@@ -50,10 +51,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -50,10 +51,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -92,6 +90,18 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -92,6 +90,18 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
*/ */
@Override @Override
public IPage<EmployeeRegistration> getEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration) { public IPage<EmployeeRegistration> getEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration) {
getDtpeAuth(employeeRegistration);
return baseMapper.getEmployeeRegistrationPage(page, employeeRegistration);
}
/**
* hr入离职登记表代办列表简单分页查询
*
* @param employeeRegistration 入离职登记表
* @return
*/
@Override
public IPage<EmployeeRegistration> getHrEmployeeRegistrationPage(Page<EmployeeRegistration> page, EmployeeRegistrationSearchVo employeeRegistration) {
return baseMapper.getEmployeeRegistrationPage(page, employeeRegistration); return baseMapper.getEmployeeRegistrationPage(page, employeeRegistration);
} }
...@@ -113,6 +123,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -113,6 +123,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8)); response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, EmployeeRegistrationExportVo.class).build(); ExcelWriter excelWriter = EasyExcel.write(out, EmployeeRegistrationExportVo.class).build();
getDtpeAuth(searchVo);
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) { for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
...@@ -447,10 +458,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -447,10 +458,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
if (sendUser != null) { if (sendUser != null) {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>(); Map<String, Object> requestMap = new HashMap<>();
String authUrl = null;
Map<String, Object> textcard = new HashMap<>(); Map<String, Object> textcard = new HashMap<>();
String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), "javascript:void(0)", "01"+registration.getId());
authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName()+"/auth/oauth/wxLogin", "01"+registration.getId());
StringBuilder description = new StringBuilder(); StringBuilder description = new StringBuilder();
String title = ""; String title = "";
if (CommonConstants.ONE_STRING.equals(type) || CommonConstants.TWO_STRING.equals(type)) { if (CommonConstants.ONE_STRING.equals(type) || CommonConstants.TWO_STRING.equals(type)) {
...@@ -545,4 +554,28 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -545,4 +554,28 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
return false; return false;
} }
/**
* @Description: 获取部门权限
* @Author: huych
* @Date: 2025/3/4 10:41
* @return:
**/
private void getDtpeAuth(EmployeeRegistrationSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser();
if (null != user && Common.isNotNull(user.getId())) {
List<UserPermissionVo> cspPermList = user.getCspPermMap();
if (Common.isNotNull(cspPermList)) {
// 获取用户在当前项目下的权限
UserPermissionVo authority = null;
for (UserPermissionVo userPermissionVo : cspPermList) {
if (searchVo.getDeptNo().equals(userPermissionVo.getProjectNo())) {
authority = userPermissionVo;
}
}
if (Common.isNotNull(authority) && !authority.isHaveAll()) {
searchVo.setDepartIdSet(authority.getDepartIdSet());
}
}
}
}
} }
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<result property="deptId" column="dept_id"/> <result property="deptId" column="dept_id"/>
<result property="customerPhone" column="customer_phone"/> <result property="customerPhone" column="customer_phone"/>
<result property="customerUsername" column="customer_username"/> <result property="customerUsername" column="customer_username"/>
<result property="customerUserLoginname" column="customer_user_loginname"/>
</resultMap> </resultMap>
<resultMap id="employeeRegistrationExportMap" type="com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationExportVo"> <resultMap id="employeeRegistrationExportMap" type="com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationExportVo">
...@@ -84,7 +85,8 @@ ...@@ -84,7 +85,8 @@
a.dept_id, a.dept_id,
a.dept_no, a.dept_no,
a.customer_username, a.customer_username,
a.customer_phone a.customer_phone,
a.customer_user_loginname
</sql> </sql>
<sql id="employeeRegistration_where"> <sql id="employeeRegistration_where">
<if test="employeeRegistration != null"> <if test="employeeRegistration != null">
...@@ -157,6 +159,19 @@ ...@@ -157,6 +159,19 @@
<if test="employeeRegistration.createName != null and employeeRegistration.createName.trim() != ''"> <if test="employeeRegistration.createName != null and employeeRegistration.createName.trim() != ''">
AND a.create_name = #{employeeRegistration.createName} AND a.create_name = #{employeeRegistration.createName}
</if> </if>
<if test="employeeRegistration.customerUserLoginname != null and employeeRegistration.customerUserLoginname.trim() != ''">
AND a.customer_user_loginname = #{employeeRegistration.customerUserLoginname}
</if>
<if test="employeeRegistration.deptNo != null and employeeRegistration.deptNo.trim() != ''">
AND a.dept_no = #{employeeRegistration.deptNo}
</if>
<if test="employeeRegistration.departIdSet != null and employeeRegistration.departIdSet.size > 0">
AND a.emp_deptid in
<foreach item="idStr" index="index" collection="employeeRegistration.departIdSet" open="(" separator=","
close=")">
#{idStr}
</foreach>
</if>
</if> </if>
</sql> </sql>
<!--employeeRegistration简单分页查询--> <!--employeeRegistration简单分页查询-->
......
...@@ -103,4 +103,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -103,4 +103,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
IPage<SysUser> cspUserPage(Page page, @Param("deptId")String deptId, @Param("userName")String userName, IPage<SysUser> cspUserPage(Page page, @Param("deptId")String deptId, @Param("userName")String userName,
@Param("nickName")String nickName, @Param("nickName")String nickName,
@Param("projectNo")String projectNo); @Param("projectNo")String projectNo);
List<String> getCspUserByDeptId(@Param("deptId")String deptId);
} }
...@@ -37,10 +37,12 @@ import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDeptMapper; ...@@ -37,10 +37,12 @@ import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDeptMapper;
import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysUserMapper; import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysUserMapper;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptRelationService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptRelationService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService; import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants; 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.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; 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.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo; import com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo;
import com.yifu.cloud.plus.v1.yifu.common.ldap.util.LdapUtil; import com.yifu.cloud.plus.v1.yifu.common.ldap.util.LdapUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
...@@ -73,6 +75,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -73,6 +75,8 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
private final SysUserMapper sysUserMapper; private final SysUserMapper sysUserMapper;
private final RedisUtil redisUtil;
/** /**
* 添加信息部门 * 添加信息部门
* @param dept 部门 * @param dept 部门
...@@ -507,6 +511,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -507,6 +511,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
} }
dept.setClient(ClientNameConstants.CLIENT_CSP); dept.setClient(ClientNameConstants.CLIENT_CSP);
this.save(dept); this.save(dept);
// 清理用户权限,重新获取用户的部门权限
List<String> userNames = sysUserMapper.getCspUserByDeptId(dept.getDeptId().toString());
if (Common.isNotNull(userNames)){
for (String us:userNames){
redisUtil.remove(CacheConstants.USER_DETAILS +"::"+ us);
}
}
return R.ok("创建成功"); return R.ok("创建成功");
} }
...@@ -553,6 +564,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -553,6 +564,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
return R.failed("部门下仍然有员工,请调出所有员工后,删除部门"); return R.failed("部门下仍然有员工,请调出所有员工后,删除部门");
} }
this.removeById(deptId); this.removeById(deptId);
// 清理用户权限,重新获取用户的部门权限
List<String> userNames = sysUserMapper.getCspUserByDeptId(deptId.toString());
if (Common.isNotNull(userNames)){
for (String us:userNames){
redisUtil.remove(CacheConstants.USER_DETAILS +"::"+ us);
}
}
return R.ok("删除成功"); return R.ok("删除成功");
} }
...@@ -599,6 +617,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl ...@@ -599,6 +617,13 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
baseMapper.updateById(updateEntity); baseMapper.updateById(updateEntity);
List<DeptSortVo> moveVos = dept.getDeptSortList(); List<DeptSortVo> moveVos = dept.getDeptSortList();
baseMapper.batchUpdateSort(moveVos); baseMapper.batchUpdateSort(moveVos);
//清理用户权限
List<String> userNames = sysUserMapper.getCspUserByDeptId(dept.getDeptId());
if (Common.isNotNull(userNames)){
for (String us:userNames){
redisUtil.remove(CacheConstants.USER_DETAILS +"::"+ us);
}
}
}catch (Exception e){ }catch (Exception e){
log.error("客户服务平台机构变更异常",e); log.error("客户服务平台机构变更异常",e);
return R.failed(CommonConstants.UPDATE_DATA_FAIL); return R.failed(CommonConstants.UPDATE_DATA_FAIL);
......
...@@ -441,4 +441,11 @@ ...@@ -441,4 +441,11 @@
ORDER BY u.create_time DESC ORDER BY u.create_time DESC
</select> </select>
<select id="getCspUserByDeptId" resultType="java.lang.String">
SELECT a.username from sys_user a
where a.user_id in (
select c.user_id from sys_user_dept_permission c
where c.project_no in (SELECT project_no from sys_user_dept_permission where dept_id=#{deptId})
) and a.del_flag='0'
</select>
</mapper> </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