Commit f1164655 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 2831096b
......@@ -129,7 +129,7 @@ public class TElecEmployeeInfoController {
@PostMapping("/importZip")
@Operation(summary = "批量导入电子档案", description = "批量导入电子档案")
@SysLog("批量导入电子档案" )
public R<Boolean> importZip(@RequestBody MultipartFile file) {
public R importZip(@RequestBody MultipartFile file) {
return this.tElecEmployeeInfoService.importZip(file);
}
}
......@@ -41,7 +41,7 @@ public interface TElecEmployeeInfoService extends IService<TElecEmployeeInfo> {
* @author: huyc
* @date: 2022/6/24
*/
R<Boolean> importZip(MultipartFile file);
R importZip(MultipartFile file);
/**
* @description: 通过身份证号查询人员档案
......
......@@ -46,6 +46,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.*;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
......@@ -90,7 +91,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
* @date: 2022/6/27
*/
@Override
public R<Boolean> importZip(MultipartFile zipFile){
public R importZip(MultipartFile zipFile){
try {
String pathName = ResourceUtils.getURL("classpath:").getPath() + "unloap/";
String dec = ResourceUtils.getURL("classpath:").getPath() + "unloap/";
......@@ -107,9 +108,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
File file = new File(pathName);
zipFile.transferTo(file);
// 获取解压出来的文件名 不带后缀
unZip(file, dec);
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFolder(dec);
return unZip(file, dec);
} catch (Exception e) {
e.printStackTrace();
}
......@@ -121,6 +120,9 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,idCard)).eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
if (Common.isNotNull(tEmployeeInfo)) {
if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) {
return R.failed("身份证号对应的档案为已减档");
}
return R.ok(tEmployeeInfo);
}
return R.failed("未找到身份证号对应的档案信息");
......@@ -196,18 +198,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
fos.write(buf, 0, len);
}
R<FileVo> fileVo =fileUploadService.uploadImg(fileCovertMultipartFile(targetFile),"", CommonConstants.EIGHT_INT,"");
if (empInfo.length() > empInfo.lastIndexOf("/") + 1) {
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()
.eq(TEmployeeInfo::getEmpIdcard,idCard)));
.eq(TEmployeeInfo::getEmpIdcard,idCard)).eq(TEmployeeInfo::getFileStatus,CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
if (Common.isNotNull(tEmployeeInfo)) {
empName = tEmployeeInfo.getEmpName();
}else {
return R.failed(idCard,"未找到身份证号对应的档案信息");
}
String attachInfo = empInfo.substring(empInfo.lastIndexOf("/")+1,empInfo.length());
TElecEmployeeInfo tElecEmployeeInfo = new TElecEmployeeInfo();
tElecEmployeeInfo.setEmpIdcard(idCard);
tElecEmployeeInfo.setEmpName(empName);
......@@ -215,7 +217,14 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
tElecEmployeeInfo.setDataType(elecTypeMap.get(dataType));
}
this.save(tElecEmployeeInfo);
//文件上传并保存附件信息
R<FileVo> fileVo =fileUploadService.uploadImg(fileCovertMultipartFile(targetFile),"", CommonConstants.EIGHT_INT,"");
String id = fileVo.getData().getUid();
attaInfoMapper.updateDomainId(tElecEmployeeInfo.getId(), Arrays.asList(id));
}
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFolder(destDirPath);
// 关流顺序,先打开的后关闭
fos.close();
is.close();
......
......@@ -185,14 +185,30 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
boolean flag = this.updateById(tEmployeeProject);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT));
if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo tEmployeeInfoCompare = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
if (CommonConstants.ZERO_STRING.equals(tEmployeeProject.getEmpNatrue())) {
//查询该人员所有的的项目档案
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
//从剩下的项目档案中查找员工类型并更新
if (Common.isNotNull(list)) {
for (TEmployeeProject t : list) {
if (CommonConstants.ZERO_STRING.equals(t.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
break;
} else if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfoCompare.getId(), "", tEmployeeInfoCompare, tEmployeeInfo);
}
......@@ -241,16 +257,66 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeProject tEmployeeProject = this.getById(empProId);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT));
if (Common.isNotNull(tEmployeeInfo)) {
//查询该人员所有的的项目档案
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
//从剩下的项目档案中查找员工类型并更新
if (Common.isNotNull(list)) {
for (TEmployeeProject t : list) {
if (CommonConstants.ZERO_STRING.equals(t.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
break;
} else if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeInfoOld, tEmployeeInfo);
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", empProId, tEmployeeProjectOld, tEmployeeProject);
} else {
//复档复项
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId);
TEmployeeProject tEmployeeProject = this.getById(empProId);
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", empProId, tEmployeeProjectOld, tEmployeeProject);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId);
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
//查询该人员所有的的项目档案
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
//从剩下的项目档案中查找员工类型并更新
if (Common.isNotNull(list)) {
for (TEmployeeProject t : list) {
if (CommonConstants.ZERO_STRING.equals(t.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
break;
} else if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], empId, "", tEmployeeInfoOld, tEmployeeInfo);
}
} else {
......@@ -296,11 +362,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (CommonConstants.ZERO_STRING.equals(t.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
break;
}
if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
} else if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
}
tEmployeeInfoMapper.updateById(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