| | |
| | | import java.util.function.Consumer; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.constant.FebsConstant; |
| | | import cc.mrbird.febs.common.core.entity.constant.StringConstant; |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.common.core.utils.MyUtil; |
| | | import cc.mrbird.febs.common.core.utils.*; |
| | | import cc.mrbird.febs.server.hr.entity.EmpDimissionLog; |
| | | import cc.mrbird.febs.server.hr.entity.EmpJobChange; |
| | | import cc.mrbird.febs.server.hr.feign.IRemoteDicItemService; |
| | |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.core.entity.system.Dept; |
| | | import cc.mrbird.febs.common.core.entity.system.DicItem; |
| | | import cc.mrbird.febs.common.core.utils.CastUtil; |
| | | import cc.mrbird.febs.common.core.utils.FebsUtil; |
| | | import cc.mrbird.febs.common.core.utils.SequenceUtil; |
| | | import cc.mrbird.febs.common.redis.service.RedisService; |
| | | import cc.mrbird.febs.server.hr.entity.EmpBaseInfo; |
| | | import cc.mrbird.febs.server.hr.feign.IRemoteDeptService; |
| | |
| | | @Override |
| | | public IPage<EmpBaseInfo> findZsEmpBaseInfos(QueryRequest request, EmpBaseInfo empBaseInfo) { |
| | | Page<EmpBaseInfo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | SortUtil.handlePageSort(request, page, "createTime", FebsConstant.ORDER_DESC, true); |
| | | IPage<EmpBaseInfo> iPage = empBaseInfoMapper.selectPageVo(page, createQueryWrapper(empBaseInfo)); |
| | | //设置部门 |
| | | List<EmpBaseInfo> list = setDeptName(iPage.getRecords()); |
| | | // List<EmpBaseInfo> list = setDeptName(iPage.getRecords()); |
| | | List<EmpBaseInfo> list = iPage.getRecords(); |
| | | List<DicItem> dicItems = CastUtil.castList(redisService.get("dicItems"), DicItem.class); |
| | | list.forEach(p -> { |
| | | p.setSexName("1".equals(p.getSex()) ? "男" : "女"); |
| | |
| | | .findFirst() |
| | | .map(Dept::getDeptName) |
| | | .orElse("")); |
| | | empBaseInfo.setAllDeptName(depts.stream() |
| | | .filter(k -> k.getDeptId().equals(empBaseInfo.getDeptId())) |
| | | .findFirst() |
| | | .map(Dept::getAllDeptName) |
| | | .orElse("")); |
| | | } |
| | | return empBaseInfoList; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importEmpBaseInfo(List<List<Object>> listObject, List<String> returnList) { |
| | | public void importEmpBaseInfo(List<List<Object>> listObject, List<String> returnList,List<DicItem> dicItems) { |
| | | for (List<Object> list : listObject) { |
| | | if (list.size() == 0) { |
| | | continue; |
| | |
| | | empBaseInfo.setEmpId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | empBaseInfo.setArchivesNumb(list.get(0).toString()); |
| | | empBaseInfo.setEmpNumb(list.get(1).toString()); |
| | | empBaseInfo.setEmpName(list.get(2).toString()); |
| | | |
| | | List<Dept> depts = CastUtil.castList(redisService.get("depts"), Dept.class); |
| | | empBaseInfo.setDeptName(list.get(3).toString()); |
| | | Dept dept = depts.stream().filter(d -> d.getDeptName().equals(list.get(3).toString())).findFirst().orElse(null); |
| | | empBaseInfo.setDeptName(list.get(2).toString()); |
| | | Dept dept = depts.stream().filter(d -> d.getDeptName().equals(list.get(2).toString())).findFirst().orElse(null); |
| | | if (null == dept) { |
| | | returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}部门不存在", listObject.indexOf(list) + 1, list.get(3).toString())); |
| | | returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}部门不存在", listObject.indexOf(list) + 1, list.get(2).toString())); |
| | | continue; |
| | | } |
| | | empBaseInfo.setEmpName(list.get(3).toString()); |
| | | empBaseInfo.setDeptId(dept.getDeptId()); |
| | | empBaseInfo.setJobName(list.get(4).toString()); |
| | | empBaseInfo.setEmpType(list.get(5).toString()); |
| | | empBaseInfo.setSex("男".equals(list.get(6).toString()) ? "1" : "2"); |
| | | empBaseInfo.setNation(list.get(7).toString()); |
| | | empBaseInfo.setCertificateNumb(list.get(8).toString()); |
| | | empBaseInfo.setMarriage(list.get(9).toString()); |
| | | |
| | | //婚姻状况 |
| | | DicItem dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"marriage")&&StrUtil.equals(j.getDicItemName(),list.get(9).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setMarriage(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(list.get(10).toString())) { |
| | | empBaseInfo.setStature(Integer.valueOf(list.get(10).toString())); |
| | | } |
| | | empBaseInfo.setPolitics(list.get(11).toString()); |
| | | |
| | | //政治面貌 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"politics")&&StrUtil.equals(j.getDicItemName(),list.get(11).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setPolitics(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | |
| | | if (StringUtils.isNotBlank(list.get(12).toString())) { |
| | | empBaseInfo.setEntryDate(DateUtil.parseDate(list.get(12).toString())); |
| | | } |
| | | empBaseInfo.setEducation(list.get(13).toString()); |
| | | |
| | | //最高学历 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"education")&&StrUtil.equals(j.getDicItemName(),list.get(13).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setEducation(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | |
| | | if (StringUtils.isNotBlank(list.get(14).toString())) { |
| | | empBaseInfo.setSeniority(Integer.valueOf(list.get(14).toString())); |
| | | } |
| | | empBaseInfo.setNativePlace(list.get(15).toString()); |
| | | //籍贯 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"nativePlace")&&StrUtil.equals(j.getDicItemName(),list.get(15).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setNativePlace(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | empBaseInfo.setCensusAddress(list.get(16).toString()); |
| | | empBaseInfo.setCurrentAddress(list.get(17).toString()); |
| | | empBaseInfo.setGuardNumb(list.get(18).toString()); |
| | |
| | | empBaseInfo.setIntroducer(list.get(21).toString()); |
| | | empBaseInfo.setBankName(list.get(22).toString()); |
| | | empBaseInfo.setBankNumb(list.get(23).toString()); |
| | | empBaseInfo.setInsuranceType(list.get(24).toString()); |
| | | //保险类型 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"insuranceType")&&StrUtil.equals(j.getDicItemName(),list.get(24).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setInsuranceType(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | empBaseInfo.setSocialNumb(list.get(25).toString()); |
| | | empBaseInfo.setFamily(list.get(26).toString()); |
| | | empBaseInfo.setUrgencyPhone(list.get(27).toString()); |
| | | empBaseInfo.setHandbookStatus(list.get(28).toString()); |
| | | empBaseInfo.setEmpCardStatus(list.get(29).toString()); |
| | | //员工手册 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"handbookStatus")&&StrUtil.equals(j.getDicItemName(),list.get(28).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setHandbookStatus(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | //工作证 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"empCardStatus")&&StrUtil.equals(j.getDicItemName(),list.get(29).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setEmpCardStatus(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | |
| | | empBaseInfo.setCertificateList(list.get(30).toString()); |
| | | empBaseInfo.setDelFlag(2); |
| | | //入职类型 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"lztype")&&StrUtil.equals(j.getDicItemName(),list.get(31).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setEntryType(dicItem.getDicItemCode()); |
| | | } |
| | | empBaseInfo.setEmpStatus("0"); |
| | | this.save(empBaseInfo); |
| | | } |
| | |
| | | if (StringUtils.isNotBlank(empBaseInfo.getBaseKey())) { |
| | | queryWrapper.and(p -> { |
| | | p.like("a.EmpNumb", empBaseInfo.getBaseKey()); |
| | | p.or().like("a.EmpName", empBaseInfo.getBaseKey()); |
| | | p.or().like("a.DeptName", empBaseInfo.getBaseKey()); |
| | | p.or().like("a.allDeptName", empBaseInfo.getBaseKey()); |
| | | p.or().like("a.empName", empBaseInfo.getBaseKey()); |
| | | p.or().like("a.CertificateNumb", empBaseInfo.getBaseKey()); |
| | | p.or().like("a.archivesNumb", empBaseInfo.getBaseKey()); |
| | | p.or().like("a.stature", empBaseInfo.getBaseKey()); |
| | |
| | | queryWrapper.like("a.EmpName", empBaseInfo.getEmpName()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getDeptName())) { |
| | | queryWrapper.like("a.DeptName", empBaseInfo.getDeptName()); |
| | | queryWrapper.like("a.allDeptName", empBaseInfo.getDeptName()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getCertificateNumb())) { |
| | | queryWrapper.like("a.CertificateNumb", empBaseInfo.getCertificateNumb()); |
| | |
| | | List<EmpBaseInfo> exportList = this.findZsEmpBaseInfos(request, empBaseinfo).getRecords(); |
| | | List<Map<String, Object>> listMapDicItem = new ArrayList(); |
| | | listMapDicItem.add(map); |
| | | String exportField = FebsUtil.reflectAnnotation(EmpBaseInfo.class); |
| | | List<Map<String, Object>> allList = PoiExportExcel.getDataList(exportField, exportList, listMapDicItem); |
| | | String exportField = "archivesNumb, deptName, jobName, empName, certificateNumb, certificateValidity, sexName, nationName, age, marriageName, stature, birthdate, politicsName, empTypeName, educationName, nativePlaceName, censusAddress, currentAddress, guardNumb, returnReceipt, archivesStatusName, bankName, bankNumb, telePhone, entryDate, InsuranceTypeName, socialNumb, introducer, seniority, empCardStatusName, certificateList, urgencyPhone, handbookStatusName, family, empStatusName, dimissionDate"; |
| | | List<Map<String, Object>> allList = PoiExportExcel.getDataList(exportField, exportList, null); |
| | | Page<EmpBaseInfo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | List<Long> empIds = exportList.stream().map(i -> i.getEmpId()).collect(Collectors.toList()); |
| | | |