Commit f7879155 authored by hongguangwu's avatar hongguangwu

MVP1.6.6-预入职相关_导出优化

parent ab350a17
......@@ -51,10 +51,10 @@ public class TPreEmpMainVo extends RowIndex implements Serializable {
@ExcelAttribute(name = "档案所在地省", isArea = true)
@ExcelProperty("档案所在地省")
private String fileProvince;
@ExcelAttribute(name = "档案所在地市", isArea = true)
@ExcelAttribute(name = "档案所在地市", isArea = true, parentField = "fileProvince")
@ExcelProperty("档案所在地市")
private String fileCity;
@ExcelAttribute(name = "档案所在地县", isArea = true)
@ExcelAttribute(name = "档案所在地县", isArea = true, parentField = "fileCity")
@ExcelProperty("档案所在地县")
private String fileTown;
......
......@@ -134,7 +134,7 @@ public class TPreEmpMainController {
@SysLog("预入职批量完善信息")
@PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('archives_tpreempmain-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file) {
public R<List<ErrorMessage<String>>> importListAdd(@RequestBody MultipartFile file) {
return tPreEmpMainService.importDiy(file.getInputStream());
}
......
......@@ -70,7 +70,7 @@ public interface TPreEmpMainService extends IService<TPreEmpMain> {
R<String> savePreEmpMain(PreEmpMainDetailVo vo);
// 批量完善信息
R<List<ErrorMessage>> importDiy(InputStream inputStream);
R<List<ErrorMessage<String>>> importDiy(InputStream inputStream);
// 导出
void listExport(HttpServletResponse response, TPreEmpMainSearchVo searchVo);
......
......@@ -117,7 +117,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
private final OSSUtil ossUtil;
private final static String ID = "id";
private static final String ID = "id";
/**
* 预入职-主表简单分页查询
......@@ -169,11 +169,11 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
// 2024-7-3 17:23:50 倩倩要求放开状态拦截,前端加按钮禁用即可
/* (CommonConstants.ONE_STRING.equals(main.getStatus())
|| CommonConstants.TWO_STRING.equals(main.getStatus()))
return R.failed("信息审核中,请耐心等待!")
}
retur R.failed("信息审核中,请耐心等待!")
(CommonConstants.FOUR_STRING.equals(main.getStatus()))
return R.failed("信息已填写,请勿重复操作!")
}*/
retur R.failed("信息已填写,请勿重复操作!")
*/
TPreEmployeeInfo tPreEmployeeInfo = tPreEmployeeInfoService.getTPreEmployeeInfoList(main.getId());
if (tPreEmployeeInfo != null && Common.isNotNull(tPreEmployeeInfo.getId())) {
empId = tPreEmployeeInfo.getId();
......@@ -999,14 +999,13 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
Set<String> dbAuthsSet = new HashSet<>();
Collection<? extends GrantedAuthority> authorities = AuthorityUtils
.createAuthorityList(dbAuthsSet.toArray(new String[0]));
YifuUser user = new YifuUser("2", 1L, "", "预入职扫码",
return new YifuUser("2", 1L, "", "预入职扫码",
"预入职扫码", "0", SecurityConstants.BCRYPT + "123456",
"12345678911", true, true, true,
true,
"1", authorities, "1",
null, null,
null);
return user;
}
/**
......@@ -1480,7 +1479,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
**/
private void setNewEmpProjectBaseData(TEmployeeProject insTEmployeePro, TEmployeeInfo tEmployeeInfo, TSettleDomain tSettleDomain, YifuUser user) {
// 新增档案
insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replace("-", ""));
insTEmployeePro.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeePro.setStatus(CommonConstants.ZERO_INT);
......@@ -1498,13 +1497,16 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
insTEmployeePro.setEmpNo(empNO);
}
//员工编码生成规则
insTEmployeePro.setEmpCode(tEmployeeInfo.getEmpCode());
if (tEmployeeInfo != null) {
insTEmployeePro.setEmpId(tEmployeeInfo.getId());
insTEmployeePro.setEmpName(tEmployeeInfo.getEmpName());
insTEmployeePro.setEmpCode(tEmployeeInfo.getEmpCode());
}
insTEmployeePro.setCreateBy(user.getId());
insTEmployeePro.setEmpName(tEmployeeInfo.getEmpName());
insTEmployeePro.setCreateTime(LocalDateTime.now());
insTEmployeePro.setCreateName(user.getNickname());
insTEmployeePro.setProjectSource(CommonConstants.EIGHT_STRING);
insTEmployeePro.setEmpId(tEmployeeInfo.getId());
}
......@@ -1643,8 +1645,8 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
public R<List<ErrorMessage<String>>> importDiy(InputStream inputStream) {
List<ErrorMessage<String>> errorMessageList = new ArrayList<>();
ExcelUtil<TPreEmpMainVo> util1 = new ExcelUtil<>(TPreEmpMainVo.class);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
......@@ -1665,7 +1667,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
ErrorMessage<String> errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
} else {
......@@ -1703,7 +1705,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
}
}
private void importTPreEmpMain(List<TPreEmpMainVo> excelVOList, List<ErrorMessage> errorMessageList) {
private void importTPreEmpMain(List<TPreEmpMainVo> excelVOList, List<ErrorMessage<String>> errorMessageList) {
TPreEmpMain main;
TPreEmployeeInfo employee;
TPreEmployeeProject project;
......@@ -1711,23 +1713,23 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
for (int i = 0; i < excelVOList.size(); i++) {
TPreEmpMainVo excel = excelVOList.get(i);
if (Common.isEmpty(excel.getDeptNo()) || Common.isEmpty(excel.getEmpIdcard()) || Common.isEmpty(excel.getEmpNatrue()) || Common.isEmpty(excel.getFileProvince())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "完善信息不可为空!"));
errorMessageList.add(new ErrorMessage<>(excel.getRowIndex(), "完善信息不可为空!"));
} else {
// 插入
main = baseMapper.getTPreEmpMainByCardAndDeptNo(excel.getEmpIdcard(), excel.getDeptNo());
if (main == null || Common.isEmpty(main.getId()) || Common.isEmpty(main.getStatus())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "未找到预入职主表!"));
errorMessageList.add(new ErrorMessage<>(excel.getRowIndex(), "未找到预入职主表!"));
} else {
if (!CommonConstants.ONE_STRING.equals(main.getStatus())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "状态不为待完善,不可编辑!"));
errorMessageList.add(new ErrorMessage<>(excel.getRowIndex(), "状态不为待完善,不可编辑!"));
} else {
employee = tPreEmployeeInfoService.getTPreEmployeeInfoList(main.getId());
if (employee == null || Common.isEmpty(employee.getId())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "未找到预入职人员表!"));
errorMessageList.add(new ErrorMessage<>(excel.getRowIndex(), "未找到预入职人员表!"));
} else {
project = tPreEmployeeProjectService.getTPreEmployeeProjectList(main.getId());
if (project == null || Common.isEmpty(project.getId())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "未找到预入职项目档案表!"));
errorMessageList.add(new ErrorMessage<>(excel.getRowIndex(), "未找到预入职项目档案表!"));
} else {
employee.setEmpNatrue(excel.getEmpNatrue());
project.setEmpNatrue(excel.getEmpNatrue());
......@@ -1738,7 +1740,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
try {
employee.setFileCity(Integer.parseInt(excel.getFileCity()));
} catch (Exception e) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "未找到市!"));
errorMessageList.add(new ErrorMessage<>(excel.getRowIndex(), "未找到市!"));
}
}
if (Common.isEmpty(excel.getFileTown())) {
......@@ -1747,7 +1749,7 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
try {
employee.setFileTown(Integer.parseInt(excel.getFileTown()));
} catch (Exception e) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "未找到县!"));
errorMessageList.add(new ErrorMessage<>(excel.getRowIndex(), "未找到县!"));
}
}
tPreEmployeeInfoService.updateById(employee);
......@@ -2067,7 +2069,9 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
}
}
out.flush();
excelWriter.finish();
if (excelWriter != null) {
excelWriter.finish();
}
} catch (Exception e) {
log.error("执行异常", e);
} finally {
......
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