From d66324804d38f71c46e3ce0f80fcbbb4bb9e4ef7 Mon Sep 17 00:00:00 2001 From: Administrator <704728292@qq.com> Date: Tue, 23 Apr 2024 18:47:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=81=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kq/cmd/report/ExportDailyExcelCmd.java | 86 ++++++++++++++++++ .../engine/kq/cmd/report/ExportExcelCmd.java | 88 ++++++++++++++++++- 2 files changed, 173 insertions(+), 1 deletion(-) diff --git a/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java b/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java index 0fcd6ac..21af84a 100644 --- a/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java +++ b/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java @@ -325,6 +325,32 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand4){ + fieldValue = split[0]+"/"+split[1]+"/"+split[2]+"/"+split[3]+"/"+split[4]; + } + }else if(fieldName.equals("overtimeType")){ + //根据id查询加班类型 + String overtimeType = getOvertimeTypeById(id); + if("0".equals(overtimeType)){ + overtimeType = "有加班费"; + }else{ + overtimeType = "无加班费"; + } + fieldValue = overtimeType; + }else if(fieldName.equals("companystartdate")){ + //根据id查询入职日期 + Map map = getEmployAndResignDateById(id); + fieldValue = map.get("companystartdate"); + }else if(fieldName.equals("resignDate")){ + //根据id查询离职日期 + Map map = getEmployAndResignDateById(id); + fieldValue = map.get("resignDate"); }else if(fieldName.equals("jobtitle")){ String tmpJobtitleId = Util.null2String(rs.getString("jobtitle")); if(tmpJobtitleId.length()==0){ @@ -654,6 +680,66 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand getEmployAndResignDateById(String id){ + RecordSet rs = new RecordSet(); + Map map = new HashMap<>(); + String companystartdate = "";//入职时间 + String created = "";//创建日期 + String field30 = "";//离职时间 + String sql = "select b.companystartdate,b.created,a.field30 from cus_fielddata a left join hrmresource b on" + + " a.id = b.id where a.scope='HrmCustomFieldByInfoType' and a.scopeid= 3 and a.id = ? "; + rs.executeQuery(sql,id); + if(rs.next()){ + companystartdate = Util.null2String(rs.getString("companystartdate")); + created = Util.null2String(rs.getString("created")); + field30 = Util.null2String(rs.getString("field30")); + } + companystartdate = "".equals(companystartdate)?created:companystartdate; + map.put("companystartdate",companystartdate); + map.put("resignDate",field30); + return map; + } private Map getChildColumnsInfo(String parentid, User user){ Map returnMap = new HashMap<>(); diff --git a/src/com/engine/kq/cmd/report/ExportExcelCmd.java b/src/com/engine/kq/cmd/report/ExportExcelCmd.java index 340e61a..ec6deda 100644 --- a/src/com/engine/kq/cmd/report/ExportExcelCmd.java +++ b/src/com/engine/kq/cmd/report/ExportExcelCmd.java @@ -330,7 +330,33 @@ public class ExportExcelCmd extends AbstractCommonCommand> { departmentComInfo.getDepartmentname(tmpDepartmentId); // fieldValue = departmentComInfo.getDepartmentname(tmpDepartmentId); - } else if (fieldName.equals("jobtitle")) { + } else if(fieldName.equals("multiLevelDepartment")){ + //根据id查询多级部门信息 + //String multiLevelDepartmentStr = getMultiLevelDepartmentById(id); + String departmentid = Util.null2String(rs.getString("departmentid")); + fieldValue = "总部/"+departmentComInfo.getDepartmentRealPath(departmentid, "/", "0"); + String[] split = fieldValue.split("/"); + if(split.length>4){ + fieldValue = split[0]+"/"+split[1]+"/"+split[2]+"/"+split[3]+"/"+split[4]; + } + }else if(fieldName.equals("overtimeType")){ + //根据id查询加班类型 + String overtimeType = getOvertimeTypeById(id); + if("0".equals(overtimeType)){ + overtimeType = "有加班费"; + }else{ + overtimeType = "无加班费"; + } + fieldValue = overtimeType; + }else if(fieldName.equals("companystartdate")){ + //根据id查询入职日期 + Map map = getEmployAndResignDateById(id); + fieldValue = map.get("companystartdate"); + }else if(fieldName.equals("resignDate")){ + //根据id查询离职日期 + Map map = getEmployAndResignDateById(id); + fieldValue = map.get("resignDate"); + }else if (fieldName.equals("jobtitle")) { String tmpJobtitleId = Util.null2String(rs.getString("jobtitle")); if (tmpJobtitleId.length() == 0) { tmpJobtitleId = Util.null2String(resourceComInfo.getJobTitle(id)); @@ -595,6 +621,66 @@ public class ExportExcelCmd extends AbstractCommonCommand> { } return retmap; } + /*获取人员多级部门*/ + private String getMultiLevelDepartmentById(String id){ + RecordSet rs = new RecordSet(); + String str = "总部"; + String field31 = ""; + String field32 = ""; + String field33 = ""; + String field34 = ""; + String sql = "select field31,field32,field33,field34 from cus_fielddata where" + + " id = ? and scope='HrmCustomFieldByInfoType' and scopeid= -1"; + rs.executeQuery(sql,id); + if(rs.next()){ + field31 = Util.null2String(rs.getString("field31")); + field32 = Util.null2String(rs.getString("field32")); + field33 = Util.null2String(rs.getString("field33")); + field34 = Util.null2String(rs.getString("field34")); + } + if(!"".equals(field31)){ + str = str+"/"+field31; + }else if(!"".equals(field32)){ + str = str+"/"+field32; + }else if(!"".equals(field33)){ + str = str+"/"+field33; + }else if(!"".equals(field34)){ + str = str+"/"+field34; + } + return str; + } + /*获取人员加班类型*/ + private String getOvertimeTypeById(String id){ + RecordSet rs = new RecordSet(); + String field35 = ""; + String sql = "select field35 from cus_fielddata where" + + " id = ? and scope='HrmCustomFieldByInfoType' and scopeid= 3"; + rs.executeQuery(sql,id); + if(rs.next()){ + field35 = Util.null2String(rs.getString("field35")); + } + return field35; + } + /*获取人员入离职时间*/ + private Map getEmployAndResignDateById(String id){ + RecordSet rs = new RecordSet(); + Map map = new HashMap<>(); + String companystartdate = "";//入职时间 + String created = "";//创建日期 + String field30 = "";//离职时间 + String sql = "select b.companystartdate,b.created,a.field30 from cus_fielddata a left join hrmresource b on" + + " a.id = b.id where a.scope='HrmCustomFieldByInfoType' and a.scopeid= 3 and a.id = ? "; + rs.executeQuery(sql,id); + if(rs.next()){ + companystartdate = Util.null2String(rs.getString("companystartdate")); + created = Util.null2String(rs.getString("created")); + field30 = Util.null2String(rs.getString("field30")); + } + companystartdate = "".equals(companystartdate)?created:companystartdate; + map.put("companystartdate",companystartdate); + map.put("resignDate",field30); + return map; + } private Map getChildColumnsInfo(String parentid, User user) { Map returnMap = new HashMap<>();