From 3ca0d2b2941d55398099af8679c66f2866a55cc1 Mon Sep 17 00:00:00 2001
From: yz <yz_0812@outlook.com>
Date: 星期四, 04 三月 2021 02:16:18 +0800
Subject: [PATCH] 修改bug
---
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpBaseInfoServiceImpl.java | 73 ++++++++++++++++++++++--------------
1 files changed, 44 insertions(+), 29 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 9441a8b..dab475f 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
@@ -7,12 +7,14 @@
import java.util.*;
import java.util.function.Consumer;
+import cc.mrbird.febs.common.core.entity.constant.StringConstant;
import cc.mrbird.febs.common.core.entity.system.SysConfig;
import cc.mrbird.febs.common.core.exception.FebsException;
import cc.mrbird.febs.common.core.utils.MyUtil;
import cc.mrbird.febs.server.hr.entity.EmpDimissionLog;
import cc.mrbird.febs.server.hr.entity.EmpJobChange;
import cc.mrbird.febs.server.hr.feign.IRemoteUserService;
+import cc.mrbird.febs.server.hr.mapper.EmpContractInfoMapper;
import cc.mrbird.febs.server.hr.properties.FebsServerHrProperties;
import cc.mrbird.febs.server.hr.service.IEmpContractInfoService;
import cc.mrbird.febs.server.hr.service.IEmpDimissionLogService;
@@ -47,6 +49,7 @@
import cc.mrbird.febs.server.hr.service.IEmpBaseInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.util.FileSystemUtils;
+import org.springframework.validation.annotation.Validated;
import javax.servlet.http.HttpServletResponse;
@@ -68,8 +71,9 @@
private final EmpBaseInfoMapper empBaseInfoMapper;
private final IEmpDimissionLogService dimissionLogService;
private final IEmpJobChangeService jobChangeService;
- private final IEmpContractInfoService empContractInfoService;
+ private final EmpContractInfoMapper empContractInfoMapper;
private final FebsServerHrProperties properties;
+ private final IRemoteDeptService remoteDeptService;
private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser())
.map(u -> u.getUserId().toString())
.orElse("1");
@@ -82,7 +86,7 @@
@Override
public IPage<EmpBaseInfo> findZsEmpBaseInfos(QueryRequest request, EmpBaseInfo empBaseInfo) {
Page<EmpBaseInfo> page = new Page<>(request.getPageNum(), request.getPageSize());
- IPage<EmpBaseInfo> iPage = this.page(page, createQueryWrapper(empBaseInfo));
+ IPage<EmpBaseInfo> iPage = empBaseInfoMapper.selectPageVo(page, createQueryWrapper(empBaseInfo));
//设置部门
List<EmpBaseInfo> list = setDeptName(iPage.getRecords());
List<DicItem> dicItems = CastUtil.castList(redisService.get("dicItems"), DicItem.class);
@@ -298,14 +302,15 @@
switch (flag) {
case 1:
//解除合同
- empContractInfoService.terminateContract(empDimissionLog.getEmpIds(), operatorId);
+
+ empContractInfoMapper.terminateContract(new ArrayList<>(Arrays.asList(empDimissionLog.getEmpIds().split(StringConstant.COMMA))), operatorId);
break;
case 2:
//禁用账户
iRemoteUserService.updateStatus(empDimissionLog.getCertificateNumb());
break;
case 3:
- empContractInfoService.terminateContract(empDimissionLog.getEmpIds(), operatorId);
+ empContractInfoMapper.terminateContract(new ArrayList<>(Arrays.asList(empDimissionLog.getEmpIds().split(StringConstant.COMMA))), operatorId);
iRemoteUserService.updateStatus(empDimissionLog.getCertificateNumb());
break;
}
@@ -373,7 +378,7 @@
continue;
}
if (this.count(new LambdaQueryWrapper<EmpBaseInfo>().eq(EmpBaseInfo::getEmpNumb,list.get(1).toString()).ne(EmpBaseInfo::getDelFlag,1))>0){
- returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}员工编号重复",listObject.indexOf(list),list.get(1).toString()));
+ returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}员工编号重复",listObject.indexOf(list)+1,list.get(1).toString()));
continue;
}
EmpBaseInfo empBaseInfo = new EmpBaseInfo();
@@ -385,7 +390,7 @@
empBaseInfo.setDeptName(list.get(3).toString());
Dept dept = depts.stream().filter(d -> d.getDeptName().equals(list.get(3).toString())).findFirst().orElse(null);
if (null == dept) {
- returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}部门不存在",listObject.indexOf(list),list.get(3).toString()));
+ returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}部门不存在",listObject.indexOf(list)+1,list.get(3).toString()));
continue;
}
empBaseInfo.setDeptId(dept.getDeptId());
@@ -823,77 +828,77 @@
return hasCondition == 1;
}
- private LambdaQueryWrapper<EmpBaseInfo> createQueryWrapper(EmpBaseInfo empBaseInfo) {
- LambdaQueryWrapper<EmpBaseInfo> queryWrapper = new LambdaQueryWrapper<>();
+ private QueryWrapper<EmpBaseInfo> createQueryWrapper(EmpBaseInfo empBaseInfo) {
+ QueryWrapper<EmpBaseInfo> queryWrapper = new QueryWrapper<>();
//记录的状态,0-正常 1-删除 2-暂存
if (StringUtils.isNotBlank(empBaseInfo.getDelFlag().toString())) {
- queryWrapper.eq(EmpBaseInfo::getDelFlag, empBaseInfo.getDelFlag());
+ queryWrapper.eq("a.DelFlag", empBaseInfo.getDelFlag());
} else {
- queryWrapper.eq(EmpBaseInfo::getDelFlag, 0);
+ queryWrapper.eq("a.DelFlag", 0);
}
//人员的状态,0-在职 1-离职 2-退休
if (StringUtils.isNotBlank(empBaseInfo.getEmpStatus())) {
- queryWrapper.in(EmpBaseInfo::getEmpStatus, empBaseInfo.getEmpStatus().split(","));
+ queryWrapper.in("a.EmpStatus", empBaseInfo.getEmpStatus().split(","));
} else {
- queryWrapper.in(EmpBaseInfo::getEmpStatus, 0);
+ queryWrapper.in("a.EmpStatus", 0);
}
// 下面的条件就是人员的属性条件,条件之间是或的关系
if (this.checkQueryCondition(empBaseInfo)) {
queryWrapper.and(p -> {
if (StringUtils.isNotBlank(empBaseInfo.getEmpNumb())) {
- p.like(EmpBaseInfo::getEmpNumb, empBaseInfo.getEmpNumb());
+ p.like("a.EmpNumb", empBaseInfo.getEmpNumb());
}
if (StringUtils.isNotBlank(empBaseInfo.getEmpName())) {
- p.or().like(EmpBaseInfo::getEmpName, empBaseInfo.getEmpName());
+ p.or().like("a.EmpName", empBaseInfo.getEmpName());
}
if (StringUtils.isNotBlank(empBaseInfo.getDeptName())) {
- p.or().like(EmpBaseInfo::getDeptName, empBaseInfo.getDeptName());
+ p.or().like("a.DeptName", empBaseInfo.getDeptName());
}
if (StringUtils.isNotBlank(empBaseInfo.getCertificateNumb())) {
- p.or().like(EmpBaseInfo::getCertificateNumb, empBaseInfo.getCertificateNumb());
+ p.or().like("a.CertificateNumb", empBaseInfo.getCertificateNumb());
}
if (StringUtils.isNotBlank(empBaseInfo.getEntryDateStr())) {
- p.or().between(EmpBaseInfo::getEntryDate, empBaseInfo.getEntryDateStr().split(",")[0], empBaseInfo.getEntryDateStr().split(",")[1]);
+ p.or().between("a.EntryDate", empBaseInfo.getEntryDateStr().split(",")[0], empBaseInfo.getEntryDateStr().split(",")[1]);
}
if (StringUtils.isNotBlank(empBaseInfo.getDimissionDateStr())) {
- p.or().between(EmpBaseInfo::getDimissionDate, empBaseInfo.getDimissionDateStr().split(",")[0], empBaseInfo.getDimissionDateStr().split(",")[1]);
+ p.or().between("a.DimissionDate", empBaseInfo.getDimissionDateStr().split(",")[0], empBaseInfo.getDimissionDateStr().split(",")[1]);
}
if (StringUtils.isNotBlank(empBaseInfo.getSex())) {
- p.or().in(EmpBaseInfo::getSex, empBaseInfo.getSex().split(","));
+ p.or().in("a.Sex", empBaseInfo.getSex().split(","));
}
if (StringUtils.isNotBlank(empBaseInfo.getEducation())) {
- p.or().in(EmpBaseInfo::getEducation, empBaseInfo.getEducation().split(","));
+ p.or().in("a.Education", empBaseInfo.getEducation().split(","));
}
if (StringUtils.isNotBlank(empBaseInfo.getPolitics())) {
- p.or().in(EmpBaseInfo::getPolitics, empBaseInfo.getPolitics().split(","));
+ p.or().in("a.Politics", empBaseInfo.getPolitics().split(","));
}
if (StringUtils.isNotBlank(empBaseInfo.getAgeStr())) {
String[] ages = empBaseInfo.getAgeStr().split(",");
- Consumer<LambdaQueryWrapper<EmpBaseInfo>> consumer = new Consumer<LambdaQueryWrapper<EmpBaseInfo>>() {
- @Override
- public void accept(LambdaQueryWrapper<EmpBaseInfo> wrapper) {
+ Consumer<QueryWrapper<EmpBaseInfo>> consumer = new Consumer<QueryWrapper<EmpBaseInfo>>() {
+ public void accept(QueryWrapper<EmpBaseInfo> wrapper) {
for (int i = 0; i < ages.length; i++) {
String ageBtn = ages[i];
- wrapper.or().between(EmpBaseInfo::getAge, ageBtn.split("-")[0], ageBtn.split("-")[1]);
+ wrapper.or().between("a.Age", ageBtn.split("-")[0], ageBtn.split("-")[1]);
}
}
};
p.or().and(consumer);
}
if (StringUtils.isNotBlank(empBaseInfo.getArchivesStatus())) {
- p.or().in(EmpBaseInfo::getArchivesStatus, empBaseInfo.getArchivesStatus().split(","));
+ p.or().in("a.ArchivesStatus", empBaseInfo.getArchivesStatus().split(","));
}
if (StringUtils.isNotBlank(empBaseInfo.getInsuranceType())) {
- p.or().in(EmpBaseInfo::getInsuranceType, empBaseInfo.getInsuranceType().split(","));
+ p.or().in("a.InsuranceType", empBaseInfo.getInsuranceType().split(","));
}
if (StringUtils.isNotBlank(empBaseInfo.getHandbookStatus())) {
- p.or().in(EmpBaseInfo::getHandbookStatus, empBaseInfo.getHandbookStatus().split(","));
+ p.or().in("a.HandbookStatus", empBaseInfo.getHandbookStatus().split(","));
}
if (StringUtils.isNotBlank(empBaseInfo.getEmpCardStatus())) {
- p.or().in(EmpBaseInfo::getEmpCardStatus, empBaseInfo.getEmpCardStatus().split(","));
+ p.or().in("a.EmpCardStatus", empBaseInfo.getEmpCardStatus().split(","));
}
});
}
+ queryWrapper.in("c.dept_Id", remoteDeptService.userRightDepts().split(StringConstant.COMMA));
return queryWrapper;
}
@@ -907,4 +912,14 @@
return dbEmpInfo;
}
}
+
+ @Override
+ public Long getEmpIdByEmpNumb(String empNumb) {
+ try {
+ return this.getOne(new LambdaQueryWrapper<EmpBaseInfo>().eq(EmpBaseInfo::getEmpNumb,empNumb).ne(EmpBaseInfo::getDelFlag,1)).getEmpId();
+ }catch (Exception e){
+ return null;
+ }
+
+ }
}
--
Gitblit v1.8.0