From 6d240fbbf6a47b4125320f26c4f5c537e1493fb6 Mon Sep 17 00:00:00 2001
From: luoyb <412940104@qq.com>
Date: 星期五, 05 十一月 2021 22:19:12 +0800
Subject: [PATCH] fix(bug修复): 到期合同的统计条件修改为只针对在职员工统计

---
 febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/ExportPdfServiceImpl.java |   70 ++++++++++++++++++++++------------
 1 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/ExportPdfServiceImpl.java b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/ExportPdfServiceImpl.java
index 922e798..ec518e9 100644
--- a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/ExportPdfServiceImpl.java
+++ b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/ExportPdfServiceImpl.java
@@ -25,6 +25,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class ExportPdfServiceImpl implements ExportPdfService {
@@ -105,7 +106,7 @@
 			}
 			//社保档位
 			Map<String,String> insuranceGaers = new HashMap<>();
-			for (DicItem m:   empAccessoryMapper.getDictType("insuranceGaers")) {
+			for (DicItem m:   empAccessoryMapper.getDictType("INSURANCETYPE")) {
 				insuranceGaers.put(m.getDicItemCode(),m.getDicItemName());
 			}
 			//社保是否已经报告
@@ -217,7 +218,7 @@
 						.orElse(""));
 				empBaseInfo.setInsuranceTypeName(INSURANCETYPE.get(empBaseInfo.getInsuranceType()==null?"":empBaseInfo.getInsuranceType()));
 				empBaseInfo.setHandbookStatusName(handbookStatus.get(empBaseInfo.getHandbookStatus()==null?"":empBaseInfo.getHandbookStatus()));
-				empBaseInfo.setCertificateListName(certificateList.get(empBaseInfo.getCertificateList()==null?"":empBaseInfo.getCertificateList()));
+				empBaseInfo.setCertificateListName(getCertificateListName(empBaseInfo.getCertificateList(), certificateList));
 				empBaseInfo.setEmpStatusName("0".equals(empBaseInfo.getEmpStatus()) ? "在职" : "离职");
 				empBaseInfo.setEntryTypeName(dicItems.stream()
 						.filter(k -> DicCode.IN_OUT_TYPE.equals(k.getDicCode()) && k.getDicItemCode().equals(empBaseInfo.getEntryType()))
@@ -225,15 +226,16 @@
 						.map(DicItem::getDicItemName)
 						.orElse(""));
 			}
+			EmpBaseInfo empBaseInfo = empBaseInfoList.get(0);
 			//工作经历
-			String[] workhead = { "序号","开始时间", "结束时间", "工作单位", "主要工作内容"};
+			String[] workhead = { "开始时间", "结束时间", "工作单位", "主要工作内容"};
 			EmpWorkExperience empWorkExperiences=new EmpWorkExperience();
 			empWorkExperiences.setCertificateNumb(empNum);
 			empWorkExperiences.setDelFlag(0);
 			
 			List<EmpWorkExperience> empWorkExperiences1 = iEmpWorkExperienceService.findEmpWorkExperiences(queryRequest, empWorkExperiences).getRecords();
 			//体检信息
-			String[] empPhysicalhead = {  "序号","体检医院", "体检日期", "体检类型", "血压", "转氨酶", "心电图", "体检结论", "复查日期", "备注"};
+			String[] empPhysicalhead = {  "体检医院", "体检日期", "体检类型", "血压", "转氨酶", "心电图", "体检结论", "复查日期", "备注"};
 			EmpPhysicalExam empPhysicalExam=new EmpPhysicalExam();
 			empPhysicalExam.setCertificateNumb(empNum);
 			
@@ -242,25 +244,25 @@
 				empPhysicalExam1.setPhysicalExamTypeName(physicalExamType.get(empPhysicalExam1.getPhysicalExamType()==null?"":empPhysicalExam1.getPhysicalExamType()));
 			}
 			//合同信息
-			String[] empContractInfo = {  "序号","合同签订日期", "合同结束日期", "合同期限(年)", "合同状态", "合同办理人","备注"};
+			String[] empContractInfo = {  "合同签订日期", "合同结束日期", "合同期限(年)", "合同状态", "合同办理人","备注"};
 			EmpContractInfo empContractInfo1=new EmpContractInfo();
 			empContractInfo1.setCertificateNumb(empNum);
-			
+			empContractInfo1.setEmpStatus(empBaseInfo.getEmpStatus());
 			List<EmpContractInfo> empContractInfos = iEmpContractInfoService.findEmpContractinfos(queryRequest, empContractInfo1).getRecords();
 			for (EmpContractInfo empCon:empContractInfos){
 				empCon.setContractStatusName(contractstatus.get(empCon.getContractStatus()==null?"":empCon.getContractStatus()));
 			}
 			//调岗记录
