| | |
| | | import cc.mrbird.febs.server.hr.properties.FebsServerHrProperties; |
| | | import cc.mrbird.febs.server.hr.service.*; |
| | | import cc.mrbird.febs.server.hr.util.PoiExportExcel; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cc.mrbird.febs.server.hr.entity.*; |
| | |
| | | private final EmpBadRecordMapper empBadRecordMapper; |
| | | private final EmpRemarkInfoMapper empRemarkInfoMapper; |
| | | private final IRemoteDicItemService remoteDicItemService; |
| | | private final EmpOccupationalMapper empOccupationalMapper; |
| | | |
| | | // private final String operatorId = Optional.of(FebsUtil.getUserId()).orElse("1"); |
| | | |
| | | @Override |
| | | public IPage<EmpBaseInfo> findEmpBaseInfos(QueryRequest request, EmpBaseInfo empBaseInfo) { |
| | |
| | | p.setArchivesStatusName("0".equals(p.getArchivesStatus()) ? "未移交" : "已移交"); |
| | | p.setEmpCardStatusName("1".equals(p.getEmpCardStatus()) ? "未发" : "已发"); |
| | | p.setHandbookStatusName("1".equals(p.getHandbookStatus()) ? "未发" : "已发"); |
| | | p.setEmpStatusName("0".equals(p.getEmpStatus()) ? "在职" : "离职"); |
| | | //保险类型 |
| | | p.setInsuranceTypeName(dicItems.stream() |
| | | .filter(k -> DicCode.INSURANCETYPE.equals(k.getDicCode()) && k.getDicItemCode().equals(p.getInsuranceType())) |
| | | .findFirst() |
| | | .map(DicItem::getDicItemName) |
| | | .orElse("汉族")); |
| | | .orElse("未知")); |
| | | //员工类别 |
| | | p.setEmpTypeName(dicItems.stream() |
| | | .filter(k -> DicCode.EMPTYPE.equals(k.getDicCode()) && k.getDicItemCode().equals(p.getEmpType())) |
| | |
| | | } |
| | | |
| | | //离职员工总数 |
| | | Integer empStatus = this.baseMapper.selectCount(new QueryWrapper<EmpBaseInfo>().eq("empStatus", 1)); |
| | | Integer empStatus = this.baseMapper.selectCount(new QueryWrapper<EmpBaseInfo>().eq("delFlag", 0).eq("empStatus", 1)); |
| | | if (empStatus != null) { |
| | | stringObjectMap.put("lzyg", empStatus); |
| | | } |
| | |
| | | dicItems.stream().forEach(dicItem -> itemMap.put(dicItem.getDicItemCode(), dicItem.getDicItemName())); |
| | | map.put(dicItems.get(0).getDicCode().toLowerCase(), itemMap); |
| | | }); |
| | | |
| | | List<String> sheetNames = new ArrayList<>(); |
| | | sheetNames.add("基本信息"); |
| | | //基本信息 |
| | | QueryRequest request = new QueryRequest(); |
| | | request.setPageSize(25535); |
| | |
| | | |
| | | //工作经历 |
| | | IPage<EmpWorkExperience> workExperienceIPage = empWorkExperienceMapper.selectPageVo(page, new QueryWrapper<EmpWorkExperience>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpWorkExperience.class); |
| | | List<Map<String, Object>> allListEmpWork = PoiExportExcel.getDataList(exportField, workExperienceIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpWork.get(0)); |
| | | if (workExperienceIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpWorkExperience.class); |
| | | List<Map<String, Object>> allListEmpWork = PoiExportExcel.getDataList(exportField, workExperienceIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpWork.get(0)); |
| | | sheetNames.add("工作经历"); |
| | | } |
| | | |
| | | //体检信息 |
| | | IPage<EmpPhysicalExam> empPhysicalExamIPage = empPhysicalExamMapper.selectPageVo(page, new QueryWrapper<EmpPhysicalExam>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpWorkExperience.class); |
| | | List<Map<String, Object>> allListEmpPhysical = PoiExportExcel.getDataList(exportField, empPhysicalExamIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpPhysical.get(0)); |
| | | |
| | | if (empPhysicalExamIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpWorkExperience.class); |
| | | List<Map<String, Object>> allListEmpPhysical = PoiExportExcel.getDataList(exportField, empPhysicalExamIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpPhysical.get(0)); |
| | | sheetNames.add("体检信息"); |
| | | } |
| | | |
| | | //调岗记录 |
| | | IPage<EmpJobChange> jobChangeIPage = empJobChangeMapper.selectPageVoBean(page, new QueryWrapper<EmpJobChange>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpJobChange.class); |
| | | List<Map<String, Object>> allListjobChangeI = PoiExportExcel.getDataList(exportField, jobChangeIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListjobChangeI.get(0)); |
| | | if (jobChangeIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpJobChange.class); |
| | | List<Map<String, Object>> allListjobChangeI = PoiExportExcel.getDataList(exportField, jobChangeIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListjobChangeI.get(0)); |
| | | sheetNames.add("调岗记录"); |
| | | } |
| | | |
| | | //合同信息 |
| | | IPage<EmpContractInfo> empContractInfoIPage = empContractInfoMapper.selectPageVo(page, new QueryWrapper<EmpContractInfo>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpContractInfo.class); |
| | | List<Map<String, Object>> allListEmpContractInfo = PoiExportExcel.getDataList(exportField, empContractInfoIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpContractInfo.get(0)); |
| | | if (empContractInfoIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpContractInfo.class); |
| | | List<Map<String, Object>> allListEmpContractInfo = PoiExportExcel.getDataList(exportField, empContractInfoIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpContractInfo.get(0)); |
| | | sheetNames.add("合同信息"); |
| | | } |
| | | |
| | | //入离职记录 |
| | | IPage<EmpDimissionAttend> empDimissionAttendIPage = empDimissionAttendMapper.selectPageVo(page, new QueryWrapper<EmpDimissionAttend>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpDimissionAttend.class); |
| | | List<Map<String, Object>> allListEmpDimissionAtt = PoiExportExcel.getDataList(exportField, empDimissionAttendIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpDimissionAtt.get(0)); |
| | | if (empDimissionAttendIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpDimissionAttend.class); |
| | | List<Map<String, Object>> allListEmpDimissionAtt = PoiExportExcel.getDataList(exportField, empDimissionAttendIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpDimissionAtt.get(0)); |
| | | sheetNames.add("入离职记录"); |
| | | } |
| | | |
| | | //请假记录 |
| | | IPage<EmpLeaveInfo> empLeaveInfoIPage = empLeaveInfoMapper.selectPageVo(page, new QueryWrapper<EmpLeaveInfo>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpLeaveInfo.class); |
| | | List<Map<String, Object>> allListEmpLoeaveInfo = PoiExportExcel.getDataList(exportField, empLeaveInfoIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpLoeaveInfo.get(0)); |
| | | if (empLeaveInfoIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpLeaveInfo.class); |
| | | List<Map<String, Object>> allListEmpLoeaveInfo = PoiExportExcel.getDataList(exportField, empLeaveInfoIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpLoeaveInfo.get(0)); |
| | | sheetNames.add("请假记录"); |
| | | } |
| | | |
| | | |
| | | //失业金领取 |
| | | IPage<EmpUnemployment> empUnemploymentIPage = empUnemploymentMapper.selectPageVo(page, new QueryWrapper<EmpUnemployment>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpUnemployment.class); |
| | | List<Map<String, Object>> allListEmpUnemployment = PoiExportExcel.getDataList(exportField, empUnemploymentIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpUnemployment.get(0)); |
| | | |
| | | if (empUnemploymentIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpUnemployment.class); |
| | | List<Map<String, Object>> allListEmpUnemployment = PoiExportExcel.getDataList(exportField, empUnemploymentIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpUnemployment.get(0)); |
| | | sheetNames.add("失业金领取"); |
| | | } |
| | | |
| | | //社保申请 |
| | | IPage<EmpInsurance> empInsuranceIPage = empInsuranceMapper.selectPageVo(page, new QueryWrapper<EmpInsurance>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpInsurance.class); |
| | | List<Map<String, Object>> allListEmpInsurance = PoiExportExcel.getDataList(exportField, empInsuranceIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpInsurance.get(0)); |
| | | if (empInsuranceIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpInsurance.class); |
| | | List<Map<String, Object>> allListEmpInsurance = PoiExportExcel.getDataList(exportField, empInsuranceIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpInsurance.get(0)); |
| | | sheetNames.add("社保申请"); |
| | | } |
| | | |
| | | |
| | | //意外险案件 |
| | | IPage<EmpAccidentCases> empAccidentCasesIPage = empAccidentCasesMapper.selectPageVo(page, new QueryWrapper<EmpInsurance>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpAccidentCases.class); |
| | | List<Map<String, Object>> allListEmpAccidentCases = PoiExportExcel.getDataList(exportField, empAccidentCasesIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpAccidentCases.get(0)); |
| | | if (empAccidentCasesIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpAccidentCases.class); |
| | | List<Map<String, Object>> allListEmpAccidentCases = PoiExportExcel.getDataList(exportField, empAccidentCasesIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpAccidentCases.get(0)); |
| | | sheetNames.add("意外险案件"); |
| | | } |
| | | |
| | | //工伤案件 |
| | | IPage<EmpOccupational> empOccupationalIPage = empOccupationalMapper.selectPageVo(page, new QueryWrapper<EmpOccupational>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | if (empOccupationalIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpOccupational.class); |
| | | List<Map<String, Object>> allListEmpOccupational = PoiExportExcel.getDataList(exportField, empOccupationalIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpOccupational.get(0)); |
| | | sheetNames.add("工伤案件"); |
| | | } |
| | | |
| | | //劳资案件 |
| | | IPage<EmpLaborTrouble> empLaborTroubleIPage = empLaborTroubleMapper.selectPageVo(page, new QueryWrapper<EmpInsurance>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpLaborTrouble.class); |
| | | List<Map<String, Object>> allListEmpLaborTrouble = PoiExportExcel.getDataList(exportField, empLaborTroubleIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpLaborTrouble.get(0)); |
| | | if (empLaborTroubleIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpLaborTrouble.class); |
| | | List<Map<String, Object>> allListEmpLaborTrouble = PoiExportExcel.getDataList(exportField, empLaborTroubleIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpLaborTrouble.get(0)); |
| | | sheetNames.add("劳资案件"); |
| | | } |
| | | |
| | | |
| | | //不良记录 |
| | | IPage<EmpBadRecord> empBadRecordIPage = empBadRecordMapper.selectPageVo(page, new QueryWrapper<EmpInsurance>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpBadRecord.class); |
| | | List<Map<String, Object>> allListEmpBadRecord = PoiExportExcel.getDataList(exportField, empBadRecordIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpBadRecord.get(0)); |
| | | if (empBadRecordIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpBadRecord.class); |
| | | List<Map<String, Object>> allListEmpBadRecord = PoiExportExcel.getDataList(exportField, empBadRecordIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpBadRecord.get(0)); |
| | | sheetNames.add("不良记录"); |
| | | } |
| | | |
| | | |
| | | //备注信息 |
| | | IPage<EmpRemarkInfo> empRemarkInfoIPage = empRemarkInfoMapper.selectPageVo(page, new QueryWrapper<EmpRemarkInfo>().in("a.empId", empIds).ne("a.delFlag", 1)); |
| | | exportField = FebsUtil.reflectAnnotation(EmpRemarkInfo.class); |
| | | List<Map<String, Object>> allListEmpRemarkInfo = PoiExportExcel.getDataList(exportField, empRemarkInfoIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpRemarkInfo.get(0)); |
| | | if (empRemarkInfoIPage.getRecords().size() != 0) { |
| | | exportField = FebsUtil.reflectAnnotation(EmpRemarkInfo.class); |
| | | List<Map<String, Object>> allListEmpRemarkInfo = PoiExportExcel.getDataList(exportField, empRemarkInfoIPage.getRecords(), listMapDicItem); |
| | | allList.add(allListEmpRemarkInfo.get(0)); |
| | | sheetNames.add("备注信息"); |
| | | } |
| | | |
| | | |
| | | List<String> sheetNames = new ArrayList<>(); |
| | | sheetNames.add("基本信息"); |
| | | sheetNames.add("工作经历"); |
| | | sheetNames.add("体检信息"); |
| | | sheetNames.add("调岗记录"); |
| | | sheetNames.add("合同信息"); |
| | | sheetNames.add("入离职记录"); |
| | | sheetNames.add("请假记录"); |
| | | sheetNames.add("失业金领取"); |
| | | sheetNames.add("社保申请"); |
| | | sheetNames.add("意外险案件"); |
| | | sheetNames.add("工商案件"); |
| | | sheetNames.add("劳资案件"); |
| | | sheetNames.add("不良记录"); |
| | | sheetNames.add("备注信息"); |
| | | boolean result = PoiExportExcel.exportCommonExcelMultiSheet(response, "在职员工列表", allList, sheetNames); |
| | | } |
| | | } |