diff --git a/src/com/engine/kq/biz/KQReportBiz.java b/src/com/engine/kq/biz/KQReportBiz.java index ca0ddc9..6b3465c 100644 --- a/src/com/engine/kq/biz/KQReportBiz.java +++ b/src/com/engine/kq/biz/KQReportBiz.java @@ -1,11 +1,8 @@ package com.engine.kq.biz; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.engine.kq.biz.chain.shiftinfo.ShiftInfoBean; import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum; -import com.engine.kq.enums.FlowReportTypeEnum; import com.engine.kq.enums.KqSplitFlowTypeEnum; import com.engine.kq.log.KQLog; import com.engine.kq.util.KQDurationCalculatorUtil; @@ -85,12 +82,12 @@ public class KQReportBiz extends BaseBean { try { Map kqdate = null; List datas = null; - Map data = null; + Map data = null; sql = " select kqdate,serialid, workbegindate, workbegintime,workenddate, workendtime," + - " signintime,signouttime,beLateMins,graveBeLateMins,leaveEarlyMins,graveLeaveEarlyMins," + - " absenteeismMins, forgotCheckMins,forgotBeginWorkCheckMins,otherinfo "+ - " from kq_format_detail " + - " where resourceid=? and kqdate>=? and kqdate<=? "; + " signintime,signouttime,beLateMins,graveBeLateMins,leaveEarlyMins,graveLeaveEarlyMins," + + " absenteeismMins, forgotCheckMins,forgotBeginWorkCheckMins,otherinfo "+ + " from kq_format_detail " + + " where resourceid=? and kqdate>=? and kqdate<=? "; if(!isAll){ if(rs.getDBType().equalsIgnoreCase("oracle") || Util.null2String(rs.getOrgindbtype()).equals("dm") || Util.null2String(rs.getOrgindbtype()).equals("st")) { sql += " and beLateMins+graveBeLateMins+leaveEarlyMins+graveLeaveEarlyMins+absenteeismMins+forgotCheckMins+nvl(forgotBeginWorkCheckMins,0)>0 "; @@ -150,7 +147,7 @@ public class KQReportBiz extends BaseBean { kqdate = new HashMap<>(); datas = new ArrayList<>(); - kqdate.put("kqdate",Util.null2String(rs.getString("kqdate"))); + kqdate.put("kqdate", Util.null2String(rs.getString("kqdate"))); if(workbegindate.length()>0){ data = new HashMap<>(); data.put("workbegindate",workbegindate); @@ -294,23 +291,23 @@ public class KQReportBiz extends BaseBean { }else if(fieldName.equals("officialBusiness")){ unitType = KQExitRulesBiz.getMinimumUnit().equals("3")?"2":"1";//单位类型 }else if(parentid.equals("overtime") || parentid.equals("overtime_nonleave") || parentid.equals("overtime_4leave")){ - unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 ||KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";//单位类型 + unitType = (KQOvertimeRulesBiz.getMinimumUnit()==3 || KQOvertimeRulesBiz.getMinimumUnit()==5 || KQOvertimeRulesBiz.getMinimumUnit()==6)?"2":"1";//单位类型 } } if(Util.null2String(unitType).length()>0){ if(unitType.equals("1")){ - unitTypeName=SystemEnv.getHtmlLabelName(1925, user.getLanguage()); + unitTypeName= SystemEnv.getHtmlLabelName(1925, user.getLanguage()); }else if(unitType.equals("2")){ - unitTypeName=SystemEnv.getHtmlLabelName(391, user.getLanguage()); + unitTypeName= SystemEnv.getHtmlLabelName(391, user.getLanguage()); }else if(unitType.equals("3")){ - unitTypeName=SystemEnv.getHtmlLabelName(18083, user.getLanguage()); + unitTypeName= SystemEnv.getHtmlLabelName(18083, user.getLanguage()); } } return unitTypeName; } - public Map getFlowData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getFlowData(Map params, User user){ + Map datas = new HashMap<>();; try{ datas.putAll(getFlowLeaveData(params,user)); datas.putAll(getFlowEvectionOutData(params,user)); @@ -324,107 +321,14 @@ public class KQReportBiz extends BaseBean { return datas; } - /** - * 获取周六销假数据 - * @param params - * @param user - * @return - */ - public Map getSaturdayFlowLeaveBackData(Map params, User user){ - Map datas = new HashMap<>();; - RecordSet rs = new RecordSet(); - String sql = ""; - String sqlWhere = " "; - try{ - KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo(); - JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); - String fromDate = Util.null2String(jsonObj.get("fromDate")); - String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); - if(typeselect.length()==0)typeselect = "3"; - if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ - if(typeselect.equals("1")){ - fromDate = TimeUtil.getCurrentDateString(); - toDate = TimeUtil.getCurrentDateString(); - }else{ - fromDate = TimeUtil.getDateByOption(typeselect,"0"); - toDate = TimeUtil.getDateByOption(typeselect,"1"); - } - } - String subCompanyId = Util.null2String(jsonObj.get("subCompanyId")); - String departmentId = Util.null2String(jsonObj.get("departmentId")); - String resourceId = Util.null2String(jsonObj.get("resourceId")); - String allLevel = Util.null2String(jsonObj.get("allLevel")); - String isNoAccount = Util.null2String(jsonObj.get("isNoAccount")); - String viewScope = Util.null2String(jsonObj.get("viewScope")); - if(subCompanyId.length()>0){ - sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") "; - } - - if(departmentId.length()>0){ - sqlWhere +=" and a.departmentid in("+departmentId+") "; - } - - if(resourceId.length()>0){ - sqlWhere +=" and b.resourceid in("+resourceId+") "; - } - - if(viewScope.equals("4")){//我的下属 - if(allLevel.equals("1")){//所有下属 - sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'"; - }else{ - sqlWhere+=" and a.managerid="+user.getUID();//直接下属 - } - } - if (!"1".equals(isNoAccount)) { - sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); - } - - sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " + - "and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = " + - "(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) " +sqlWhere + - " group by resourceid, newleavetype, durationrule "; - rs.execute(sql); - while (rs.next()) { - String resourceid = rs.getString("resourceid"); - String newleavetype = rs.getString("newleavetype"); - String durationrule = rs.getString("durationrule"); - double value = rs.getDouble("val")<0?0:rs.getDouble("val"); - - double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype)); - if(KQUnitBiz.isLeaveHour(newleavetype,kqLeaveRulesComInfo)){//按小时 - if(!KQUnitBiz.isLeaveHour(durationrule)){ - if(proportion>0) value = value*proportion; - } - }else{//按天 - if(KQUnitBiz.isLeaveHour(durationrule)){ - if(proportion>0) value = value/proportion; - } - } - - String key = resourceid+"|leavebackType_"+newleavetype; - if(datas.containsKey(key)){ - value += Util.getDoubleValue(Util.null2String(datas.get(key))); - } - //df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了 - df.setMaximumFractionDigits(5); - datas.put(key,df.format(value)); - } - }catch (Exception e){ - writeLog(e); - } - return datas; - } - /** * 获取周六请假数据 * @param params * @param user * @return */ - public Map getSaturdayFlowLeaveData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getSaturdayFlowLeaveData(Map params, User user){ + Map datas = new HashMap<>();; try{ RecordSet rs = new RecordSet(); String sql = ""; @@ -434,7 +338,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -474,11 +378,8 @@ public class KQReportBiz extends BaseBean { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and " + - "(DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 " + - "AND groupid = (select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid " + - " and serialid = b.serialid and kqdate = b.belongdate)) " +sqlWhere + + sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " +sqlWhere + " group by resourceid, newleavetype, durationrule "; rs.execute(sql); while (rs.next()) { @@ -515,108 +416,14 @@ public class KQReportBiz extends BaseBean { return datas; } - /** - * 获取每日销假数据 - * @param params - * @param user - * @return - */ - public Map getDailySaturdayFlowLeaveBackData(Map params, User user){ - Map datas = new HashMap<>();; - RecordSet rs = new RecordSet(); - String sql = ""; - String sqlWhere = " "; - try{ - KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo(); - JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); - String fromDate = Util.null2String(jsonObj.get("fromDate")); - String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); - if(typeselect.length()==0)typeselect = "3"; - if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ - if(typeselect.equals("1")){ - fromDate = TimeUtil.getCurrentDateString(); - toDate = TimeUtil.getCurrentDateString(); - }else{ - fromDate = TimeUtil.getDateByOption(typeselect,"0"); - toDate = TimeUtil.getDateByOption(typeselect,"1"); - } - } - String subCompanyId = Util.null2String(jsonObj.get("subCompanyId")); - String departmentId = Util.null2String(jsonObj.get("departmentId")); - String resourceId = Util.null2String(jsonObj.get("resourceId")); - String allLevel = Util.null2String(jsonObj.get("allLevel")); - String isNoAccount = Util.null2String(jsonObj.get("isNoAccount")); - String viewScope = Util.null2String(jsonObj.get("viewScope")); - if(subCompanyId.length()>0){ - sqlWhere +=" and a.subcompanyid1 in("+subCompanyId+") "; - } - - if(departmentId.length()>0){ - sqlWhere +=" and a.departmentid in("+departmentId+") "; - } - - if(resourceId.length()>0){ - sqlWhere +=" and b.resourceid in("+resourceId+") "; - } - - if(viewScope.equals("4")){//我的下属 - if(allLevel.equals("1")){//所有下属 - sqlWhere+=" and a.managerstr like '%,"+user.getUID()+",%'"; - }else{ - sqlWhere+=" and a.managerid="+user.getUID();//直接下属 - } - } - if (!"1".equals(isNoAccount)) { - sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); - } - - sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " + - "and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = " + - "(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) " +sqlWhere + - " group by resourceid, newleavetype, durationrule,belongdate "; - rs.execute(sql); - while (rs.next()) { - String resourceid = rs.getString("resourceid"); - String belongdate = rs.getString("belongdate"); - String newleavetype = rs.getString("newleavetype"); - String durationrule = rs.getString("durationrule"); - double value = rs.getDouble("val")<0?0:rs.getDouble("val"); - - double proportion = Util.getDoubleValue(kqLeaveRulesComInfo.getProportion(newleavetype)); - if(KQUnitBiz.isLeaveHour(newleavetype,kqLeaveRulesComInfo)){//按小时 - if(!KQUnitBiz.isLeaveHour(durationrule)){ - if(proportion>0) value = value*proportion; - } - }else{//按天 - if(KQUnitBiz.isLeaveHour(durationrule)){ - if(proportion>0) value = value/proportion; - } - } - - String key = resourceid+"|"+belongdate+"|leavebackType_"+newleavetype; - if(datas.containsKey(key)){ - value += Util.getDoubleValue(Util.null2String(datas.get(key))); - } - //df.format 默认是不四舍五入的 0.125这样的就会直接变成0.12了 - df.setMaximumFractionDigits(5); - datas.put(key,df.format(value)); - } - }catch (Exception e){ - writeLog(e); - } - return datas; - } - /** * 获取周六请假数据 * @param params * @param user * @return */ - public Map getDailySaturdayFlowLeaveData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getDailySaturdayFlowLeaveData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -625,7 +432,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -665,10 +472,8 @@ public class KQReportBiz extends BaseBean { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " + - "and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = " + - "(select top 1 groupid from kq_shiftschedule where resourceid = b.resourceid and serialid = b.serialid and kqdate = b.belongdate)) " +sqlWhere + + sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) " +sqlWhere + " group by resourceid, newleavetype, durationrule,belongdate "; rs.execute(sql); while (rs.next()) { @@ -709,8 +514,8 @@ public class KQReportBiz extends BaseBean { * @param user * @return */ - public Map getDailyFlowData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getDailyFlowData(Map params, User user){ + Map datas = new HashMap<>();; try{ datas.putAll(getDailyFlowLeaveData(params,user)); datas.putAll(getDailyFlowEvectionOutData(params,user)); @@ -728,8 +533,8 @@ public class KQReportBiz extends BaseBean { * @param user * @return */ - public Map getFlowEvectionOutData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getFlowEvectionOutData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -743,7 +548,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -836,8 +641,8 @@ public class KQReportBiz extends BaseBean { * @param user * @return */ - public Map getDailyFlowEvectionOutData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getDailyFlowEvectionOutData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -851,7 +656,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -944,8 +749,8 @@ public class KQReportBiz extends BaseBean { * @param user * @return */ - public Map getFlowLeaveData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getFlowLeaveData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -954,7 +759,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -994,7 +799,7 @@ public class KQReportBiz extends BaseBean { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ + sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + " group by resourceid, newleavetype, durationrule "; rs.execute(sql); @@ -1035,8 +840,8 @@ public class KQReportBiz extends BaseBean { * @param user * @return */ - public Map getFlowLeaveBackData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getFlowLeaveBackData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -1045,7 +850,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -1085,7 +890,7 @@ public class KQReportBiz extends BaseBean { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ + sql = " select resourceid, newleavetype, durationrule, sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + " group by resourceid, newleavetype, durationrule "; rs.execute(sql); @@ -1126,8 +931,8 @@ public class KQReportBiz extends BaseBean { * @param user * @return */ - public Map getFlowProcessChangeData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getFlowProcessChangeData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -1138,7 +943,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -1178,9 +983,9 @@ public class KQReportBiz extends BaseBean { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - sql = " select resourceid, durationrule, changetype,sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.PROCESSCHANGE.getTablename()+" b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+ - " group by resourceid, durationrule,changetype "; + sql = " select resourceid, durationrule, changetype,sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.PROCESSCHANGE.getTablename()+" b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+ + " group by resourceid, durationrule,changetype "; rs.execute(sql); while (rs.next()) { String resourceid = rs.getString("resourceid"); @@ -1229,8 +1034,8 @@ public class KQReportBiz extends BaseBean { * @param user * @return */ - public Map getDailyFlowLeaveData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getDailyFlowLeaveData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -1239,7 +1044,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -1279,9 +1084,9 @@ public class KQReportBiz extends BaseBean { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + - " group by resourceid, newleavetype, durationrule,belongdate "; + sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + + " group by resourceid, newleavetype, durationrule,belongdate "; rs.execute(sql); while (rs.next()) { String resourceid = rs.getString("resourceid"); @@ -1321,8 +1126,8 @@ public class KQReportBiz extends BaseBean { * @param user * @return */ - public Map getDailyFlowLeaveBackData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getDailyFlowLeaveBackData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -1331,7 +1136,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -1371,9 +1176,9 @@ public class KQReportBiz extends BaseBean { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + - " group by resourceid, newleavetype, durationrule,belongdate "; + sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+ KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere + + " group by resourceid, newleavetype, durationrule,belongdate "; rs.execute(sql); while (rs.next()) { String resourceid = rs.getString("resourceid"); @@ -1411,8 +1216,8 @@ public class KQReportBiz extends BaseBean { * 获取实际加班数据,包括流程,打卡生成的 * @return */ - public Map getFlowOverTimeDataNew(Map params, User user){ - Map datas = new HashMap<>();; + public Map getFlowOverTimeDataNew(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -1421,7 +1226,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -1467,9 +1272,9 @@ public class KQReportBiz extends BaseBean { String valueField = ""; sql = " select resourceid,changeType, sum(cast(duration_min as decimal(18,4))) as val,paidLeaveEnable "+ - " from hrmresource a, kq_flow_overtime b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ - " group by resourceid,changeType,paidLeaveEnable "; + " from hrmresource a, kq_flow_overtime b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ + " group by resourceid,changeType,paidLeaveEnable "; rs.execute(sql); kqLog.info("getFlowOverTimeDataNew:sql:"+sql); while (rs.next()) { @@ -1519,8 +1324,8 @@ public class KQReportBiz extends BaseBean { * 获取加班数据 * @return */ - public Map getFlowOverTimeData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getFlowOverTimeData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -1529,7 +1334,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -1580,7 +1385,7 @@ public class KQReportBiz extends BaseBean { } sql = " select resourceid,changeType, " +valueField+ - " from hrmresource a, "+KqSplitFlowTypeEnum.OVERTIME.getTablename()+" b "+ + " from hrmresource a, "+ KqSplitFlowTypeEnum.OVERTIME.getTablename()+" b "+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ " group by resourceid,changeType,durationrule "; rs.execute(sql); @@ -1617,8 +1422,8 @@ public class KQReportBiz extends BaseBean { * 获取每日加班数据 * @return */ - public Map getDailyFlowOverTimeData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getDailyFlowOverTimeData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -1627,7 +1432,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -1678,9 +1483,9 @@ public class KQReportBiz extends BaseBean { } sql = " select resourceid,changeType,belongdate,paidLeaveEnable, sum(cast(duration_min as decimal(18,4))) as val "+ - " from hrmresource a, kq_flow_overtime b "+ - " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ - " group by resourceid,changeType,paidLeaveEnable,belongdate "; + " from hrmresource a, kq_flow_overtime b "+ + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ + " group by resourceid,changeType,paidLeaveEnable,belongdate "; rs.execute(sql); while (rs.next()) { String resourceid = rs.getString("resourceid"); @@ -1722,8 +1527,8 @@ public class KQReportBiz extends BaseBean { * 异常冲抵 * @return */ - public Map getFlowOtherData(Map params, User user){ - Map datas = new HashMap<>();; + public Map getFlowOtherData(Map params, User user){ + Map datas = new HashMap<>();; RecordSet rs = new RecordSet(); String sql = ""; String sqlWhere = " "; @@ -1734,7 +1539,7 @@ public class KQReportBiz extends BaseBean { JSONObject jsonObj = JSON.parseObject(Util.null2String(params.get("data"))); String fromDate = Util.null2String(jsonObj.get("fromDate")); String toDate = Util.null2String(jsonObj.get("toDate")); - String typeselect =Util.null2String(jsonObj.get("typeselect")); + String typeselect = Util.null2String(jsonObj.get("typeselect")); if(typeselect.length()==0)typeselect = "3"; if(!typeselect.equals("") && !typeselect.equals("0")&& !typeselect.equals("6")){ if(typeselect.equals("1")){ @@ -1774,7 +1579,7 @@ public class KQReportBiz extends BaseBean { sqlWhere += " and a.loginid is not null "+(rs.getDBType().equals("oracle")?"":" and a.loginid<>'' "); } - sql = " select resourceid, durationrule, sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.OTHER.getTablename()+" b "+ + sql = " select resourceid, durationrule, sum(duration) as val from hrmresource a, "+ KqSplitFlowTypeEnum.OTHER.getTablename()+" b "+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+ " group by resourceid, durationrule "; rs.execute(sql); @@ -1814,21 +1619,21 @@ public class KQReportBiz extends BaseBean { * @param toDate * @return */ - public Map getDetialDatas(String resourceId,String fromDate, String toDate, User user){ + public Map getDetialDatas(String resourceId, String fromDate, String toDate, User user){ KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo(); - Map datas = new HashMap<>(); - Map data = null; - Map tmpdatas = new HashMap<>(); - Map tmpdata = null; - Map tmpmap = null; + Map datas = new HashMap<>(); + Map data = null; + Map tmpdatas = new HashMap<>(); + Map tmpdata = null; + Map tmpmap = null; RecordSet rs = new RecordSet(); String sql = ""; try { sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+ - " leaveMins,leaveInfo,evectionMins,outMins " + - " from kq_format_detail " + - " where resourceid = ? and kqdate>=? and kqdate<=? "+ - " order by resourceid, kqdate, serialnumber "; + " leaveMins,leaveInfo,evectionMins,outMins " + + " from kq_format_detail " + + " where resourceid = ? and kqdate>=? and kqdate<=? "+ + " order by resourceid, kqdate, serialnumber "; rs.executeQuery(sql,resourceId, fromDate,toDate); while (rs.next()) { String key = rs.getString("resourceid") + "|" + rs.getString("kqdate"); @@ -1850,12 +1655,12 @@ public class KQReportBiz extends BaseBean { if(datas.get(key)==null){ data = new HashMap<>(); }else{ - data = (Map)datas.get(key); + data = (Map)datas.get(key); tmptext = Util.null2String(data.get("text")); } tmpdata = new HashMap<>(); if(tmpdatas.get(key)!=null){ - tmpmap = (Map)tmpdatas.get(key); + tmpmap = (Map)tmpdatas.get(key); flag = Util.null2String(tmpmap.get("text")); } @@ -1893,38 +1698,38 @@ public class KQReportBiz extends BaseBean { } } } - if (leaveMins > 0) {//请假 - Map jsonObject = null; - if(leaveInfo.length()>0){ - jsonObject = JSON.parseObject(leaveInfo); - for (Entry entry : jsonObject.entrySet()) { - String newLeaveType = entry.getKey(); - String tmpLeaveMins = Util.null2String(entry.getValue()); - if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){ + if (leaveMins > 0) {//请假 + Map jsonObject = null; + if(leaveInfo.length()>0){ + jsonObject = JSON.parseObject(leaveInfo); + for (Entry entry : jsonObject.entrySet()) { + String newLeaveType = entry.getKey(); + String tmpLeaveMins = Util.null2String(entry.getValue()); + if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){ + if (text.length() > 0) text += " "; + //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); + text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage()); + } + } + }else{ + if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) { if (text.length() > 0) text += " "; - //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); - text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage()); + text += SystemEnv.getHtmlLabelName(670, user.getLanguage()); } } - }else{ - if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) { + } + if (evectionMins > 0) {//出差 + if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) { if (text.length() > 0) text += " "; - text += SystemEnv.getHtmlLabelName(670, user.getLanguage()); + text += SystemEnv.getHtmlLabelName(20084, user.getLanguage()); } } - } - if (evectionMins > 0) {//出差 - if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) { - if (text.length() > 0) text += " "; - text += SystemEnv.getHtmlLabelName(20084, user.getLanguage()); - } - } - if (outMins > 0) {//公出 - if(text.indexOf(SystemEnv.getHtmlLabelName(24058, user.getLanguage()))==-1) { - if (text.length() > 0) text += " "; - text += SystemEnv.getHtmlLabelName(24058, user.getLanguage()); + if (outMins > 0) {//公出 + if(text.indexOf(SystemEnv.getHtmlLabelName(24058, user.getLanguage()))==-1) { + if (text.length() > 0) text += " "; + text += SystemEnv.getHtmlLabelName(24058, user.getLanguage()); + } } - } if(text.length()==0) { text = "√"; @@ -1944,10 +1749,10 @@ public class KQReportBiz extends BaseBean { //全部搞一遍 if(tmpdatas != null){ // writeLog(n+">>>tmpdatas="+JSONObject.toJSONString(tmpdatas)); - Map data1 = null; - for(Entry entry : tmpdatas.entrySet()){ + Map data1 = null; + for(Entry entry : tmpdatas.entrySet()){ String mapKey = Util.null2String(entry.getKey()); - Map mapValue = (Map)entry.getValue(); + Map mapValue = (Map)entry.getValue(); String flag = Util.null2String(mapValue.get("text")); if("true".equals(flag)){//需要加工的数据 data1 = new HashMap<>(); @@ -2003,11 +1808,11 @@ public class KQReportBiz extends BaseBean { return serialCount; } - public static String getSignStatus(Map signInfo, User user){ + public static String getSignStatus(Map signInfo, User user){ return getSignStatus(signInfo,user,""); } - public static String getSignStatus(Map signInfo, User user,String onOrOff){ + public static String getSignStatus(Map signInfo, User user, String onOrOff){ KQLeaveRulesComInfo kqLeaveRulesComInfo = new KQLeaveRulesComInfo(); String text = ""; String workdate = Util.null2String(signInfo.get("workdate")); @@ -2027,32 +1832,21 @@ public class KQReportBiz extends BaseBean { int evectionMins = Util.getIntValue(Util.null2String(signInfo.get("evectionMins"))); int outMins = Util.getIntValue(Util.null2String(signInfo.get("outMins"))); - String resourceId = Util.null2String(signInfo.get("resourceId")); - String kqDate = Util.null2String(signInfo.get("kqdate")); - String flowinfo = Util.null2String(signInfo.get("flowinfo")); - KQTimesArrayComInfo kqTimesArrayComInfo = new KQTimesArrayComInfo(); - int split_time_index = 0; - ShiftInfoBean shiftInfoBean = KQDurationCalculatorUtil.getWorkTime(resourceId, kqDate, false); - List halfWorkIndex = shiftInfoBean.getHalfWorkIndex(); - if(halfWorkIndex != null && !halfWorkIndex.isEmpty()) { - int[] halfWorkIndexs = halfWorkIndex.get(0); - split_time_index = halfWorkIndexs[1];//半天的时间 - } if(worktime.length()>0){ if (absenteeismMins > 0) {//旷工 - text = SystemEnv.getHtmlLabelName(20085, user.getLanguage())+absenteeismMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); + text = SystemEnv.getHtmlLabelName(20085, user.getLanguage())+absenteeismMins+ SystemEnv.getHtmlLabelName(15049, user.getLanguage()); }else { if (beLateMins > 0) {//迟到 - text = SystemEnv.getHtmlLabelName(20081, user.getLanguage())+beLateMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); + text = SystemEnv.getHtmlLabelName(20081, user.getLanguage())+beLateMins+ SystemEnv.getHtmlLabelName(15049, user.getLanguage()); } if (graveBeLateMins > 0) {//严重迟到 - text = SystemEnv.getHtmlLabelName( 500546, user.getLanguage())+graveBeLateMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); + text = SystemEnv.getHtmlLabelName( 500546, user.getLanguage())+graveBeLateMins+ SystemEnv.getHtmlLabelName(15049, user.getLanguage()); } if (leaveEarlyMins > 0) {//早退 - text = SystemEnv.getHtmlLabelName(20082, user.getLanguage())+leaveEarlyMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); + text = SystemEnv.getHtmlLabelName(20082, user.getLanguage())+leaveEarlyMins+ SystemEnv.getHtmlLabelName(15049, user.getLanguage()); } if (graveLeaveEarlyMins > 0) {//严重早退 - text = SystemEnv.getHtmlLabelName(500547, user.getLanguage())+graveLeaveEarlyMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); + text = SystemEnv.getHtmlLabelName(500547, user.getLanguage())+graveLeaveEarlyMins+ SystemEnv.getHtmlLabelName(15049, user.getLanguage()); } if (forgotCheckMins > 0) {//漏签 text = SystemEnv.getHtmlLabelName(20086, user.getLanguage()); @@ -2065,73 +1859,23 @@ public class KQReportBiz extends BaseBean { } if (leaveMins > 0) {//请假 - Map jsonObject = null; -// if(leaveInfo.length()>0){ -// jsonObject = JSON.parseObject(leaveInfo); -// for (Map.Entry entry : jsonObject.entrySet()) { -// String newLeaveType = entry.getKey(); -// String tmpLeaveMins = Util.null2String(entry.getValue()); -// if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){ -// if (text.length() > 0) text += " "; -// //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); -// text += Util.formatMultiLang(kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage()); -// } -// } -// }else{ -// if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) { -// if (text.length() > 0) text += " "; -// text += SystemEnv.getHtmlLabelName(670, user.getLanguage()); -// } -// } - - if(flowinfo.length() > 0) { - jsonObject = JSON.parseObject(flowinfo); - String jsonKey = ""; - String jsonValue = ""; - if (jsonObject.containsKey(FlowReportTypeEnum.LEAVE.getFlowType())) { - jsonKey = FlowReportTypeEnum.LEAVE.getFlowType(); - jsonValue = SystemEnv.getHtmlLabelName(670, user.getLanguage()); - } - if (jsonKey.length() > 0) { - JSONArray jsonArray = (JSONArray) jsonObject.get(jsonKey); - String text4temp = ""; - if (jsonArray != null && !jsonArray.isEmpty()) { - //客户不存在多个重复流程的情况,只是显示第一个就行 - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject1 = (JSONObject) jsonArray.get(i); - if (jsonObject1 != null && !jsonObject1.isEmpty()) { - String newLeaveType = Util.null2s(Util.null2String(jsonObject1.get("newLeaveType")), ""); - String begintime = Util.null2s(Util.null2String(jsonObject1.get("begintime")), ""); - String endtime = Util.null2s(Util.null2String(jsonObject1.get("endtime")), ""); - int beginIdx = kqTimesArrayComInfo.getArrayindexByTimes(begintime); - int endIdx = kqTimesArrayComInfo.getArrayindexByTimes(endtime); - if (jsonKey.equalsIgnoreCase(FlowReportTypeEnum.LEAVE.getFlowType())) { - if (newLeaveType.length() > 0) { - jsonValue = kqLeaveRulesComInfo.getLeaveName(newLeaveType); - } - } - if (beginIdx <= split_time_index && endIdx <= split_time_index) { - //上午 - if ("on".equalsIgnoreCase(onOrOff)) { - text4temp = jsonValue; - } - } else if (beginIdx >= split_time_index && endIdx >= split_time_index) { - //下午 - if ("off".equalsIgnoreCase(onOrOff)) { - text4temp = jsonValue; - } - } else { - //全天 - text4temp = jsonValue; - } - } - } - if(text4temp.length()>0){ - if (text.length() > 0) text += " "; - text += text4temp; - } + Map jsonObject = null; + if(leaveInfo.length()>0){ + jsonObject = JSON.parseObject(leaveInfo); + for (Entry entry : jsonObject.entrySet()) { + String newLeaveType = entry.getKey(); + String tmpLeaveMins = Util.null2String(entry.getValue()); + if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){ + if (text.length() > 0) text += " "; + //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage()); + text += Util.formatMultiLang(kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage()); } } + }else{ + if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) { + if (text.length() > 0) text += " "; + text += SystemEnv.getHtmlLabelName(670, user.getLanguage()); + } } } if (evectionMins > 0) {//出差 @@ -2148,14 +1892,14 @@ public class KQReportBiz extends BaseBean { } if(text.equals("")){ boolean needCal = new KQFormatBiz().needCal(workdate,worktime); - text = needCal?SystemEnv.getHtmlLabelName(225, user.getLanguage()):""; + text = needCal? SystemEnv.getHtmlLabelName(225, user.getLanguage()):""; } }else{ if (leaveMins > 0) {//请假 - Map jsonObject = null; + Map jsonObject = null; if(leaveInfo.length()>0){ jsonObject = JSON.parseObject(leaveInfo); - for (Entry entry : jsonObject.entrySet()) { + for (Entry entry : jsonObject.entrySet()) { String newLeaveType = entry.getKey(); String tmpLeaveMins = Util.null2String(entry.getValue()); if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){ @@ -2242,11 +1986,11 @@ public class KQReportBiz extends BaseBean { return text; } - public static boolean getShowFlowText(String leaveInfo,String onOrOff){ - Map jsonObject = null; + public static boolean getShowFlowText(String leaveInfo, String onOrOff){ + Map jsonObject = null; jsonObject = JSON.parseObject(leaveInfo); String flow_signtype = ""; - for (Entry entry : jsonObject.entrySet()) { + for (Entry entry : jsonObject.entrySet()) { String tmpSignType = Util.null2String(entry.getValue()); flow_signtype += ","+tmpSignType; } @@ -2256,7 +2000,7 @@ public class KQReportBiz extends BaseBean { return isShowFlowText(flow_signtype,onOrOff); } - public static boolean isShowFlowText(String flow_signtype,String onOrOff){ + public static boolean isShowFlowText(String flow_signtype, String onOrOff){ boolean showFlowText = true; if(flow_signtype.length() > 0){ @@ -2400,7 +2144,7 @@ public class KQReportBiz extends BaseBean { rs1.executeUpdate(delSql); } - Map result = kqFlowActiontBiz.handleKQFlowAction(proc_set_id, usedetails, Util.getIntValue(requestid), kqtype, Util.getIntValue(workflowid), isForce1,isUpgrade1,map); + Map result = kqFlowActiontBiz.handleKQFlowAction(proc_set_id, usedetails, Util.getIntValue(requestid), kqtype, Util.getIntValue(workflowid), isForce1,isUpgrade1,map); if(!result.isEmpty()){ @@ -2421,7 +2165,7 @@ public class KQReportBiz extends BaseBean { * @param bcfs * @return */ - public double getOverTimeCount(String startdate,String enddate,String userid,String jblx,String bcfs){ + public double getOverTimeCount(String startdate, String enddate, String userid, String jblx, String bcfs){ double result = 0.00; RecordSet rs = new RecordSet(); rs.executeQuery("select sum(gjsc) as count from uf_jbtz where gzrq >= ? and gzrq <= ? and jbr=? and jblx=? and bcfs=?",startdate,enddate,userid,jblx,bcfs); @@ -2440,7 +2184,7 @@ public class KQReportBiz extends BaseBean { * @param bcfs * @return */ - public double getOverTimeDailyCount(String kqdate,String userid,String jblx,String bcfs){ + public double getOverTimeDailyCount(String kqdate, String userid, String jblx, String bcfs){ double result = 0.00; RecordSet rs = new RecordSet(); rs.executeQuery("select sum(gjsc) as count from uf_jbtz where gzrq = ? and jbr=? and jblx=? and bcfs=?",kqdate,userid,jblx,bcfs); @@ -2457,30 +2201,21 @@ public class KQReportBiz extends BaseBean { * @param userid * @return */ - public double getNightSubsidyDaily(String kqdate,String userid){ + public double getNightSubsidyDaily(String kqdate, String userid){ double result = 0.00; RecordSet rs = new RecordSet(); int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid")); int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid")); - int night_rest_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","night_rest_serialid")); rs.executeQuery("select * from kq_format_total where kqdate = ? and resourceid=?",kqdate,userid); rs.writeLog("select * from kq_format_total where kqdate = '"+ kqdate +"' and resourceid="+ userid); while(rs.next()){ int serialid = Util.getIntValue(rs.getString("serialid")); double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00); - attendanceMins = attendanceMins / 60; double overTimeTotal = getOverTimeTotal(kqdate,userid); double time = attendanceMins+overTimeTotal; - //1、 12小时工作制夜班、做六休一夜班有夜班补贴,并且出勤(上班时间+加班时间)>=8小时,统计一次 - if(serialid == sixnight_serialid || serialid == twelvehours_night_serialid){ + if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){ if(time >= 8){ - result ++; - } - } - //2、当一线人员排“夜休”班次,并且加班台账当天导入的加班时长>=8小时,统计一次。 - if(serialid == night_rest_serialid){ - if(overTimeTotal >= 8){ - result ++; + result = 1; } } } @@ -2494,37 +2229,24 @@ public class KQReportBiz extends BaseBean { * @param userid * @return */ - public double getNightSubsidyTotal(String fromDate,String toDate,String userid){ + public double getNightSubsidyTotal(String fromDate, String toDate, String userid){ double result = 0.00; RecordSet rs = new RecordSet(); int sixnight_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","sixnight_serialid")); int twelvehours_night_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","twelvehours_night_serialid")); - int night_rest_serialid = Integer.parseInt(rs.getPropValue("nbjh_ygdjblc","night_rest_serialid")); rs.executeQuery("select * from kq_format_total where kqdate >= ? and kqdate <= ? and resourceid=?",fromDate,toDate,userid); rs.writeLog("select * from kq_format_total where kqdate >= '"+ fromDate +"' and kqdate <= '"+ toDate +"' and resourceid="+ userid); while(rs.next()){ int serialid = Util.getIntValue(rs.getString("serialid")); String kqdate = Util.null2String(rs.getString("kqdate")); double attendanceMins = Util.getDoubleValue(rs.getString("attendanceMins"),0.00); - attendanceMins = attendanceMins / 60; - rs.writeLog("========= getNightSubsidyTotal attendanceMins ========== "+ attendanceMins); double overTimeTotal = getOverTimeTotal(kqdate,userid); - rs.writeLog("========= getNightSubsidyTotal overTimeTotal ========== "+ overTimeTotal); double time = attendanceMins+overTimeTotal; - rs.writeLog("========= getNightSubsidyTotal time ========== "+ time); - if(serialid == sixnight_serialid || serialid == twelvehours_night_serialid){ + if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){ if(time >= 8){ result++; } } - rs.writeLog("========= getNightSubsidyTotal result 111 ========== "+ result); - //2、当一线人员排“夜休”班次,并且加班台账当天导入的加班时长>=8小时,统计一次。 - if(serialid == night_rest_serialid){ - if(overTimeTotal >= 8){ - result ++; - } - } - rs.writeLog("========= getNightSubsidyTotal result 222 ========== "+ result); } return result; } @@ -2535,7 +2257,7 @@ public class KQReportBiz extends BaseBean { * @param userid * @return */ - public double getOverTimeTotal(String kqdate,String userid){ + public double getOverTimeTotal(String kqdate, String userid){ double result = 0.00; RecordSet rs = new RecordSet(); rs.executeQuery("select sum(gjsc)as gjsc from uf_jbtz where gzrq=? and jbr=?",kqdate,userid); @@ -2552,17 +2274,18 @@ public class KQReportBiz extends BaseBean { * @param userid * @return */ - public int getFillCardCount(String fromDate,String toDate,String userid){ + public int getFillCardCount(String fromDate, String toDate, String userid){ int result = 0; RecordSet rs = new RecordSet(); String tablename = rs.getPropValue("nbjh_ygdjblc","fillcard_table"); String tablename_dt = tablename+"_dt1"; - rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c " + - "where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3 " + - "and a.detail_signdate >=? and a.detail_signdate <=? and a.resourceId=?",fromDate,toDate,userid); - while(rs.next()){ - result++; + rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" + + "where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" + + "and a.ksrq >=? and a.jsrq <=? and a.resourceId=?",fromDate,toDate,userid); + if(rs.next()){ + } + result = rs.getCounts(); return result; } @@ -2572,16 +2295,16 @@ public class KQReportBiz extends BaseBean { * @param userid * @return */ - public int getFillCardCountDaily(String kqdate,String userid){ + public int getFillCardCountDaily(String kqdate, String userid){ int result = 0; RecordSet rs = new RecordSet(); String tablename = rs.getPropValue("nbjh_ygdjblc","fillcard_table"); String tablename_dt = tablename+"_dt1"; - rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c " + - "where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3 " + + rs.executeQuery("select b.* from "+ tablename +" a,"+ tablename_dt +" b,workflow_requestbase c" + + "where a.requestid = c.requestid and a.id=b.mainid and c.currentnodetype=3" + "and b.detail_signdate =? and a.resourceId=?",kqdate,userid); - while(rs.next()){ - result ++; + if(rs.next()){ + result = 1; } return result; } diff --git a/src/com/engine/kq/cmd/report/GetKQReportCmd.java b/src/com/engine/kq/cmd/report/GetKQReportCmd.java index 28f18ca..fdd1dc0 100644 --- a/src/com/engine/kq/cmd/report/GetKQReportCmd.java +++ b/src/com/engine/kq/cmd/report/GetKQReportCmd.java @@ -5,15 +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.KQFormatBiz; -import com.engine.kq.biz.KQHolidaySetBiz; -import com.engine.kq.biz.KQLeaveRulesBiz; -import com.engine.kq.biz.KQOvertimeRulesBiz; -import com.engine.kq.biz.KQReportBiz; -import com.engine.kq.biz.KQReportFieldComInfo; -import com.engine.kq.biz.KQSettingsComInfo; -import com.engine.kq.biz.KQShiftManagementComInfo; -import com.engine.kq.biz.KQUnitBiz; +import com.engine.kq.biz.*; import com.engine.kq.util.KQDurationCalculatorUtil; import com.engine.kq.util.PageUidFactory; import org.apache.commons.lang3.StringUtils; @@ -31,11 +23,7 @@ import weaver.hrm.resource.ResourceComInfo; import weaver.systeminfo.SystemEnv; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class GetKQReportCmd extends AbstractCommonCommand> { @@ -198,11 +186,11 @@ public class GetKQReportCmd extends AbstractCommonCommand> { String definedFieldSum = Util.null2String(definedFieldInfo.get("definedFieldSum")); //支援班次统计 String supportSerId = new BaseBean().getPropValue("nbkq_main", "supportSerId"); - String backFields = " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayworkdays," + + String backFields = " (select sum(workdays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayworkdays," + " (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid=" + supportSerId + " )as supportTotal," + - " (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and (DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) AND zma.kqdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND zma.groupid = groupId)) as saturdayattendancedays," + - " (select sum(zma.workdays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayworkdays," + - " (select sum(zma.attendancedays) from kq_format_total zma where zma.resourceid = a.id and zma.kqdate >='" + fromDate + "' and zma.kqdate <='" + toDate + "' and ((DATEPART(dw, zma.kqdate) != 7 and DATEPART(dw, zma.kqdate) != 1) or ((DATEPART(dw, zma.kqdate) = 7 or DATEPART(dw, zma.kqdate) = 1) and zma.kqdate IN (select holidayDate from KQ_HolidaySet where changeType = 3 and zma.groupid = groupId)))) as weekdayattendancedays," + + " (select sum(attendancedays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and (DATEPART(dw, kqdate) = 7 or DATEPART(dw, kqdate) = 1)) as saturdayattendancedays," + + " (select sum(workdays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayworkdays," + + " (select sum(attendancedays) from kq_format_total where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and DATEPART(dw, kqdate) != 7 and DATEPART(dw, kqdate) != 1) as weekdayattendancedays," + "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, " + @@ -341,10 +329,6 @@ public class GetKQReportCmd extends AbstractCommonCommand> { Map flowData = kqReportBiz.getFlowData(params, user); Map saturdayFlowLeaveData = kqReportBiz.getSaturdayFlowLeaveData(params, user); - Map saturdayFlowLeaveBackData = kqReportBiz.getSaturdayFlowLeaveBackData(params, user); - if ((!CollectionUtils.isEmpty(saturdayFlowLeaveBackData)) || saturdayFlowLeaveBackData.size() > 0) { - saturdayFlowLeaveData.putAll(saturdayFlowLeaveBackData); - } rs.execute(sql); rs.writeLog("========== GetKQReportCmd sql ========== " + sql); while (rs.next()) { @@ -516,11 +500,10 @@ public class GetKQReportCmd extends AbstractCommonCommand> { } String sjbjcjRes = "0.0"; String hjsjRes = "0.0"; - for (int ia = 0; allLeaveRules != null && ia < allLeaveRules.size(); ia++) { - leaveRule = (Map) allLeaveRules.get(ia); - int i = Integer.valueOf(leaveRule.get("id").toString()); + for (int i = 0; allLeaveRules != null && i < allLeaveRules.size(); i++) { if (((!CollectionUtils.isEmpty(sjbjcjidList)) && sjbjcjidList.contains(i)) || ((!CollectionUtils.isEmpty(hjsjidList)) && hjsjidList.contains(i))) { + leaveRule = (Map) allLeaveRules.get(i); String flowType = Util.null2String("leaveType_" + leaveRule.get("id")); String leaveData = Util.null2String(saturdayFlowLeaveData.get(id + "|" + flowType)); String flowLeaveBackType = Util.null2String("leavebackType_" + leaveRule.get("id")); diff --git a/src/weaver/general/SendMail.java b/src/weaver/general/SendMail.java index 7e6603c..d106d68 100644 --- a/src/weaver/general/SendMail.java +++ b/src/weaver/general/SendMail.java @@ -28,6 +28,7 @@ import java.util.*; import java.io.*; import java.net.*; +import com.sun.net.ssl.internal.www.protocol.https.BASE64Encoder; import org.apache.oro.text.regex.*; import weaver.system.*; @@ -1478,7 +1479,7 @@ public class SendMail extends MailErrorBean { InputStream is = (InputStream) fileContentList.get(i); String filename = (String) fileNameList.get(i); String ctype = FileTypeMap.getDefaultFileTypeMap().getContentType(filename); - sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder(); + BASE64Encoder enc = new BASE64Encoder(); filename = "=?UTF-8?B?" + enc.encode(filename.getBytes("UTF-8")) + "?="; filename = filename.replace("\n", ""); // 当文件名过长时 StringBuffer sb = new StringBuffer(filename.length()); // 需要