-			String[] empJobChange = {  "序号","现部门", "现岗位", "姓名", "原部门", "原岗位", "调岗日期", "调岗类型"};
+			String[] empJobChange = {  "现部门", "现岗位", "姓名", "原部门", "原岗位", "调岗日期", "调岗类型", "调岗理由"};
 			EmpJobChange empJobChange1=new EmpJobChange();
 			empJobChange1.setCertificateNumb(empNum);
-			
+			empJobChange1.setEmpStatus(empBaseInfo.getEmpStatus());
 			List<Map<String, Object>> empJobChangeList = iEmpJobChangeService.findEmpJobChanges(queryRequest, empJobChange1).getRecords();
 			for (Map<String, Object> map:empJobChangeList){
 				map.put("changeType",changeType.get(map.get("changeType")==null?"":map.get("changeType").toString()));
 			}
 			//请假记录
-			String[] leaveInfo = {  "序号","开始时间", "结束时间", "请假天数", "请假类型", "到岗时间", "报备人", "备注"};
+			String[] leaveInfo = {  "开始时间", "结束时间", "请假天数", "请假类型", "到岗时间", "报备人", "备注"};
 			EmpLeaveInfo empLeaveInfo=new EmpLeaveInfo();
 			empLeaveInfo.setCertificateNumb(empNum);
 			
@@ -269,34 +271,34 @@
 				leaveInfo1.setLeaveTypeName(leavetype.get(leaveInfo1.getLeaveType()==null?"":leaveInfo1.getLeaveType()));
 			}
 			//辞职申请
-			String[] resign = {  "序号","辞职申请日期", "辞职事由", "汇报人", "备注"};
+			String[] resign = {  "辞职申请日期", "辞职事由", "汇报人", "备注"};
 			EmpResign empResign=new EmpResign();
 			empResign.setCertificateNumb(empNum);
-			
+			empResign.setEmpStatus(empBaseInfo.getEmpStatus());
 			List<EmpResign> empResigns = iEmpResignService.findEmpResigns(queryRequest, empResign).getRecords();
 			//离职当月考勤
-			String[] dimissionAttend = {  "序号","离职考勤月份", "出勤天数", "加班(天)", "加班(小时)", "有无代扣款项", "请假(天)", "旷工(天)", "备注"};
+			String[] dimissionAttend = {  "离职考勤月份", "出勤天数", "加班(天)", "加班(小时)", "有无代扣款项", "请假(天)", "旷工(天)", "备注"};
 			EmpDimissionAttend empDimissionAttend=new EmpDimissionAttend();
 			empDimissionAttend.setCertificateNumb(empNum);
 			
 			List<EmpDimissionAttend> dimissionAttends = iEmpDimissionAttendService.findEmpDimissionattends(queryRequest, empDimissionAttend).getRecords();
             //入离职记录
-			String[] dimissionLog = {  "序号","入职日期", "离职日期", "离职类型", "自离天数", "报备人", "备注"};
+			String[] dimissionLog = {  "入职日期", "离职日期", "离职类型", "自离天数", "报备人", "备注"};
 			EmpDimissionLog empDimissionLog=new EmpDimissionLog();
-			empDimissionLog.setCertificateNumb(empNum);
-			
+			empDimissionLog.setEmpId(empBaseInfo.getEmpId());
+			empDimissionLog.setEmpStatus(empBaseInfo.getEmpStatus());
 			List<Map<String, Object>> records1 = iEmpDimissionLogService.findEmpDimissionLogs(queryRequest, empDimissionLog).getRecords();
 			for (Map<String, Object> objectMap:records1){
 				objectMap.put("dimissionType",lztype.get(objectMap.get("dimissionType")==null?"":objectMap.get("dimissionType").toString()));
 			}
 			//失业金领取
-			String[] unemployment = {  "序号","失业金申请日期", "申报事由", "汇报人", "审核人", "备注"};
+			String[] unemployment = {  "失业金申请日期", "申报事由", "汇报人", "审核人", "备注"};
 			EmpUnemployment empUnemployment=new EmpUnemployment();
 			empUnemployment.setCertificateNumb(empNum);
-			
+			empUnemployment.setEmpStatus(empBaseInfo.getEmpStatus());
 			List<EmpUnemployment> empUnemployments = iEmpUnemploymentService.findEmpUnemployments(queryRequest, empUnemployment).getRecords();
            //社保申请
-			String[] insurance = {  "序号","社保申请日期", "申请人", "社保档位", "是否已报告", "状态", "审核人", "备注"};
+			String[] insurance = {  "社保申请日期", "申请人", "社保档位", "是否已报告", "状态", "审核人", "备注"};
 			EmpInsurance empInsurance=new EmpInsurance();
 			empInsurance.setCertificateNumb(empNum);
 			
@@ -307,7 +309,7 @@
 				leaveInfo1.setApplayStatusName(applayStatus.get(leaveInfo1.getApplayStatus()==null?"":String.valueOf(leaveInfo1.getApplayStatus())));
 			}
 			//意外险案件
