18756
2024-08-13 17a4ea77b0403b584dd8f9f01d7e3f28bee2a1a0
考勤功能优化8.13
已修改2个文件
367 ■■■■ 文件已修改
src/main/java/com/product/administration/service/PunchRecordService.java 208 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/service/WorkAttendanceKanbanService.java 159 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/product/administration/service/PunchRecordService.java
@@ -1,11 +1,17 @@
package com.product.administration.service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -40,10 +46,206 @@
     * @param fse
     * @return
     */
    public DataTableEntity listRecordInfo(FieldSetEntity fse) {
    public DataTableEntity listRecordInfo(FieldSetEntity fse) throws ParseException {
        DataTableEntity dt=baseDao.listTable(CmnConst.PRODUCT_OA_PUNCH_RECORD, "created_by=?", new Object[] {SpringMVCContextHolder.getCurrentUser().getUser_id()}, null, CmnConst.CREATED_UTC_DATETIME+" DESC", fse.getInteger(CmnConst.PAGESIZE), fse.getInteger(CmnConst.CPAGE));
        dt.setFieldFormat("punch_time_one", "yyyy-MM-dd HH:mm:ss");
        dt.setFieldFormat("punch_time_three", "yyyy-MM-dd HH:mm:ss");
        for (int i=0;i<dt.getRows();i++){
            FieldSetEntity fieldSetEntity = dt.getData().get(i);
            String punch_time_one = fieldSetEntity.getValue("punch_time_one").toString();
            Date date1=new Date(punch_time_one);
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            String sign_date = dateFormat.format(date1);
            fieldSetEntity.setValue("sign_date",sign_date);
            //获取早退迟到的分钟数
            List<Object>param1=new ArrayList<>();
            param1.add(fieldSetEntity.getValue("created_by").toString());
            param1.add(fieldSetEntity.getValue("punch_congfig_uuid").toString());
            param1.add(fieldSetEntity.getValue("created_by").toString()+",");
            //获取使用到的设置规则
            StringBuilder sbPunchTime=new StringBuilder();
            sbPunchTime.append(" SELECT c.* ");
            sbPunchTime.append(" FROM ( ");
            sbPunchTime.append(" SELECT d.* ");
            sbPunchTime.append(" FROM product_oa_punch_time d ");
            sbPunchTime.append(" left JOIN product_oa_punch_record b ");
            sbPunchTime.append(" on d.punch_site_uuid=b.punch_congfig_uuid and d.created_by=? where d.punch_site_uuid= ? ");
            sbPunchTime.append(" ) c ");
            sbPunchTime.append(" where  c.uuid in ( ");
            sbPunchTime.append(" SELECT DISTINCT uuid ");
            sbPunchTime.append(" FROM product_oa_punch_time ");
            sbPunchTime.append(" where LOCATE(?, concat(attendance_object,','))>0 ");
            sbPunchTime.append(" ) ");
            DataTableEntity dataTableEntity = baseDao.listTable(sbPunchTime.toString(), param1.toArray());
            long beLate1 = 0;
            long beLate2 = 0;
            long beEarily1 = 0;
            long beEarily2 = 0;
            if(dataTableEntity.getRows()!=0){
                String morning_work="";
                String morning_work_off="";
                String afternoon_work="";
                String afternoon_work_off="";
                Date  morning_work_date;
                Date  morning_work_off_date;
                Date  afternoon_work_date;
                Date  afternoon_work_off_date;
                DateTime punch_time_one_date;
                DateTime punch_time_two_date;
                DateTime punch_time_three_date;
                DateTime punch_time_four_date;
                SimpleDateFormat dateFormatHHmmss = new SimpleDateFormat("HH:mm:ss");
                morning_work = dataTableEntity.getData().get(0).getValue("morning_work").toString();
                afternoon_work_off = dataTableEntity.getData().get(0).getValue("afternoon_work_off").toString();
                morning_work_date= DateUtil.parse(morning_work.split(" ")[1]);
                afternoon_work_off_date= DateUtil.parse(afternoon_work_off.split(" ")[1]);
                StringBuilder  lateSb=new StringBuilder();
                StringBuilder   earilySb=new StringBuilder();
                StringBuilder supereffective_distance=new StringBuilder();
                if(!ObjectUtil.isNotEmpty(dataTableEntity.getData().get(0).getValue("morning_work_off")) && !ObjectUtil.isNotEmpty(dataTableEntity.getData().get(0).getValue("afternoon_work"))){
                    int distance = Integer.parseInt(dataTableEntity.getData().get(0).getValue("distance").toString());
                    if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_one"))){
                        String punch_time_one1 = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_one"));
                        punch_time_one_date = DateUtil.parse(punch_time_one1);
                        beLate1 = DateUtil.between(punch_time_one_date, morning_work_date, DateUnit.MINUTE);
                        lateSb.append("迟到:"+beLate1+"分钟");
                        int punch_range_one = Integer.parseInt(fieldSetEntity.getValue("punch_range_one").toString());
                        if(punch_range_one>distance){
                            int distanceMorning = punch_range_one- distance;
                            fieldSetEntity.setValue("supereffective_distance","上班超有效距离:"+distanceMorning);
                        }
                    }else {
                        lateSb.append("上班未打卡");
                    }
                    if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_four"))){
                        String punch_time_four = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_four"));
                        punch_time_four_date = DateUtil.parse(punch_time_four);
                        beEarily2 = DateUtil.between(punch_time_four_date, afternoon_work_off_date, DateUnit.MINUTE);
                        earilySb.append("早退:"+beEarily2+"分钟");
                        int punch_range_four = Integer.parseInt(fieldSetEntity.getValue("punch_range_four").toString());
                        if(punch_range_four>distance){
                            int distanceMorning = punch_range_four- distance;
                            fieldSetEntity.setValue("supereffective_distance","下班超有效距离:"+distanceMorning);
                        }
                    }else {
                        earilySb.append("下班未打卡");
                    }
                    int punch_range_four = Integer.parseInt(fieldSetEntity.getValue("punch_range_four").toString());
                    int punch_range_one = Integer.parseInt(fieldSetEntity.getValue("punch_range_one").toString());
                    if(punch_range_one>distance){
                        fieldSetEntity.setValue("supereffective_distance",punch_range_one-distance);
                    }else if(punch_range_four>distance){
                        fieldSetEntity.setValue("supereffective_distance",punch_range_four-distance);
                    }else {
                        fieldSetEntity.setValue("supereffective_distance","正常");
                    }
                }else {
                    morning_work = dataTableEntity.getData().get(0).getValue("morning_work").toString();
                    morning_work_date= DateUtil.parse(morning_work.split(" ")[1]);
                    morning_work_off = dataTableEntity.getData().get(0).getValue("morning_work_off").toString();
                    morning_work_off_date= DateUtil.parse(morning_work_off.split(" ")[1]);
                    afternoon_work =dataTableEntity.getData().get(0).getValue("afternoon_work").toString();
                    afternoon_work_date= DateUtil.parse(afternoon_work.split(" ")[1]);
                    afternoon_work_off = dataTableEntity.getData().get(0).getValue("afternoon_work_off").toString();
                    afternoon_work_off_date= DateUtil.parse(afternoon_work_off.split(" ")[1]);
                    int distance = Integer.parseInt(dataTableEntity.getData().get(0).getValue("distance").toString());
                    if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_one"))){
                        String punch_time_one1 = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_one"));
                        punch_time_one_date = DateUtil.parse(punch_time_one1);
                        beLate1 = DateUtil.between(punch_time_one_date, morning_work_date, DateUnit.MINUTE);
                        lateSb.append("早上上班迟到:"+beLate1+" ");
                        int punch_range_one = Integer.parseInt(fieldSetEntity.getValue("punch_range_one").toString());
                        if(punch_range_one>distance){
                            int distanceMorning = punch_range_one- distance;
                            supereffective_distance.append("早上上班超有效距离:"+distanceMorning);
                        }
                    }else {
                        lateSb.append("早上上班未打卡"+" ");
                    }
                    if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_two"))){
                        String punch_time_two= dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_two"));
                        punch_time_two_date = DateUtil.parse(punch_time_two);
                        beEarily1 = DateUtil.between(punch_time_two_date, morning_work_off_date, DateUnit.MINUTE);
                        earilySb.append("早上下班早退:"+beEarily1+" ");
                        int punch_range_two = Integer.parseInt(fieldSetEntity.getValue("punch_range_two").toString());
                        if(punch_range_two>distance){
                            int distanceMorningoff = punch_range_two- distance;
                            supereffective_distance.append("早上下班超有效距离:"+distanceMorningoff);
                        }
                    }else {
                        earilySb.append("早上下班未打卡"+" ");
                    }
                    if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_three"))){
                        String punch_time_three = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_three"));
                        punch_time_three_date = DateUtil.parse(punch_time_three);
                        beLate2 = DateUtil.between(punch_time_three_date, afternoon_work_date, DateUnit.MINUTE);
                        lateSb.append("下午上班迟到:"+beLate2+" ");
                        int punch_range_three = Integer.parseInt(fieldSetEntity.getValue("punch_range_three").toString());
                        if(punch_range_three>distance){
                            int distanceAfternoon = punch_range_three- distance;
                            supereffective_distance.append("下午上班超有效距离:"+distanceAfternoon);
                        }
                    }else {
                        lateSb.append("早上上班未打卡"+" ");
                    }
                    if(ObjectUtil.isNotEmpty(fieldSetEntity.getValue("punch_time_four"))){
                        String punch_time_four = dateFormatHHmmss.format(fieldSetEntity.getValue("punch_time_four"));
                        punch_time_four_date = DateUtil.parse(punch_time_four);
                        beEarily2 = DateUtil.between(punch_time_four_date, afternoon_work_off_date, DateUnit.MINUTE);
                        earilySb.append("下午下班早退:"+beEarily2+" ");
                        int punch_range_four = Integer.parseInt(fieldSetEntity.getValue("punch_range_four").toString());
                        if(punch_range_four>distance){
                            int distanceAfternoonoff = punch_range_four- distance;
                            supereffective_distance.append("下午下班超有效距离:"+distanceAfternoonoff);
                        }
                    }else {
                        earilySb.append("下午下班未打卡"+" ");
                    }
                }
                fieldSetEntity.setValue("be_late",lateSb);
                fieldSetEntity.setValue("ealy_leave",earilySb);
                fieldSetEntity.setValue("supereffective_distance",supereffective_distance.toString());
            }
        }
        dt.setFieldFormat("punch_time_one", " HH:mm");
        dt.setFieldFormat("punch_time_two", " HH:mm");
        dt.setFieldFormat("punch_time_three", " HH:mm");
        dt.setFieldFormat("punch_time_four", " HH:mm");
        baseDao.loadPromptData(dt);
        return dt;
    }
src/main/java/com/product/administration/service/WorkAttendanceKanbanService.java
@@ -5,6 +5,7 @@
import java.util.Date;
import java.util.List;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -258,14 +259,31 @@
        
        //获取当前人信息
        SystemUser currentUser=SpringMVCContextHolder.getCurrentUser();
        String org_level_uuid=currentUser.getOrg_level_uuid();
        List<Object>param1=new ArrayList<>();
        param1.add(currentUser.getUser_id());
        param1.add(currentUser.getUser_id()+",");
       //获取使用到的设置规则
        StringBuilder sbPunchTime=new StringBuilder();
        sbPunchTime.append(" SELECT DISTINCT c.* ");
        sbPunchTime.append(" FROM ( ");
        sbPunchTime.append(" SELECT d.* ");
        sbPunchTime.append(" FROM product_oa_punch_time d ");
        sbPunchTime.append(" left JOIN product_oa_punch_record b ");
        sbPunchTime.append(" on d.punch_site_uuid=b.punch_congfig_uuid and d.created_by=? ");
        sbPunchTime.append(" ) c ");
        sbPunchTime.append(" where  c.uuid in ( ");
        sbPunchTime.append(" SELECT DISTINCT uuid ");
        sbPunchTime.append(" FROM product_oa_punch_time ");
        sbPunchTime.append(" where LOCATE(?, concat(attendance_object,','))>0 ");
        sbPunchTime.append(" ) ");
        DataTableEntity dataTableEntity = baseDao.listTable(sbPunchTime.toString(), param1.toArray());
        List<DataTableEntity> dataTableEntityLits=new ArrayList<>();
        for(int i=0;i<dataTableEntity.getRows();i++){
        //获取公司工作时间配置信息
        FieldSetEntity fseCompanyPunch=baseDao.getFieldSetEntityByFilter(CmnConst.PRODUCT_OA_PUNCH_TIME, "", new Object[] {}, false);
            FieldSetEntity fseCompanyPunch = dataTableEntity.getData().get(i);
        if (fseCompanyPunch==null) {
            throw new BaseException(SystemCode.COMPANY_PUNCH_TIME_NOT_CONFIG.getValue(), SystemCode.COMPANY_PUNCH_TIME_NOT_CONFIG.getText(), this.getClass(), "listMonthReport");
        }
        //获取查询月份
        String yearAndMonth=fse.getString("yearAndMonth");
        if (StringUtils.isEmpty(yearAndMonth)) {
@@ -284,19 +302,24 @@
            dayOfWork=dayOfMonth-dtHoliday.getRows();
        }
        
        //workTimeMethod 0:上午上班,下午下班  1:一卡 2:四卡  3:上午上班,下午上班
        int workTimeMethod=0;
         if (StringUtils.isEmpty(fseCompanyPunch.getString("work_time_two")) && StringUtils.isEmpty(fseCompanyPunch.getString("work_time_three")) && StringUtils.isEmpty(fseCompanyPunch.getString("work_time_four"))) {
             workTimeMethod=1;
        } else if (!StringUtils.isEmpty(fseCompanyPunch.getString("work_time_two")) && !StringUtils.isEmpty(fseCompanyPunch.getString("work_time_three")) && !StringUtils.isEmpty(fseCompanyPunch.getString("work_time_four"))) {
            workTimeMethod=2;
        } else if (StringUtils.isEmpty(fseCompanyPunch.getString("work_time_two")) && StringUtils.isEmpty(fseCompanyPunch.getString("work_time_four"))) {
            workTimeMethod=3;
        }
        
        StringBuilder sb=new StringBuilder();
        List<Object>param=new ArrayList<>();
            String morinng_work = fseCompanyPunch.getValue("morning_work").toString().split(" ")[1];
            param.add(morinng_work);
            if(ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("morning_work_off"))&& ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("afternoon_work"))){
                String morinng_work_off = fseCompanyPunch.getValue("morning_work_off").toString().split(" ")[1];
                String afternoon_work = fseCompanyPunch.getValue("afternoon_work").toString().split(" ")[1];
                param.add(afternoon_work);
                param.add(morinng_work_off);
            }
            String afternoon_work_off = fseCompanyPunch.getValue("afternoon_work_off").toString().split(" ")[1];
            String uuid = fseCompanyPunch.getValue("uuid").toString();
            param.add(afternoon_work_off);
        param.add(yearAndMonth);
            param.add(uuid);
        param.add(yearAndMonth);
        param.add(yearAndMonth);
        sb.append(" SELECT ");
