| | |
| | | sb.append(" (SELECT 0 UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5) t4, "); |
| | | sb.append(" (SELECT @row := -1) t0) d WHERE i < DAY(last_day(DATE_FORMAT(?, '%Y-%m-01')))) a "); |
| | | param.add(yearAndMonth+"-01"); |
| | | sb.append(" LEFT JOIN (SELECT * FROM product_oa_ask_for_leave WHERE user_id=?) b "); |
| | | sb.append(" LEFT JOIN (SELECT * FROM product_oa_ask_for_leave WHERE user_id=? and flow_flag=2) b "); |
| | | param.add(user_id); |
| | | sb.append(" on DATE_FORMAT( a.punch_date, '%Y-%m-%d' )>= DATE_FORMAT( b.start_time, '%Y-%m-%d' ) and DATE_FORMAT( a.punch_date, '%Y-%m-%d' )<= DATE_FORMAT( b.end_time, '%Y-%m-%d' ) "); |
| | | sb.append(" LEFT JOIN (SELECT * FROM product_sys_dict where dict_name='Leave_Type') c on b.leave_type =c.dict_value "); |
| | | sb.append(" LEFT JOIN product_oa_punch_record d on a.punch_date=DATE_FORMAT( d.punch_time_one, '%Y-%m-%d' ) "); |
| | | sb.append(" LEFT JOIN (SELECT applicant,DATE_FORMAT( replenish_date, '%Y-%m-%d') replenish_date,max(replacement_card_type) bk FROM product_oa_replenish_punch "); |
| | | sb.append(" where applicant=? GROUP BY applicant,DATE_FORMAT( replenish_date, '%Y-%m-%d')) e on a.punch_date=e.replenish_date "); |
| | | sb.append(" where applicant=? and flow_flag=2 GROUP BY applicant,DATE_FORMAT( replenish_date, '%Y-%m-%d')) e on a.punch_date=e.replenish_date "); |
| | | param.add(user_id); |
| | | sb.append(" LEFT JOIN product_oa_punch_time f on d.punch_congfig_uuid =f.punch_site_uuid "); |
| | | sb.append(" where a.punch_date NOT IN (SELECT DATE_FORMAT( date_holiday, '%Y-%m-%d' ) FROM product_sys_company_holiday) "); |
| | | DataTableEntity dt = baseDao.listTable(sb.toString(), param.toArray()); |
| | | for (int i = 0; i < dt.getRows(); i++) { |
| | | FieldSetEntity fs = dt.getFieldSetEntity(i); |
| | | if ("2024-08-07".equals(fs.getString("punch_date"))){ |
| | | System.out.println(fs.getString("punch_date")); |
| | | } |
| | | //获取补卡标识 |
| | | List<String> bk=new ArrayList<>(); |
| | | if (!StringUtils.isEmpty(fs.getString("bk"))){ |
| | |
| | | sb.append(" sum(IF(leave_type=9,TRUE,0))marriage_leave,sum(IF(leave_type=4,TRUE,0))paid_leave, "); |
| | | sb.append(" sum(IF(leave_type!=1 && leave_type!=2 && leave_type!=4 && leave_type!=9,TRUE,0))other_leave "); |
| | | sb.append(" FROM product_oa_ask_for_leave "); |
| | | sb.append(" WHERE DATE_FORMAT(start_time,'%Y-%m')=? "); |
| | | sb.append(" WHERE DATE_FORMAT(start_time,'%Y-%m')=? and flow_flag=2 "); |
| | | sb.append(" GROUP BY created_by "); |
| | | sb.append(" )c "); |
| | | sb.append(" ON a.created_by=c.created_by "); |
| | |
| | | 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())); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | //处理补卡的情况 |
| | | List<Object>param2=new ArrayList<>(); |
| | | param2.add(currentUser); |
| | | param2.add(fse.getString("yearAndMonth")); |
| | | |
| | | StringBuilder sbReplenish=new StringBuilder(); |
| | | sbReplenish.append(" SELECT DISTINCT replenish_date "); |
| | | sbReplenish.append(" FROM product_oa_replenish_punch "); |
| | | sbReplenish.append(" WHERE"); |
| | | sbReplenish.append(" created_by =? and flow_flag=2"); |
| | | sbReplenish.append(" AND DATE_FORMAT( replenish_date, '%Y-%m' )=? "); |
| | | sbReplenish.append(" and DATE_FORMAT( replenish_date, '%Y-%m-%d') "); |
| | | sbReplenish.append(" not in ("); |
| | | sbReplenish.append(" SELECT DISTINCT record_data FROM "); |
| | | sbReplenish.append(" ( "); |
| | | sbReplenish.append(" select DATE_FORMAT(punch_time_one, '%Y-%m-%d') as record_data from product_oa_punch_record "); |
| | | sbReplenish.append(" union all select DATE_FORMAT(punch_time_two, '%Y-%m-%d') as record_data from product_oa_punch_record"); |
| | | sbReplenish.append(" union all select DATE_FORMAT(punch_time_three, '%Y-%m-%d') as record_data from product_oa_punch_record"); |
| | | sbReplenish.append(" union all select DATE_FORMAT(punch_time_four, '%Y-%m-%d') as record_data from product_oa_punch_record"); |
| | | sbReplenish.append(" )n )"); |
| | | DataTableEntity dataTableEntityReplenish = baseDao.listTable(sbReplenish.toString(), param2.toArray()); |
| | | if(dataTableEntityReplenish.getRows()!=0){ |
| | | dataTableEntity1.getData().get(0).setValue("workDayOfMonth",Integer.parseInt(dataTableEntity1.getData().get(0).getString("workDayOfMonth"))+dataTableEntityReplenish.getRows()); |
| | | dataTableEntity1.getData().get(0).setValue("dayOfWork",Integer.parseInt(dataTableEntity1.getData().get(0).getString("dayOfWork"))-dataTableEntityReplenish.getRows()); |
| | | } |
| | | |
| | | return dataTableEntity1; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |