Commit 58971c6b authored by fangxinjiang's avatar fangxinjiang

附件编辑-fxj

parent 02bcc89f
......@@ -81,7 +81,7 @@ public class TAttaInfo extends BaseEntity {
@TableField(exist = false)
private String attaUrl;
/**
* 附件变更类型:0 增加 1 减少。 档案编辑附件时需要告知后端是增加还是减少
* 附件变更类型:0 新增 1 更新 2 删除 3 不变 档案编辑附件时需要告知后端是增加还是减少
*/
@TableField(exist = false)
private String handleType;
......
......@@ -78,7 +78,7 @@ public class TEmpOtherFile {
@TableField(exist = false)
private List<TAttaInfo> attaList;
/**
* 档案编辑其他附件分租信息处理类型 0 新增 1 更新 2 删除
* 档案编辑其他附件分租信息处理类型 0 新增 1 更新 2 删除 3 不变
*/
@TableField(exist = false)
private String handleType;
......
......@@ -249,22 +249,32 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
this.doUpdateEducationCore(education, employeeInfo);
// 更新附件信息 fxj 2024-09-09
updateOtherAtta(employeeInfo);
// 获取最新附件信息 fxj 2024-09-09
getAttaInfo(employeeInfo);
if (updateOtherAtta(employeeInfo)){
// 获取最新附件信息 fxj 2024-09-09
getAttaInfo(employeeInfo);
} else{
old.setOtherFiles(null);
employeeInfo.setOtherFiles(null);
}
// 记录变更日志
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], old.getId(), "", old, employeeInfo);
return R.ok(this.updateById(employeeInfo));
}
private void updateOtherAtta(TEmployeeInfo employeeInfo) {
private boolean updateOtherAtta(TEmployeeInfo employeeInfo) {
List<TEmpOtherFile> otherFileList = employeeInfo.getOtherFiles();
boolean flag = false;
if (Common.isNotNull(otherFileList)){
List<TAttaInfo> attaInfos = new ArrayList<>();
for (TEmpOtherFile otherFile:otherFileList){
//处理新增或删除其他附件分租的逻辑
handleOtherFile(otherFile);
if (!flag){
flag = handleOtherFile(otherFile);
}else {
handleOtherFile(otherFile);
}
if (Common.isNotNull(otherFile.getAttaList())){
attaInfos.addAll(otherFile.getAttaList());
}
......@@ -276,27 +286,29 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (CommonConstants.ZERO_STRING.equals(attaInfo.getHandleType())){
adds.add(attaInfo);
}
if (CommonConstants.ONE_STRING.equals(attaInfo.getHandleType())){
adds.add(attaInfo);
}
if (CommonConstants.TWO_STRING.equals(attaInfo.getHandleType())){
deleteIds.add(attaInfo.getId());
}
}
if (Common.isNotNull(deleteIds)){
attaInfoService.removeBatchByIds(deleteIds);
flag =true;
}
if (Common.isNotNull(adds)){
attaInfoService.updateBatchById(adds);
flag =true;
}
}
}
return flag;
}
private void handleOtherFile(TEmpOtherFile otherFile) {
private boolean handleOtherFile(TEmpOtherFile otherFile) {
boolean flag =false;
// 新增时先增加 empOtherFile
if (CommonConstants.ZERO_STRING.equals(otherFile.getHandleType())){
empOtherFileService.save(otherFile);
flag = true;
if (Common.isNotNull(otherFile.getAttaList())){
for (TAttaInfo info: otherFile.getAttaList()){
info.setDomainId(otherFile.getId());
......@@ -304,6 +316,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
// 更新
}if (CommonConstants.ONE_STRING.equals(otherFile.getHandleType())){
flag = true;
if (Common.isNotNull(otherFile.getId())){
empOtherFileService.updateById(otherFile);
if (Common.isNotNull(otherFile.getAttaList())){
......@@ -313,9 +326,20 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
}
}
// 删除时
}else if (CommonConstants.TWO_STRING.equals(otherFile.getHandleType())){
}if (CommonConstants.THREE_STRING.equals(otherFile.getHandleType())){
if (Common.isNotNull(otherFile.getId())){
if (Common.isNotNull(otherFile.getAttaList())){
for (TAttaInfo info: otherFile.getAttaList()){
info.setDomainId(otherFile.getId());
}
}
}
// 删除时
}else if (CommonConstants.TWO_STRING.equals(otherFile.getHandleType())){
empOtherFileService.removeById(otherFile.getId());
flag = true;
}
return flag;
}
private void getAttaInfo(TEmployeeInfo emp) {
......
......@@ -1447,7 +1447,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
employee.setEmpPhone(vo.getMobile());
}
if(Common.isEmpty(vo.getFlag())){
employee.setIsCollege(CommonConstants.ZERO_INT);
if (Common.isNotNull(vo.getHighEducation())) {
employee.setHignEducation(vo.getHighEducation());
if ("5".equals(employee.getHignEducation())
......
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