许鹏程
2024-08-20 0e730e50ae1adcd416fb929b37f022e595d88d79
src/main/java/com/product/administration/service/WorkAttendanceKanbanService.java
@@ -185,9 +185,6 @@
      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"))){
@@ -410,13 +407,43 @@
            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 =? ");
      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;
   }
}