考勤报表关于哺乳假逻辑修改 20240411-wcf

nb0402
fage 1 year ago
parent eb89823db7
commit 26948accc3

@ -1,4 +1,4 @@
#宁波精华考勤需
#
#管理人员指定人员考勤组id
glrygroupid=6
#管理人员考勤组id
@ -8,7 +8,7 @@ sjbjcjid=6,7,8
#婚假丧假id
hjsjid=10,11
#预入职流程id
yrzWfid=518
yrzWfid=533
#固定流程创建人id
lccjr=43
#目录id
@ -22,9 +22,11 @@ searIdYb=2
#管理人员12小时班制夜班最大加班时长
ybMaxMins=240
#加班申请流程表名
lctableName=formtable_main_374
#两小时起步加班休班次id
lctableName=formtable_main_436
#休班次两小时起步
twoStartSerId=12
#支援班次id 11 支援休班次id 21 支援夜班次id 22
supportSerId=11,21,22

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.engine.kq.cmd.attendanceButton.ButtonStatusEnum;
import com.engine.kq.enums.KqSplitFlowTypeEnum;
import com.engine.kq.log.KQLog;
import com.engine.kq.nbjh.KqUtil;
import com.engine.kq.util.KQDurationCalculatorUtil;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
@ -84,10 +85,10 @@ public class KQReportBiz extends BaseBean {
List<Object> datas = null;
Map<String, Object> 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 ";
@ -1176,8 +1177,8 @@ public class KQReportBiz extends BaseBean {
}
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 ";
" 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");
@ -1277,8 +1278,8 @@ public class KQReportBiz extends BaseBean {
}
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 ";
" 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");
@ -1369,8 +1370,8 @@ public class KQReportBiz extends BaseBean {
}
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 ";
" 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");
@ -1464,9 +1465,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()) {
@ -1675,9 +1676,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");
@ -1822,13 +1823,15 @@ public class KQReportBiz extends BaseBean {
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");
String userid = rs.getString("resourceid");
String kqdate = rs.getString("kqdate");
String key = userid + "|" + kqdate;
int workMins = rs.getInt("workMins");
int beLateMins = rs.getInt("beLateMins");
int leaveEarlyMins = rs.getInt("leaveEarlyMins");
@ -1856,6 +1859,9 @@ public class KQReportBiz extends BaseBean {
flag = Util.null2String(tmpmap.get("text"));
}
// 判断 指定日期 是否在 哺乳假流程 日期范围内
boolean bool = KqUtil.checkIsBetweenRange(userid,kqdate);
if (workMins<=0) {
if(text.length()>0) text +=" ";
text += SystemEnv.getHtmlLabelName(26593, user.getLanguage());
@ -1890,38 +1896,47 @@ public class KQReportBiz extends BaseBean {
}
}
}
if (leaveMins > 0) {//请假
Map<String, Object> jsonObject = null;
if(leaveInfo.length()>0){
jsonObject = JSON.parseObject(leaveInfo);
for (Entry<String, Object> 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 (leaveMins > 0) {//请假
Map<String, Object> jsonObject = null;
if(leaveInfo.length()>0){
jsonObject = JSON.parseObject(leaveInfo);
for (Entry<String, Object> 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 += SystemEnv.getHtmlLabelName(670, user.getLanguage());
//text += kqLeaveRulesComInfo.getLeaveName(newLeaveType)+tmpLeaveMins+SystemEnv.getHtmlLabelName(15049, user.getLanguage());
text += Util.formatMultiLang( kqLeaveRulesComInfo.getLeaveName(newLeaveType),""+user.getLanguage());
}
}
}
if (evectionMins > 0) {//出差
if(text.indexOf(SystemEnv.getHtmlLabelName(20084, user.getLanguage()))==-1) {
}else{
if(text.indexOf(SystemEnv.getHtmlLabelName(670, user.getLanguage()))==-1) {
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 (text.length() > 0) text += " ";
text += SystemEnv.getHtmlLabelName(24058, 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(bool){
if (text.length() > 0) text += " ";
//不包含 休息
if(!text.contains(SystemEnv.getHtmlLabelName(26593, user.getLanguage()))) {
text += SystemEnv.getHtmlLabelName(24062, user.getLanguage());
}
}
if(text.length()==0) {
text = "√";
@ -2398,16 +2413,25 @@ public class KQReportBiz extends BaseBean {
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;
if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){
//1、 12小时工作制夜班、做六休一夜班有夜班补贴并且出勤上班时间+加班时间)>=8小时统计一次
if(serialid == sixnight_serialid || serialid == twelvehours_night_serialid){
if(time >= 8){
result = 1;
result ++;
}
}
//2、当一线人员排“夜休”班次并且加班台账当天导入的加班时长>=8小时统计一次。
if(serialid == night_rest_serialid){
if(overTimeTotal >= 8){
result ++;
}
}
}
@ -2426,19 +2450,32 @@ public class KQReportBiz extends BaseBean {
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;
if(serialid == sixnight_serialid|| serialid == twelvehours_night_serialid){
rs.writeLog("========= getNightSubsidyTotal time ========== "+ time);
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;
}
@ -2471,13 +2508,12 @@ public class KQReportBiz extends BaseBean {
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.ksrq >=? and a.jsrq <=? and a.resourceId=?",fromDate,toDate,userid);
if(rs.next()){
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 b.detail_signdate <=? and a.resourceId=?",fromDate,toDate,userid);
while(rs.next()){
result++;
}
result = rs.getCounts();
return result;
}
@ -2495,8 +2531,8 @@ public class KQReportBiz extends BaseBean {
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);
if(rs.next()){
result = 1;
while(rs.next()){
result ++;
}
return result;
}

@ -210,7 +210,7 @@ public class ExportExcelCmd extends AbstractCommonCommand<Map<String, Object>> {
//支援班次统计
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," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid=" + supportSerId + " )as supportTotal," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid in (" + 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," +

@ -188,7 +188,7 @@ public class GetKQReportCmd extends AbstractCommonCommand<Map<String, Object>> {
//支援班次统计
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," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid=" + supportSerId + " )as supportTotal," +
" (select count(0) from kq_shiftschedule where resourceid = a.id and kqdate >='" + fromDate + "' and kqdate <='" + toDate + "' and serialid in (" + 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," +

@ -1,8 +1,14 @@
package com.engine.kq.nbjh;
import com.engine.kq.biz.KQWorkTime;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/**
* @Title
* @Author wangchaofa
@ -11,25 +17,158 @@ import weaver.general.Util;
* @Description
*/
public class KqUtil {
/**
*
* @param userid
* @param date
* @return
*/
public static boolean checkIsBetweenRange(String userid,String date){
boolean bool = false;
RecordSet rs = new RecordSet();
String breastfeedLeave_table = rs.getPropValue("nbjh_ygdjblc","breastfeedLeave_table");
rs.executeQuery(" select a.mtgjxs as result,a.ksrq,a.jsrq from "+ breastfeedLeave_table +" a,workflow_requestbase b " +
" where a.requestid=b.requestid and b.currentnodetype=3 " +
" and a.ksrq <= ? and a.jsrq >= ? and a.xm = ?",date,date,userid);
if(rs.next()){
bool = true;
}
return bool;
}
/**
*
* @param fromDate
* @param toDate
* @param userid
* @return
* 2024-03-01 2024-03-31
* 2024-03-12 2024-11-21
* 2024-02-10 2024-04-10
* 2024-02-10 2024-02-20
*/
public static double getBreastfeedLeave(String fromDate,String toDate,String userid){
double result = 0.00;
int ycqdays = 0;
double day = 0.00;
RecordSet rs = new RecordSet();
String lc_fromDate = "";
String lc_toDate = "";
rs.writeLog("============== fromDate =================== "+ fromDate);
rs.writeLog("============== toDate =================== "+ toDate);
String currentdate = TimeUtil.getCurrentDateString();
String breastfeedLeave_table = rs.getPropValue("nbjh_ygdjblc","breastfeedLeave_table");
rs.executeQuery(" select sum(a.mtgjxs) as result from "+ breastfeedLeave_table +" a,workflow_requestbase b " +
rs.executeQuery(" select a.mtgjxs as result,a.ksrq,a.jsrq from "+ breastfeedLeave_table +" a,workflow_requestbase b " +
" where a.requestid=b.requestid and b.currentnodetype=3 " +
" and a.ksrq >= ? and a.jsrq <= ? and a.xm = ?",fromDate,toDate,userid);
while(rs.next()){
result = Util.getDoubleValue(rs.getString("result"),0.00);
" and a.xm = ?",userid);
if(rs.next()){
lc_fromDate = Util.null2String(rs.getString("ksrq"));
lc_toDate = Util.null2String(rs.getString("jsrq"));
day = Util.getDoubleValue(rs.getString("result"),0.00);
// 流程里的开始日期 2024-03-12 >= 查询的开始日期 2024-03-01
if(compareDate(lc_fromDate,fromDate)){
//流程里的开始日期 2024-03-12 <= 查询的结束日期 2024-03-031
if(compareDate(toDate,lc_fromDate)){
//流程里的结束日期 2024-03-20 <= 查询的结束日期 2024-03-31 。 此时 应该 计算 流程里的开始日期 到 流程里的结束日期,这个范围内的 应出勤天数
if(compareDate(toDate,lc_toDate)){
ycqdays = getWorkdays(lc_fromDate,lc_toDate,userid);
}
//流程里的结束日期 2024-04-10 > 查询的结束日期 2024-03-31 。此时 应该 计算 流程里的开始日期 到 查询的结束日期,这个范围内的 应出勤天数
else{
ycqdays = getWorkdays(lc_fromDate,toDate,userid);
}
}
//流程里的开始日期 2024-04-10 > 查询的结束日期 2024-03-31
else{
ycqdays = 0;
}
}
//流程里的开始日期 2024-02-10 < 查询的开始日期 2024-03-01
else{
//流程里的结束日期 2024-03-10 >= 查询的开始日期 2024-03-01
if(compareDate(lc_toDate,fromDate)){
//流程里的结束日期 2024-03-10 <= 查询的结束日期 2024-03-31 。此时 应该 计算 查询的开始日期 到 流程里的结束日期,这个范围内的 应出勤天数
if(compareDate(toDate,lc_toDate)){
//流程里的结束日期 >= 当前日期
if(compareDate(lc_toDate,currentdate)){
ycqdays = getWorkdays(fromDate,currentdate,userid);
}else{
ycqdays = getWorkdays(fromDate,lc_toDate,userid);
}
}
// 流程里的结束日期 2024-04-10 > 查询的结束日期 2024-03-31 。此时 应该 计算 查询的开始日期 到 查询的结束日期,这个范围内的 应出勤天数
else{
//流程里的结束日期 >= 当前日期
if(compareDate(toDate,currentdate)){
ycqdays = getWorkdays(fromDate,currentdate,userid);
}else{
ycqdays = getWorkdays(fromDate,toDate,userid);
}
}
}
//查询的开始日期 2024-03-01 > 流程里的结束日期 2024-02-20
else{
ycqdays = 0;
}
}
}
rs.writeLog("=============== ycqdays ================= "+ ycqdays);
rs.writeLog("=============== day ================= "+ day);
result = ycqdays * day;
return result;
}
/**
*
* @param fromDate
* @param toDate
* @param resourceId id
* @return
*/
public static int getWorkdays(String fromDate, String toDate, String resourceId) {
int workDays = 0;
/**统计应出勤天数*/
KQWorkTime kqWorkTime = new KQWorkTime();
boolean isEnd = false;
for (String date = fromDate; !isEnd; ) {
if (date.compareTo(toDate)>=0) {
isEnd = true;
}
boolean isWorkDay = kqWorkTime.isWorkDay(resourceId, date);
if (isWorkDay) {
workDays += 1;
}
date = DateUtil.getDate(date, 1);
}
return workDays;
}
/**
*
* @param a
* @param b
* @return
* @throws ParseException
*/
public static boolean compareDate(String a, String b){
boolean bool = false;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
long t1 = sdf.parse(a).getTime();
long t2 = sdf.parse(b).getTime();
if (t1 >= t2) {
bool = true;
}
return bool;
}catch (Exception e){
e.printStackTrace();
}
return bool;
}
}

Loading…
Cancel
Save