@@ -304,60 +327,57 @@
        sb.append(" (SELECT org_level_name FROM product_sys_org_levels WHERE uuid=dept_uuid)dept_uuid, ");
        sb.append(" dayOfWork,workDayOfMonth,lateCome,leaveEarly,total_hours,casual_leave,medical_leave,marriage_leave,paid_leave,other_leave,(dayOfWork-workDayOfMonth)absenteeism ");
        sb.append(" FROM ( ");
        sb.append(" SELECT ");
        sb.append(" a.created_by,"+dayOfWork+" dayOfWork,COUNT(day_of_month)workDayOfMonth,a.dept_uuid, ");
        if (workTimeMethod==0) {
            sb.append(" COUNT(IF(result1='迟到',TRUE,NULL)) lateCome, ");
            sb.append(" COUNT(IF(result4='早退',TRUE,NULL)) leaveEarly ");
        }else if (workTimeMethod==1) {
            sb.append(" COUNT(IF(result1='迟到',TRUE,NULL)) lateCome, ");
            sb.append(" 0 leaveEarly ");
        }else if (workTimeMethod==2) {
            sb.append(" COUNT(IF(result1='迟到',TRUE,NULL))+COUNT(IF(result3='迟到',TRUE,NULL)) lateCome, ");
            sb.append(" COUNT(IF(result2='早退',TRUE,NULL))+COUNT(IF(result4='早退',TRUE,NULL)) leaveEarly ");
        }else if (workTimeMethod==3) {
            sb.append(" COUNT(IF(result1='迟到',TRUE,NULL))+COUNT(IF(result3='迟到',TRUE,NULL)) lateCome, ");
            sb.append(" 0 leaveEarly ");
        }
        /*
        if (workTimeMethod==1) {
            sb.append(" COUNT(IF(result1='迟到',TRUE,NULL))+COUNT(IF(result3='迟到',TRUE,NULL)) lateCome, ");
            sb.append(" COUNT(IF(result2='早退',TRUE,NULL))+COUNT(IF(result4='早退',TRUE,NULL)) leaveEarly ");
        } else if (workTimeMethod==2) {
            sb.append("");
        } else if (workTimeMethod==3) {
            if(ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("morning_work_off"))&& ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("afternoon_work"))){
                sb.append(" SELECT b.created_by,b.dayOfWork,b.workDayOfMonth,b.dept_uuid,b.lateCome1+b.lateCome2 lateCome,b.leaveEarly1+b.leaveEarly2 leaveEarly");
        } else {
            sb.append(" COUNT(IF(result1='迟到',TRUE,NULL)) lateCome, ");
            sb.append(" COUNT(IF(result4='早退',TRUE,NULL)) leaveEarly ");
                sb.append(" SELECT b.created_by,b.dayOfWork,b.workDayOfMonth,b.dept_uuid,b.lateCome1 lateCome,b.leaveEarly2 leaveEarly");
        }
        */
        sb.append(" FROM ( ");
        sb.append(" SELECT ");
        sb.append(" created_by,dept_uuid, ");
        sb.append(" DATE_FORMAT(created_utc_datetime,'%Y-%m-%d') day_of_month, ");
        sb.append(" punch_time_one,IF(punch_time_one IS TRUE,IF(DATE_FORMAT(punch_time_one,'%H:%i:%S')>'09:00:00','迟到','正常'),'未打卡') result1 ");
            sb.append(" a.created_by,"+dayOfWork+" dayOfWork,COUNT(day_of_month)workDayOfMonth,a.dept_uuid, ");
            sb.append(" COUNT(");
            sb.append(" IF ");
            sb.append(" ( result1 = '迟到', TRUE, NULL )) lateCome1,");
            if(ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("morning_work_off"))&& ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("afternoon_work"))){
                sb.append(" COUNT(");
                sb.append(" IF ");
                sb.append(" ( result2 = '迟到', TRUE, NULL )) lateCome2,");
                sb.append(" COUNT(");
                sb.append(" IF ");
                sb.append(" ( result3 = '早退', TRUE, NULL )) leaveEarly1,");
        
//        sb.append(" punch_time_two,IF(punch_time_two IS TRUE,IF(DATE_FORMAT(punch_time_two,'%H:%i:%S')<'12:00:00','早退','正常'),'未打卡') result2, ");
//        sb.append(" punch_time_three,IF(punch_time_three IS TRUE,IF(DATE_FORMAT(punch_time_three,'%H:%i:%S')>'14:00:00','迟到','正常'),'未打卡') result3, ");
//        sb.append(" punch_time_four,IF(punch_time_four IS TRUE,IF(DATE_FORMAT(punch_time_four,'%H:%i:%S')<'17:00:00','早退','正常'),'未打卡') result4 ");
        if (workTimeMethod==0) {
            sb.append(", punch_time_four,IF(punch_time_four IS TRUE,IF(DATE_FORMAT(punch_time_four,'%H:%i:%S')<'17:00:00','早退','正常'),'未打卡') result4 ");
        }else if (workTimeMethod==2) {
            sb.append(", punch_time_two,IF(punch_time_two IS TRUE,IF(DATE_FORMAT(punch_time_two,'%H:%i:%S')<'12:00:00','早退','正常'),'未打卡') result2 ");
            sb.append(", punch_time_three,IF(punch_time_three IS TRUE,IF(DATE_FORMAT(punch_time_three,'%H:%i:%S')>'14:00:00','迟到','正常'),'未打卡') result3 ");
            sb.append(", punch_time_four,IF(punch_time_four IS TRUE,IF(DATE_FORMAT(punch_time_four,'%H:%i:%S')<'17:00:00','早退','正常'),'未打卡') result4 ");
        }else if (workTimeMethod==3) {
            sb.append(", punch_time_three,IF(punch_time_three IS TRUE,IF(DATE_FORMAT(punch_time_three,'%H:%i:%S')>'14:00:00','迟到','正常'),'未打卡') result3 ");
            }
            sb.append(" COUNT(");
            sb.append(" IF ");
            sb.append(" ( result4 = '早退', TRUE, NULL )) leaveEarly2 ");
            sb.append(" FROM ( ");
            sb.append(" SELECT d.created_by,d.dept_uuid,DATE_FORMAT( d.created_utc_datetime, '%Y-%m-%d' ) day_of_month,punch_time_one, ");
            sb.append(" IF ");
            sb.append(" ( punch_time_one IS TRUE, IF ( DATE_FORMAT( punch_time_one, '%H:%i:%S' )> ?, '迟到', '正常' ), '未打卡' ) ");
            sb.append(" result1 ,");
            if(ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("morning_work_off"))&& ObjectUtil.isNotEmpty(fseCompanyPunch.getValue("afternoon_work"))){
                sb.append(" IF ");
                sb.append(" ( punch_time_three IS TRUE, IF ( DATE_FORMAT( punch_time_three, '%H:%i:%S' )> ?, '迟到', '正常' ), '未打卡' ) ");
                sb.append(" result2 ,");
                sb.append(" IF ");
                sb.append(" ( punch_time_two IS TRUE, IF ( DATE_FORMAT( punch_time_two, '%H:%i:%S' )< ?, '早退', '正常' ), '未打卡' ) ");
                sb.append(" result3 ,");
        }
        
        sb.append(" FROM product_oa_punch_record ");
        sb.append(" WHERE DATE_FORMAT(created_utc_datetime,'%Y-%m')=? AND DATE_FORMAT(punch_time_one,'%Y-%m-%d') NOT IN(SELECT date_holiday FROM product_sys_company_holiday) ");
            sb.append(" IF ");
            sb.append(" ( punch_time_four IS TRUE, IF ( DATE_FORMAT( punch_time_four, '%H:%i:%S' ) < ?, '早退', '正常' ), '未打卡' ) ");
            sb.append(" result4 ");
            sb.append(" FROM product_oa_punch_record d ");
            sb.append(" left JOIN   product_oa_punch_time e ");
            sb.append(" on d.punch_congfig_uuid=e.punch_site_uuid ");
            sb.append(" and DATE_FORMAT( d.created_utc_datetime,'%Y-%m')=? AND DATE_FORMAT(punch_time_one,'%Y-%m-%d') NOT IN(SELECT date_holiday FROM product_sys_company_holiday) ");
            sb.append(" where e.uuid=? ");
        sb.append(" )a  ");
        sb.append(" GROUP BY a.created_by,a.dept_uuid ");
            sb.append(" )b");
        sb.append(" )a ");
        sb.append(" LEFT JOIN (SELECT user_id,sum(total_hours)total_hours FROM product_oa_work_overtime WHERE flow_flag=2 AND DATE_FORMAT(start_time,'%Y-%m')=? GROUP BY user_id)b  ");
            sb.append(" LEFT JOIN (SELECT user_id, sum( duration ) total_hours FROM product_oa_work_overtime o left join product_oa_work_overtime_sub b on o.uuid=b.main_uuid and   DATE_FORMAT( b.start_time, '%Y-%m' )=? GROUP BY o.user_id)b  ");
        sb.append(" ON a.created_by=b.user_id ");
        sb.append(" LEFT JOIN ( ");
        sb.append(" SELECT ");
