From b9ee2a3cd3544aa4b5d04915f4cc99d7ee0778a0 Mon Sep 17 00:00:00 2001 From: chenwei <3291673014@qq.com> Date: Sun, 28 Apr 2024 15:32:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=B7=AE=E6=B5=81=E7=A8=8B=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=A4=96=E5=8B=A4=E6=89=93=E5=8D=A1=E4=B8=8D=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E8=80=83=E5=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/kq/biz/KQFormatData.java | 7 +- src/com/engine/kq/biz/KQReportBiz.java | 53 +++++---- .../kq/cmd/report/ExportDailyExcelCmd.java | 90 +++++++++++---- .../engine/kq/cmd/report/ExportExcelCmd.java | 98 ++++++++++++++-- .../kq/cmd/report/GetKQDailyReportCmd.java | 105 ++++++++++++------ .../engine/kq/cmd/report/GetKQReportCmd.java | 95 +++++++++++++--- 6 files changed, 340 insertions(+), 108 deletions(-) diff --git a/src/com/engine/kq/biz/KQFormatData.java b/src/com/engine/kq/biz/KQFormatData.java index e418ce7..5242ed9 100644 --- a/src/com/engine/kq/biz/KQFormatData.java +++ b/src/com/engine/kq/biz/KQFormatData.java @@ -898,6 +898,11 @@ public class KQFormatData extends BaseBean { } /*考勤二开--阶梯式记旷工start*/ + //优化:先去除相同人员和日期的数据 + RecordSet rs = new RecordSet(); + String delSql = "delete from uf_AbnAttToComLeave where resourceid = '" + userId + "' and belongdate = '" + kqDate + "'"; + bb.writeLog("优化 delSql:" + delSql); + rs.executeUpdate(delSql ); //迟到、早退(注意严重迟到、严重早退的情况) belateMins--迟到 graveBeLateMins--严重迟到 leaveEarlyMins--早退 graveLeaveEarlyMins--严重早退 String changeBeforeData = "beLateMins:" + beLateMins + "graveBeLateMins:" + graveBeLateMins + "leaveEarlyMins:" + leaveEarlyMins + "graveLeaveEarlyMins:" + graveLeaveEarlyMins; int abnormalMins = beLateMins + graveBeLateMins + leaveEarlyMins + graveLeaveEarlyMins; @@ -916,7 +921,7 @@ public class KQFormatData extends BaseBean { leaveMins = 240; //转事假 SskjUtil sskjUtil = new SskjUtil(); - RecordSet rs = new RecordSet(); + String toCusLeaveSql = "insert into uf_AbnAttToComLeave (resourceid, belongdate, duration, formmodeid, modedatacreater, modedatacreatertype, modedatacreatedate, modedatacreatetime, MODEUUID) values (?,?,?,?,?,?,?,?,?)"; Integer abnAttToComLeaveModeId = Util.getIntValue(Util.null2String(bb.getPropValue("project_sskj", "abnAttToComLeaveModeId"))); Integer modedatacreater = 1; diff --git a/src/com/engine/kq/biz/KQReportBiz.java b/src/com/engine/kq/biz/KQReportBiz.java index db90123..1c84357 100644 --- a/src/com/engine/kq/biz/KQReportBiz.java +++ b/src/com/engine/kq/biz/KQReportBiz.java @@ -97,7 +97,7 @@ public class KQReportBiz extends BaseBean { } return sectionMap; } - + /*** * 获取考勤状态 * @param resourceId @@ -372,19 +372,19 @@ public class KQReportBiz extends BaseBean { datas.putAll(getSignDetailInfoData(params,user)); //考勤二开--增加补卡字段 - basebean.writeLog("getDailyFlowData to do "); + datas.putAll(getDailyReissueCardData(params,user)); //考勤二开--加班申请情况 - basebean.writeLog("getDailyFlowData appFprOvertime"); + datas.putAll(getDailyAppForOvertimeData(params,user)); //考勤二开--转事假 - basebean.writeLog("getDailyFlowData toComLeave"); + datas.putAll(getDailyToComLeaveData(params,user)); //考勤二开--异常考勤转事假 - basebean.writeLog("getDailyFlowData abnAttToComLeave"); + datas.putAll(getDailyAbnAttToComLeaveData(params,user)); @@ -412,23 +412,23 @@ public class KQReportBiz extends BaseBean { //end //考勤二开--加班申请情况 - basebean.writeLog("getFlowData appFprOvertime"); + datas.putAll(getAppForOvertimeData(params,user)); //考勤二开--转事假 - basebean.writeLog("getFlowData getToComLeaveData"); + datas.putAll(getToComLeaveData(params,user)); //考勤二开--统计公休时长 - basebean.writeLog("getFlowData getHoliDurationData"); + datas.putAll(getHoliDurationData(params,user)); //考勤二开--统计劳务工时 - basebean.writeLog("getFlowData getLaborHoursData"); + datas.putAll(getLaborHoursData(params,user)); //考勤二开--异常考勤转事假 - basebean.writeLog("getFlowData getAbnAttToComLeaveData"); + datas.putAll(getAbnAttToComLeaveData(params,user)); }catch (Exception e){ @@ -491,10 +491,10 @@ public class KQReportBiz extends BaseBean { //获取劳务工人员 List empTypes = new ArrayList<>(); String empType = Util.null2String(PropBean.getUfPropValue("empType"),"field9"); - basebean.writeLog("empType: " + empType); + String acqLaSql = "select id from cus_fielddata where scopeid = -1 and scope = 'HrmCustomFieldByInfoType' and " + empType + " = 1"; - basebean.writeLog("acqLaSql: " + acqLaSql); + rs.executeQuery(acqLaSql); while (rs.next()) { @@ -508,7 +508,7 @@ public class KQReportBiz extends BaseBean { KQOvertimeRulesBiz kqOvertimeRulesBiz = new KQOvertimeRulesBiz(); sql = "select a.attendancemins, a.resourceid, a.kqdate from kq_format_total a left join hrmresource b on a.resourceid = b.id " + " where a.resourceid in (" + String.join(",", empTypes) + ") and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' " + sqlWhere; - basebean.writeLog("sql: " + sql); + rs.executeQuery(sql); while (rs.next()) { @@ -642,12 +642,12 @@ public class KQReportBiz extends BaseBean { /*考勤二开--公休时长统计start*/ String offdutyId = Util.null2String(PropBean.getUfPropValue("shift.offduty.id"),"7"); - basebean.writeLog("offdutyId: " + offdutyId); + /*考勤二开--公休时长统计end*/ sql = " select a.resourceid, count(*) as number from kq_format_total a left join hrmresource b on b.id = a. resourceid" + " where a.serialid = " + offdutyId + " " + sqlWhere; - basebean.writeLog("getHoliDurationData sql: " + sql); + rs.executeQuery(sql); while (rs.next()) { @@ -702,7 +702,7 @@ public class KQReportBiz extends BaseBean { } if (resourceId.length() > 0) { - sqlWhere += " and c.resourceid in(" + resourceId + ") "; + sqlWhere += " and c.id in(" + resourceId + ") "; } if (viewScope.equals("4")) {//我的下属 @@ -801,14 +801,17 @@ public class KQReportBiz extends BaseBean { sql = sql = " select * from (select a.resourceId, a.duration, a.belongDate, b.subcompanyid1, b.departmentid, b.managerstr, b.managerid, b.loginid " + " from uf_AbnAttToComLeave a left join hrmresource b on b.id = a.resourceid " + " where a.belongdate >='" + fromDate + "' and a.belongdate <='" + toDate + "' ) c where 1=1 " + sqlWhere; - basebean.writeLog("getAbnAttToComLeaveData sql: " + sql); + rs.executeQuery(sql); while (rs.next()) { double duration = Util.getDoubleValue(Util.null2String(rs.getString("duration"))); + String resId = Util.null2String(rs.getString("resourceId")); + if ( duration > 0.00){ double temp = Util.getDoubleValue(Util.null2String(datas.get("-AbnAttToComLeaveData|" + resId ))); + if (temp <= 0.00) { datas.put("-AbnAttToComLeaveData|" + resId , duration); } else { @@ -879,15 +882,19 @@ public class KQReportBiz extends BaseBean { sql = " select * from (select a.resourceId, a.duration, a.belongDate, b.subcompanyid1, b.departmentid, b.managerstr, b.managerid, b.loginid " + " from uf_AbnAttToComLeave a left join hrmresource b on b.id = a.resourceid " + " where a.belongdate >='" + fromDate + "' and a.belongdate <='" + toDate + "' ) c where 1=1 " + sqlWhere; - basebean.writeLog("getDailyAbnAttToComLeaveData sql: " + sql); + rs.executeQuery(sql); while (rs.next()) { double duration = Util.getDoubleValue(Util.null2String(rs.getString("duration"))); + String kqdate = Util.null2String(rs.getString("belongDate")); + String resId = Util.null2String(rs.getString("resourceId")); + if ( duration > 0.00){ double temp = Util.getDoubleValue(Util.null2String(datas.get("DailyAbnAttToComLeaveData|" + resId + "|" + kqdate))); + if (temp <= 0.00) { datas.put("DailyAbnAttToComLeaveData|" + resId + "|" + kqdate, duration); } else { @@ -2204,15 +2211,10 @@ public class KQReportBiz extends BaseBean { /*考勤二开--当前时间在当天班次下班点之前,不显示旷工start*/ String nowDay = cn.hutool.core.date.DateUtil.format(new Date(), "yyyy-MM-dd"); String nowTime = cn.hutool.core.date.DateUtil.format(new Date(), "HH:mm"); - basebean.writeLog("nowDay: " + nowDay); - basebean.writeLog("nowTime: " + nowTime); - basebean.writeLog("workenddate: " + workenddate); - basebean.writeLog("workendtime: " + kqTimesArrayComInfo.turn48to24Time(workendtime)); if (workenddate.equals(nowDay) && nowTime.compareTo(kqTimesArrayComInfo.turn48to24Time(workendtime)) < 0) { signStatusInfo.put("isneedcal","1"); } - basebean.writeLog("signStatusInfo: " + signStatusInfo); /*考勤二开--当前时间在当天班次下班点之前,不显示旷工end*/ data.put(tmpkey+"signintime"+serialnumber, signintime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signintime); @@ -2237,15 +2239,10 @@ public class KQReportBiz extends BaseBean { /*考勤二开--当前时间在当天班次下班点之前,不显示旷工start*/ String nowDay = cn.hutool.core.date.DateUtil.format(new Date(), "yyyy-MM-dd"); String nowTime = cn.hutool.core.date.DateUtil.format(new Date(), "HH:mm"); - basebean.writeLog("nowDay: " + nowDay); - basebean.writeLog("nowTime: " + nowTime); - basebean.writeLog("workenddate: " + workenddate); - basebean.writeLog("workendtime: " + kqTimesArrayComInfo.turn48to24Time(workendtime)); if (workenddate.equals(nowDay) && nowTime.compareTo(kqTimesArrayComInfo.turn48to24Time(workendtime)) < 0) { signStatusInfo.put("isneedcal","1"); } - basebean.writeLog("signStatusInfo: " + signStatusInfo); /*考勤二开--当前时间在当天班次下班点之前,不显示旷工end*/ data.put(tmpkey+"signouttime"+serialnumber, signouttime.length()==0?SystemEnv.getHtmlLabelName(25994, user.getLanguage()):signouttime); diff --git a/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java b/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java index 0fcd6ac..5b69253 100644 --- a/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java +++ b/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java @@ -111,20 +111,20 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand0){ tmpShowColumns.add(cascadekey); } } showColumns = tmpShowColumns; - bb.writeLog("showColumns: " + showColumns); + String today = DateUtil.getCurrentDate(); if(DateUtil.compDate(today, toDate)>0){//结束如期不大于今天 @@ -267,7 +267,7 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand resLabComMap = new HashMap<>(); + String laborCompanies = Util.null2String(PropBean.getUfPropValue("laborCompanies"),"field25"); + String acqResLaborComSql = "select id, " + laborCompanies + " from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType'"; + rs.executeQuery(acqResLaborComSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String value = Util.null2String(rs.getString(laborCompanies)); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) { + resLabComMap.put(id, value); + } + } + bb.writeLog("resLabComMap: " + resLabComMap); + //获取所有劳务公司 + Map laborCompaniesMap = new HashMap<>(); + String acqLabComSql = "select id, gsmc from uf_lwgs "; + rs.executeQuery(acqLabComSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String value = Util.null2String(rs.getString("gsmc")); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) { + laborCompaniesMap.put(id, value); + } + } + bb.writeLog("laborCompaniesMap: " + laborCompaniesMap); + /*考勤二开--劳务公司end*/ rs.execute(sql); while (rs.next()) { @@ -300,7 +327,6 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand> allLeaveRules = KQLeaveRulesBiz.getAllLeaveRules(); @@ -440,28 +488,28 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand= 0.00) { temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0))); double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData)); flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp); } - bb.writeLog("flowLeaveData: " + flowLeaveData); + } /*考勤二开--转事假end*/ /*考勤二开--异常考勤转事假start*/ if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) { - bb.writeLog("-flowLeaveData: " + flowLeaveData); + double temp = Util.getDoubleValue(Util.null2String(flowData.get("DailyAbnAttToComLeaveData|" + id + "|" + kqdate))); - bb.writeLog("-temp: " + temp); + if (temp >= 0.00) { temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0))); double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData)); flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp); } - bb.writeLog("-flowLeaveData: " + flowLeaveData); + } /*考勤二开--异常考勤转事假end*/ @@ -528,23 +576,21 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand> { cascadekey = "absenteeismMins"; }else if(showColumn.equals("overtime")){ tmpShowColumns.add("overtime_4leave"); - tmpShowColumns.add("overtime_nonleave"); - tmpShowColumns.add("workingDayOvertime_nonleave"); +// tmpShowColumns.add("overtime_nonleave"); +// tmpShowColumns.add("workingDayOvertime_nonleave"); tmpShowColumns.add("workingDayOvertime_4leave"); - tmpShowColumns.add("restDayOvertime_nonleave"); +// tmpShowColumns.add("restDayOvertime_nonleave"); tmpShowColumns.add("restDayOvertime_4leave"); tmpShowColumns.add("holidayOvertime_4leave"); - tmpShowColumns.add("holidayOvertime_nonleave"); +// tmpShowColumns.add("holidayOvertime_nonleave"); } if(cascadekey.length()>0){ tmpShowColumns.add(cascadekey); @@ -295,6 +297,51 @@ public class ExportExcelCmd extends AbstractCommonCommand> { /*考勤二开--转事假start*/ String calLeaveId = bb.getPropValue("project_sskj", "calLeaveId"); /*考勤二开--转事假end*/ + /*考勤二开--公休时长统计start*/ + String offdutyId = Util.null2String(PropBean.getUfPropValue("shift.offduty.id"),"7"); + + /*考勤二开--公休时长统计end*/ + + /*考勤二开--劳务工时start*/ + Map empTypes = new HashMap<>(); + String empType = Util.null2String(PropBean.getUfPropValue("empType"),"field9"); + String acqLaSql = "select id, " + empType + " from cus_fielddata where scopeid = -1 and scope = 'HrmCustomFieldByInfoType'"; + rs.executeQuery(acqLaSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String empTypeValue = Util.null2String(rs.getString(empType)); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(empTypeValue)) { + empTypes.put(id, empTypeValue); + } + } + /*考勤二开--劳务工时end*/ + /*考勤二开--劳务公司start*/ + //获取人员的劳务公司 + Map resLabComMap = new HashMap<>(); + String laborCompanies = Util.null2String(PropBean.getUfPropValue("laborCompanies"),"field25"); + String acqResLaborComSql = "select id, " + laborCompanies + " from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType'"; + rs.executeQuery(acqResLaborComSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String value = Util.null2String(rs.getString(laborCompanies)); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) { + resLabComMap.put(id, value); + } + } + bb.writeLog("resLabComMap: " + resLabComMap); + //获取所有劳务公司 + Map laborCompaniesMap = new HashMap<>(); + String acqLabComSql = "select id, gsmc from uf_lwgs "; + rs.executeQuery(acqLabComSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String value = Util.null2String(rs.getString("gsmc")); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) { + laborCompaniesMap.put(id, value); + } + } + bb.writeLog("laborCompaniesMap: " + laborCompaniesMap); + /*考勤二开--劳务公司end*/ rs.execute(sql); while (rs.next()) { @@ -306,7 +353,7 @@ public class ExportExcelCmd extends AbstractCommonCommand> { String fieldid = KQReportFieldComInfo.field2Id.get(fieldName); String fieldValue = ""; if(fieldName.equals("nightdaysx") || fieldName.equals("nightdaysd") ) { - continue; + continue; } if (fieldName.equals("subcompany")) { String tmpSubcompanyId = Util.null2String(rs.getString("subcompanyid")); @@ -384,17 +431,24 @@ public class ExportExcelCmd extends AbstractCommonCommand> { /*考勤二开--转事假start*/ if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) { - bb.writeLog("ExportExcelCmd flowLeaveData start "); - bb.writeLog("flowLeaveData: " + flowLeaveData); double temp = Util.getDoubleValue(Util.null2String(flowData.get("ToComLeaveData|" + resourceId))); - bb.writeLog("temp: " + temp); if (temp >= 0.00) { flowLeaveData = flowLeaveData + temp; } - bb.writeLog("flowLeaveData: " + flowLeaveData); } /*考勤二开--转事假end*/ + /*考勤二开--异常考勤转事假start*/ + if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) { + double temp = Util.getDoubleValue(Util.null2String(flowData.get("-AbnAttToComLeaveData|" + id ))); + if (temp >= 0.00) { + temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0))); + double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData)); + flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp); + } + } + /*考勤二开--异常考勤转事假end*/ + data.add(flowLeaveData); } continue; @@ -406,7 +460,29 @@ public class ExportExcelCmd extends AbstractCommonCommand> { data.add("0"); } continue; - }else if ("laborHours".equals(fieldName) ) { + } else if ("resourceType".equals(fieldName)) {//考勤二开--员工类型显示 + + int emp = Util.getIntValue(Util.null2String(empTypes.get(id))); + + if(emp == 0) { + fieldValue = "正式工"; + }else if(emp == 1) { + fieldValue = "劳务工"; + } + + data.add( fieldValue); + continue; + } else if ("laborCompanies".equals(fieldName)) {//考勤二开--员工劳务公司 + + String labCom = Util.null2String(resLabComMap.get(id)); + bb.writeLog("劳务公司 labCom: " + labCom); + if (StringUtils.isNotBlank(labCom)) { + fieldValue = Util.null2String(laborCompaniesMap.get(labCom)); + } + bb.writeLog("劳务公司 fieldValue: " + fieldValue); + data.add( fieldValue); + continue; + } else if ("laborHours".equals(fieldName) ) { double holidayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|holiday")), 0.00); double workdayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|workday")), 0.00); @@ -454,7 +530,7 @@ public class ExportExcelCmd extends AbstractCommonCommand> { double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave"))); holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave; fieldValue = KQDurationCalculatorUtil.getDurationRound(String.valueOf(workingDayOvertime_4leave+restDayOvertime_4leave+holidayOvertime_4leave+ - workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave)); + workingDayOvertime_nonleave+restDayOvertime_nonleave+holidayOvertime_nonleave)); data.add(getFieldValueByUnitType(fieldValue,kqReportFieldComInfo.getUnittype(KQReportFieldComInfo.field2Id.get("overtimeTotal")))); continue; }else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){ diff --git a/src/com/engine/kq/cmd/report/GetKQDailyReportCmd.java b/src/com/engine/kq/cmd/report/GetKQDailyReportCmd.java index 1c89965..3b95a3a 100644 --- a/src/com/engine/kq/cmd/report/GetKQDailyReportCmd.java +++ b/src/com/engine/kq/cmd/report/GetKQDailyReportCmd.java @@ -241,7 +241,6 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand resLabComMap = new HashMap<>(); + String laborCompanies = Util.null2String(PropBean.getUfPropValue("laborCompanies"),"field25"); + String acqResLaborComSql = "select id, " + laborCompanies + " from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType'"; + rs.executeQuery(acqResLaborComSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String value = Util.null2String(rs.getString(laborCompanies)); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) { + resLabComMap.put(id, value); + } + } + bb.writeLog("resLabComMap: " + resLabComMap); + //获取所有劳务公司 + Map laborCompaniesMap = new HashMap<>(); + String acqLabComSql = "select id, gsmc from uf_lwgs "; + rs.executeQuery(acqLabComSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String value = Util.null2String(rs.getString("gsmc")); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) { + laborCompaniesMap.put(id, value); + } + } + bb.writeLog("laborCompaniesMap: " + laborCompaniesMap); + /*考勤二开--劳务公司end*/ + // #1475814-概述:满足考勤报分部部门显示及导出时显示全路径 String fullPathMainKey = "show_full_path"; KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo(); @@ -330,14 +356,17 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand map = getEmployAndResignDateById(id); fieldValue = map.get("resignDate"); data.put(fieldName,fieldValue); - } - else if (fieldName.equals("jobtitle")) { + } else if (fieldName.equals("jobtitle")) { String fieldValueID = rs.getString("jobtitle"); fieldValue = jobTitlesComInfo.getJobTitlesname(rs.getString("jobtitle")); if (fieldValue.length() == 0) { @@ -399,12 +427,12 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand= 0.00) { temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0))); double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData)); flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp); } - bb.writeLog("flowLeaveData: " + flowLeaveData); + } /*考勤二开--转事假end*/ /*考勤二开--异常考勤转事假start*/ if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) { - bb.writeLog("-flowLeaveData: " + flowLeaveData); + + double temp = Util.getDoubleValue(Util.null2String(flowData.get("DailyAbnAttToComLeaveData|" + id + "|" + kqdate))); - bb.writeLog("-temp: " + temp); + if (temp >= 0.00) { temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0))); double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData)); flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp); } - bb.writeLog("-flowLeaveData: " + flowLeaveData); + } /*考勤二开--异常考勤转事假end*/ data.put(flowType, flowLeaveData); @@ -589,6 +637,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand getEmployAndResignDateById(String id){ RecordSet rs = new RecordSet(); @@ -735,7 +785,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand> { sql = " select " + sql; } - writeLog("howeccccccccccccggggggg10"+ System.currentTimeMillis()); + // #1475814-概述:满足考勤报分部部门显示及导出时显示全路径 String fullPathMainKey = "show_full_path"; KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo(); @@ -327,9 +329,52 @@ public class GetKQReportCmd extends AbstractCommonCommand> { /*考勤二开--转事假start*/ String calLeaveId = bb.getPropValue("project_sskj", "calLeaveId"); /*考勤二开--转事假end*/ + /*考勤二开--公休时长统计start*/ + String offdutyId = Util.null2String(PropBean.getUfPropValue("shift.offduty.id"),"7"); + /*考勤二开--公休时长统计end*/ + /*考勤二开--劳务公司start*/ + //获取人员的劳务公司 + Map resLabComMap = new HashMap<>(); + String laborCompanies = Util.null2String(PropBean.getUfPropValue("laborCompanies"),"field25"); + String acqResLaborComSql = "select id, " + laborCompanies + " from cus_fielddata where scopeid = 3 and scope = 'HrmCustomFieldByInfoType'"; + rs.executeQuery(acqResLaborComSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String value = Util.null2String(rs.getString(laborCompanies)); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) { + resLabComMap.put(id, value); + } + } + bb.writeLog("resLabComMap: " + resLabComMap); + //获取所有劳务公司 + Map laborCompaniesMap = new HashMap<>(); + String acqLabComSql = "select id, gsmc from uf_lwgs "; + rs.executeQuery(acqLabComSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String value = Util.null2String(rs.getString("gsmc")); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(value)) { + laborCompaniesMap.put(id, value); + } + } + bb.writeLog("laborCompaniesMap: " + laborCompaniesMap); + /*考勤二开--劳务公司end*/ + /*考勤二开--劳务工时start*/ + Map empTypes = new HashMap<>(); + String empType = Util.null2String(PropBean.getUfPropValue("empType"),"field9"); + String acqLaSql = "select id, " + empType + " from cus_fielddata where scopeid = -1 and scope = 'HrmCustomFieldByInfoType'"; + rs.executeQuery(acqLaSql); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String empTypeValue = Util.null2String(rs.getString(empType)); + if (StringUtils.isNotBlank(id) && StringUtils.isNotBlank(empTypeValue)) { + empTypes.put(id, empTypeValue); + } + } + /*考勤二开--劳务工时end*/ rs.execute(sql); - writeLog("howeccccccccccccggggggg11"+ System.currentTimeMillis()); + while (rs.next()) { data = new HashMap<>(); kqReportFieldComInfo.setTofirstRow(); @@ -415,7 +460,7 @@ public class GetKQReportCmd extends AbstractCommonCommand> { } else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave") ||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){ if(fieldName.equals("overtimeTotal")){ - writeLog("howeccccccccccccggggggg12"+ System.currentTimeMillis()); + double workingDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_4leave"))); workingDayOvertime_4leave = workingDayOvertime_4leave<0?0:workingDayOvertime_4leave; double restDayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_4leave"))); @@ -464,7 +509,27 @@ public class GetKQReportCmd extends AbstractCommonCommand> { } else { data.put(fieldName,"0"); } - } else if ("laborHours".equals(kqReportFieldComInfo.getParentid()) ) { + } else if ("resourceType".equals(fieldName)) {//考勤二开--员工类型显示 + + int emp = Util.getIntValue(Util.null2String(empTypes.get(id))); + + if(emp == 0) { + fieldValue = "正式工"; + }else if(emp == 1) { + fieldValue = "劳务工"; + } + + data.put(fieldName, fieldValue); + } else if ("laborCompanies".equals(fieldName)) {//考勤二开--员工劳务公司 + + String labCom = Util.null2String(resLabComMap.get(id)); + bb.writeLog("劳务公司 labCom: " + labCom); + if (StringUtils.isNotBlank(labCom)) { + fieldValue = Util.null2String(laborCompaniesMap.get(labCom)); + } + bb.writeLog("劳务公司 fieldValue: " + fieldValue); + data.put(fieldName, fieldValue); + }else if ("laborHours".equals(kqReportFieldComInfo.getParentid()) ) { if ("laborHoursTotal".equals(fieldName)) { // @@ -473,7 +538,7 @@ public class GetKQReportCmd extends AbstractCommonCommand> { double restdayValue = Util.getDoubleValue(Util.null2String(flowData.get("LaborHoursData|" + id + "|restday")), 0.00); // double total = holidayValue + workdayValue + restdayValue; - bb.writeLog("--total: " +total); + // // data.put("holiday", holidayValue); // data.put("workday", workdayValue); @@ -506,8 +571,8 @@ public class GetKQReportCmd extends AbstractCommonCommand> { data.put(fieldName,fieldValue); } - bb.writeLog("--end data: " +data); - writeLog("howeccccccccccccggggggg13"+ System.currentTimeMillis()); + + //请假 List> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules(); Map leaveRule = null; @@ -536,7 +601,7 @@ public class GetKQReportCmd extends AbstractCommonCommand> { }catch (Exception e){ writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e); } - writeLog("howeccccccccccccggggggg14"+ System.currentTimeMillis()); + //考虑下冻结的数据 if(b_flowLeaveData.length() > 0){ flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData); @@ -546,28 +611,29 @@ public class GetKQReportCmd extends AbstractCommonCommand> { /*考勤二开--转事假start*/ if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) { - bb.writeLog("flowLeaveData: " + flowLeaveData); + double temp = Util.getDoubleValue(Util.null2String(flowData.get("-ToComLeaveData|" + id))); - bb.writeLog("temp: " + temp); + if (temp >= 0.00) { temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0))); double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData)); flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp); } - bb.writeLog("flowLeaveData: " + flowLeaveData); + } /*考勤二开--转事假end*/ /*考勤二开--异常考勤转事假start*/ if ( flowType.equals( ("leaveType_" + calLeaveId) ) ) { - bb.writeLog("-flowLeaveData: " + flowLeaveData); + + double temp = Util.getDoubleValue(Util.null2String(flowData.get("-AbnAttToComLeaveData|" + id ))); - bb.writeLog("-temp: " + temp); + if (temp >= 0.00) { temp = Double.parseDouble(KQDurationCalculatorUtil.getDurationRound(String.valueOf(temp / 60.0))); double doubleValue = Util.getDoubleValue(Util.null2String(flowLeaveData)); flowLeaveData = String.valueOf(doubleValue > 0.00? doubleValue : 0.00 + temp); } - bb.writeLog("-flowLeaveData: " + flowLeaveData); + } /*考勤二开--异常考勤转事假end*/ @@ -645,7 +711,6 @@ public class GetKQReportCmd extends AbstractCommonCommand> { } datas.add(data); } - bb.writeLog("--datas: " +datas); List lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate); retmap.put("holidays", lsHolidays);