Commit 551fdbd9 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 9c2423c7
......@@ -25,6 +25,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
......@@ -39,11 +40,15 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectExportVO;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
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.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
......@@ -66,6 +71,7 @@ import java.util.stream.Collectors;
*/
@Service
@RequiredArgsConstructor
@EnableConfigurationProperties(DaprCheckProperties.class)
public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMapper, TEmployeeProject> implements TEmployeeProjectService {
private final TEmployeeLogService tEmployeeLogService;
......@@ -76,6 +82,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
private final TCustomerInfoMapper tCustomerInfoMapper;
private final DaprCheckProperties daprCheckProperties;
// 缓存信息
private final CacheManager cacheManager;
......@@ -216,6 +224,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
List<TEmployeeInfo> updateList = new ArrayList();
List<TEmployeeProject> proInsList = new ArrayList();
List<TEmployeeProject> proupdateList = new ArrayList();
// 获取身份证、手机号列表,批量查询档案
Map<String, Integer> idCardMap = new HashMap<>();
String idCard;
// 执行数据插入操作 组装 PostDto
for (int i = 0; i < excelVOList.size(); i++) {
EmployeeProjectVO excel = excelVOList.get(i);
......@@ -226,6 +239,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
continue;
}
idCard = excel.getEmpIdcard();
if (idCardMap.get(idCard) != null) {
errorMsgMap.put((i + 2L), new ErrorMessage("第" + (i + 2) + "行身份证号与第" + idCardMap.get(idCard) + "行重复!"));
} else {
idCardMap.put(idCard, i + 2);
}
//根据身份证获取人员档案
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
......@@ -239,8 +259,28 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//不存在复档或复项的情况
//档案无(在档人员、离职库皆无),项目无
if (Common.isEmpty(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)) {
insertExcelPost(excel, insertList);
insertExcelPro(excel, proInsList);
// 校验身份证实名
TCheckIdCard checkIdCard = new TCheckIdCard();
checkIdCard.setName(excel.getEmpName());
checkIdCard.setIdCard(excel.getEmpIdcard());
List<TCheckIdCard> checkList = new ArrayList<>();
checkList.add(checkIdCard);
R<List<TCheckIdCard>> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckidcard/inner/checkIdCard", checkList, TCheckIdCard.class, SecurityConstants.FROM_IN);
Boolean isSave = false;
if (checkListR != null && checkListR.getData() != null) {
for (TCheckIdCard check : checkListR.getData()) {
if (check.getIsTrue() == CommonConstants.ZERO_INT) {
errorMsg.add(check.getReason());
isSave = true;
break;
}
}
}
if (!isSave) {
insertExcelPost(excel, insertList);
insertExcelPro(excel, proInsList);
}
//档案有(在档人员),项目无
} else if (Common.isNotNull(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)
&& CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
......
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