Commit aaa17af0 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent 7f513c12
......@@ -83,7 +83,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override
public R addCheck(TEmployeeProject tEmployeeProject) {
Map<String,Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>();
//身份证系统中是否已有
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
......@@ -92,9 +92,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//项目下已有身份证信息
TEmployeeProject employeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard,tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo,tEmployeeProject.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL));
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, tEmployeeProject.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (!Common.isEmpty(employeeProject)) {
//身份证实名认证
......@@ -105,9 +105,9 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
//项目编码校验
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,tEmployeeProject.getDeptNo())
.eq(TSettleDomain::getStopFlag,CommonConstants.ZERO_STRING)
.eq(TSettleDomain::getDeleteFlag,CommonConstants.ZERO_STRING));
.eq(TSettleDomain::getDepartNo, tEmployeeProject.getDeptNo())
.eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING)
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING));
if (Common.isEmpty(tSettleDomain)) {
return R.failed("未找到对应的项目,请核实");
}
......@@ -115,12 +115,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//项目状态为已减项
if (CommonConstants.dingleDigitIntArray[1] == employeeProject.getProjectStatus()) {
if (!Common.isEmpty(tEmployeeInfo)) {
map.put("empProId",employeeProject.getId());
map.put("empProId", employeeProject.getId());
if (CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
return new R<>(CommonConstants.dingleDigitIntArray[4],"该人员已减项,是否“复项”",map);
return new R<>(CommonConstants.dingleDigitIntArray[4], "该人员已减项,是否“复项”", map);
} else {
map.put("employeeId", tEmployeeInfo.getId());
return new R<>(CommonConstants.dingleDigitIntArray[2],"该人员已减档减项,是否“复档复项”",map);
return new R<>(CommonConstants.dingleDigitIntArray[2], "该人员已减档减项,是否“复档复项”", map);
}
}
}
......@@ -136,7 +136,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//判断是否已经减档
if (tEmployeeInfo.getFileStatus() == CommonConstants.dingleDigitIntArray[1]) {
map.put("employeeId", tEmployeeInfo.getId());
return new R<>(CommonConstants.dingleDigitIntArray[3],"该人员在离职库已存在,是否“恢复档案”",map);
return new R<>(CommonConstants.dingleDigitIntArray[3], "该人员在离职库已存在,是否“恢复档案”", map);
}
}
return R.ok();
......@@ -159,7 +159,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
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())) {
} else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
}
tEmployeeInfo.setProjectNum(tEmployeeInfo.getProjectNum().intValue() + CommonConstants.ONE_INT);
......@@ -178,15 +178,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo tEmployeeInfoCompare = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
if (CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
if (CommonConstants.ZERO_STRING.equals(tEmployeeProject.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
} else if (CommonConstants.ONE_STRING.equals(tEmployeeProject.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], tEmployeeInfoCompare.getId(), "", tEmployeeInfoCompare, tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfoCompare.getId(), "", tEmployeeInfoCompare, tEmployeeInfo);
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1],"",tEmployeeProject.getId(),compareProject,tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), compareProject, tEmployeeProject);
return R.ok(flag);
}
......@@ -199,23 +199,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
//删除项目档案
this.removeById(id);
//从剩下的项目档案中查找员工类型
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(list)) {
for (TEmployeeProject t :list) {
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())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
TEmployeeInfo tEmployeeInfoCop = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(),tEmployeeInfo);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
//更新操作日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfoCop.getId(), "", tEmployeeInfoCop, tEmployeeInfo);
return R.ok();
}
......@@ -231,13 +223,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId);
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[0]);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],empId,"",tEmployeeInfoOld,tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], empId, "", tEmployeeInfoOld, tEmployeeInfo);
} else if (Common.isEmpty(empId) && !Common.isEmpty(empProId)) {
//复项
TEmployeeProject tEmployeeProject = this.getById(empProId);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1],"",empProId,tEmployeeProjectOld,tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", empProId, tEmployeeProjectOld, tEmployeeProject);
} else {
//复档复项
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(empId);
......@@ -246,8 +238,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[0]);
this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1],"",empProId,tEmployeeProjectOld,tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],empId,"",tEmployeeInfoOld,tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", empProId, tEmployeeProjectOld, tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], empId, "", tEmployeeInfoOld, tEmployeeInfo);
}
} else {
return R.failed("传参为空!");
......@@ -258,10 +250,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override
public R deleteEmpPro(TEmployeeProject tEmployeeProject) {
Long count = this.count(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getId,tEmployeeProject.getId())
.eq(TEmployeeProject::getInsuranceStatus,CommonConstants.dingleDigitIntArray[0])
.eq(TEmployeeProject::getSocialStatus,CommonConstants.dingleDigitIntArray[0])
.eq(TEmployeeProject::getFundStatus,CommonConstants.dingleDigitIntArray[0]));
.eq(TEmployeeProject::getId, tEmployeeProject.getId())
.eq(TEmployeeProject::getInsuranceStatus, CommonConstants.dingleDigitIntArray[0])
.eq(TEmployeeProject::getSocialStatus, CommonConstants.dingleDigitIntArray[0])
.eq(TEmployeeProject::getFundStatus, CommonConstants.dingleDigitIntArray[0]));
if (count == CommonConstants.ONE_INT) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
......@@ -270,17 +262,22 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (tEmployeeProject.getIsLeaveEmployee() == CommonConstants.dingleDigitIntArray[1]) {
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
code = CommonConstants.ONE_STRING;
}
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(),tEmployeeInfo);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
this.updateById(tEmployeeProject);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeInfoOld, tEmployeeProject);
if (CommonConstants.ONE_STRING.equals(code)) {
return R.ok(null,"减项减档成功");
return R.ok(null, "减项减档成功");
} else {
return R.ok(null,"减项成功,项目状态已更新为“已减项”");
return R.ok(null, "减项成功,项目状态已更新为“已减项”");
}
}
}
......@@ -310,29 +307,32 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
.eq(TEmployeeProject::getEmpId, tEmployeeProject.getEmpId())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.dingleDigitIntArray[0]));
if (count.compareTo(CommonConstants.DEPT_TREE_ROOT_ID) > 0) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST)));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST)));
}
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfo.setLeaveReason(excel.getLeaveReason());
tEmployeeInfo.setLeaveRemark(excel.getLeaveRemark());
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo);
}
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeProject.setLeaveReason(excel.getLeaveReason());
tEmployeeProject.setLeaveRemark(excel.getLeaveRemark());
this.updateById(tEmployeeProject);
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(),tEmployeeInfo);
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeProjectOld, tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeInfoOld, tEmployeeProject);
}
}
if (errorMessageList.size()> CommonConstants.ZERO_INT) {
if (errorMessageList.size() > CommonConstants.ZERO_INT) {
return R.failed(errorMessageList);
}
return R.ok();
}
@Override
public R<List<ErrorMessage>> importListAdd(InputStream inputStream,String isAdd) {
public R<List<ErrorMessage>> importListAdd(InputStream inputStream, String isAdd) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class);
// 写法2:
......@@ -378,7 +378,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importListAdd(cachedDataList, errorMessageList,isAdd);
importListAdd(cachedDataList, errorMessageList, isAdd);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -391,6 +391,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/**
* 新增档案操作记录
*
* @param excelVOList
* @param errorMessageList
* @param
......@@ -398,7 +399,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
* @date 2022-06-20 18:52:16
*/
@Transactional
public void importListAdd(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList, String idAdd) {
public void importListAdd(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList, String idAdd) {
// 通用校验获取失败的数据
List<TEmployeeInfo> updateList = new ArrayList();
List<TEmployeeProject> proInsList = new ArrayList();
......@@ -429,7 +430,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
}
if (idCardMap.get(idCard.concat(deptNo)) != null) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),"第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + idCardMap.get(idCard) + "行重复!"));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + idCardMap.get(idCard) + "行重复!"));
} else {
idCardMap.put(idCard.concat(deptNo), i + 2);
}
......@@ -447,17 +448,17 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//不存在复档或复项的情况
//档案无(在档人员、离职库皆无),项目无
if (Common.isEmpty(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_EXIT_EMPPROJECT_ERROR)));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EXIT_EMPPROJECT_ERROR)));
//档案有(在档人员),项目无
} else if (Common.isNotNull(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)
&& CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ONE_INT);
updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ONE_INT);
insertExcelPro(excel, proInsList);
//档案有(在档人员),项目有(草稿/已审核);
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[0] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ZERO_INT);
updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ZERO_INT);
updateExcelPro(excel, proupdateList, tEmployeeProject);
}
......@@ -465,18 +466,18 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (CommonConstants.ONE_STRING.equals(idAdd)) {
//档案有(离职库),项目(已减档)
if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ZERO_INT);
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ZERO_INT);
updateExcelPro(excel, proupdateList, tEmployeeProject);
//档案有(离职库),项目无;
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject) ) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ONE_INT);
&& Common.isEmpty(tEmployeeProject)) {
updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ONE_INT);
insertExcelPro(excel, proInsList);
//档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo,CommonConstants.ZERO_INT);
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
updateExcelPost(excel, updateList, tEmployeeInfo, CommonConstants.ZERO_INT);
updateExcelPro(excel, proupdateList, tEmployeeProject);
}
//不允许复档复项
......@@ -484,14 +485,15 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//档案有(离职库),项目(已减档)
if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_PROJECT_ERROR)));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_PROJECT_ERROR)));
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_EMP_ERROR)));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_EMP_ERROR)));
//档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_PROJECT_ERROR))); }
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_REDUCE_PROJECT_ERROR)));
}
}
}
......@@ -502,21 +504,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (proInsList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.insertExcelEmpProject(proInsList);
List<String> idList = proInsList.stream().map(TEmployeeProject::getEmpIdcard).collect(Collectors.toList());
List<TEmployeeInfo> updList = tEmployeeInfoMapper.selectList(Wrappers.<TEmployeeInfo>query().lambda().in(TEmployeeInfo::getEmpIdcard,idList));
List<TEmployeeInfo> updList = tEmployeeInfoMapper.selectList(Wrappers.<TEmployeeInfo>query().lambda().in(TEmployeeInfo::getEmpIdcard, idList));
baseMapper.updateEmpIdById(updList);
}
if (proupdateList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.updateExcelEmpProject(proupdateList);
}
} catch (Exception e) {
log.error("数据更新异常",e);
log.error("数据更新异常", e);
}
}
@Override
@Transactional
public R<List<ErrorMessage>> importEmpProjectUpdate(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class);;
ExcelUtil<EmployeeProjectVO> util1 = new ExcelUtil<>(EmployeeProjectVO.class);
;
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
......@@ -535,11 +539,11 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
public void invoke(EmployeeProjectVO data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
}else {
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
......@@ -559,25 +563,25 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importEmpProjectUpdate(cachedDataList,errorMessageList);
importEmpProjectUpdate(cachedDataList, errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
return R.ok(errorMessageList);
}
/**
* @Author huyc
* @Description 批量更新项目档案信息
* @Description 批量更新项目档案信息
* @Date 19:25 2022/6/21
**/
public void importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, List<ErrorMessage> errorMessageList) {
// 通用校验获取失败的数据
Map<Long,ErrorMessage> errorMsgMap = new HashMap<>();
Map<Long, ErrorMessage> errorMsgMap = new HashMap<>();
List<TEmployeeProject> updateList = new ArrayList<>();
......@@ -592,7 +596,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
String checkCount = excel.getEmpIdcard().concat(excel.getDeptNo());
if (Common.isNotNull(checkCountMap.get(checkCount))) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),"第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + checkCountMap.get(checkCount) + "行重复!"));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + checkCountMap.get(checkCount) + "行重复!"));
} else {
checkCountMap.put(checkCount, i + 2);
}
......@@ -602,12 +606,29 @@ 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)));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.CHECKS_EMP_EXIT_ERROR)));
}
// 数据合法情况
if (CollUtil.isEmpty(errorMessageList)) {
updateExcelPro(excel,updateList,tEmployeeProject);
updateExcelPro(excel, updateList, tEmployeeProject);
if (!excel.getEmpNatrue().equals(tEmployeeProject.getEmpNatrue())) {
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));
if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo tEmployeeInfoCof = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
String empNature = tEmployeeInfo.getEmpNatrue();
if (CommonConstants.ZERO_STRING.equals(excel.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (CommonConstants.ONE_STRING.equals(excel.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(empNature)) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(), "", tEmployeeInfoCof, tEmployeeInfo);
}
}
}
}
try {
......@@ -615,18 +636,18 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
baseMapper.updateExcelEmpProject(updateList);
}
} catch (Exception e) {
log.error("数据更新异常",e);
log.error("数据更新异常", e);
}
}
/**
* 插入excel Pro
*/
private void insertExcelPro(EmployeeProjectVO excel,List<TEmployeeProject> proInsList) {
private void insertExcelPro(EmployeeProjectVO excel, List<TEmployeeProject> proInsList) {
TEmployeeProject insTEmployeePro = new TEmployeeProject();
BeanUtil.copyProperties(excel, insTEmployeePro);
insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replaceAll("-",""));
insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
insTEmployeePro.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeePro.setStatus(CommonConstants.dingleDigitIntArray[0]);
//人员档案主表id先设置成空,后面更新id
......@@ -634,13 +655,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//获取项目和单位信息
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,insTEmployeePro.getDeptNo()).eq(TSettleDomain::getDeleteFlag,CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag,CommonConstants.STATUS_NORMAL));
.eq(TSettleDomain::getDepartNo, insTEmployeePro.getDeptNo()).eq(TSettleDomain::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tSettleDomain)) {
insTEmployeePro.setDeptId(tSettleDomain.getId());
insTEmployeePro.setDeptName(tSettleDomain.getDepartName());
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectById(tSettleDomain.getCustomerId());
if(Common.isNotNull(tCustomerInfo)) {;
if (Common.isNotNull(tCustomerInfo)) {
;
insTEmployeePro.setUnitId(tCustomerInfo.getId());
insTEmployeePro.setUnitNo(tCustomerInfo.getCustomerCode());
insTEmployeePro.setUnitName(tCustomerInfo.getCustomerName());
......@@ -674,21 +696,21 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (Common.isNotEmpty(idsList)) {
list = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda().in(TEmployeeProject::getId, idsList));
}
if(Common.isNotEmpty(list)) {
if (Common.isNotEmpty(list)) {
int i = 0;
for (TEmployeeProject delProject : list) {
++i;
try {
if (CommonConstants.dingleDigitIntArray[0] ==delProject.getStatus()) {
if (CommonConstants.dingleDigitIntArray[0] == delProject.getStatus()) {
delProject.setDeleteFlag(CommonConstants.ONE_STRING);
baseMapper.updateById(delProject);
}else {
errorList.add(new ErrorMessage(i,MsgUtils.getMessage(ErrorCodes.CHECKS_PROJECT_DELETE_ERROR)));
} else {
errorList.add(new ErrorMessage(i, MsgUtils.getMessage(ErrorCodes.CHECKS_PROJECT_DELETE_ERROR)));
}
} catch (Exception e) {
log.error("项目档案批量删除异常:" + e.getMessage());
errorList.add(new ErrorMessage(i,MsgUtils.getMessage("项目档案批量删除异常:", e.getMessage())));
return R.failed(errorList,CommonConstants.RESULT_DATA_FAIL);
errorList.add(new ErrorMessage(i, MsgUtils.getMessage("项目档案批量删除异常:", e.getMessage())));
return R.failed(errorList, CommonConstants.RESULT_DATA_FAIL);
}
}
}
......@@ -700,13 +722,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override
public IPage<TEmployeeProject> getTEmployeeProjectInfoPage(Page page, TEmployeeProject tEmployeeProject) {
return baseMapper.getTEmployeeProjectInfoPage(page,tEmployeeProject);
return baseMapper.getTEmployeeProjectInfoPage(page, tEmployeeProject);
}
/**
* @Author huyc
* @Description 批量导出项目档案信息
* @Description 批量导出项目档案信息
* @Date 10:55 2022/6/23
**/
@Override
......@@ -725,28 +747,28 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//获取记录
list = gettEmpProInfoExportVos(idstr, projectDTO);
if (Common.isNotNull(list)){
if (Common.isNotNull(list)) {
ExcelUtil<EmployeeProjectExportVO> util = new ExcelUtil<>(EmployeeProjectExportVO.class);
for (EmployeeProjectExportVO vo:list){
util.convertEntity(vo,null,null,null);
for (EmployeeProjectExportVO vo : list) {
util.convertEntity(vo, null, null, null);
}
}
ServletOutputStream out = null;
try {
if (list.size()>0) {
if (list.size() > 0) {
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*=utf-8'zh_cn'" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, EmployeeProjectExportVO.class).includeColumnFiledNames(includeColumnFiledNames).sheet("项目档案")
.doWrite(list);
out.flush();
}
}catch (Exception e){
log.error("执行异常" ,e);
}finally {
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
......@@ -779,13 +801,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeProject.setDeptNo(employeeInfo.getDeptNo());
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,employeeInfo.getDeptNo()).eq(TSettleDomain::getDeleteFlag,CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag,CommonConstants.STATUS_NORMAL));
.eq(TSettleDomain::getDepartNo, employeeInfo.getDeptNo()).eq(TSettleDomain::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TSettleDomain::getStopFlag, CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(tSettleDomain)) {
tEmployeeProject.setDeptId(tSettleDomain.getId());
tEmployeeProject.setDeptName(tSettleDomain.getDepartName());
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectById(tSettleDomain.getCustomerId());
if(Common.isNotNull(tCustomerInfo)) {;
if (Common.isNotNull(tCustomerInfo)) {
;
tEmployeeProject.setUnitId(tCustomerInfo.getId());
tEmployeeProject.setUnitNo(tCustomerInfo.getCustomerCode());
tEmployeeProject.setUnitName(tCustomerInfo.getCustomerName());
......@@ -797,7 +820,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/**
* 获取导出的项目档案列表
*/
private List<EmployeeProjectExportVO> gettEmpProInfoExportVos(String idstr,EmployeeProjectExportVO projectDTO) {
private List<EmployeeProjectExportVO> gettEmpProInfoExportVos(String idstr, EmployeeProjectExportVO projectDTO) {
List<EmployeeProjectExportVO> list;
if (!Common.isEmpty(idstr)) {
projectDTO.setIdList(Common.initStrToList(idstr, CommonConstants.COMMA_STRING));
......@@ -809,7 +832,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/**
* 更新人员档案
*/
private void updateExcelPost(EmployeeProjectVO excel,List<TEmployeeInfo> updateList,TEmployeeInfo tEmployeeInfo,int num) {
private void updateExcelPost(EmployeeProjectVO excel, List<TEmployeeInfo> updateList, TEmployeeInfo tEmployeeInfo, int num) {
String empNature = tEmployeeInfo.getEmpNatrue();
BeanUtil.copyProperties(excel, tEmployeeInfo);
YifuUser user = SecurityUtils.getUser();
tEmployeeInfo.setUpdateBy(user.getId());
......@@ -818,7 +842,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
if (CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
}else if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
} else if (CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue()) && !CommonConstants.ZERO_STRING.equals(empNature)) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
}
updateList.add(tEmployeeInfo);
......@@ -830,7 +854,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/**
* 更新项目档案
*/
private void updateExcelPro(EmployeeProjectVO excel,List<TEmployeeProject> proupdateList,TEmployeeProject tEmployeeProject) {
private void updateExcelPro(EmployeeProjectVO excel, List<TEmployeeProject> proupdateList, TEmployeeProject tEmployeeProject) {
BeanUtil.copyProperties(excel, tEmployeeProject);
YifuUser user = SecurityUtils.getUser();
tEmployeeProject.setUpdateBy(user.getId());
......@@ -863,10 +887,10 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
@Override
public R getItemByEmpNo(String empIdcard, String empNo) {
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
.eq(TSettleDomain::getDepartNo,empNo));
.eq(TSettleDomain::getDepartNo, empNo));
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,empIdcard));
Map<String,Object> map = new HashMap<>();
.eq(TEmployeeInfo::getEmpIdcard, empIdcard));
Map<String, Object> map = new HashMap<>();
String empCode = "";
if (Common.isNotNull(tEmployeeInfo)) {
empCode = tEmployeeInfo.getEmpCode();
......@@ -874,27 +898,27 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
String customerName = "";
if (Common.isNotNull(tSettleDomain)) {
TCustomerInfo tCustomerInfo = tCustomerInfoMapper.selectOne(Wrappers.<TCustomerInfo>query().lambda()
.eq(TCustomerInfo::getId,tSettleDomain.getCustomerId()));
.eq(TCustomerInfo::getId, tSettleDomain.getCustomerId()));
if (Common.isNotNull(tCustomerInfo)) {
customerName = tCustomerInfo.getCustomerName();
}
}
map.put("empCode",empCode);
map.put("itemInfo",tSettleDomain);
map.put("customerName",customerName);
map.put("empCode", empCode);
map.put("itemInfo", tSettleDomain);
map.put("customerName", customerName);
return R.ok(map);
}
@Override
public R<Map<String, String>> getProjectByIdCard(String empIdCard) {
List<TEmployeeProject> projects = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getProjectStatus,CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getEmpIdcard,empIdCard));
Map<String,String> projectMap = new HashMap<>();
if (Common.isNotNull(projects)){
for (TEmployeeProject project:projects){
projectMap.put(project.getDeptName(),project.getDeptNo());
List<TEmployeeProject> projects = baseMapper.selectList(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getEmpIdcard, empIdCard));
Map<String, String> projectMap = new HashMap<>();
if (Common.isNotNull(projects)) {
for (TEmployeeProject project : projects) {
projectMap.put(project.getDeptName(), project.getDeptNo());
}
}
return R.ok(projectMap);
......@@ -911,4 +935,25 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
return str;
}
//从剩下的项目档案中查找员工类型
public void setEmpNature(String empIdcard,TEmployeeInfo tEmployeeInfo) {
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, empIdcard)
.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;
}
if (CommonConstants.ONE_STRING.equals(t.getEmpNatrue()) && !CommonConstants.ONE_STRING.equals(tEmployeeInfo.getEmpNatrue())) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
break;
}
}
}
}
}
......@@ -104,9 +104,6 @@
<if test="fddContractAttachInfo.salaryStandardPerPiece != null">
AND a.SALARY_STANDARD_PER_PIECE = #{fddContractAttachInfo.salaryStandardPerPiece}
</if>
<if test="fddContractAttachInfo.createUserId != null and fddContractAttachInfo.createUserId.trim() != ''">
AND a.CREATE_USER_ID = #{fddContractAttachInfo.createUserId}
</if>
<if test="fddContractAttachInfo.fddTemplateId != null and fddContractAttachInfo.fddTemplateId.trim() != ''">
AND a.FDD_TEMPLATE_ID = #{fddContractAttachInfo.fddTemplateId}
</if>
......
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