Commit d296e691 authored by fangxinjiang's avatar fangxinjiang

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

parents a79f81f9 7e3566c6
......@@ -435,4 +435,12 @@ public class TEmployeeProject extends BaseEntity {
@TableField(exist = false)
private String empDeptid;
@Schema(description = "操作的用户id")
@TableField(exist = false)
private String operationUserId;
@Schema(description = "操作的用户Name")
@TableField(exist = false)
private String operationUserName;
}
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -65,6 +66,7 @@ public class TEmployeeProjectBelongDept {
private String empDeptid;
// 日志确认接收时间,与项目档案日期比较
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
private LocalDateTime logCreateTime;
......
......@@ -49,4 +49,10 @@ public class TEmployeeProjectBelongDeptSearchCspVo {
@Schema(description = "项目档案创建与离职人")
private String empCreateAndLeaveUser;
@Schema(description = "登录人Id")
private String userId;
// 项目档案入离职日期,与日志确认接收时间比较
@Schema(description = "登录人姓名")
private String userName;
}
......@@ -16,8 +16,6 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProjectBelongDept;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......
......@@ -63,9 +63,9 @@ public class TEmployeeProjectBelongDeptController {
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
@PostMapping("/page")
public R<IPage<EmployeeProjectScpVO>> getTEmployeeProjectBelongDeptPage(Page<EmployeeProjectScpVO> page
, TEmployeeProjectBelongDeptSearchVo tEmployeeProjectBelongDept) {
, @RequestBody TEmployeeProjectBelongDeptSearchVo tEmployeeProjectBelongDept) {
return new R<>(tEmployeeProjectBelongDeptService.getTEmployeeProjectBelongDeptPage(page, tEmployeeProjectBelongDept));
}
......
......@@ -393,6 +393,19 @@ public class TEmployeeProjectController {
return tEmployeeProjectService.getEmpProjectStatus(vo);
}
/**
* @param vo 人员信息
* @Description: 获取人员项目档案信息
* @Author: huyc
* @Date: 2025/2/27 15:18
* @return:
**/
@Inner
@PostMapping("/inner/getOutEmpProjectStatus")
public EmpProjectStatusVo getOutEmpProjectStatus(@RequestBody EmpProjectStatusVo vo) {
return tEmployeeProjectService.getOutEmpProjectStatus(vo);
}
/**
* 通过项目编码查询项目信息
* @param tEmployeeProject
......
......@@ -64,9 +64,9 @@ public interface TEmployeeProjectBelongDeptService extends IService<TEmployeePro
* 根据权限获取对应部门ID下的花名册总数Map
*
* @param tEmployeeProjectBelongDept 花名册查询
* @return Map<String,Integer> 对应部门ID下的花名册总数Map
* @return Map<String, Integer> 对应部门ID下的花名册总数Map
*/
Map<String,Integer> getDeptCountMap(TEmployeeProjectBelongDeptSearchVo tEmployeeProjectBelongDept, UserPermissionVo authority);
Map<String, Integer> getDeptCountMap(TEmployeeProjectBelongDeptSearchVo tEmployeeProjectBelongDept, UserPermissionVo authority);
/**
* 没有关联部门的花名册总数
......
......@@ -46,6 +46,8 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
TSalaryStandardSelectViewVo getUnProjectEmpList(List<TSalaryStandardUnprojectVo> voList);
EmpProjectStatusVo getEmpProjectStatus(EmpProjectStatusVo vo);
EmpProjectStatusVo getOutEmpProjectStatus(EmpProjectStatusVo vo);
/**
* @param tEmployeeProject
* @Description: 新增项目档案校验
......
......@@ -681,6 +681,8 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
tEmployeeProjectService.updateChangeById(oldEmpProject);
//新增或变更新的项目档案
tEmployeeProjectService.saveOrUpdate(newEmpProject);
// 增加,同步CSP,下面的减少老项目档案,在方法里有减少CSP
tEmployeeProjectService.doSaveBelongDept(newEmpProject, CommonConstants.ONE_STRING);
//同步减项老项目档案
if (CommonConstants.ONE_STRING.equals(vo.getChangeType())){
oldEmpProject.setIsLeaveEmployee(CommonConstants.ZERO_INT);
......
......@@ -2580,6 +2580,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(p)) {
p.setStatus(CommonConstants.ONE_INT);
p.setOperationUserId(vo.getCreateBy());
p.setOperationUserName(vo.getCreateName());
// hgw加所属部门逻辑:
tEmployeeProjectService.doSaveBelongDept(p, CommonConstants.ONE_STRING);
}
......@@ -2608,7 +2610,10 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
contractAudit.setRemark(vo.getRemarkTemp());
contractAudit.setRootName("合同审核");
contractServicer.updateInUseStatusById(c.getEmpId(), c.getDeptNo(), c.getId());
tEmployeeProjectService.updateContractStatus(c.getEmpId(), c.getSettleDomain(), CommonConstants.ONE_INT);
if (p != null) {
p.setContractStatus(CommonConstants.ONE_INT);
}
//tEmployeeProjectService.updateContractStatus(c.getEmpId(), c.getSettleDomain(), CommonConstants.ONE_INT)
baseMapper.updateContractStatus(c.getEmpId(), CommonConstants.ONE_INT);
//审核不同
} else if (CommonConstants.ONE_STRING.equals(vo.getType())) {
......
......@@ -22,7 +22,6 @@ 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.SysDeptVo;
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;
......@@ -44,7 +43,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
/**
* 项目档案所属部门表
......
......@@ -160,6 +160,20 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
return null;
}
@Override
public EmpProjectStatusVo getOutEmpProjectStatus(EmpProjectStatusVo vo) {
TEmployeeProject employeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, vo.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, vo.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ONE_INT).last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(employeeProject)) {
vo.setProjectTime(employeeProject.getLeaveTime());
return vo;
}
return null;
}
@Override
public R addCheck(TEmployeeProject tEmployeeProject) {
......@@ -2084,6 +2098,17 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
searchCspVo.setDeptId(p.getDeptId());
searchCspVo.setEmpIdCard(p.getEmpIdcard());
searchCspVo.setFeedbackType(feedbackType);
YifuUser user = SecurityUtils.getUser();
if (user != null && Common.isNotNull(user.getNickname())) {
searchCspVo.setUserId(user.getId());
searchCspVo.setUserName(user.getNickname());
} else if (Common.isNotNull(p.getOperationUserId())) {
searchCspVo.setUserId(p.getOperationUserId());
searchCspVo.setUserName(p.getOperationUserName());
} else {
searchCspVo.setUserId(p.getCreateBy());
searchCspVo.setUserName(p.getCreateName());
}
if (CommonConstants.ONE_STRING.equals(feedbackType)) {
searchCspVo.setEmpCreateAndLeaveTime(p.getCreateTime());
searchCspVo.setEmpCreateAndLeaveUser(p.getCreateName());
......
......@@ -21,8 +21,12 @@ public class RegistConstants {
public static final String CONFIRM_SUBMIT = "确认接收";
public static final String BEFORE_IN_PROJECT = "先于登记入项";
public static final String BEFORE_IN_PROJECT = "入职登记前已增员";
public static final String BEFORE_OUT_PROJECT = "离职登记前已减员";
public static final String MESSAGE_REGIST = "信息登记";
public static final String MESSAGE_FINISH = "已处理";
}
package com.yifu.cloud.plus.v1.csp.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -52,6 +53,7 @@ public class EmployeeRegistrationExportVo implements Serializable {
@ExcelAttribute(name = "入/离职日期", isDate = true)
@Schema(description = "入/离职日期")
@ExcelProperty("入/离职日期")
@DateTimeFormat("yyyy-MM-dd")
private Date joinLeaveDate;
@ExcelAttribute(name = "登记人")
......
package com.yifu.cloud.plus.v1.csp.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -62,6 +63,7 @@ public class EmployeeRegistrationHrExportVo implements Serializable {
@ExcelAttribute(name = "入/离职日期", isDate = true)
@Schema(description = "入/离职日期")
@ExcelProperty("入/离职日期")
@DateTimeFormat("yyyy-MM-dd")
private Date joinLeaveDate;
@ExcelAttribute(name = "登记人")
......
......@@ -24,8 +24,8 @@ public class EmployeeRegistrationVo extends RowIndex implements Serializable {
* 员工姓名
*/
@NotBlank(message = "员工姓名 不能为空")
@Length(max = 50, message = "员工姓名 不能超过50个字符")
@ExcelAttribute(name = "员工姓名", isNotEmpty = true, errorInfo = "员工姓名不能为空", maxLength = 50)
@Length(max = 20, message = "员工姓名 不能超过20个字符")
@ExcelAttribute(name = "员工姓名", isNotEmpty = true, errorInfo = "员工姓名不能为空", maxLength = 20)
@Schema(description = "员工姓名")
@ExcelProperty("员工姓名")
private String employeeName;
......
......@@ -22,12 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.csp.entity.TOperationLog;
import com.yifu.cloud.plus.v1.csp.service.TOperationLogService;
import com.yifu.cloud.plus.v1.csp.vo.TOperationLogSearchVo;
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.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......
......@@ -116,6 +116,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
String fileName = "入离职登记表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<EmployeeRegistrationExportVo> list = new ArrayList<>();
getDtpeAuth(searchVo);
long count = baseMapper.selectExportCount(searchVo);
try (ServletOutputStream out = response.getOutputStream()) {
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
......@@ -123,7 +124,6 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, EmployeeRegistrationExportVo.class).build();
getDtpeAuth(searchVo);
int index = 0;
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
......@@ -162,7 +162,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
*/
@Override
public void listHrExport(HttpServletResponse response, EmployeeRegistrationSearchVo searchVo) {
String fileName = "入离职登记表批量导出" + DateUtil.getThisTime() + ".xlsx";
String fileName = "入离职待办任务表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<EmployeeRegistrationHrExportVo> list = new ArrayList<>();
long count = baseMapper.selectExportCount(searchVo);
......@@ -180,7 +180,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.selectHrExportList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("入离职登记表" + index).build();
WriteSheet writeSheet = EasyExcel.writerSheet("入离职待办任务表" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
......@@ -189,7 +189,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("入离职登记表" + index).build();
WriteSheet writeSheet = EasyExcel.writerSheet("入离职待办任务表" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
......@@ -347,19 +347,22 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
//点击“接收确认”的时候,监测到该人员该项目下已有在项的档案时,再次提醒:该人员已在项,
//状态将更新成“已处理”;处理记录中,针对此情况,记录真实的进项时间,备注:先于登记入项
EmpProjectStatusVo vo = new EmpProjectStatusVo();
vo.setEmpIdcard(registrationNow.getEmpIdcard());
vo.setDeptNo(registrationNow.getDeptNo());
EmpProjectStatusVo exit;
if (CommonConstants.ONE_STRING.equals(registrationNow.getFeedbackType())) {
EmpProjectStatusVo vo = new EmpProjectStatusVo();
vo.setEmpIdcard(registrationNow.getEmpIdcard());
vo.setDeptNo(registrationNow.getDeptNo());
EmpProjectStatusVo exit = getEmpProjectStatus(vo);
if (Common.isNotNull(exit)) {
return R.ok(registration.getProjectCreateTime());
}
exit = getEmpProjectStatus(vo);
} else {
exit = getOutEmpProjectStatus(vo);
}
if (Common.isNotNull(exit)) {
return R.ok(exit.getProjectTime());
}
registrationNow.setProcessStatus(CommonConstants.ZERO_STRING);
baseMapper.updateById(registrationNow);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.CONFIRM_SUBMIT, LocalDateTime.now(),
registration.getRegistorUsername(),null);
registrationNow.getRegistorUsername(),null);
return R.ok();
}
......@@ -368,10 +371,13 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
if (Common.isEmpty(registrationNow) || !CommonConstants.ONE_STRING.equals(registrationNow.getProcessStatus())) {
return R.failed(RegistConstants.NO_DATA_TO_HANDLE);
}
registrationNow.setProcessStatus(CommonConstants.ZERO_STRING);
registrationNow.setProcessStatus(CommonConstants.TWO_STRING);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.CONFIRM_SUBMIT, LocalDateTime.now(),
registrationNow.getRegistorUsername(),null);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.MESSAGE_FINISH, registration.getProjectCreateTime(),
registrationNow.getRegistorUsername(),CommonConstants.ONE_STRING.equals(registrationNow.getFeedbackType())
? RegistConstants.BEFORE_IN_PROJECT :RegistConstants.BEFORE_OUT_PROJECT);
baseMapper.updateById(registrationNow);
logService.saveLog(registration.getId(), CommonConstants.ZERO_STRING,RegistConstants.CONFIRM_SUBMIT, registration.getProjectCreateTime(),
registration.getRegistorUsername(),RegistConstants.BEFORE_IN_PROJECT);
return R.ok();
}
......@@ -422,6 +428,19 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
}
}
//获取减项人员档案信息
private EmpProjectStatusVo getOutEmpProjectStatus(EmpProjectStatusVo vo) {
//找到不在项人员的身份证信息
R<EmpProjectStatusVo> sdr = HttpDaprUtil.invokeMethodPost(archivesProperties.getAppUrl(), archivesProperties.getAppId()
, "/temployeeproject/inner/getOutEmpProjectStatus", vo, EmpProjectStatusVo.class, SecurityConstants.FROM_IN);
if (sdr != null && sdr.getData() != null) {
vo = sdr.getData();
return vo;
} else {
return null;
}
}
//数据初始化
private void initRegistInfo(EmployeeRegistration insert,YifuUser user,TSettleDomainSelectVo selectVo) {
insert.setRegistorDeptname(user.getDeptName());
......@@ -463,7 +482,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
StringBuilder description = new StringBuilder();
String title = "";
if (CommonConstants.ONE_STRING.equals(type) || CommonConstants.TWO_STRING.equals(type)) {
title = "人员入职提醒";
title = CommonConstants.ONE_STRING.equals(type) ? "人员入职提醒:":"人员离职提醒:";
description.append(CommonConstants.ONE_STRING.equals(type) ? "入职日期:":"离职日期:")
.append(DateUtil.dateToString(registration.getJoinLeaveDate(),DateUtil.ISO_EXPANDED_DATE_FORMAT)).append("<br>");
description.append("项目名称:").append(registration.getDeptName()).append("<br>");
......@@ -521,10 +540,6 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
* @return: boolean
**/
private boolean doSaveLogBatch(TEmployeeProjectBelongDeptSearchCspVo searchCspVo, List<TEmployeeProjectBelongDept> belongDeptList) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return true;
}
TOperationLog log;
List<TOperationLog> logList = new ArrayList<>();
String title = "已处理";
......@@ -543,8 +558,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
log.setRemark("离职登记前已减员");
}
}
log.setCreateBy(user.getId());
log.setCreateName(user.getNickname());
log.setCreateBy(searchCspVo.getUserId());
log.setCreateName(searchCspVo.getUserName());
log.setCreateTime(LocalDateTime.now());
logList.add(log);
}
......
......@@ -67,7 +67,7 @@ public class TOperationLogServiceImpl extends ServiceImpl<TOperationLogMapper, T
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
}
wrapper.orderByDesc(TOperationLog::getCreateTime);
wrapper.orderByAsc(TOperationLog::getCreateTime);
return baseMapper.selectList(wrapper);
}
......
......@@ -38,3 +38,9 @@ security:
- /v3/api-docs
- /actuator/**
- /swagger-ui/**
wx:
corpid: wwbcb090af0dfe50e5
corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid: 1000010
authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://test-wx.worfu.com
\ No newline at end of file
......@@ -71,11 +71,9 @@
a.registor_username,
a.registor_deptname,
a.registor_deptid,
a.registor_deptno,
a.registor_phone,
a.emp_deptname,
a.emp_deptid,
a.emp_deptno,
a.create_by,
a.create_name,
a.create_time,
......@@ -94,13 +92,13 @@
AND a.id = #{employeeRegistration.id}
</if>
<if test="employeeRegistration.employeeName != null and employeeRegistration.employeeName.trim() != ''">
AND a.employee_name like CONCAT(#{employeeRegistration.employeeName},'%')
AND a.employee_name like CONCAT('%',#{employeeRegistration.employeeName},'%')
</if>
<if test="employeeRegistration.empIdcard != null and employeeRegistration.empIdcard.trim() != ''">
AND a.emp_idcard like CONCAT(#{employeeRegistration.empIdcard},'%')
AND a.emp_idcard like CONCAT('%',#{employeeRegistration.empIdcard},'%')
</if>
<if test="employeeRegistration.empPhone != null and employeeRegistration.empPhone.trim() != ''">
AND a.emp_phone like CONCAT(#{employeeRegistration.empPhone},'%')
AND a.emp_phone like CONCAT('%',#{employeeRegistration.empPhone},'%')
</if>
<if test="employeeRegistration.postList != null and employeeRegistration.postList.size() > 0 ">
AND a.position in
......@@ -138,8 +136,8 @@
<if test="employeeRegistration.registorUsername != null and employeeRegistration.registorUsername.trim() != ''">
AND a.registor_username = #{employeeRegistration.registorUsername}
</if>
<if test="employeeRegistration.registorDeptname != null and employeeRegistration.registorDeptname.trim() != ''">
AND a.registor_deptname like CONCAT(#{employeeRegistration.registorDeptname},'%')
<if test="employeeRegistration.deptName != null and employeeRegistration.deptName.trim() != ''">
AND a.dept_name like CONCAT('%',#{employeeRegistration.deptName},'%')
</if>
<if test="employeeRegistration.registorDeptid != null and employeeRegistration.registorDeptid.trim() != ''">
AND a.registor_deptid = #{employeeRegistration.registorDeptid}
......@@ -261,17 +259,21 @@
<if test="searchCspVo.feedbackType != null and searchCspVo.feedbackType.trim() != ''">
AND a.feedback_type = #{searchCspVo.feedbackType}
</if>
GROUP BY a.id
order by a.create_time desc
</select>
<!-- 将数据处理为已处理 -->
<select id="updateTwoRegistrationByIdCard" resultType="java.lang.Integer">
<update id="updateTwoRegistrationByIdCard">
update employee_registration a
set a.process_status= '2'
where a.emp_idcard = #{searchCspVo.empIdCard} and a.process_status= '0'
<if test="searchCspVo.deptId != null and searchCspVo.deptId.trim() != ''">
AND a.dept_id = #{searchCspVo.deptId}
</if>
<if test="searchCspVo.feedbackType != null and searchCspVo.feedbackType.trim() != ''">
AND a.feedback_type = #{searchCspVo.feedbackType}
</if>
</select>
</update>
</mapper>
......@@ -593,7 +593,6 @@
acc.DEPT_NO,
acc.EMP_NAME,
acc.EMP_IDCARD,
acc.EMP_NAME,
acc.RELAY_SALARY,
acc.ACTUAL_SALARY,
lll.APPLY_NO,
......
......@@ -311,4 +311,18 @@ public class DeptController {
return sysDeptService.cspUpdateDept(dept);
}
/**
* 客户服务平台——获取项目下已删除的部门
* @return R<String> 删除部门的ID集合
* @author chenyuxi
* @since 1.9.7
*/
@GetMapping(value = "/csp/getDelDeptIds")
public R<String> cspDelDeptIds(SysDeptVo dept) {
if(Common.isEmpty(dept.getProjectNo())){
return R.failed("项目编码不能为空");
}
return R.ok(sysDeptService.cspDelDeptIds(dept.getProjectNo()));
}
}
......@@ -15,25 +15,20 @@
*/
package com.yifu.cloud.plus.v1.yifu.admin.controller;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUserDeptPermission;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.DeptTreeSelectVO;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysDeptVo;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDeptService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysUserDeptPermissionService;
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.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.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
......@@ -51,7 +46,7 @@ public class UserDeptPermissionController {
private final SysUserDeptPermissionService sysUserDeptPermissionService;
/**
* 客户服务平台——获取用户权限
* 客户服务平台——获取项目下用户的部门,数据权限配置信息
* @param sysUserDeptPermission 实体
* @return success/false
*/
......@@ -117,4 +112,35 @@ public class UserDeptPermissionController {
return sysUserDeptPermissionService.relationUser(sysUserDeptPermission);
}
/**
* 客户服务平台——获取指定项目下用户的数据权限
* @param sysUserDeptPermission 实体
* @return success/false
*/
@GetMapping("/permissionByProject")
public R<UserPermissionVo> getUserPermissionByProject(SysUserDeptPermission sysUserDeptPermission) {
if(Common.isEmpty(sysUserDeptPermission.getProjectNo())){
return R.failed("项目编码不能为空");
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
List<UserPermissionVo> cspPermList = user.getCspPermMap();
if(Common.isEmpty(cspPermList)){
return R.failed("获取用户权限失败!");
}
// 获取用户在当前项目下的权限
UserPermissionVo authority = null;
for (UserPermissionVo userPermissionVo : cspPermList) {
if(sysUserDeptPermission.getProjectNo().equals(userPermissionVo.getProjectNo())){
authority = userPermissionVo;
}
}
if(Common.isEmpty(authority)){
return R.failed("获取用户在当前项目下的权限失败!");
}
return R.ok(authority);
}
}
......@@ -97,4 +97,8 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
void batchUpdateSort(@Param("moveVos")List<DeptSortVo> moveVos);
List<SysDept> cspDelDeptIds(@Param("projectNo") String projectNo);
}
......@@ -105,4 +105,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Param("projectNo")String projectNo);
List<String> getCspUserByDeptId(@Param("deptId")String deptId);
List<String> getCspUserByProjectNo(@Param("projectNo")String projectNo);
}
......@@ -144,4 +144,12 @@ public interface SysDeptService extends IService<SysDept> {
R<Boolean> cspUpdateDept(SysDeptMoveVo dept);
/**
* 客户服务平台——获取项目下已删除的部门
* @return R<String> 删除部门的ID集合
* @author chenyuxi
* @since 1.9.7
*/
String cspDelDeptIds(String projectNo);
}
......@@ -23,7 +23,6 @@ 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;
/**
......@@ -36,11 +35,11 @@ public interface SysUserDeptPermissionService extends IService<SysUserDeptPermis
/**
* 项目下用户数据权限
* 获取项目下用户的部门,数据权限配置信息
* @param projectNo 项目编号
* @param userId 用户ID
*
* @return UserPermissionVo 用户在指定项目下的权限
* @return SysUserDeptPermission
*/
SysUserDeptPermission getInfo(String projectNo, String userId);
......
......@@ -352,10 +352,12 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
// 先存当前部门ID
allDepartIdSet.add(deptVo.getDeptId().toString());
String ancestors = deptVo.getAncestors();
String[] ancestorArr = ancestors.split(CommonConstants.COMMA_STRING);
Set<String> ancestorDeptIdSet = Arrays.stream(ancestorArr).collect(Collectors.toSet());
if(Common.isNotNull(ancestorDeptIdSet)){
allDepartIdSet.addAll(ancestorDeptIdSet);
if(Common.isNotNull(ancestors)){
String[] ancestorArr = ancestors.split(CommonConstants.COMMA_STRING);
Set<String> ancestorDeptIdSet = Arrays.stream(ancestorArr).collect(Collectors.toSet());
if(Common.isNotNull(ancestorDeptIdSet)){
allDepartIdSet.addAll(ancestorDeptIdSet);
}
}
}
}
......@@ -511,8 +513,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
}
dept.setClient(ClientNameConstants.CLIENT_CSP);
this.save(dept);
// 清理用户权限,重新获取用户的部门权限
List<String> userNames = sysUserMapper.getCspUserByDeptId(dept.getDeptId().toString());
// 清理用户权限,重新获取项目下的用户的部门权限
List<String> userNames = sysUserMapper.getCspUserByProjectNo(dept.getProjectNo());
if (Common.isNotNull(userNames)){
for (String us:userNames){
redisUtil.remove(CacheConstants.USER_DETAILS +"::"+ us);
......@@ -533,6 +536,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
if (Common.isEmpty(findInfo)) {
return R.failed("部门未找到");
}
if(findInfo.getName().equals(dept.getName())){
return R.failed("名称未发生变化,未做更新");
}
SysDept nameInfo = baseMapper.checkDeptNameUnique(findInfo.getProjectNo(),dept.getName(), findInfo.getParentId());
if (Common.isNotNull(nameInfo) && nameInfo.getDeptId().longValue() != dept.getDeptId().longValue()) {
return R.failed("已存在同级同名部门");
......@@ -630,4 +636,27 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
}
return R.ok();
}
/**
* 客户服务平台——获取项目下已删除的部门
*
* @param projectNo
* @return R<String> 删除部门的ID集合
* @author chenyuxi
* @since 1.9.7
*/
@Override
public String cspDelDeptIds(String projectNo) {
String delDeptIds = "";
List<SysDept> deptList = baseMapper.cspDelDeptIds(projectNo);
if(Common.isNotNull(deptList)){
for(SysDept dept : deptList){
delDeptIds = delDeptIds.concat(",").concat(dept.getDeptId().toString());
}
}
if(delDeptIds.length()>0){
delDeptIds = delDeptIds.substring(1);
}
return delDeptIds;
}
}
......@@ -65,6 +65,13 @@ public class SysUserDeptPermissionServiceImpl extends ServiceImpl<SysUserDeptPer
private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder();
/**
* 项目下用户的部门,数据权限配置信息
* @param projectNo 项目编号
* @param userId 用户ID
*
* @return UserPermissionVo 用户在指定项目下的权限
*/
@Override
public SysUserDeptPermission getInfo(String projectNo, String userId) {
LambdaQueryWrapper<SysUserDeptPermission> permissionQuery = Wrappers.<SysUserDeptPermission>lambdaQuery()
......
......@@ -19,7 +19,7 @@
<mapper namespace="com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDeptMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept">
<id column="deptId" property="deptId"/>
<id column="dept_id" property="deptId"/>
<result column="name" property="name"/>
<result column="parent_id" property="parentId"/>
<result column="dept_dn" property="deptDn"/>
......@@ -155,4 +155,8 @@
</foreach>
</update>
<select id="cspDelDeptIds" resultType="com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDept">
select dept_id from sys_dept where del_flag = '1' AND project_no = #{projectNo}
</select>
</mapper>
......@@ -448,4 +448,12 @@
where c.project_no in (SELECT project_no from sys_user_dept_permission where dept_id=#{deptId})
) and a.del_flag='0'
</select>
<select id="getCspUserByProjectNo" 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 (#{projectNo})
) and a.del_flag='0'
</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