From ccb43ae87e5e13b0c796d1d73b82d5c5fb0e5300 Mon Sep 17 00:00:00 2001 From: howec <> Date: Mon, 18 Dec 2023 09:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=8A=A5=EF=BC=8C=E6=9C=88=E6=8A=A5?= =?UTF-8?q?=EF=BC=8C=E5=A4=A7=E5=A4=9C=E7=8F=AD=E5=A4=A9=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=B0=8F=E5=A4=9C=E7=8F=AD=E5=A4=A9=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kq/cmd/report/ExportDailyExcelCmd.java | 32 +- .../engine/kq/cmd/report/ExportExcelCmd.java | 40 ++- .../kq/cmd/report/GetKQDailyReportCmd.java | 23 +- .../engine/kq/cmd/report/GetKQReportCmd.java | 292 +++++++++--------- 4 files changed, 224 insertions(+), 163 deletions(-) diff --git a/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java b/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java index 3cbeb1e..6f82ad7 100644 --- a/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java +++ b/src/com/engine/kq/cmd/report/ExportDailyExcelCmd.java @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.entity.BizLogContext; import com.engine.core.interceptor.CommandContext; -import com.engine.kq.biz.*; +import com.engine.kq.biz.KQReportBiz; import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit; import com.engine.kq.util.ExcelUtil; import com.engine.kq.util.KQDurationCalculatorUtil; @@ -176,12 +176,20 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand(); - title.put("title","夜班天数"); + title.put("title","大夜班天数"); title.put("width",30*256); title.put("rowSpan", 3); titleList.add(title); + + //刘浩 导出新增列[小夜班天数]-begin + title = new HashMap<>(); + title.put("title","小夜班天数"); + title.put("width",30*256); + title.put("rowSpan", 3); + titleList.add(title); + //刘浩 导出新增列[夜班天数]-end sheet.put("titleList", titleList); @@ -476,11 +484,22 @@ public class ExportDailyExcelCmd extends AbstractCommonCommand> { } titleList.add(title); } - //刘浩 新增一列[夜班天数] + //刘浩 新增一列[大夜班天数] title = new HashMap(); - title.put("title","夜班天数"); + title.put("title","大夜班天数"); title.put("width", 30 * 256); title.put("rowSpan",3); titleList.add(title); + //刘浩 新增一列[小夜班天数] + title = new HashMap(); + title.put("title","小夜班天数"); + title.put("width", 30 * 256); + title.put("rowSpan",3); + titleList.add(title); + sheet.put("titleList", titleList); String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) "; @@ -469,12 +476,13 @@ public class ExportExcelCmd extends AbstractCommonCommand> { } s1 = s1.substring(0,s1.length()-1); - String sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + + //刘浩--大夜班天数统计 + String sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + " and b.signintime !='' and b.signouttime !='' " + - " and b.kqdate in("+s1+") and b.serialid in (3,5,6)"; - String sql99 = "select count(b.resourceid) as sums from kq_format_detail b where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + + " and b.kqdate in("+s1+") and c.serial like '%值夜班%'"; + String sql99 = "select count(b.resourceid) as sums from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + " and b.signintime !='' and b.signouttime !='' " + - " and b.kqdate in("+s1+") and b.serialid in (3,5,6)"; + " and b.kqdate in("+s1+") and c.serial like '%值夜班%'"; writeLog("howec:::::sql2:"+sql88); RecordSet rs99 = new RecordSet(); rs99.execute(sql99); @@ -483,8 +491,26 @@ public class ExportExcelCmd extends AbstractCommonCommand> { counts99 = String.valueOf(rs99.getInt("sums")); } data.add(counts99); + + //刘浩--小夜班天数统计 + sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + + " and b.signintime !='' and b.signouttime !='' " + + " and b.kqdate in("+s1+") and c.serial like '%两班夜班%'"; + sql99 = "select count(b.resourceid) as sums from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + + " and b.signintime !='' and b.signouttime !='' " + + " and b.kqdate in("+s1+") and c.serial like '%两班夜班%'"; + writeLog("howec:::::sql2-1:"+sql88); + rs99 = new RecordSet(); + rs99.execute(sql99); + counts99 = "0"; + if (rs99.next()){ + counts99 = String.valueOf(rs99.getInt("sums")); + } + data.add(counts99); + }else { data.add("0"); + data.add("0"); } dataList.add(data); } diff --git a/src/com/engine/kq/cmd/report/GetKQDailyReportCmd.java b/src/com/engine/kq/cmd/report/GetKQDailyReportCmd.java index 5464f78..e97d14d 100644 --- a/src/com/engine/kq/cmd/report/GetKQDailyReportCmd.java +++ b/src/com/engine/kq/cmd/report/GetKQDailyReportCmd.java @@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.entity.BizLogContext; import com.engine.core.interceptor.CommandContext; -import com.engine.kq.biz.*; +import com.engine.kq.biz.KQReportBiz; import com.engine.kq.cmd.shiftmanagement.toolkit.ShiftManagementToolKit; import com.engine.kq.entity.WorkTimeEntity; import com.engine.kq.log.KQLog; @@ -44,8 +44,8 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand> leaveRules = kqLeaveRulesBiz.getAllLeaveRules(); List columns = new ArrayList(); Map column = null; @@ -95,6 +96,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand mapChildColumnInfo = null; List childColumns = null; KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo(); + writeLog("howeccccccccccccggggggg5"+ new Date()); while (kqReportFieldComInfo.next()){ if(Util.null2String(kqReportFieldComInfo.getParentid()).length()>0)continue; boolean isDaily = kqReportFieldComInfo.getReportType().equals("daily"); @@ -117,6 +119,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand0){ sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") "; } - + writeLog("howeccccccccccccggggggg8"+ new Date()); if(departmentId.length()>0){ sqlWhere +=" and a.departmentid in("+departmentId+") "; } @@ -198,7 +202,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand 0 && pageSize > 0) { if (rs.getDBType().equals("oracle")) { sql = " select " + sql; @@ -236,7 +240,6 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand0) {//弹性工作制没有班次 // data.put("serialid", shiftManagementToolKit.getShiftOnOffWorkSections(fieldValue, user.getLanguage())); @@ -354,6 +361,7 @@ public class GetKQDailyReportCmd extends AbstractCommonCommand lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate); retmap.put("holidays", lsHolidays); retmap.put("columns",columns); diff --git a/src/com/engine/kq/cmd/report/GetKQReportCmd.java b/src/com/engine/kq/cmd/report/GetKQReportCmd.java index 10e2c75..b001c05 100644 --- a/src/com/engine/kq/cmd/report/GetKQReportCmd.java +++ b/src/com/engine/kq/cmd/report/GetKQReportCmd.java @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.engine.common.biz.AbstractCommonCommand; import com.engine.common.entity.BizLogContext; import com.engine.core.interceptor.CommandContext; -import com.engine.kq.biz.*; +import com.engine.kq.biz.KQReportBiz; import com.engine.kq.util.KQDurationCalculatorUtil; import com.engine.kq.util.PageUidFactory; import weaver.common.DateUtil; @@ -23,7 +23,6 @@ import weaver.systeminfo.SystemEnv; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.time.LocalDate; import java.util.*; public class GetKQReportCmd extends AbstractCommonCommand> { @@ -44,12 +43,11 @@ public class GetKQReportCmd extends AbstractCommonCommand> { String pageUid = PageUidFactory.getHrmPageUid("KQReport"); SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo(); - DepartmentComInfo departmentComInfo = new DepartmentComInfo(); + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); ResourceComInfo resourceComInfo = new ResourceComInfo(); JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo(); KQLeaveRulesBiz kqLeaveRulesBiz = new KQLeaveRulesBiz(); KQReportBiz kqReportBiz = new KQReportBiz(); - JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String attendanceSerial = Util.null2String(jsonObj.get("attendanceSerial")); String fromDate = Util.null2String(jsonObj.get("fromDate")); @@ -101,7 +99,6 @@ public class GetKQReportCmd extends AbstractCommonCommand> { if(KQReportFieldComInfo.cascadekey2fieldname.keySet().contains(kqReportFieldComInfo.getFieldname()))continue; if(!kqReportFieldComInfo.getReportType().equals("all") && !kqReportFieldComInfo.getReportType().equals("month"))continue; if("leave".equalsIgnoreCase(kqReportFieldComInfo.getFieldname())&&leaveRules.size()==0)continue; - column = new HashMap(); column.put("title", SystemEnv.getHtmlLabelNames(kqReportFieldComInfo.getFieldlabel(), user.getLanguage())); column.put("unit", KQReportBiz.getUnitType(kqReportFieldComInfo, user)); @@ -124,20 +121,19 @@ public class GetKQReportCmd extends AbstractCommonCommand> { columns.addAll(this.getCascadeKeyColumnsInfo(kqReportFieldComInfo.getCascadekey(),user)); } - //Liuhao 新增列[夜班天数] --begin + //Liuhao 新增列[大夜班天数] --begin column = new HashMap(); - column.put("title","夜班天数"); + column.put("title","大夜班天数"); column.put("unit","天"); - column.put("dataIndex","nightdays"); + column.put("dataIndex","nightdaysd"); column.put("type","businessLeave"); - column.put("key","nightdays"); + column.put("key","nightdaysd"); column.put("isSystem","1"); column.put("rowSpan","3"); column.put("width",65); column.put("showDetial","1"); columns.add(column); //Liuhao 新增列[夜班天数] --end - boolean isEnd = false; Calendar cal = DateUtil.getCalendar(); String today = DateUtil.getCurrentDate(); @@ -176,26 +172,25 @@ public class GetKQReportCmd extends AbstractCommonCommand> { columns.add(column); String forgotBeginWorkCheck_field = " sum(b.forgotBeginWorkCheck) "; - - if(rs.getDBType().equalsIgnoreCase("oracle")) { - forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) "; - }else if((rs.getDBType()).equalsIgnoreCase("mysql")){ - forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) "; - }else { - forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) "; - } + if(rs.getDBType().equalsIgnoreCase("oracle")) { + forgotBeginWorkCheck_field = " sum(nvl(b.forgotBeginWorkCheck,0)) "; + }else if((rs.getDBType()).equalsIgnoreCase("mysql")){ + forgotBeginWorkCheck_field = " sum(ifnull(b.forgotBeginWorkCheck,0)) "; + }else { + forgotBeginWorkCheck_field = " sum(isnull(b.forgotBeginWorkCheck,0)) "; + } Map definedFieldInfo = new KQFormatBiz().getDefinedField(); String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum")); String backFields = " a.id,a.lastname,a.workcode,a.dsporder,b.resourceid,a.subcompanyid1 as subcompanyid,a.departmentid,a.jobtitle," + - " sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," + - " sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " + - " sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," + - " sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " + - " sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " + - " sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+ - " sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":""); + " sum(b.workdays) as workdays,sum(b.workMins) as workMins,sum(b.attendancedays) as attendancedays," + + " sum(b.attendanceMins) as attendanceMins,sum(b.beLate) as beLate,sum(b.beLateMins) as beLateMins, " + + " sum(b.graveBeLate) as graveBeLate, sum(b.graveBeLateMins) as graveBeLateMins,sum(b.leaveEearly) as leaveEearly," + + " sum(b.leaveEarlyMins) as leaveEarlyMins, sum(b.graveLeaveEarly) as graveLeaveEarly, " + + " sum(b.graveLeaveEarlyMins) as graveLeaveEarlyMins,sum(b.absenteeism) as absenteeism, " + + " sum(b.signdays) as signdays,sum(b.signmins) as signmins, "+ + " sum(b.absenteeismMins) as absenteeismMins, sum(b.forgotCheck)+"+forgotBeginWorkCheck_field+" as forgotCheck "+(definedFieldSum.length()>0?","+definedFieldSum+"":""); if(rs.getDBType().equals("oracle")){ backFields = "/*+ index(kq_format_total IDX_KQ_FORMAT_TOTAL_KQDATE) */ "+backFields; @@ -206,7 +201,6 @@ public class GetKQReportCmd extends AbstractCommonCommand> { if(subCompanyId.length()>0){ sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") "; } - if(departmentId.length()>0){ sqlWhere +=" and a.departmentid in("+departmentId+") "; } @@ -226,14 +220,13 @@ public class GetKQReportCmd extends AbstractCommonCommand> { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - if(status.length()>0){ - if (!status.equals("8") && !status.equals("9")) { - sqlWhere += " and a.status = "+status+ ""; - }else if (status.equals("8")) { - sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) "; - } - } - + if(status.length()>0){ + if (!status.equals("8") && !status.equals("9")) { + sqlWhere += " and a.status = "+status+ ""; + }else if (status.equals("8")) { + sqlWhere += " and (a.status = 0 or a.status = 1 or a.status = 2 or a.status = 3) "; + } + } sql = " select count(*) as c from ( select 1 as c "+sqlFrom+sqlWhere+groupBy+") t"; rs.execute(sql); if (rs.next()){ @@ -286,12 +279,11 @@ public class GetKQReportCmd extends AbstractCommonCommand> { // orderBy = "order by "+orderBy; sql = backFields + sqlFrom + sqlWhere + groupBy; - if (pageIndex > 0 && pageSize > 0) { if (rs.getDBType().equals("oracle")) { sql = " select * from (select " + sql+") t "+orderBy; sql = "select * from ( select row_.*, rownum rownum_ from ( " + sql + " ) row_ where rownum <= " - + (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize); + + (pageIndex * pageSize) + ") where rownum_ > " + ((pageIndex - 1) * pageSize); } else if (rs.getDBType().equals("mysql")) { sql = " select * from (select " + sql+") t "+orderBy; sql = "select t1.* from (" + sql + ") t1 limit " + ((pageIndex - 1) * pageSize) + "," + pageSize; @@ -309,7 +301,7 @@ public class GetKQReportCmd extends AbstractCommonCommand> { topSize = count - (pageSize * (pageIndex - 1)); } sql = " select top " + topSize + " * from ( select top " + topSize + " * from ( select top " - + (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy; + + (pageIndex * pageSize) + sql + orderBy+ " ) tbltemp1 " + descOrderBy + ") tbltemp2 " + orderBy; } else { sql = " select top " + pageSize + sql+orderBy; } @@ -318,7 +310,7 @@ public class GetKQReportCmd extends AbstractCommonCommand> { sql = " select " + sql; } - + writeLog("howeccccccccccccggggggg10"+ System.currentTimeMillis()); // #1475814-概述:满足考勤报分部部门显示及导出时显示全路径 String fullPathMainKey = "show_full_path"; KQSettingsComInfo kqSettingsComInfo = new KQSettingsComInfo(); @@ -335,6 +327,7 @@ public class GetKQReportCmd extends AbstractCommonCommand> { rs.execute(sql); + writeLog("howeccccccccccccggggggg11"+ System.currentTimeMillis()); while (rs.next()) { data = new HashMap<>(); kqReportFieldComInfo.setTofirstRow(); @@ -388,8 +381,9 @@ public class GetKQReportCmd extends AbstractCommonCommand> { data.put(serialIds.get(i), kqReportBiz.getSerialCount(id,fromDate,toDate,serialIds.get(i))); } }else if(kqReportFieldComInfo.getParentid().equals("overtime")||kqReportFieldComInfo.getParentid().equals("overtime_nonleave") - ||kqReportFieldComInfo.getParentid().equals("overtime_4leave")||fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){ + ||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"))); @@ -397,37 +391,37 @@ public class GetKQReportCmd extends AbstractCommonCommand> { double holidayOvertime_4leave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_4leave"))); holidayOvertime_4leave = holidayOvertime_4leave<0?0:holidayOvertime_4leave; - double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave"))); - workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave; - double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave"))); - restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave; - double holidayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|holidayOvertime_nonleave"))); - holidayOvertime_nonleave = holidayOvertime_nonleave<0?0:holidayOvertime_nonleave; + double workingDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|workingDayOvertime_nonleave"))); + workingDayOvertime_nonleave = workingDayOvertime_nonleave<0?0:workingDayOvertime_nonleave; + double restDayOvertime_nonleave = Util.getDoubleValue(Util.null2String(flowData.get(id+"|restDayOvertime_nonleave"))); + restDayOvertime_nonleave = restDayOvertime_nonleave<0?0:restDayOvertime_nonleave; + 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)); }else if(fieldName.equals("businessLeave") || fieldName.equals("officialBusiness")){ - String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0"); - String backType = fieldName+"_back"; - String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0"); - String businessLeave = ""; - try{ - //以防止出现精度问题 - if(businessLeaveData.length() == 0){ - businessLeaveData = "0.0"; - } - if(businessLeavebackData.length() == 0){ - businessLeavebackData = "0.0"; - } - BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData); - BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData); - businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString(); - if(Util.getDoubleValue(businessLeave, -1) < 0){ - businessLeave = "0.0"; + String businessLeaveData = Util.null2s(Util.null2String(flowData.get(id+"|"+fieldName)),"0.0"); + String backType = fieldName+"_back"; + String businessLeavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+backType)),"0.0"); + String businessLeave = ""; + try{ + //以防止出现精度问题 + if(businessLeaveData.length() == 0){ + businessLeaveData = "0.0"; + } + if(businessLeavebackData.length() == 0){ + businessLeavebackData = "0.0"; + } + BigDecimal b_businessLeaveData = new BigDecimal(businessLeaveData); + BigDecimal b_businessLeavebackData = new BigDecimal(businessLeavebackData); + businessLeave = b_businessLeaveData.subtract(b_businessLeavebackData).toString(); + if(Util.getDoubleValue(businessLeave, -1) < 0){ + businessLeave = "0.0"; + } + }catch (Exception e){ } - }catch (Exception e){ - } - fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave); + fieldValue = KQDurationCalculatorUtil.getDurationRound(businessLeave); }else{ fieldValue = KQDurationCalculatorUtil.getDurationRound(Util.null2String(flowData.get(id+"|"+fieldName))); } @@ -445,7 +439,7 @@ public class GetKQReportCmd extends AbstractCommonCommand> { } data.put(fieldName,fieldValue); } - + writeLog("howeccccccccccccggggggg13"+ System.currentTimeMillis()); //请假 List> allLeaveRules = kqLeaveRulesBiz.getAllLeaveRules(); Map leaveRule = null; @@ -456,31 +450,31 @@ public class GetKQReportCmd extends AbstractCommonCommand> { String flowLeaveBackType = Util.null2String("leavebackType_"+leaveRule.get("id")); String leavebackData = Util.null2s(Util.null2String(flowData.get(id+"|"+flowLeaveBackType)),"0.0"); String b_flowLeaveData = ""; - String flowLeaveData = ""; + String flowLeaveData = ""; try{ - //以防止出现精度问题 - if(leaveData.length() == 0){ - leaveData = "0.0"; - } - if(leavebackData.length() == 0){ - leavebackData = "0.0"; - } - BigDecimal b_leaveData = new BigDecimal(leaveData); - BigDecimal b_leavebackData = new BigDecimal(leavebackData); - b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString(); - if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){ - b_flowLeaveData = "0.0"; - } - }catch (Exception e){ - writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e); - } - - //考虑下冻结的数据 - if(b_flowLeaveData.length() > 0){ - flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData); - }else{ - flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0))); - } + //以防止出现精度问题 + if(leaveData.length() == 0){ + leaveData = "0.0"; + } + if(leavebackData.length() == 0){ + leavebackData = "0.0"; + } + BigDecimal b_leaveData = new BigDecimal(leaveData); + BigDecimal b_leavebackData = new BigDecimal(leavebackData); + b_flowLeaveData = b_leaveData.subtract(b_leavebackData).toString(); + if(Util.getDoubleValue(b_flowLeaveData, -1) < 0){ + b_flowLeaveData = "0.0"; + } + }catch (Exception e){ + writeLog("GetKQReportCmd:leaveData"+leaveData+":leavebackData:"+leavebackData+":"+e); + } + writeLog("howeccccccccccccggggggg14"+ System.currentTimeMillis()); + //考虑下冻结的数据 + if(b_flowLeaveData.length() > 0){ + flowLeaveData = KQDurationCalculatorUtil.getDurationRound(b_flowLeaveData); + }else{ + flowLeaveData = KQDurationCalculatorUtil.getDurationRound(Util.null2String(Util.getDoubleValue(leaveData,0.0)-Util.getDoubleValue(leavebackData,0.0))); + } data.put(flowType,flowLeaveData); } @@ -519,13 +513,13 @@ public class GetKQReportCmd extends AbstractCommonCommand> { s1 = s1+"'"+strdate+"',"; } s1 = s1.substring(0,s1.length()-1); - - String sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + + //刘浩 大夜班天数 + String sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + " and b.signintime !='' and b.signouttime !='' " + - " and b.kqdate in("+s1+") and b.serialid in (3,5,6)"; - String sql99 = "select count(b.resourceid) as sums from kq_format_detail b where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + + " and b.kqdate in("+s1+") and c.serial like '%值夜班%'"; + String sql99 = "select count(b.resourceid) as sums from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + " and b.signintime !='' and b.signouttime !='' " + - " and b.kqdate in("+s1+") and b.serialid in (3,5,6)"; + " and b.kqdate in("+s1+") and c.serial like '%值夜班%'"; writeLog("howec:::::sql1:"+sql88); RecordSet rs99 = new RecordSet(); rs99.execute(sql99); @@ -533,16 +527,30 @@ public class GetKQReportCmd extends AbstractCommonCommand> { if (rs99.next()){ counts99 = String.valueOf(rs99.getInt("sums")); } - data.put("nightdays",counts99); + data.put("nightdaysd",counts99); + //刘浩 小夜班天数 + sql88 = "select b.resourceid,b.signintime,b.signouttime,b.serialid from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + + " and b.signintime !='' and b.signouttime !='' " + + " and b.kqdate in("+s1+") and c.serial like '%两班夜班%'"; + sql99 = "select count(b.resourceid) as sums from kq_format_detail b inner join kq_ShiftManagement c on c.id = b.serialid where b.resourceid = "+resourceid+" and b.signintime is not null and b.signouttime is not null " + + " and b.signintime !='' and b.signouttime !='' " + + " and b.kqdate in("+s1+") and c.serial like '%两班夜班%'"; + writeLog("howec:::::sql1-1:"+sql88); + rs99 = new RecordSet(); + rs99.execute(sql99); + counts99 = "0"; + if (rs99.next()){ + counts99 = String.valueOf(rs99.getInt("sums")); + } + data.put("nightdaysx",counts99); }else { - data.put("nightdays","0"); + data.put("nightdaysd","0"); + data.put("nightdaysx","0"); } datas.add(data); } - List lsHolidays = KQHolidaySetBiz.getHolidaySetListByScope(""+user.getUID(),fromDate,toDate); retmap.put("holidays", lsHolidays); - retmap.put("columns",columns); retmap.put("datas",datas); retmap.put("pagesize", pageSize); @@ -576,7 +584,7 @@ public class GetKQReportCmd extends AbstractCommonCommand> { column.put("width", 65); column.put("dataIndex", serialIds.get(i)); column.put("key", serialIds.get(i)); - column.put("rowSpan", 2); + column.put("rowSpan", 2); column.put("colSpan", 1); sumChildColumnWidth+=65; lsChildColumns.add(column); @@ -602,48 +610,48 @@ public class GetKQReportCmd extends AbstractCommonCommand> { lsChildColumns.add(column); } }else if(parentid.equals("overtime")){ - String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"}; - for(int i=0;i0){ - if(unitType.equals("1")){ - unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage()); - }else if(unitType.equals("2")){ - unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage()); - }else if(unitType.equals("3")){ - unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage()); - } - } - column.put("unit", unitTypeName); - } - column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())); - column.put("dataIndex", id); - column.put("key", id); - column.put("rowSpan", 1); - Map mapChildColumnInfo = getChildColumnsInfo(id, user); - int childWidth = 65; - List childColumns = (List)mapChildColumnInfo.get("childColumns"); - if(childColumns.size()>0) {//跨列width取子列的width - column.put("children", childColumns); - childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65); - } - column.put("width", childWidth+""); - sumChildColumnWidth+=childWidth; - lsChildColumns.add(column); - } - }else{ + String[] overtimeChild = {"overtime_nonleave","overtime_4leave","overtimeTotal"}; + for(int i=0;i0){ + if(unitType.equals("1")){ + unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage()); + }else if(unitType.equals("2")){ + unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage()); + }else if(unitType.equals("3")){ + unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage()); + } + } + column.put("unit", unitTypeName); + } + column.put("title", SystemEnv.getHtmlLabelNames(fieldlabel, user.getLanguage())); + column.put("dataIndex", id); + column.put("key", id); + column.put("rowSpan", 1); + Map mapChildColumnInfo = getChildColumnsInfo(id, user); + int childWidth = 65; + List childColumns = (List)mapChildColumnInfo.get("childColumns"); + if(childColumns.size()>0) {//跨列width取子列的width + column.put("children", childColumns); + childWidth = Util.getIntValue(Util.null2String(mapChildColumnInfo.get("sumChildColumnWidth")),65); + } + column.put("width", childWidth+""); + sumChildColumnWidth+=childWidth; + lsChildColumns.add(column); + } + }else{ KQReportFieldComInfo kqReportFieldComInfo = new KQReportFieldComInfo(); while (kqReportFieldComInfo.next()){ if(kqReportFieldComInfo.getParentid().equals(parentid)) {