-			String[] accidentCases = {  "序号","受伤日期", "受伤地点", "受伤部位", "受伤经过描述", "意外险诊断", "就诊医院", "是否住院", "床号", "报案时间", "递交资料时间", "递交人", "医疗总费用", "保险赔付费用", "是否结案"};
+			String[] accidentCases = {  "受伤日期", "受伤地点", "受伤部位", "受伤经过描述", "意外险诊断", "就诊医院", "是否住院", "床号", "报案时间", "递交资料时间", "递交人", "医疗总费用", "保险赔付费用", "是否结案"};
 			EmpAccidentCases empAccidentCases=new EmpAccidentCases();
 			empAccidentCases.setCertificateNumb(empNum);
 			
@@ -317,7 +319,7 @@
 				leaveInfo1.setSettleStatusName(settleStatus.get(leaveInfo1.getSettleStatus()==null?"":leaveInfo1.getSettleStatus().toString()));
 			}
 			//工伤案件
-			String[] occupational = {  "序号","受伤日期", "受伤地点", "受伤部位", "受伤经过描述", "工伤诊断", "就诊医院", "就诊科室", "是否住院", "床号", "报案时间", "递交资料时间", "递交人", "医疗总费用", "已赔付医药费用", "是否结案"};
+			String[] occupational = {  "受伤日期", "受伤地点", "受伤部位", "受伤经过描述", "工伤诊断", "就诊医院", "就诊科室", "是否住院", "床号", "报案时间", "递交资料时间", "递交人", "医疗总费用", "已赔付医药费用", "是否结案"};
 			EmpOccupational empOccupational=new EmpOccupational();
 			empOccupational.setCertificateNumb(empNum);
 			
@@ -327,7 +329,7 @@
 				leaveInfo1.setSettleStatusName(settleStatus.get(leaveInfo1.getSettleStatus()==null?"":leaveInfo1.getSettleStatus().toString()));
 			}
 			//劳资案件
-			String[] laborTrouble = {  "序号","仲裁日期", "仲裁类型", "仲裁事由", "报备人", "备注", "仲裁赔付(元)", "是否结案", "案结日期"};
+			String[] laborTrouble = {  "仲裁日期", "仲裁类型", "仲裁事由", "报备人", "备注", "仲裁赔付(元)", "是否结案", "案结日期"};
 			EmpLaborTrouble empLaborTrouble=new EmpLaborTrouble();
 			empLaborTrouble.setCertificateNumb(empNum);
 			
@@ -337,16 +339,16 @@
 				leaveInfo1.setArbitrationStatusName(settleStatus.get(leaveInfo1.getArbitrationStatus()==null?"":String.valueOf(leaveInfo1.getArbitrationStatus())));
 			}
 			//不良记录
-			String[] badRecord = {  "序号","不良记录日期", "不良记录描述", "汇报人", "备注"};
+			String[] badRecord = {  "不良记录日期", "不良记录描述", "汇报人", "备注"};
 			EmpBadRecord empBadRecord=new EmpBadRecord();
 			empBadRecord.setCertificateNumb(empNum);
-			
+			empBadRecord.setEmpStatus(empBaseInfo.getEmpStatus());
 			List<EmpBadRecord> empBadRecords = iEmpBadRecordService.findEmpBadrecords(queryRequest, empBadRecord).getRecords();
 			//备注
-			String[] remarkInfo = {  "序号","备注日期", "备注信息"};
+			String[] remarkInfo = {  "备注日期", "备注信息"};
 			EmpRemarkInfo empRemarkInfo=new EmpRemarkInfo();
 			empRemarkInfo.setCertificateNumb(empNum);
-			
+			empRemarkInfo.setEmpStatus(empBaseInfo.getEmpStatus());
 			List<EmpRemarkInfo> empRemarkInfos = iEmpRemarkinfoService.findEmpRemarkinfos(queryRequest, empRemarkInfo).getRecords();
 			String filePath = new CreatePdf().generatePDFs(baseinfo,empBaseInfoList,workhead, empWorkExperiences1,empPhysicalhead,records,
 					empContractInfo,empContractInfos,
@@ -407,4 +409,22 @@
 		}
 		return null;
 	}
+
+    private String getCertificateListName(String certificateList, Map<String,String> mapCertificate) {
+        String tempName;
+        List<String> nameList = new ArrayList<>();
+        String[] tempList = certificateList.split(",");
+        // certificateList.get(empBaseInfo.getCertificateList()
+        if (tempList.length > 0) {
+            for (int i = 0, len = tempList.length; i < len; i++) {
+                String tempValue = tempList[i];
+                tempName = mapCertificate.get(tempValue)==null?tempValue:mapCertificate.get(tempValue);
+                nameList.add(tempName);
+            }
+            tempName = nameList.stream().collect(Collectors.joining(", "));
+        } else {
+            tempName = "";
+        }
+        return tempName;
+    }
 }

--
Gitblit v1.8.0