From 0ba51b87c662a28778fbe25bf804aa9ea85c802e Mon Sep 17 00:00:00 2001
From: luoyb <412940104@qq.com>
Date: 星期三, 03 三月 2021 02:23:29 +0800
Subject: [PATCH] feat(在职员工): 关闭档案
---
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpBaseInfoServiceImpl.java | 81 +++++++++++++++++++++++++---------------
1 files changed, 51 insertions(+), 30 deletions(-)
diff --git a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpBaseInfoServiceImpl.java b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpBaseInfoServiceImpl.java
index e7ed572..8927b0c 100644
--- a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpBaseInfoServiceImpl.java
+++ b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpBaseInfoServiceImpl.java
@@ -13,6 +13,7 @@
import cc.mrbird.febs.server.hr.entity.EmpJobChange;
import cc.mrbird.febs.server.hr.feign.IRemoteUserService;
import cc.mrbird.febs.server.hr.properties.FebsServerHrProperties;
+import cc.mrbird.febs.server.hr.service.IEmpContractInfoService;
import cc.mrbird.febs.server.hr.service.IEmpDimissionLogService;
import cc.mrbird.febs.server.hr.service.IEmpJobChangeService;
import cn.hutool.core.date.DateUnit;
@@ -66,6 +67,7 @@
private final EmpBaseInfoMapper empBaseInfoMapper;
private final IEmpDimissionLogService dimissionLogService;
private final IEmpJobChangeService jobChangeService;
+ private final IEmpContractInfoService empContractInfoService;
private final FebsServerHrProperties properties;
private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser())
.map(u -> u.getUserId().toString())
@@ -232,12 +234,11 @@
@Override
public boolean verifyEmpNumb(EmpBaseInfo empBaseInfo) {
QueryWrapper<EmpBaseInfo> queryWrapper = new QueryWrapper<>();
- queryWrapper.lambda().eq(EmpBaseInfo::getEmpNumb, empBaseInfo.getEmpNumb());
- EmpBaseInfo tempEmpBaseInfo = this.getOne(queryWrapper);
- if (tempEmpBaseInfo == null) {
+ queryWrapper.lambda().eq(EmpBaseInfo::getEmpNumb, empBaseInfo.getEmpNumb()).ne(EmpBaseInfo::getDelFlag, 1);
+ if (this.count(queryWrapper) <= 0) {
return false;
}
- return !empBaseInfo.getEmpNumb().equals(tempEmpBaseInfo.getEmpNumb());
+ return true;
}
@Override
@@ -270,6 +271,7 @@
String[] str = empDimissionLog.getEmpIds().split(",");
List<String> list = new ArrayList<>(Arrays.asList(str));
String[] strDate = empDimissionLog.getEntryDates().split(",");
+
EmpDimissionLog dimissionLog = null;
for (int i = 0, k = str.length; i < k; i++) {
dimissionLog = new EmpDimissionLog();
@@ -285,9 +287,28 @@
dimissionLog.setModifier(operatorId);
dimissionLogService.save(dimissionLog);
}
- EmpBaseInfo empBaseInfo = this.getById(dimissionLog.getEmpId());
- //禁用账户
- iRemoteUserService.updateStatus(empBaseInfo.getCertificateNumb());
+
+ if (StrUtil.isNotBlank(empDimissionLog.getAfterOperation())) {
+ String[] strAfterOperation = empDimissionLog.getAfterOperation().split(",");
+ int flag = 0;
+ for (String s : strAfterOperation) {
+ flag = flag + Integer.parseInt(s);
+ }
+ switch (flag) {
+ case 1:
+ //解除合同
+ empContractInfoService.terminateContract(empDimissionLog.getEmpIds(), operatorId);
+ break;
+ case 2:
+ //禁用账户
+ iRemoteUserService.updateStatus(empDimissionLog.getCertificateNumb());
+ break;
+ case 3:
+ empContractInfoService.terminateContract(empDimissionLog.getEmpIds(), operatorId);
+ iRemoteUserService.updateStatus(empDimissionLog.getCertificateNumb());
+ break;
+ }
+ }
return empBaseInfoMapper.closeEmpArchives(list, empDimissionLog.getDimissionType(), empDimissionLog.getDimissionDate(), empDimissionLog.getRemark(), operatorId) > 0;
}
@@ -741,71 +762,71 @@
}
/**
- *
* 检查是否是带条件查询
- *
+ * <p>
* date 2021-02-26 13:49
- * @author: luoyibo
+ *
* @param empBaseInfo 人员参数
* @return boolean
+ * @author: luoyibo
*/
- private boolean checkQueryCondition(EmpBaseInfo empBaseInfo){
+ private boolean checkQueryCondition(EmpBaseInfo empBaseInfo) {
int hasCondition = 0;
if (StringUtils.isNotBlank(empBaseInfo.getEmpNumb())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getEmpName())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getDeptName())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getCertificateNumb())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getEntryDateStr())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getDimissionDateStr())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getSex())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getEducation())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getPolitics())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getAgeStr())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getArchivesStatus())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
if (StringUtils.isNotBlank(empBaseInfo.getInsuranceType())) {
- hasCondition = hasCondition|1;
+ hasCondition = hasCondition | 1;
}
- return hasCondition==1;
+ return hasCondition == 1;
}
- private LambdaQueryWrapper<EmpBaseInfo> createQueryWrapper(EmpBaseInfo empBaseInfo){
+ private LambdaQueryWrapper<EmpBaseInfo> createQueryWrapper(EmpBaseInfo empBaseInfo) {
LambdaQueryWrapper<EmpBaseInfo> queryWrapper = new LambdaQueryWrapper<>();
//记录的状态,0-正常 1-删除 2-暂存
- if(StringUtils.isNotBlank(empBaseInfo.getDelFlag().toString())) {
+ if (StringUtils.isNotBlank(empBaseInfo.getDelFlag().toString())) {
queryWrapper.eq(EmpBaseInfo::getDelFlag, empBaseInfo.getDelFlag());
- } else{
+ } else {
queryWrapper.eq(EmpBaseInfo::getDelFlag, 0);
}
//人员的状态,0-在职 1-离职 2-退休
if (StringUtils.isNotBlank(empBaseInfo.getEmpStatus())) {
queryWrapper.in(EmpBaseInfo::getEmpStatus, empBaseInfo.getEmpStatus().split(","));
- } else{
+ } else {
queryWrapper.in(EmpBaseInfo::getEmpStatus, 0);
}
// 下面的条件就是人员的属性条件,条件之间是或的关系
- if(this.checkQueryCondition(empBaseInfo)){
+ if (this.checkQueryCondition(empBaseInfo)) {
queryWrapper.and(p -> {
if (StringUtils.isNotBlank(empBaseInfo.getEmpNumb())) {
p.like(EmpBaseInfo::getEmpNumb, empBaseInfo.getEmpNumb());
@@ -867,7 +888,7 @@
@Override
public EmpBaseInfo addInEmpBaseInfo(EmpBaseInfo empBaseInfo) {
EmpBaseInfo dbEmpInfo = this.getEmpBaseInfo(empBaseInfo);
- if(dbEmpInfo==null){
+ if (dbEmpInfo == null) {
this.createEmpBaseInfo(empBaseInfo);
return null;
} else {
--
Gitblit v1.8.0