From 952f285f3890c1a4a53d3eeed39620b70ea76fe5 Mon Sep 17 00:00:00 2001
From: shilei <798989044@qq.com>
Date: Mon, 1 Sep 2025 21:00:02 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B5=99=E6=96=87=E4=BB=A3=E7=A0=81=E5=A4=87?=
=?UTF-8?q?=E4=BB=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
浙文眼镜/interface/zw/do.jsp | 1471 +++++++++++++++++
.../zw/workflow/htpblc/getSchedulingDateType.jsp | 284 ++++
.../workflow/htpblc/querySchedulingUserData.jsp | 221 +++
.../zw/workflow/htpblc/queryUserTransferData.jsp | 114 ++
.../zw/workflow/httblc/getSchedulingDateType.jsp | 282 ++++
.../workflow/httblc/querySchedulingUserData.jsp | 221 +++
.../zw/workflow/httblc/queryUserSerialByMonth.jsp | 840 ++++++++++
.../httblc/queryUserSerialByMonth_test.jsp | 848 ++++++++++
.../zw/workflow/mdtblc/countUserWorkTime.jsp | 264 +++
.../zw/workflow/mdtblc/getSchedulingDateType.jsp | 285 ++++
.../workflow/mdtblc/querySchedulingUserData.jsp | 221 +++
.../zw/workflow/mdtblc/queryUserSerialByMonth.jsp | 842 ++++++++++
.../mdtblc/queryUserSerialByMonth_test.jsp | 851 ++++++++++
.../zw/workflow/mdtblc/queryUserTransferData.jsp | 83 +
.../mdtblc/queryUserTransferData_test.jsp | 87 +
.../zw/workflow/mdtblc/queryUserWorkdayData.jsp | 440 +++++
.../zw/workflow/pblc/countUserWorkTime.jsp | 263 +++
.../zw/workflow/pblc/getSchedulingDateType.jsp | 306 ++++
.../workflow/pblc/queryMainSchedulingUserData.jsp | 54 +
.../zw/workflow/pblc/querySchedulingUserData.jsp | 222 +++
.../zw/workflow/pblc/querySchedulingUserData2.jsp | 225 +++
.../zw/workflow/pblc/queryUserTransferData.jsp | 83 +
.../zw/workflow/pblc/queryUserTransferData2.jsp | 87 +
.../workflow/pblc/queryUserTransferData_test.jsp | 87 +
.../zw/workflow/pblc/queryUserWorkdayData.jsp | 381 +++++
.../zw/workflow/pblc/queryUserWorkdayData2.jsp | 385 +++++
.../zw/workflow/pblc/queryUserWorkdayData3.jsp | 450 +++++
.../workflow/pblc/queryUserWorkdayData3_test.jsp | 450 +++++
.../workflow/pblc/queryUserWorkdayData3_test2.jsp | 248 +++
.../workflow/pblc/queryUserWorkdayData3_test3.jsp | 470 ++++++
.../zw/workflow/pblc/queryUserWorkdayData4.jsp | 514 ++++++
.../pblc/queryUserWorkdayDataByMonth2.jsp | 857 ++++++++++
.../pblc/queryUserWorkdayDataByMonth2bak.jsp | 849 ++++++++++
.../pblc/queryUserWorkdayDataByMonth3.jsp | 599 +++++++
.../interface/zw/workflow/pblc/testrs.jsp | 309 ++++
.../interface/zw/workflow/pblc/testrs3.jsp | 69 +
.../zw/workflow/tblc/queryUserSerialByMonth.jsp | 840 ++++++++++
.../workflow/tblc/queryUserWorkdayDataByMonth.jsp | 916 ++++++++++
.../tblc/queryUserWorkdayDataByMonth_test.jsp | 939 +++++++++++
.../zw/cron/EmployeeDataSnapshotCron.java | 21 +
.../zw/cron/EmployeeDataSnapshotDayCron.java | 22 +
.../zw/cron/EmployeeDataSnapshotMonthCron.java | 22 +
.../interfaces/zw/cron/EmployeeTransferCron.java | 62 +
.../weaver/interfaces/zw/utils/CommonUtil.java | 136 ++
.../action/Htpblc2SchedulingEditAction.java | 373 +++++
.../action/Htpblc2SchedulingEditActionbak.java | 496 ++++++
.../action/Httblc2SchedulingEditAction.java | 331 ++++
.../action/Mdpblc2SchedulingEditAction.java | 351 ++++
.../action/Mdtblc2SchedulingEditAction.java | 331 ++++
.../action/SchedulingDataCheckAction.java | 261 +++
.../action/WorkflowToSchedulingAction.java | 317 ++++
.../action/WorkflowToSchedulingAddAction.java | 318 ++++
.../action/WorkflowToSchedulingEditAction.java | 334 ++++
.../action/WorkflowToSchedulingUpdateAction.java | 350 ++++
.../xygrzlc/NewEmployee2HrmResoyeceAction.java | 350 ++++
55 files changed, 21032 insertions(+)
create mode 100644 浙文眼镜/interface/zw/do.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/htpblc/getSchedulingDateType.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/htpblc/querySchedulingUserData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/htpblc/queryUserTransferData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/httblc/getSchedulingDateType.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/httblc/querySchedulingUserData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/httblc/queryUserSerialByMonth.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/httblc/queryUserSerialByMonth_test.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/mdtblc/countUserWorkTime.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/mdtblc/getSchedulingDateType.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/mdtblc/querySchedulingUserData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/mdtblc/queryUserSerialByMonth.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/mdtblc/queryUserSerialByMonth_test.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/mdtblc/queryUserTransferData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/mdtblc/queryUserTransferData_test.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/mdtblc/queryUserWorkdayData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/countUserWorkTime.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/getSchedulingDateType.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryMainSchedulingUserData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/querySchedulingUserData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/querySchedulingUserData2.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserTransferData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserTransferData2.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserTransferData_test.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayData.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayData2.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayData3.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayData3_test.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayData3_test2.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayData3_test3.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayData4.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayDataByMonth2.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayDataByMonth2bak.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/queryUserWorkdayDataByMonth3.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/testrs.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/pblc/testrs3.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/tblc/queryUserSerialByMonth.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/tblc/queryUserWorkdayDataByMonth.jsp
create mode 100644 浙文眼镜/interface/zw/workflow/tblc/queryUserWorkdayDataByMonth_test.jsp
create mode 100644 浙文眼镜/src/weaver/interfaces/zw/cron/EmployeeDataSnapshotCron.java
create mode 100644 浙文眼镜/src/weaver/interfaces/zw/cron/EmployeeDataSnapshotDayCron.java
create mode 100644 浙文眼镜/src/weaver/interfaces/zw/cron/EmployeeDataSnapshotMonthCron.java
create mode 100644 浙文眼镜/src/weaver/interfaces/zw/cron/EmployeeTransferCron.java
create mode 100644 浙文眼镜/src/weaver/interfaces/zw/utils/CommonUtil.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/Htpblc2SchedulingEditAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/Htpblc2SchedulingEditActionbak.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/Httblc2SchedulingEditAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/Mdpblc2SchedulingEditAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/Mdtblc2SchedulingEditAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/SchedulingDataCheckAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/WorkflowToSchedulingAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/WorkflowToSchedulingAddAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/WorkflowToSchedulingEditAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/action/WorkflowToSchedulingUpdateAction.java
create mode 100755 浙文眼镜/src/weaver/interfaces/zw/workflow/xygrzlc/NewEmployee2HrmResoyeceAction.java
diff --git a/浙文眼镜/interface/zw/do.jsp b/浙文眼镜/interface/zw/do.jsp
new file mode 100644
index 0000000..75bbba6
--- /dev/null
+++ b/浙文眼镜/interface/zw/do.jsp
@@ -0,0 +1,1471 @@
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<%@page import="weaver.general.Util"%>
+<%@ page import="java.math.BigDecimal" %>
+<%@ page import="weaver.conn.RecordSet" %>
+<%@ page import="com.engine.kq.util.KQDurationCalculatorUtil" %>
+<%@ page import="weaver.hrm.User" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="java.text.ParseException" %>
+<%@ page import="org.apache.commons.lang3.StringUtils" %>
+<%@ page import="java.util.*" %>
+<%@ page import="java.time.LocalDate" %>
+<%@ page import="java.time.format.DateTimeFormatter" %>
+<%@ page import="com.engine.kq.biz.KQWorkTime" %>
+<%@ page import="com.engine.kq.entity.WorkTimeEntity" %>
+<%@ page import="com.engine.kq.biz.KQGroupMemberComInfo" %>
+<%@ page import="com.engine.kq.entity.KQGroupEntity" %>
+
+
+
+
+<%
+ int sum = 0;
+ String userid = Util.null2String(request.getParameter("userid"));
+ String fromdate = Util.null2String(request.getParameter("fromdate"));
+ String todate = Util.null2String(request.getParameter("todate"));
+
+ User user = new User(Integer.parseInt(userid));
+
+ String username = user.getLastname();
+
+ rs.executeQuery("select groupid,sum(workdays)as workdays from kq_format_total " +
+ " where resourceid = ? and kqdate >= ? and kqdate <= ? group by groupid",userid,fromdate,todate);
+ rs.next();
+ String workdays = Util.null2o(rs.getString("workdays"));
+
+ //请假时长
+ String leaveHours = getLeaveHours(fromdate,todate,userid);
+
+ // 应出勤(排班)小时数
+ String workhours = getWorkHours(fromdate,todate,userid);
+
+ //月标准工时
+ String standardWorkingHours = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getStandardWorkingHours(fromdate, todate, userid)));
+
+ //应计薪小时数
+ String accruedPayHours = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getAccruedPayHours(fromdate, todate, userid)));
+
+ //国假排班小时(3倍)
+ String nationalHoliday3Hours = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getNationalHoliday3Hours(fromdate, todate, userid)));
+
+ //国假排班小时(2倍)
+ String nationalHoliday2Hours = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getNationalHoliday2Hours(fromdate, todate, userid)));
+
+ //国假在职小时数
+ String nationalWorkingHours = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getNationalWorkingHours(fromdate, todate, userid)));
+
+ //补签卡次数
+ String replaceCardNum = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getReplaceCardNum(fromdate, todate, userid)));
+
+ //迟到/早退(10分钟以内)/次
+ String beLateLeaveEearly10 = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getBeLateLeaveEearly10(fromdate, todate, userid)));
+
+ //迟到/早退(10(含)-30分钟以内)/次
+ String beLateLeaveEearly10To30 = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getBeLateLeaveEearly10To30(fromdate, todate, userid)));
+
+ //迟到/早退(30(含)-60分钟以内)/次
+ String beLateLeaveEearly30To60 = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getBeLateLeaveEearly30To60(fromdate, todate, userid)));
+
+ //迟到/早退(60分钟以上)/次
+ String beLateLeaveEearly60More = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getBeLateLeaveEearly60More(fromdate,todate,userid)));
+
+ //旷工合计小时
+ String absenteeismTotalHours = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getAbsenteeismTotalHours(fromdate,todate,userid)));
+
+ //实际出勤小时数
+ String actualAttendanceHours = KQDurationCalculatorUtil.getDurationRound(String.valueOf(getActualAttendanceHours(fromdate, todate, userid)));
+
+ // 7:病假 6:事假
+ String bjtypeid = "7";
+ // 7:病假 6:事假
+ String sjtypeid = "6";
+ // 病假、事假 小时数
+ String bjleavehours = getLeaveTypeHours(bjtypeid,fromdate,todate,userid);
+
+ // 病假、事假 小时数
+ String sjleavehours = getLeaveTypeHours(sjtypeid,fromdate,todate,userid);
+
+ // 旷工小时数
+ String absencehours = "0";
+ // 漏签当天的排班时长之和
+ String forgotserialhours = "0";
+ rs1.executeQuery("select forgotcheck,forgotBeginWorkCheck,kqdate,absenteeismmins from kq_format_total where resourceid=? and kqdate >= ? and kqdate <= ? ",userid,fromdate,todate);
+ while(rs1.next()){
+ String kqdate = Util.null2String(rs1.getString("kqdate"));
+ int forgotcheck1 = Util.getIntValue(rs1.getString("forgotcheck"));
+ int forgotBeginWorkCheck = Util.getIntValue(rs1.getString("forgotBeginWorkCheck"));
+ int forgotcheck = forgotcheck1 + forgotBeginWorkCheck;
+ // 旷工小时数
+ String count1 = Util.null2o(rs1.getString("absenteeismmins"));
+ count1 = floatDivide(count1,"60");
+ absencehours = floatAdd(absencehours,count1);
+
+ // 当天有漏签
+ if(forgotcheck > 0){
+ // 漏签当天的排班时长之和
+ String workhour = getWorkHours(kqdate,kqdate,userid);
+ workhour = floatMultiply(workhour,String.valueOf(forgotcheck));
+ forgotserialhours = floatAdd(forgotserialhours,workhour);
+ }
+ }
+
+ // 迟到分钟数
+ double latemins = getLateMins(fromdate,userid);
+
+ // 早退分钟数
+ double leaveearlymins = getLeaveEarlyMins(fromdate,userid);
+
+ KQWorkTime kqWorkTime = new KQWorkTime();
+ WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(userid, fromdate);
+ String searIdFrom = workTimeEntity.getSerialId();
+ //第一个班段上班卡的 时间
+ String oneStart = getBcTimes(searIdFrom,"start","0");
+ oneStart += ":00";
+
+ //第一个班段下班卡的 时间
+ String oneEnd = getBcTimes(searIdFrom,"end","0");
+ oneEnd += ":00";
+
+ sum++;
+
+%>
+
+<%!
+ /**
+ * 获取 月标准工时 = 日历表上应出勤天数 * 8
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getStandardWorkingHours(String fromDate, String toDate, String userid){
+ RecordSet rs = new RecordSet();
+ double result = 0.00;
+ int days = 0;
+ // 格式化日期
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+ rs.executeQuery("select distinct groupid from kq_format_total " +
+ " where resourceid = ? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+ rs.next();
+// String groupid = Util.null2String(rs.getString("groupid"));
+
+ // 后台职能 考勤组id
+ String groupid = "5";
+
+ String[] dateStartArr = parseDate(fromDate);
+ String[] dateEndtArr = parseDate(toDate);
+ LocalDate startDate = LocalDate.of(Integer.parseInt(dateStartArr[0]), Integer.parseInt(dateStartArr[1]), Integer.parseInt(dateStartArr[2]));
+ LocalDate endDate = LocalDate.of(Integer.parseInt(dateEndtArr[0]), Integer.parseInt(dateEndtArr[1]), Integer.parseInt(dateEndtArr[2]));
+ // 遍历日期范围
+ for (LocalDate date = startDate; !date.isAfter(endDate); date = date.plusDays(1)) {
+ // 输出格式化后的日期字符串
+ String dateString = date.format(formatter);
+ // 是 周六或 周日
+ if(isSaturdayOrSunday(dateString)) {
+ if(checkIsWorkday(groupid,dateString)){
+ days++;
+ }
+ }else{
+ if(!checkIsRestOrHoliday(groupid,dateString)){
+ days++;
+ }
+ }
+ }
+ result = Double.valueOf(floatMultiply(String.valueOf(days),"8"));
+ return result;
+ }
+
+ /**
+ * 获取 应计薪小时数 日历表上应出勤天数 * 8 + 法定(公众假日)天数 * 8
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static String getAccruedPayHours(String fromDate, String toDate, String userid){
+ String result = "0";
+ RecordSet rs = new RecordSet();
+ //
+ String attenddays = String.valueOf(getStandardWorkingHours(fromDate,toDate,userid));
+ //
+ String publicHolidays = "0";
+// rs.executeQuery("select distinct groupid from kq_format_total " +
+// " where resourceid = ? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+// while(rs.next()){
+// String groupid = Util.null2String(rs.getString("groupid"));
+ // 后台职能 考勤组id
+ String groupid = "5";
+ // 法定(公众假日)天数
+ publicHolidays = getPublicHolidays(fromDate,toDate,groupid);
+// }
+ publicHolidays = floatMultiply(publicHolidays,"8");
+
+ result = floatAdd(attenddays,publicHolidays);
+ return result;
+ }
+
+ /**
+ * 获取 国假排班小时(3倍)
+ * 【公众假日】的排班时长(小时数),且要扣减掉当前的请假时长;
+ * 如:10-01号,当前排班9小时,如果他当前请了2小时事假,统计后,则为:7小时,以此类推……
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getNationalHoliday3Hours(String fromDate, String toDate, String userid){
+ RecordSet rs = new RecordSet();
+ RecordSet rs1 = new RecordSet();
+ // 【公众假日】的排班时长(小时数)
+ String holidayHours = "0";
+ // 【公众假日】的请假时长(小时数)
+ String leaveHours = "0";
+ // 【公众假日】的矿工时长(小时数)
+ String absenseHours = "0";
+ rs.executeQuery("select distinct groupid from kq_format_total " +
+ " where resourceid = ? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+ rs.next();
+ String groupid = Util.null2String(rs.getString("groupid"));
+ KQGroupMemberComInfo groupMemberComInfo = new KQGroupMemberComInfo();
+ // 休息班 班次id
+ String rest_serial_id = rs.getPropValue("hrm_zhewen","rest_serial_id");
+ rs1.executeQuery("select * from KQ_HolidaySet where holidayDate between ? and ? and changeType=1 and groupid = ?",fromDate,toDate,groupid);
+ while(rs1.next()){
+ String holidayDate = Util.null2String(rs1.getString("holidayDate"));
+ String holiday_serialid = getSerialId(holidayDate,holidayDate,userid);
+ if(holiday_serialid != null && !"".equals(holiday_serialid)){
+ // 非休息班次
+ if(!rest_serial_id.equals(holiday_serialid)) {
+ KQGroupEntity kqGroupEntity = groupMemberComInfo.getUserKQGroupInfo(userid,holidayDate);
+ if(kqGroupEntity!=null) {
+ String kqtype = kqGroupEntity.getKqtype();
+ //排班制
+ if ("2".equals(kqtype)) {
+ String holiday_hours = getHoursBySerial(holiday_serialid);
+ holidayHours = floatAdd(holidayHours, holiday_hours);
+
+ String leave_hour = getLeaveHours(holidayDate, holidayDate, userid);
+ leaveHours = floatAdd(leaveHours, leave_hour);
+
+ String absense_hour = getAbsenteeishours(holidayDate, holidayDate, userid);
+ absenseHours = floatAdd(absenseHours, absense_hour);
+ }
+ }
+ }
+ }
+ }
+ String result = floatSubtract(floatSubtract(holidayHours,leaveHours),absenseHours);
+ if(floatCompare(result,"0") == -1){
+ result = "0";
+ }
+ return Double.valueOf(result);
+ }
+
+ /**
+ * 获取 旷工 时长
+ * @param fromdate
+ * @param todate
+ * @param userid
+ * @return
+ */
+ public static String getAbsenteeishours(String fromdate, String todate,String userid){
+ String result = "0";
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select sum(absenteeismmins) as count from kq_format_total "+
+ " where resourceid = ? and kqdate >= ? and kqdate <= ? ",userid,fromdate,todate);
+ while(rs.next()){
+ String count = Util.null2o(rs.getString("count"));
+ result = floatDivide(count,"60");
+ }
+ return result;
+ }
+
+ /**
+ * 获取 国假排班小时(2倍)
+ * 节假日设置的说明是这俩字【春节】,并且是【调配休息日】排班时长(小时数),且要扣减掉当前的请假时长;
+ * 扣减逻辑同上;只是这个只有春节期间才会统计出来。
+ * 如:除开初一初二初三,剩下的休息天数(只有春节有这个加班)
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getNationalHoliday2Hours(String fromDate, String toDate, String userid){
+ RecordSet rs = new RecordSet();
+ RecordSet rs1 = new RecordSet();
+ // 【公众假日,调配休息日】,假日设置的说明是这俩字【春节】,的排班时长(小时数)
+ String AdjustRestHours = "0";
+ // 【公众假日】的请假时长(小时数)
+ String leaveHours = "0";
+ // 【公众假日】的矿工时长(小时数)
+ String absenseHours = "0";
+ KQGroupMemberComInfo groupMemberComInfo = new KQGroupMemberComInfo();
+ rs.executeQuery("select distinct groupid from kq_format_total " +
+ " where resourceid = ? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+ rs.next();
+ String groupid = Util.null2String(rs.getString("groupid"));
+ // 休息班 班次id
+ String rest_serial_id = rs.getPropValue("hrm_zhewen","rest_serial_id");
+ rs1.executeQuery("select * from KQ_HolidaySet where holidayDate between ? and ? and changeType=3 and holidayDesc like '%春节%' and groupid = ?",fromDate,toDate,groupid);
+ while(rs1.next()){
+ String adjustrestDate = Util.null2String(rs1.getString("holidayDate"));
+ String adjustrest_serialid = getSerialId(adjustrestDate,adjustrestDate,userid);
+ if(adjustrest_serialid != null && !"".equals(adjustrest_serialid)){
+ // 非休息班次
+ if(!rest_serial_id.equals(adjustrest_serialid)) {
+ KQGroupEntity kqGroupEntity = groupMemberComInfo.getUserKQGroupInfo(userid,adjustrestDate);
+ if(kqGroupEntity!=null) {
+ String kqtype = kqGroupEntity.getKqtype();
+ //排班制
+ if ("2".equals(kqtype)) {
+ String adjustrest_hours = getHoursBySerial(adjustrest_serialid);
+ AdjustRestHours = floatAdd(AdjustRestHours, adjustrest_hours);
+
+ String leave_hour = getLeaveHours(adjustrestDate, adjustrestDate, userid);
+ leaveHours = floatAdd(leaveHours, leave_hour);
+
+ String absense_hour = getAbsenteeishours(adjustrestDate, adjustrestDate, userid);
+ absenseHours = floatAdd(absenseHours, absense_hour);
+ }
+ }
+ }
+ }
+ }
+ String result = floatSubtract(floatSubtract(AdjustRestHours,leaveHours),absenseHours);
+ if(floatCompare(result,"0") == -1){
+ result = "0";
+ }
+ return Double.valueOf(result);
+ }
+
+ /**
+ * 获取 国假在职小时数 = 【公众假日】的天数 * 8小时
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getNationalWorkingHours(String fromDate, String toDate, String userid){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ // 入职日期
+ String companystartdate = getCompanyStartDate(userid);
+ // 离职日期
+ String terminationdate = getTerminationDate(userid);
+ //入职日期在开始和结束之间
+ if(belongStartCalendar(companystartdate,fromDate,toDate)){
+ fromDate = companystartdate;
+ }
+ //离职日期在开始和结束之间
+ if(belongStartCalendar(terminationdate,fromDate,toDate)){
+ toDate = terminationdate;
+ }
+ rs.executeQuery("select distinct groupid from kq_format_total " +
+ " where resourceid = ? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+ while(rs.next()){
+ String groupid = Util.null2String(rs.getString("groupid"));
+ // 法定(公众假日)天数
+ String publicHolidays = getPublicHolidays(fromDate,toDate,groupid);
+ String hours = floatMultiply(publicHolidays,"8");
+ result = Double.valueOf(hours);
+ }
+ return result;
+ }
+
+ /**
+ * 获取 离职日期
+ * @param userid
+ * @return
+ */
+ public static String getTerminationDate(String userid){
+ String result = "";
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select enddate from hrmresource where id=?",userid);
+ while(rs.next()){
+ result = Util.null2String(rs.getString("enddate"));
+ }
+ return result;
+ }
+
+ /**
+ * 获取 补签卡次数
+ * 系统提取《补卡流程》的明细数据,一行表示一次,流程中增加控制:只能补3天以内(含3天自然日)的异常考勤
+ * (新员工入职30天以内不扣)
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getReplaceCardNum(String fromDate, String toDate, String userid){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ RecordSet rs1 = new RecordSet();
+ String tablename = rs.getPropValue("hrm_zhewen","replacecard_tablename");
+ String detailtable = tablename + "_dt1";
+ // 入职日期
+ String companystartdate = getCompanyStartDate(userid);
+ // 入职30天后的日期
+ String company30date = addDateDay(companystartdate,30);
+ try {
+
+ //入职30天后的日期 在 统计月份第一天 和 最后一天 之间
+ if(belongStartCalendar(company30date,fromDate,toDate)){
+ rs.executeQuery("select count(b.id)as count from "+tablename+" a," + detailtable + " b,workflow_requestbase c where a.id=b.mainid and a.requestid=c.requestid and c.currentnodetype='3' and a.resourceId=? and b.detail_signdate >= ? and b.detail_signdate <= ?", userid, company30date, toDate);
+ rs.next();
+ result = Util.getDoubleValue(rs.getString("count"),0.00);
+ }
+ //入职30天后的日期 小于 统计月份第一天
+ else if(compareDateTime(fromDate,company30date)){
+ rs.executeQuery("select count(b.id)as count from "+tablename+" a," + detailtable + " b,workflow_requestbase c where a.id=b.mainid and a.requestid=c.requestid and c.currentnodetype='3' and a.resourceId=? and b.detail_signdate >= ? and b.detail_signdate <= ?", userid, fromDate, toDate);
+ rs.next();
+ result = Util.getDoubleValue(rs.getString("count"),0.00);
+ }else if(compareDateTime(company30date,toDate)){
+ result = 0.00;
+ }
+
+ if(result < 0){
+ result = 0.00;
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ /**
+ * 获取 迟到/早退(10分钟以内)/次
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getBeLateLeaveEearly10(String fromDate, String toDate, String userid){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ // 入职日期
+ String companystartdate = getCompanyStartDate(userid);
+ // 入职30天后的日期
+ String company30date = addDateDay(companystartdate,30);
+ try{
+ rs.executeQuery("select forgotcheck,kqdate from kq_format_total where resourceid=? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+ while(rs.next()){
+ String kqdate = Util.null2String(rs.getString("kqdate"));
+ int forgotcheck = Util.getIntValue(rs.getString("forgotcheck"),0);
+ // 迟到分钟数
+ double count_late = getLateMins(kqdate,userid);
+ // 早退分钟数
+ double count_leaveearly = getLeaveEarlyMins(kqdate,userid);
+ //不在 新入职员工 30天内,需要累计
+ if(!belongStartCalendar(kqdate,companystartdate,company30date)){
+ // 当天没有漏签
+ if(forgotcheck == 0){
+ if(0 < count_late && count_late < 10){
+ result ++;
+ }
+ if(0 < count_leaveearly && count_leaveearly < 10){
+ result ++;
+ }
+ }
+ }
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ rs.writeLog(e);
+ }
+
+ return result;
+ }
+
+ /**
+ * 获取 迟到/早退(10(含)-30分钟以内)/次
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getBeLateLeaveEearly10To30(String fromDate, String toDate, String userid){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ // 入职日期
+ String companystartdate = getCompanyStartDate(userid);
+ // 入职30天后的日期
+ String company30date = addDateDay(companystartdate,30);
+ try{
+ rs.executeQuery("select forgotcheck,kqdate from kq_format_total where resourceid=? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+ while(rs.next()){
+ String kqdate = Util.null2String(rs.getString("kqdate"));
+ int forgotcheck = Util.getIntValue(rs.getString("forgotcheck"));
+ // 迟到分钟数
+ double count_late = getLateMins(kqdate,userid);
+ // 早退分钟数
+ double count_leaveearly = getLeaveEarlyMins(kqdate,userid);
+ //不在 新入职员工 30天内,需要累计
+ if(!belongStartCalendar(kqdate,companystartdate,company30date)){
+ // 当天没有漏签
+ if(forgotcheck == 0){
+ if(10 <= count_late && count_late < 30){
+ result ++;
+ }
+ if(10 <= count_leaveearly && count_leaveearly < 30){
+ result ++;
+ }
+ }
+ }
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ rs.writeLog(e);
+ }
+
+
+ return result;
+ }
+
+ /**
+ * 获取 迟到/早退(30(含)-60分钟以内)/次
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getBeLateLeaveEearly30To60(String fromDate, String toDate, String userid){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ // 入职日期
+ String companystartdate = getCompanyStartDate(userid);
+ // 入职30天后的日期
+ String company30date = addDateDay(companystartdate,30);
+ try{
+ rs.executeQuery("select forgotcheck,kqdate from kq_format_total where resourceid=? and kqdate >= ? and kqdate <= ? ",userid,fromDate,toDate);
+ while(rs.next()){
+ String kqdate = Util.null2String(rs.getString("kqdate"));
+ int forgotcheck = Util.getIntValue(rs.getString("forgotcheck"));
+ // 迟到分钟数
+ double count_late = getLateMins(kqdate,userid);
+ // 早退分钟数
+ double count_leaveearly = getLeaveEarlyMins(kqdate,userid);
+ //不在 新入职员工 30天内,需要累计
+ if(!belongStartCalendar(kqdate,companystartdate,company30date)){
+ // 当天没有漏签
+ if(forgotcheck == 0){
+ if(30 <= count_late && count_late < 60){
+ result ++;
+ }
+ if(30 <= count_leaveearly && count_leaveearly < 60){
+ result ++;
+ }
+ }
+ }
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ rs.writeLog(e);
+ }
+ return result;
+ }
+
+ /**
+ * 获取 迟到/早退(60分钟以上)/次
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getBeLateLeaveEearly60More(String fromDate, String toDate, String userid){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ // 入职日期
+ String companystartdate = getCompanyStartDate(userid);
+ // 入职30天后的日期
+ String company30date = addDateDay(companystartdate,30);
+ try{
+ rs.executeQuery("select forgotcheck,kqdate from kq_format_total where resourceid=? and kqdate >= ? and kqdate <= ? ",userid,fromDate,toDate);
+ while(rs.next()){
+ String kqdate = Util.null2String(rs.getString("kqdate"));
+ int forgotcheck = Util.getIntValue(rs.getString("forgotcheck"));
+ // 迟到分钟数
+ double count_late = getLateMins(kqdate,userid);
+ // 早退分钟数
+ double count_leaveearly = getLeaveEarlyMins(kqdate,userid);
+ //不在 新入职员工 30天内,需要累计
+ if(!belongStartCalendar(kqdate,companystartdate,company30date)){
+ // 当天没有漏签
+ if(forgotcheck == 0){
+ if(count_late >= 60){
+ result ++;
+ }
+ if(count_leaveearly >= 60){
+ result ++;
+ }
+ }
+ }
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ rs.writeLog(e);
+ }
+ return result;
+ }
+
+ /**
+ * 获取 旷工合计小时数 = 旷工小时数 + 漏签当天的排班时长之和 + 迟到/早退(60分钟以上)/次*4小时计
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getAbsenteeismTotalHours(String fromDate, String toDate, String userid){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ RecordSet rs1 = new RecordSet();
+ // 入职日期
+ String companystartdate = getCompanyStartDate(userid);
+ // 入职30天后的日期
+ String company30date = addDateDay(companystartdate,30);
+ try{
+
+// rs.executeQuery("select belate as count from kq_format_total where resourceid=? and kqdate >= ? and kqdate <= ? and belatemins >= 60",userid,fromDate,toDate);
+// while(rs.next()){
+// String kqdate = Util.null2String(rs.getString("kqdate"));
+// //不在 新入职员工 30天内,需要累计
+// if(!belongStartCalendar(kqdate,companystartdate,company30date)){
+// // 迟到/早退(60分钟以上)/次 * 4小时计
+// double countt = Util.getDoubleValue(rs.getString("count"),0.00);
+// countt = Double.valueOf(floatMultiply(String.valueOf(countt),"4"));
+// result += countt;
+// }
+// }
+
+ // 迟到/早退(60分钟以上)/次 * 4小时计
+ double lateMins = getBeLateLeaveEearly60More(fromDate,toDate,userid);
+ double countt = Double.valueOf(floatMultiply(String.valueOf(lateMins),"4"));
+ result += countt;
+
+ rs1.executeQuery("select forgotcheck,forgotBeginWorkCheck,kqdate,absenteeismmins from kq_format_total where resourceid=? and kqdate >= ? and kqdate <= ? ",userid,fromDate,toDate);
+ while(rs1.next()){
+ String kqdate = Util.null2String(rs1.getString("kqdate"));
+ int forgotcheck1 = Util.getIntValue(rs1.getString("forgotcheck"));
+ int forgotBeginWorkCheck = Util.getIntValue(rs1.getString("forgotBeginWorkCheck"));
+ int forgotcheck = forgotcheck1 + forgotBeginWorkCheck;
+ // 旷工小时数
+ double count1 = Util.getDoubleValue(rs1.getString("absenteeismmins"),0.00);
+ count1 = Double.valueOf(floatDivide(String.valueOf(count1),"60"));
+ result += count1;
+
+ // 当天有漏签
+ if(forgotcheck > 0){
+ // 漏签当天的排班时长之和
+ String workhour = getWorkHours(kqdate,kqdate,userid);
+ workhour = floatMultiply(workhour,String.valueOf(forgotcheck));
+ result += Double.valueOf(workhour);
+ }
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ rs.writeLog(e);
+ }
+ return result;
+ }
+
+ /**
+ * 实际出勤小时数 = 排班表总时间-病假小时-事假小时-旷工小时数-漏签旷工小时数
+ *
+ * -漏签旷工小时数 这个待确定是否 去除 2024-12-24
+ *
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static double getActualAttendanceHours(String fromDate, String toDate, String userid){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ RecordSet rs1 = new RecordSet();
+ // 应出勤(排班)小时数
+ String workhours = getWorkHours(fromDate,toDate,userid);
+ // 7:病假 6:事假
+ String typeid = "7,6";
+ // 病假、事假 小时数
+ String leavehours = getLeaveTypeHours(typeid,fromDate,toDate,userid);
+ // 旷工小时数
+ String absencehours = "0";
+ // 漏签当天的排班时长之和
+ String forgotserialhours = "0";
+ rs1.executeQuery("select forgotcheck,forgotBeginWorkCheck,kqdate,absenteeismmins from kq_format_total where resourceid=? and kqdate >= ? and kqdate <= ? ",userid,fromDate,toDate);
+ while(rs1.next()){
+ String kqdate = Util.null2String(rs1.getString("kqdate"));
+ int forgotcheck1 = Util.getIntValue(rs1.getString("forgotcheck"));
+ int forgotBeginWorkCheck = Util.getIntValue(rs1.getString("forgotBeginWorkCheck"));
+ int forgotcheck = forgotcheck1 + forgotBeginWorkCheck;
+ // 旷工小时数
+ String count1 = Util.null2o(rs1.getString("absenteeismmins"));
+ count1 = floatDivide(count1,"60");
+ absencehours = floatAdd(absencehours,count1);
+
+ // 当天有漏签
+ if(forgotcheck > 0){
+ // 漏签当天的排班时长之和
+ String workhour = getWorkHours(kqdate,kqdate,userid);
+ workhour = floatMultiply(workhour,String.valueOf(forgotcheck));
+ forgotserialhours = floatAdd(forgotserialhours,workhour);
+ }
+ }
+ result = Double.valueOf(floatSubtract(workhours,floatAdd(leavehours,floatAdd(absencehours,forgotserialhours))));
+ if(result < 0 ){
+ result = 0.00;
+ }
+ return result;
+ }
+
+ /**
+ * 获取 请假 时长
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static String getLeaveTypeHours(String typeid,String fromDate, String toDate,String userid){
+ String result = "0";
+ RecordSet rs = new RecordSet();
+ String serialid = getSerialId(fromDate,toDate,userid);
+ String serial_hours = getHoursBySerial(serialid);
+ rs.executeQuery("select SUM(duration)as count,durationrule,resourceid,newleavetype from kq_flow_split_leave where 1=1 and newleavetype in ("+typeid+") and belongdate >= '"+fromDate+"' and belongdate <= '"+toDate+"' and resourceid = ? group by durationrule,resourceid,newleavetype ",userid);
+ while(rs.next()){
+ String count = Util.null2o(rs.getString("count"));
+ // 1-按天请假、2-按半天请假、3-按小时请假、4-按整天请假、5-按半小时请假、6-按整小时请假
+ int durationrule = Util.getIntValue(rs.getString("durationrule"));
+ // 请假类型
+ int leavetype = Util.getIntValue(rs.getString("newleavetype"));
+ // 按天,需要 乘以 每天的班次的小时
+ if(durationrule == 1 || durationrule == 2 || durationrule == 4){
+ // 其中,2-年假、8-产假、9-陪产假、10-婚假、11-丧假,一天按8小时计算扣减;
+ if(leavetype == 2 || leavetype == 8 || leavetype == 9 || leavetype == 10 || leavetype == 11){
+ result = floatMultiply(count,"8");
+ }else{
+ result = floatMultiply(count,serial_hours);
+ }
+ }
+ // 按小时
+ if(durationrule == 3 || durationrule == 5 || durationrule == 6){
+ result = count;
+ }
+ }
+ return result;
+ }
+
+
+ /**
+ * 获取 应出勤时长 = 排班时长
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static String getWorkHours(String fromDate,String toDate,String userid){
+ String result = "0";
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select sum(workmins)as mins from kq_format_total "+
+ " where resourceid = ? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+ rs.next();
+ String count1 = Util.null2o(rs.getString("mins"));
+ result = floatDivide(count1,"60");
+ return result;
+ }
+
+ /**
+ *
+ * 方法描述 : 对两个字符串进行金额的相乘
+ * @param a
+ * @param b
+ * @return
+ * String
+ */
+ public static String floatMultiply(String a, String b) {
+ a=a.equals("")?"0":a;
+ b=b.equals("")?"0":b;
+ BigDecimal bg1 = new BigDecimal(a);
+ BigDecimal bg2 = new BigDecimal(b);
+ BigDecimal bd = bg1.multiply(bg2).setScale(4, BigDecimal.ROUND_HALF_UP);
+ return bd.toString();
+ }
+
+ /**
+ *
+ * 方法描述 : 对两个字符串进行金额的相除(默认保留两位小数)
+ * @param a
+ * @param b
+ * @return
+ * String
+ */
+ public static String floatDivide(String a, String b) {
+ a=a.equals("")?"0":a;
+ b=b.equals("")?"0":b;
+ BigDecimal bg1 = new BigDecimal(a);
+ BigDecimal bg2 = new BigDecimal(b);
+ BigDecimal bd = bg1.divide(bg2, 2, BigDecimal.ROUND_HALF_UP);
+ return bd.toString();
+ }
+
+ /**
+ * 获取 班次id
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static String getSerialId(String fromDate, String toDate,String userid){
+ String result = "";
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select distinct serialid from kq_format_total " +
+ " where resourceid = ? and kqdate >= ? and kqdate <= ?",userid,fromDate,toDate);
+ while(rs.next()){
+ result = Util.null2String(rs.getString("serialid"));
+ }
+ return result;
+ }
+
+ /**
+ * 获取班次对应的工作时长 分钟数 转换为 小时
+ * @param serialid
+ * @return
+ */
+ public static String getHoursBySerial(String serialid){
+ String result = "0";
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select * from kq_ShiftManagement where id=?",serialid);
+ if(rs.next()) {
+ String worktime = Util.null2o(rs.getString("worktime"));
+ result = floatDivide(worktime,"60");
+ }
+ return result;
+ }
+
+ /**
+ * 获取 法定(公众假日)天数
+ * @param fromDate
+ * @param toDate
+ * @param groupid
+ * @return
+ */
+ public static String getPublicHolidays(String fromDate, String toDate,String groupid){
+ String result = "0";
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select COUNT(id)as count from KQ_HolidaySet where holidayDate between ? and ? and changeType=1 and groupid = ?",fromDate,toDate,groupid);
+ while(rs.next()){
+ result = Util.null2o(rs.getString("count"));
+ }
+ return result;
+ }
+
+ /**
+ * 获取 请假 时长
+ * @param fromDate
+ * @param toDate
+ * @param userid
+ * @return
+ */
+ public static String getLeaveHours(String fromDate, String toDate,String userid){
+ String result = "0";
+ RecordSet rs = new RecordSet();
+ String serialid = getSerialId(fromDate,toDate,userid);
+ String serial_hours = getHoursBySerial(serialid);
+ rs.executeQuery("select SUM(duration)as count,durationrule,resourceid from kq_flow_split_leave where 1=1 and belongdate between ? and ? and resourceid = ? group by durationrule,resourceid",fromDate,toDate,userid);
+ while(rs.next()){
+ String count = Util.null2o(rs.getString("count"));
+ // 1-按天请假、2-按半天请假、3-按小时请假、4-按整天请假、5-按半小时请假、6-按整小时请假
+ int durationrule = Util.getIntValue(rs.getString("durationrule"));
+ // 按天,需要 乘以 每天的班次的小时
+ if(durationrule == 1 || durationrule == 2 || durationrule == 4){
+ result = floatMultiply(count,serial_hours);
+ }else{
+// // 按小时
+// if(durationrule == 3){
+ result = count;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @param a 任意数
+ * @return 是
+ */
+ private static String isZero(String a) {
+ if (a==null || "".equals(a)) {
+ a = "0";
+ }
+ return a;
+ }
+
+ /**
+ * 大小比较
+ *
+ * @param a
+ * @param b
+ * @return -1 小于 0 等于 1 大于
+ */
+ public static int floatCompare(String a, String b) {
+ a = isZero(a);
+ b = isZero(b);
+ BigDecimal bg1 = new BigDecimal(a);
+ BigDecimal bg2 = new BigDecimal(b);
+ return bg1.compareTo(bg2);
+ }
+
+ /**
+ * 方法描述 : 对两个字符串进行金额的相加
+ * @param a
+ * @param b
+ * @return
+ * String
+ */
+ public static String floatAdd(String a, String b) {
+ a=a.equals("")?"0":a;
+ b=b.equals("")?"0":b;
+ BigDecimal bg1 = new BigDecimal(a);
+ BigDecimal bg2 = new BigDecimal(b);
+ BigDecimal bd = bg1.add(bg2);
+ return bd.toString();
+ }
+
+ /**
+ *
+ * 方法描述 : 对两个字符串进行金额的相减
+ * @param a
+ * @param b
+ * @return
+ * String
+ */
+ public static String floatSubtract(String a, String b) {
+ a=a.equals("")?"0":a;
+ b=b.equals("")?"0":b;
+ BigDecimal bg1 = new BigDecimal(a);
+ BigDecimal bg2 = new BigDecimal(b);
+ BigDecimal bd = bg1.subtract(bg2);
+ return bd.toString();
+ }
+
+ /**
+ * 获取 入职日期
+ * @param userid
+ * @return
+ */
+ public static String getCompanyStartDate(String userid){
+ String result = "";
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select companystartdate from hrmresource where id=?",userid);
+ while(rs.next()){
+ result = Util.null2String(rs.getString("companystartdate"));
+ }
+ return result;
+ }
+
+ /**
+ * 对时间的天数进行加减
+ * @param daytime 时间的格式:yyyy-MM-dd HH:mm:ss
+ * @param day 天数 -1则代表减一天
+ * @return
+ */
+ public static String addDateDay(String daytime, int day){
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+ Date date = null;
+ try {
+ date = format.parse(daytime);
+ if (date == null){
+ return "";
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ cal.add(Calendar.DAY_OF_MONTH, day);// 加一天
+ date = cal.getTime();
+ cal = null;
+ return format.format(date);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return "";
+ }
+
+ /**
+ * 计算两个时间字符串日期的相差天数
+ *
+ * @param date1 字符串时间1
+ * @param date2 字符串时间2
+ * @return 相差时间
+ */
+ public static int getDays(String date1, String date2) {
+ if (!"".equals(date1) && !"".equals(date2)) {
+ String date1Arr[] = date1.split("-");
+ String date2Arr[] = date2.split("-");
+ Calendar cal1 = Calendar.getInstance();
+ cal1.set(Integer.parseInt(date1Arr[0]), Integer.parseInt(date1Arr[1]) - 1, Integer.parseInt(date1Arr[2]));
+ Date date1Obj = cal1.getTime();
+ Calendar cal2 = Calendar.getInstance();
+ cal2.set(Integer.parseInt(date2Arr[0]), Integer.parseInt(date2Arr[1]) - 1, Integer.parseInt(date2Arr[2]));
+ Date date2Obj = cal2.getTime();
+ return calculateDays(date1Obj, date2Obj);
+ }
+ return 0;
+ }
+
+ /**
+ * 计算天数
+ * @param date1 日期
+ * @param date2 日期
+ * @return 天数
+ */
+ public static int calculateDays(Date date1, Date date2) {
+ Calendar cal1 = Calendar.getInstance();
+ cal1.setTime(date1);
+ Calendar cal2 = Calendar.getInstance();
+ cal2.setTime(date2);
+ int day1 = cal1.get(Calendar.DAY_OF_YEAR);
+ int day2 = cal2.get(Calendar.DAY_OF_YEAR);
+ int year1 = cal1.get(Calendar.YEAR);
+ int year2 = cal2.get(Calendar.YEAR);
+ if (year1 != year2) {//不同 年
+ int timeDistance = 0;
+ if (year1 < year2) {//后面日期年大于前面日期
+ for (int i = year1; i < year2; i++) {
+ if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {//闰年
+ timeDistance += 366;
+ } else {//不是闰年
+ timeDistance += 365;
+ }
+ }
+ } else {
+ for (int i = year2; i < year1; i++) {
+ if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {//闰年
+ timeDistance += 366;
+ } else {//不是闰年
+ timeDistance += 365;
+ timeDistance = 0 - timeDistance;
+ }
+ }
+ }
+ return timeDistance + (day2 - day1);
+ } else {//同一年
+ return day2 - day1;
+ }
+ }
+
+ /**
+ * 判断 日期是否是 周六 或 周日
+ * @param dateString
+ * @return
+ */
+ public static boolean isSaturdayOrSunday(String dateString) {
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+ Date date = null;
+ boolean flag = false;
+ try {
+ date = format.parse(dateString);
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
+ if(dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY){
+ flag = true;
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
+
+ /**
+ * 判断 是否是 调配休息日或者是 公众假日
+ * @param dateString
+ * @return
+ */
+ public static boolean checkIsRestOrHoliday(String groupid,String dateString){
+ boolean bool = false;
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select id,changeType from KQ_HolidaySet where groupId=? and holidayDate=?",groupid,dateString);
+ if(rs.next()){
+ int changeType = Util.getIntValue(rs.getString("changeType"));
+ // 1-公众假日 2-调配工作日 3-调配休息日
+ if(changeType == 1 || changeType == 3){
+ bool = true;
+ }
+ }
+ return bool;
+ }
+
+ /**
+ * 判断 是否是 调配工作日
+ * @param dateString
+ * @return
+ */
+ public static boolean checkIsWorkday(String groupid,String dateString){
+ boolean bool = false;
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select id,changeType from KQ_HolidaySet where groupId=? and holidayDate=?",groupid,dateString);
+ if(rs.next()){
+ int changeType = Util.getIntValue(rs.getString("changeType"));
+ // 1-公众假日 2-调配工作日 3-调配休息日
+ if(changeType == 2){
+ bool = true;
+ }
+ }
+ return bool;
+ }
+
+ private static String[] parseDate(String date){
+ if (StringUtils.isEmpty(date)) {
+ return new String[]{"1990", "1", "1"};
+ }
+ try {
+ String[] split = date.split("-");
+ List list = new ArrayList<>(Arrays.asList(split));
+ // 只有年
+ if (list.size() == 1) {
+ // 添加月
+ list.add("1");
+ // 添加日
+ list.add("1");
+
+ }
+ // 只有年月
+ else if (list.size() == 2) {
+ list.add("1");
+ }
+ return list.toArray(new String[]{});
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * 获取 迟到分钟数
+ * @param fromDate
+ * @param userId
+ * @return
+ */
+ public static double getLateMins(String fromDate,String userId){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ KQWorkTime kqWorkTime = new KQWorkTime();
+ WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(userId, fromDate);
+ String searIdFrom = workTimeEntity.getSerialId();
+ //第一个班段上班卡的 时间
+ String oneStart = getBcTimes(searIdFrom,"start","0");
+ oneStart += ":00";
+
+ //休息开始时间
+ String restStart = getRestTime(searIdFrom,"start");
+ restStart += ":00";
+ //休息结束时间
+ String restEnd = getRestTime(searIdFrom,"end");
+ restEnd += ":00";
+
+ //当天没有 公出
+ if(!checkHasOut(userId,fromDate)) {
+ // 当天 有迟到
+ if(checkHasLate(userId,fromDate)) {
+ rs.executeQuery("select signintime from kq_format_detail where resourceid = ? and kqdate = ?", userId, fromDate);
+ if (rs.next()) {
+ String signtime = Util.null2String(rs.getString("signintime"));
+ signtime += ":00";
+ //上班打卡时间 大于等于 休息结束时间
+ if(compareDateTime(fromDate+" "+signtime,fromDate+" "+restEnd)){
+ double oneTimes = getBetwwenMins(oneStart,restStart);
+ double twoTimes = getBetwwenMins(restEnd,signtime);
+ result = oneTimes + twoTimes;
+ }else{
+ // 上班打卡时间 大于等于 休息开始时间
+ if(compareDateTime(fromDate+""+signtime,fromDate+" "+restStart)){
+ double oneTimes = getBetwwenMins(oneStart,restStart);
+ result = oneTimes;
+ }else{
+ double oneTimes = getBetwwenMins(oneStart,signtime);
+ result = oneTimes;
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 获取 早退分钟数
+ * @param fromDate
+ * @param userId
+ * @return
+ */
+ public static double getLeaveEarlyMins(String fromDate,String userId){
+ double result = 0.00;
+ RecordSet rs = new RecordSet();
+ RecordSet rs1 = new RecordSet();
+ KQWorkTime kqWorkTime = new KQWorkTime();
+ WorkTimeEntity workTimeEntity = kqWorkTime.getWorkTime(userId, fromDate);
+ String searIdFrom = workTimeEntity.getSerialId();
+ //第一个班段下班卡的 时间
+ String oneEnd = getBcTimes(searIdFrom,"end","0");
+ oneEnd += ":00";
+
+ //休息开始时间
+ String restStart = getRestTime(searIdFrom,"start");
+ restStart += ":00";
+ //休息结束时间
+ String restEnd = getRestTime(searIdFrom,"end");
+ restEnd += ":00";
+
+ // 当天没公出
+ if(!checkHasOut(userId,fromDate)) {
+ // 当天有早退
+ if(checkHasLeaveEarly(userId,fromDate)) {
+ rs.executeQuery("select signouttime from kq_format_detail where resourceid = ? and kqdate = ? ", userId, fromDate);
+ if (rs.next()) {
+ String signtime = Util.null2String(rs.getString("signouttime"));
+ signtime += ":00";
+ //下班打卡时间 小于 休息开始时间
+ if(compareDateTime(fromDate+" "+restStart,fromDate+" "+signtime)){
+ double oneTimes = getBetwwenMins(signtime,restStart);
+ double twoTimes = getBetwwenMins(restEnd,oneEnd);
+ result = oneTimes + twoTimes;
+ }else{
+ //下班打卡时间在 休息开始和结束之间
+ if(compareDateTime(fromDate+" "+restEnd,fromDate+" "+signtime)){
+ double twoTimes = getBetwwenMins(restEnd,oneEnd);
+ result = twoTimes;
+ }else{
+ double twoTimes = getBetwwenMins(signtime,oneEnd);
+ result = twoTimes;
+ }
+ }
+
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 给时间加上几个小时
+ * @param day 时间的格式:HH:mm:ss
+ * @param hour 需要加的小时数 -1 则代表减1小时
+ * @return
+ */
+ public static String addDateHour(String day, int hour){
+ SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
+ Date date = null;
+ try {
+ date = format.parse(day);
+ if (date == null){
+ return "";
+ }
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ cal.add(Calendar.HOUR, hour);// 24小时制
+ date = cal.getTime();
+ cal = null;
+ return format.format(date);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return "";
+ }
+
+ /**
+ * 两个时间段相差分钟数
+ * @param time1
+ * @param time2
+ * @return
+ */
+ public static double getBetwwenMins(String time1,String time2){
+ SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
+ double result = 0;
+ try {
+ Date date1 = dateFormat.parse(time1);
+ Date date2 = dateFormat.parse(time2);
+
+ long diff = date2.getTime() - date1.getTime();
+ double diffMinutes = (double)diff / (60*1000);
+
+ result = diffMinutes;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ /**
+ * 获取班次上班时段
+ * @param serial
+ * @param status
+ * @param record
+ * @return times 00:00
+ */
+ private static String getBcTimes(String serial,String status,String record){
+ RecordSet rs = new RecordSet();
+ String sql = "select times from kq_ShiftOnOffWorkSections where serialid = "+serial+" and (isdelete is null or isdelete <> '1') and onoffworktype = '"+status+"' and record = "+record;
+ rs.execute(sql);
+ String times = "";
+ if (rs.next()){
+ times = Util.null2String(rs.getString("times"));
+ }
+ return times;
+ }
+
+ /**
+ * 判断一个时间是否在一个时间段内
+ *
+ * @param nowTimee 指定时间
+ * @param beginTimee 开始时间
+ * @param endTimee 结束时间
+ */
+ public static boolean belongStartCalendar(String nowTimee, String beginTimee, String endTimee) {
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+ Date nowTime = null;
+ Date beginTime = null;
+ Date endTime = null;
+ boolean b = false;
+ try {
+ nowTime = format.parse(nowTimee);
+ beginTime = format.parse(beginTimee);
+ endTime = format.parse(endTimee);
+
+ Calendar date = Calendar.getInstance();
+ date.setTime(nowTime);
+ Calendar begin = Calendar.getInstance();
+ begin.setTime(beginTime);
+ Calendar end = Calendar.getInstance();
+ end.setTime(endTime);
+
+ if(nowTimee.equals(beginTimee)){
+ b = true;
+ }else if(date.after(begin) && date.before(end)){//在时间段内
+ b = true;
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return b;
+ }
+
+ /**
+ * 判断 当天 是否有 公出
+ * @param userid
+ * @param date
+ * @return
+ */
+ public static boolean checkHasOut(String userid,String date){
+ boolean bool = false;
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select id from kq_flow_split_out where resourceid = ? and belongdate = ?",userid,date);
+ if(rs.next()){
+ bool = true;
+ }
+ return bool;
+ }
+
+ /**
+ * 判断 当天是否 早退
+ * @param userid
+ * @param date
+ * @return
+ */
+ public static boolean checkHasLeaveEarly(String userid,String date){
+ boolean bool = false;
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select leaveearlymins from kq_format_total where resourceid = ? and kqdate = ?",userid,date);
+ while(rs.next()){
+ int leaveearlymins = Util.getIntValue(rs.getString("leaveearlymins"));
+ if(leaveearlymins > 0){
+ bool = true;
+ }
+ }
+ return bool;
+ }
+
+ /**
+ * 判断 当天是否 迟到
+ * @param userid
+ * @param date
+ * @return
+ */
+ public static boolean checkHasLate(String userid,String date){
+ boolean bool = false;
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select belatemins from kq_format_total where resourceid = ? and kqdate = ?",userid,date);
+ while(rs.next()){
+ int belatemins = Util.getIntValue(rs.getString("belatemins"));
+ if(belatemins > 0){
+ bool = true;
+ }
+ }
+ return bool;
+ }
+
+ /**
+ * 获取 休息时间
+ * @param serial
+ * @param status
+ * @return times 00:00
+ */
+ private static String getRestTime(String serial,String status){
+ RecordSet rs = new RecordSet();
+ String sql = "select times from kq_ShiftRestTimeSections where serialid = "+serial+" and (isdelete is null or isdelete <> '1') and resttype = '"+status+"' ";
+ rs.execute(sql);
+ String times = "";
+ if (rs.next()){
+ times = Util.null2String(rs.getString("time"));
+ }
+ return times;
+ }
+
+ /**
+ * 比较时间的大小
+ * @param a
+ * @param b
+ * @return
+ * @throws ParseException
+ */
+ public static boolean compareDateTime(String a, String b){
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ boolean bool = false;
+ try {
+ long t1 = sdf.parse(a).getTime();
+ long t2 = sdf.parse(b).getTime();
+ if (t1 >= t2) {
+ bool = true;
+ } else {
+ bool = false;
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return bool;
+ }
+
+%>
+
+
+
+
+ 以下是 <%=username%> <%=fromdate%> 到 <%=todate%> 的 相关数据展示
+ 请假时长 <%=leaveHours%>
+ 班次的开始时间 <%=oneStart%>
+ 班次的结束时间 <%=oneEnd%>
+ 应出勤(排班)小时数 <%=workhours%>
+ 月标准工时 <%=standardWorkingHours%>
+ 应计薪小时数 <%=accruedPayHours%>
+ 国假排班小时(3倍) <%=nationalHoliday3Hours%>
+ 国假排班小时(2倍) <%=nationalHoliday2Hours%>
+ 国假在职小时数 <%=nationalWorkingHours%>
+ 补签卡次数 <%=replaceCardNum%>
+ 迟到/早退(10分钟以内)/次 <%=beLateLeaveEearly10%>
+ 迟到/早退(10(含)-30分钟以内)/次 <%=beLateLeaveEearly10To30%>
+ 迟到/早退(30(含)-60分钟以内)/次 <%=beLateLeaveEearly30To60%>
+ 迟到/早退(60分钟以上)/次 <%=beLateLeaveEearly60More%>
+ 旷工合计小时 <%=absenteeismTotalHours%>
+ 实际出勤小时数=排班表总时间-病假小时-事假小时-旷工小时数-漏签旷工小时数 <%=actualAttendanceHours%>
+ 病假 小时数 <%=bjleavehours%>
+ 事假 小时数 <%=sjleavehours%>
+ 旷工小时数 <%=absencehours%>
+ 漏签旷工小时数 <%=forgotserialhours%>
+ 迟到分钟数 <%=latemins%>
+ 早退分钟数 <%=leaveearlymins%>
+
\ No newline at end of file
diff --git a/浙文眼镜/interface/zw/workflow/htpblc/getSchedulingDateType.jsp b/浙文眼镜/interface/zw/workflow/htpblc/getSchedulingDateType.jsp
new file mode 100644
index 0000000..c8b4b5f
--- /dev/null
+++ b/浙文眼镜/interface/zw/workflow/htpblc/getSchedulingDateType.jsp
@@ -0,0 +1,284 @@
+<%@ page import="weaver.conn.RecordSet" %>
+<%@ page import="weaver.general.Util" %>
+<%@ page import="org.apache.commons.lang3.StringUtils" %>
+<%@ page import="com.alibaba.fastjson.JSONObject" %>
+<%@ page import="java.time.LocalDate" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="weaver.hrm.User" %>
+<%@ page import="weaver.hrm.HrmUserVarify" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="java.util.HashMap" %>
+<%@ page import="weaver.general.BaseBean" %>
+<%@ page import="com.engine.kq.biz.KQGroupBiz" %>
+<%@ page import="com.engine.kq.biz.KQGroupComInfo" %>
+<%@ page import="com.engine.kq.biz.KQGroupMemberComInfo" %>
+<%@ page import="weaver.common.DateUtil" %>
+<%@ page import="java.time.DayOfWeek" %>
+<%@ page import="java.time.temporal.TemporalAdjusters" %>
+<%@ page language="java" contentType="text/html; charset=UTF-8" %>
+<%
+
+ User user = HrmUserVarify.getUser(request, response);
+ if(user==null) {
+ response.sendRedirect("/login/Login.jsp");
+ return;
+ }
+
+
+ RecordSet rs = new RecordSet();
+ String pbyf = request.getParameter("pbyf");
+ String userid = request.getParameter("userid");
+ String cjrbm = request.getParameter("cjrbm");
+
+// List