Commit f3c6dda7 authored by huyuchen's avatar huyuchen

实缴导入校验项目

parent 7a82d9e1
......@@ -28,12 +28,12 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TElecEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.FileUploadService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TElecEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
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.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
......@@ -145,19 +145,19 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
*/
private R unZip(File srcFile, String destDirPath) throws RuntimeException {
// 调用字典服务,渲染字典值
R<Map<String, Map<String, Map<String, String>>>> dictR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dict/inner/getDictToLable", null, Map.class, SecurityConstants.FROM_IN);
Map<String, Map<String, Map<String, String>>> dictMap;
// 电子档案类型
Map<String, Map<String, String>> elecTypeMapData;
Map<String, String> elecTypeMap;
if (dictR == null) {
Map<String, String> elecTypeMap = new HashMap<>();
// 渲染字典值
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue()
.get(CacheConstants.DICT_DETAILS
+ CommonConstants.COLON_STRING
+ "literature_types");
if (Common.isNotNull(dicObj)) {
for (Map.Entry<String, String> entry : dicObj.entrySet()) {
elecTypeMap.put(entry.getValue(),entry.getKey());
}
}
if (!elecTypeMap.isEmpty()) {
return R.failed("获取字典失败!");
} else {
dictMap = dictR.getData();
elecTypeMapData = dictMap.get("data");
elecTypeMap = elecTypeMapData.get("literature_types");
}
// 判断源文件是否存在
if (!srcFile.exists()) {
......@@ -173,15 +173,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
Set<String> infoList =new HashSet<>();
Set<String> idCardList =new HashSet<>();
Set<String> cardType =new HashSet<>();
TEmployeeInfo tEmployeeInfo;
ZipEntry entry;
while (entriesCheck.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entriesCheck.nextElement();
entry = (ZipEntry) entriesCheck.nextElement();
//添加进filesName
String empInfo = entry.getName();
infoList.add(empInfo);
String dataType = "";
if (empInfo.length() == empInfo.lastIndexOf("/") + 1) {
String idCard = empInfo.substring(0, empInfo.indexOf("/"));
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, idCard)).eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT));
......@@ -191,7 +194,6 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
idCardList.add(idCard);
if (empInfo.length() > 20) {
dataType = empInfo.substring(empInfo.indexOf("/") + 1, empInfo.lastIndexOf("/"));
if (Common.isNotNull(elecTypeMap)) {
if (!Common.isNotNull(elecTypeMap.get(dataType))) {
return R.failed("资料类型错误:" + dataType);
}
......@@ -199,26 +201,23 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
}
}
}
}
for (String idCarInfo : idCardList) {
if (!infoList.stream().anyMatch(e-> containsCheckTwo(e,idCarInfo))) {
if (infoList.stream().noneMatch(e-> containsCheckTwo(e,idCarInfo))) {
return R.failed(idCarInfo + ":"+"证件数据不可为空");
}
}
if (cardType.size() > CommonConstants.ZERO_INT) {
for (String typeInfo :cardType) {
if (!infoList.stream().anyMatch(e -> containsCheckOne(e, typeInfo))) {
if (infoList.stream().noneMatch(e -> containsCheckOne(e, typeInfo))) {
return R.failed(typeInfo + ":" + "证件数据不可为空");
}
}
}
Map<String, String> insMap = new HashMap<>();
List<TElecEmployeeInfo> infolist = new ArrayList<>();
List<String> list = new ArrayList<>();
TEmployeeInfo employeeInfo;
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
entry = (ZipEntry) entries.nextElement();
//添加进filesName
String empInfo = entry.getName();
// 如果是文件夹,就创建个文件夹
......@@ -249,26 +248,22 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
String idCard = empInfo.substring(0, empInfo.indexOf("/"));
String dataType = empInfo.substring(empInfo.indexOf("/") + 1, empInfo.lastIndexOf("/"));
String empName = "";
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
employeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, idCard)).eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (Common.isNotNull(tEmployeeInfo)) {
empName = tEmployeeInfo.getEmpName();
if (Common.isNotNull(employeeInfo)) {
empName = employeeInfo.getEmpName();
}
tElecEmployeeInfo.setEmpIdcard(idCard);
tElecEmployeeInfo.setEmpName(empName);
if (Common.isNotNull(elecTypeMap)) {
if (Common.isNotNull(elecTypeMap.get(dataType))) {
tElecEmployeeInfo.setDataType(elecTypeMap.get(dataType));
}
}
String id = insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType);
if (Common.isEmpty(id)) {
infolist.add(tElecEmployeeInfo);
this.save(tElecEmployeeInfo);
insMap.put(idCard + CommonConstants.DOWN_LINE_STRING + dataType, tElecEmployeeInfo.getId());
}
list.add(insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType));
fileUploadService.uploadImg(fileCovertMultipartFile(targetFile), "", CommonConstants.EIGHT_INT, insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType));
}
......
......@@ -159,6 +159,12 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
List<TEmployeeProject> updateList = new ArrayList<>();
Set<String> errorMsg;
//对象声明
TEmpChangeInfoVO excel;
TSettleDomain tSettleDomain;
TEmployeeProject employeeProject;
TEmployeeProject updateTEmployeePro;
TEmployeeProject tEmployeeProjectOld;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
// 已有验证报错直接下一个
......@@ -166,7 +172,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
continue;
}
errorMsg = new HashSet<>();
TEmpChangeInfoVO excel = excelVOList.get(i);
excel = excelVOList.get(i);
excel.setUnsettleDeal(CommonConstants.IS_NO_CHANGE);
if (Common.isNotNull(excel.getChangeStartMonth()) && excel.getChangeStartMonth().length() > CommonConstants.dingleDigitIntArray[6]) {
errorMsg.add("划转起始月长度不能超过6位");
......@@ -184,7 +190,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
}
//项目编码校验
TSettleDomain tSettleDomain = tSettleDomainMapper.selectOne(Wrappers.<TSettleDomain>query().lambda()
tSettleDomain = tSettleDomainMapper.selectOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo, excel.getNewSettleCode())
.eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING)
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING));
......@@ -193,17 +199,17 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
}
//待划转员工已在目标项目下不可划转
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
employeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,excel.getNewSettleCode())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_INT));
if (Common.isNotNull(tEmployeeProject)) {
if (Common.isNotNull(employeeProject)) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.PROJECT_NEW_SEARCH_NOT_EXIST, excel.getNewSettleCode()));
}
// 数据合法情况
if (CollUtil.isEmpty(errorMsg)) {
//划转,更新项目信息
TEmployeeProject updateTEmployeePro = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
updateTEmployeePro = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,excel.getOldSettleCode())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(updateTEmployeePro)) {
......@@ -214,7 +220,7 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
if (CommonConstants.ONE_INT == updateTEmployeePro.getProjectStatus()) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_DELETE_EXIT, excel.getOldSettleCode()));
} else if (Common.isNotNull(tSettleDomain)) {
TEmployeeProject tEmployeeProjectOld = tEmployeeProjectService.getById(updateTEmployeePro.getId());
tEmployeeProjectOld = tEmployeeProjectService.getById(updateTEmployeePro.getId());
updateTEmployeePro.setDeptNo(tSettleDomain.getDepartNo());
updateTEmployeePro.setDeptId(tSettleDomain.getId());
updateTEmployeePro.setDeptName(tSettleDomain.getDepartName());
......@@ -300,7 +306,6 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
*/
@Override
public R<List<TCustomerInfo>> getAllUint(String customerName) {
//List<TCustomerInfo> list = tCustomerInfoService.list(Wrappers.<TCustomerInfo>query().lambda().eq(TCustomerInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
List<TCustomerInfo> list = tCustomerInfoService.getAllUnit(customerName);
return R.ok(list);
}
......
......@@ -949,9 +949,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
// 新老项目档案List
List<EmployeeProjectNewOldVO> updateProjectList = new ArrayList<>();
EmployeeProjectUpdateVO excel;
TEmployeeProject tEmployeeProject;
TEmployeeInfo tEmployeeInfo;
TEmployeeProject tEmployeeProjectOld;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
EmployeeProjectUpdateVO excel = excelVOList.get(i);
excel = excelVOList.get(i);
String checkCount = excel.getEmpIdcard().concat(excel.getDeptNo());
if (Common.isNotNull(checkCountMap.get(checkCount))) {
......@@ -960,7 +964,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
checkCountMap.put(checkCount, i + 2);
}
//根据身份证和项目编码获取项目档案
TEmployeeProject tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
......@@ -971,13 +975,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_DELETE_ERROR)));
} else {
updateExcelProj(excel, updateList, tEmployeeProject);
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
newOldProject = new EmployeeProjectNewOldVO();
newOldProject.setOldProjectEmployee(tEmployeeProjectOld);
newOldProject.setNewProjectEmployee(tEmployeeProject);
updateProjectList.add(newOldProject);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
......@@ -1065,6 +1069,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
}
if (Common.isNotEmpty(list)) {
TEmployeeInfo tEmployeeInfo;
int i = 0;
for (TEmployeeProject delProject : list) {
++i;
......@@ -1072,7 +1077,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (CommonConstants.dingleDigitIntArray[0] == delProject.getStatus()) {
delProject.setDeleteFlag(CommonConstants.ONE_STRING);
updList.add(delProject);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, delProject.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
infoUpdList.add(tEmployeeInfo);
......
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