@@ -370,7 +390,30 @@
        sb.append(" )c ");
        sb.append(" ON a.created_by=c.created_by ");
        sb.append(" ORDER BY dept_uuid,a.created_by ");
            DataTableEntity dataTableEntityReport = baseDao.listTable(sb.toString(), param.toArray());
            if(dataTableEntityReport.getRows()!=0){
                dataTableEntityLits.add(baseDao.listTable(sb.toString(), param.toArray()));
            }
        
        return baseDao.listTable(sb.toString(), param.toArray());
        }
        DataTableEntity dataTableEntity1=new DataTableEntity();
        if(ObjectUtil.isNotEmpty(dataTableEntityLits)){
            dataTableEntity1=dataTableEntityLits.get(0);
            //本月内迟到早退数的累加
            for (int i = 1; i < dataTableEntityLits.size(); i++) {
                FieldSetEntity fieldSetEntity = dataTableEntityLits.get(i).getData().get(0);
                FieldSetEntity fieldSetEntity1 = dataTableEntity1.getData().get(0);
                dataTableEntity1.getData().get(0).setValue("lateCome",Integer.parseInt(fieldSetEntity.getValue("lateCome").toString())+Integer.parseInt(fieldSetEntity1.getValue("lateCome").toString()));
                dataTableEntity1.getData().get(0).setValue("leaveEarly",Integer.parseInt(fieldSetEntity.getValue("leaveEarly").toString())+Integer.parseInt(fieldSetEntity1.getValue("leaveEarly").toString()));
                dataTableEntity1.getData().get(0).setValue("workDayOfMonth",Integer.parseInt(fieldSetEntity.getValue("workDayOfMonth").toString())+Integer.parseInt(fieldSetEntity1.getValue("workDayOfMonth").toString()));
                dataTableEntity1.getData().get(0).setValue("absenteeism",Integer.parseInt(fieldSetEntity1.getValue("absenteeism").toString())-Integer.parseInt(fieldSetEntity.getValue("workDayOfMonth").toString()));
            }
        }
        return  dataTableEntity1;
    }
}