| | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importEmpOccupational(List<List<Object>> listObject) { |
| | | public void importEmpOccupational(List<List<Object>> listObject,List<String> returnList) { |
| | | for (List<Object> list : listObject) { |
| | | if (list.size()==0){ |
| | | continue; |
| | | } |
| | | EmpOccupational empOccupational=new EmpOccupational(); |
| | | empOccupational.setOccupationalId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | empOccupational.setEmpNumb(list.get(0).toString()); |
| | | List<Dept> depts = CastUtil.castList(redisService.get("depts"), Dept.class); |
| | | Long deptId = depts.stream().filter(d -> d.getDeptName().equals(list.get(1).toString())).findFirst().get() |
| | | .getDeptId(); |
| | | Dept dept = depts.stream().filter(d -> d.getDeptName().equals(list.get(3).toString())).findFirst().orElse(null); |
| | | if (null == dept) { |
| | | returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}部门不存在",listObject.indexOf(list),list.get(3).toString())); |
| | | continue; |
| | | } |
| | | empOccupational.setDeptName(list.get(1).toString()); |
| | | empOccupational.setDeptId(deptId); |
| | | empOccupational.setDeptId(dept.getDeptId()); |
| | | empOccupational.setJobName(list.get(2).toString()); |
| | | empOccupational.setEmpName(list.get(3).toString()); |
| | | empOccupational.setCertificateNumb(list.get(4).toString()); |
| | |
| | | empOccupational.setHospitalizatioFlag("未住院".equals(list.get(12).toString()) ? 0 : 1); |
| | | } |
| | | if (StringUtils.isNotBlank(list.get(13).toString())) { |
| | | empOccupational.setBedNumb(Integer.valueOf(list.get(14).toString())); |
| | | empOccupational.setBedNumb(list.get(14).toString()); |
| | | } |
| | | if (StringUtils.isNotBlank(list.get(14).toString())) { |
| | | empOccupational.setReportTime(DateUtil.parseDate(list.get(14).toString())); |
| | |
| | | this.save(empOccupational); |
| | | } |
| | | } |
| | | } |
| | | } |