From 8a5d28595e792bf2d103549752b0c80a10f49a38 Mon Sep 17 00:00:00 2001
From: luoyb <412940104@qq.com>
Date: 星期六, 06 三月 2021 21:19:28 +0800
Subject: [PATCH] fix(bug修复): 基本信息录入
---
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpBaseInfoServiceImpl.java | 44 ++++++++++++++++++++++++++++++--------------
1 files changed, 30 insertions(+), 14 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 dab475f..3522a95 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
@@ -74,9 +74,7 @@
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");
+ private final String operatorId = Optional.of(FebsUtil.getUserId()).orElse("1");
@Override
public IPage<EmpBaseInfo> findEmpBaseInfos(QueryRequest request, EmpBaseInfo empBaseInfo) {
@@ -106,7 +104,7 @@
.filter(k -> DicCode.EMPTYPE.equals(k.getDicCode()) && k.getDicItemCode().equals(p.getEmpType()))
.findFirst()
.map(DicItem::getDicItemName)
- .orElse("汉族"));
+ .orElse("正式工"));
// 设置民族
p.setNationName(dicItems.stream()
.filter(k -> DicCode.NATION.equals(k.getDicCode()) && k.getDicItemCode().equals(p.getNation()))
@@ -239,7 +237,12 @@
@Override
public boolean verifyEmpNumb(EmpBaseInfo empBaseInfo) {
QueryWrapper<EmpBaseInfo> queryWrapper = new QueryWrapper<>();
- queryWrapper.lambda().eq(EmpBaseInfo::getEmpNumb, empBaseInfo.getEmpNumb()).ne(EmpBaseInfo::getDelFlag, 1);
+ queryWrapper.lambda().eq(EmpBaseInfo::getEmpNumb, empBaseInfo.getEmpNumb())
+ .ne(EmpBaseInfo::getDelFlag, 1);
+ if (empBaseInfo.getEmpId()!=null) {
+ queryWrapper.lambda().ne(EmpBaseInfo::getEmpId, empBaseInfo.getEmpId());
+ }
+
if (this.count(queryWrapper) <= 0) {
return false;
}
@@ -372,13 +375,13 @@
*/
@Override
@Transactional(rollbackFor = Exception.class)
- public void importEmpBaseInfo(List<List<Object>> listObject,List<String> returnList) {
+ public void importEmpBaseInfo(List<List<Object>> listObject, List<String> returnList) {
for (List<Object> list : listObject) {
- if (list.size()==0){
+ if (list.size() == 0) {
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)+1,list.get(1).toString()));
+ 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) + 1, list.get(1).toString()));
continue;
}
EmpBaseInfo empBaseInfo = new EmpBaseInfo();
@@ -390,7 +393,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)+1,list.get(3).toString()));
+ returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}部门不存在", listObject.indexOf(list) + 1, list.get(3).toString()));
continue;
}
empBaseInfo.setDeptId(dept.getDeptId());
@@ -829,7 +832,7 @@
}
private QueryWrapper<EmpBaseInfo> createQueryWrapper(EmpBaseInfo empBaseInfo) {
- QueryWrapper<EmpBaseInfo> queryWrapper = new QueryWrapper<>();
+ QueryWrapper<EmpBaseInfo> queryWrapper = new QueryWrapper<>();
//记录的状态,0-正常 1-删除 2-暂存
if (StringUtils.isNotBlank(empBaseInfo.getDelFlag().toString())) {
queryWrapper.eq("a.DelFlag", empBaseInfo.getDelFlag());
@@ -858,10 +861,10 @@
p.or().like("a.CertificateNumb", empBaseInfo.getCertificateNumb());
}
if (StringUtils.isNotBlank(empBaseInfo.getEntryDateStr())) {
- p.or().between("a.EntryDate", empBaseInfo.getEntryDateStr().split(",")[0], empBaseInfo.getEntryDateStr().split(",")[1]);
+ p.between("a.EntryDate", empBaseInfo.getEntryDateStr().split(",")[0], empBaseInfo.getEntryDateStr().split(",")[1]);
}
if (StringUtils.isNotBlank(empBaseInfo.getDimissionDateStr())) {
- p.or().between("a.DimissionDate", empBaseInfo.getDimissionDateStr().split(",")[0], empBaseInfo.getDimissionDateStr().split(",")[1]);
+ p.between("a.DimissionDate", empBaseInfo.getDimissionDateStr().split(",")[0], empBaseInfo.getDimissionDateStr().split(",")[1]);
}
if (StringUtils.isNotBlank(empBaseInfo.getSex())) {
p.or().in("a.Sex", empBaseInfo.getSex().split(","));
@@ -896,6 +899,9 @@
if (StringUtils.isNotBlank(empBaseInfo.getEmpCardStatus())) {
p.or().in("a.EmpCardStatus", empBaseInfo.getEmpCardStatus().split(","));
}
+ if (StringUtils.isNotBlank(empBaseInfo.getEmpType())) {
+ p.or().in("a.empType", empBaseInfo.getEmpType().split(","));
+ }
});
}
queryWrapper.in("c.dept_Id", remoteDeptService.userRightDepts().split(StringConstant.COMMA));
@@ -916,7 +922,17 @@
@Override
public Long getEmpIdByEmpNumb(String empNumb) {
try {
- return this.getOne(new LambdaQueryWrapper<EmpBaseInfo>().eq(EmpBaseInfo::getEmpNumb,empNumb).ne(EmpBaseInfo::getDelFlag,1)).getEmpId();
+ return this.getOne(new LambdaQueryWrapper<EmpBaseInfo>().eq(EmpBaseInfo::getEmpNumb, empNumb).ne(EmpBaseInfo::getDelFlag, 1)).getEmpId();
+ } catch (Exception e) {
+ return null;
+ }
+
+ }
+
+ @Override
+ public EmpBaseInfo getEmpBaseInfoByEmpNumb(String empNumb) {
+ try {
+ return this.getOne(new LambdaQueryWrapper<EmpBaseInfo>().eq(EmpBaseInfo::getEmpNumb,empNumb).ne(EmpBaseInfo::getDelFlag,1));
}catch (Exception e){
return null;
}
--
Gitblit v1.8.0