Commit f7879155 authored by hongguangwu's avatar hongguangwu

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

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