周六假期字段统计优化

dev_zm
zhangming 1 year ago
parent d1ab0c1a33
commit f1134534dc

@ -87,10 +87,10 @@ public class KQReportBiz extends BaseBean {
List<Object> datas = null; List<Object> datas = null;
Map<String,Object> data = null; Map<String,Object> data = null;
sql = " select kqdate,serialid, workbegindate, workbegintime,workenddate, workendtime," + sql = " select kqdate,serialid, workbegindate, workbegintime,workenddate, workendtime," +
" signintime,signouttime,beLateMins,graveBeLateMins,leaveEarlyMins,graveLeaveEarlyMins," + " signintime,signouttime,beLateMins,graveBeLateMins,leaveEarlyMins,graveLeaveEarlyMins," +
" absenteeismMins, forgotCheckMins,forgotBeginWorkCheckMins,otherinfo "+ " absenteeismMins, forgotCheckMins,forgotBeginWorkCheckMins,otherinfo "+
" from kq_format_detail " + " from kq_format_detail " +
" where resourceid=? and kqdate>=? and kqdate<=? "; " where resourceid=? and kqdate>=? and kqdate<=? ";
if(!isAll){ if(!isAll){
if(rs.getDBType().equalsIgnoreCase("oracle") || Util.null2String(rs.getOrgindbtype()).equals("dm") || Util.null2String(rs.getOrgindbtype()).equals("st")) { 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 "; sql += " and beLateMins+graveBeLateMins+leaveEarlyMins+graveLeaveEarlyMins+absenteeismMins+forgotCheckMins+nvl(forgotBeginWorkCheckMins,0)>0 ";
@ -381,7 +381,9 @@ public class KQReportBiz extends BaseBean {
} }
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+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = groupId) " +sqlWhere + " 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 "; " group by resourceid, newleavetype, durationrule ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
@ -473,7 +475,10 @@ public class KQReportBiz extends BaseBean {
} }
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+"' and (DATEPART(dw, belongdate) = 7 or DATEPART(dw, belongdate) = 1) and belongdate NOT IN (select holidayDate from KQ_HolidaySet where changeType = 3 AND groupid = groupId) " +sqlWhere + " 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 "; " group by resourceid, newleavetype, durationrule ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
@ -567,7 +572,9 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ 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 = groupId) " +sqlWhere + " 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 "; " group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
@ -659,7 +666,9 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ 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 = groupId) " +sqlWhere + " 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 "; " group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
@ -1170,8 +1179,8 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, durationrule, changetype,sum(duration) as val from hrmresource a, "+KqSplitFlowTypeEnum.PROCESSCHANGE.getTablename()+" b "+ 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+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' "+sqlWhere+
" group by resourceid, durationrule,changetype "; " group by resourceid, durationrule,changetype ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
String resourceid = rs.getString("resourceid"); String resourceid = rs.getString("resourceid");
@ -1271,8 +1280,8 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVE.getTablename()+" b "+ 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 + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere +
" group by resourceid, newleavetype, durationrule,belongdate "; " group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
String resourceid = rs.getString("resourceid"); String resourceid = rs.getString("resourceid");
@ -1363,8 +1372,8 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid, newleavetype, durationrule, sum(duration) as val,belongdate from hrmresource a, "+KqSplitFlowTypeEnum.LEAVEBACK.getTablename()+" b "+ 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 + " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere +
" group by resourceid, newleavetype, durationrule,belongdate "; " group by resourceid, newleavetype, durationrule,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
String resourceid = rs.getString("resourceid"); String resourceid = rs.getString("resourceid");
@ -1458,9 +1467,9 @@ public class KQReportBiz extends BaseBean {
String valueField = ""; String valueField = "";
sql = " select resourceid,changeType, sum(cast(duration_min as decimal(18,4))) as val,paidLeaveEnable "+ sql = " select resourceid,changeType, sum(cast(duration_min as decimal(18,4))) as val,paidLeaveEnable "+
" from hrmresource a, kq_flow_overtime b "+ " from hrmresource a, kq_flow_overtime b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+
" group by resourceid,changeType,paidLeaveEnable "; " group by resourceid,changeType,paidLeaveEnable ";
rs.execute(sql); rs.execute(sql);
kqLog.info("getFlowOverTimeDataNew:sql:"+sql); kqLog.info("getFlowOverTimeDataNew:sql:"+sql);
while (rs.next()) { while (rs.next()) {
@ -1669,9 +1678,9 @@ public class KQReportBiz extends BaseBean {
} }
sql = " select resourceid,changeType,belongdate,paidLeaveEnable, sum(cast(duration_min as decimal(18,4))) as val "+ sql = " select resourceid,changeType,belongdate,paidLeaveEnable, sum(cast(duration_min as decimal(18,4))) as val "+
" from hrmresource a, kq_flow_overtime b "+ " from hrmresource a, kq_flow_overtime b "+
" where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+ " where a.id = b.resourceid and belongdate >='"+fromDate+"' and belongdate <='"+toDate+"' " +sqlWhere+
" group by resourceid,changeType,paidLeaveEnable,belongdate "; " group by resourceid,changeType,paidLeaveEnable,belongdate ";
rs.execute(sql); rs.execute(sql);
while (rs.next()) { while (rs.next()) {
String resourceid = rs.getString("resourceid"); String resourceid = rs.getString("resourceid");
@ -1816,10 +1825,10 @@ public class KQReportBiz extends BaseBean {
String sql = ""; String sql = "";
try { try {
sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+ sql = " select resourceid, kqdate, workMins, belatemins, graveBeLateMins, leaveearlymins, graveLeaveEarlyMins, absenteeismmins, forgotcheckMins, forgotBeginWorkCheckMins, "+
" leaveMins,leaveInfo,evectionMins,outMins " + " leaveMins,leaveInfo,evectionMins,outMins " +
" from kq_format_detail " + " from kq_format_detail " +
" where resourceid = ? and kqdate>=? and kqdate<=? "+ " where resourceid = ? and kqdate>=? and kqdate<=? "+
" order by resourceid, kqdate, serialnumber "; " order by resourceid, kqdate, serialnumber ";
rs.executeQuery(sql,resourceId, fromDate,toDate); rs.executeQuery(sql,resourceId, fromDate,toDate);
while (rs.next()) { while (rs.next()) {
String key = rs.getString("resourceid") + "|" + rs.getString("kqdate"); String key = rs.getString("resourceid") + "|" + rs.getString("kqdate");
@ -1884,38 +1893,38 @@ public class KQReportBiz extends BaseBean {
} }
} }
} }
if (leaveMins > 0) {//请假 if (leaveMins > 0) {//请假
Map<String,Object> jsonObject = null; Map<String,Object> jsonObject = null;
if(leaveInfo.length()>0){ if(leaveInfo.length()>0){
jsonObject = JSON.parseObject(leaveInfo); jsonObject = JSON.parseObject(leaveInfo);
for (Entry<String,Object> entry : jsonObject.entrySet()) { for (Entry<String,Object> entry : jsonObject.entrySet()) {
String newLeaveType = entry.getKey(); String newLeaveType = entry.getKey();
String tmpLeaveMins = Util.null2String(entry.getValue()); String tmpLeaveMins = Util.null2String(entry.getValue());
if(text.indexOf(kqLeaveRulesComInfo.getLeaveName(newLeaveType))==-1){ 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 += " "; if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(670, user.getLanguage()); //text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage());
text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
} }
} }
} }else{
if (evectionMins > 0) {//出差 if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
if (text.length() > 0) text += " "; if (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(20084, user.getLanguage()); text += SystemEnv.getHtmlLabelName(670, user.getLanguage());
} }
} }
if (outMins > 0) {//公出 }
if(text.indexOf(SystemEnv.getHtmlLabelName(24058, user.getLanguage()))==-1) { if (evectionMins > 0) {//出差
if (text.length() > 0) text += " "; if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
text += SystemEnv.getHtmlLabelName(24058, user.getLanguage()); 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(text.length()==0) { if(text.length()==0) {
text = "√"; text = "√";
@ -2563,5 +2572,4 @@ public class KQReportBiz extends BaseBean {
} }
return result; return result;
} }
} }

Loading…
Cancel
Save