Commit e3f75496 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents a7077194 47180616
......@@ -78,7 +78,7 @@ public class EmployeeXProjectVO extends RowIndex implements Serializable {
* 是否同步减档(0否;1是)
*/
@ExcelProperty(value ="是否同步减档")
@NotNull(message = "是否同步减档不能为空")
@ExcelAttribute(name = "是否同步减档",isNotEmpty = true, errorInfo = "是否同步减档不能为空",maxLength = 1)
// @NotNull(message = "是否同步减档不能为空")
// @ExcelAttribute(name = "是否同步减档",isNotEmpty = true, errorInfo = "是否同步减档不能为空",maxLength = 1)
private String isLeaveEmployee;
}
......@@ -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();
......
......@@ -204,7 +204,7 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T
@Override
public void listExport(HttpServletResponse response, EmpBadRecordSearchVo searchVo) {
String fileName = "不良记录批量导出" + LocalDateTime.now() + ".xlsx";
String fileName = "不良记录批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TEmpBadRecord> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
......@@ -213,7 +213,7 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName , "UTF-8"));
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, TEmpBadRecord.class).build();
......
......@@ -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())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
//查询该人员所有的的项目档案
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], tEmployeeInfoCompare.getId(), "", tEmployeeInfoCompare, tEmployeeInfo);
}
......@@ -228,29 +244,85 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (Common.isNotNull(jsonObject)) {
String empId = jsonObject.getString("empId");
String empProId = jsonObject.getString("empProId");
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(empId);
TEmployeeProject tEmployeeProjectOld = this.getById(empProId);
TEmployeeInfo tEmployeeInfoOld;
TEmployeeProject tEmployeeProjectOld;
if (!Common.isEmpty(empId) && Common.isEmpty(empProId)) {
//复档
tEmployeeInfoOld = tEmployeeInfoMapper.selectById(empId);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId);
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], empId, "", tEmployeeInfoOld, tEmployeeInfo);
} else if (Common.isEmpty(empId) && !Common.isEmpty(empProId)) {
//复项
tEmployeeProjectOld = this.getById(empProId);
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)) {
tEmployeeInfoOld = tEmployeeInfoMapper.selectById(empId);
//查询该人员所有的的项目档案
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 {
tEmployeeInfoOld = tEmployeeInfoMapper.selectById(empId);
tEmployeeProjectOld = this.getById(empProId);
//复档复项
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 +368,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);
......@@ -726,24 +798,24 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isEmpty(tEmployeeProject)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_EXIT_ERROR)));
} else {
if (tEmployeeProject.getProjectStatus() != CommonConstants.dingleDigitIntArray[0]) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_DELETE_ERROR)));
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_EXIT_ERROR)));
}
} else {
updateExcelProj(excel, updateList, tEmployeeProject);
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
newOldProject = new EmployeeProjectNewOldVO();
newOldProject.setOldProjectEmployee(tEmployeeProjectOld);
newOldProject.setNewProjectEmployee(tEmployeeProject);
updateProjectList.add(newOldProject);
updateExcelProj(excel, updateList, tEmployeeProject);
TEmployeeProject 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()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
updTEmployeeList.add(tEmployeeInfo);
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
updTEmployeeList.add(tEmployeeInfo);
}
}
}
......@@ -753,7 +825,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.updateExcelEmpProject(updateList);
}
if (updTEmployeeList.size()> CommonConstants.dingleDigitIntArray[0]) {
if (updTEmployeeList.size() > CommonConstants.dingleDigitIntArray[0]) {
List<TEmployeeInfo> updEmpInfoList = updTEmployeeList.stream().distinct().collect(Collectors.toList());
doJointTask.doUpdateEmployeeInfo(updEmpInfoList);
}
......
......@@ -16,11 +16,23 @@ spring:
password: yf_zsk
#url: jdbc:mysql://127.0.0.1:3306/yifu_upms?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://192.168.1.65:22306/mvp_archives?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
servlet:
multipart:
location: /data/tmp
#法大大生产环境
#fdd:
# app-id: FA05480470
# app-key: GTYGFVFOYUYP3ONRHY91EK8IEAK5L9E7
# server-url: https://openapi.fadada.com/api/v3/
# connect-timeout: 10000
# read-timeout: 10000
# hrms-url: http://2349f6a315.wicp.vip:39468/v1.0/invoke/yifu-archives/method
#法大大沙箱环境配置
fdd:
app-id: FA05480470
app-key: GTYGFVFOYUYP3ONRHY91EK8IEAK5L9E7
server-url: https://openapi.fadada.com/api/v3/
connect-timeout: 10000
read-timeout: 10000
hrms-url: http://2349f6a315.wicp.vip:39468/v1.0/invoke/yifu-archives/method/fdd/notifyUrl
\ No newline at end of file
appId: FA38847543
appKey: HOQBDZAEMEILJM6WU9LY0OPFHNFAMVTQ
serverUrl: https://sandboxapi.fadada.com/api/v3/
connectTimeout: 10000
readTimeout: 10000
hrmsUrl: http://2349f6a315.wicp.vip:39468/v1.0/invoke/yifu-archives/method
\ No newline at end of file
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