Explorar o código

[task-5459] 考勤重构:
修改异常次数包含旷工次数,修改支持工号查询,分钟改小时

xiexh hai 8 meses
pai
achega
255bf358aa

+ 19 - 5
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/components/sqlzdy/Service/SwdlServiceImpl.java

@@ -700,13 +700,13 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
                 boolean hasAttendance = false;
                 boolean isNormalDay = true;
                 boolean isAbnormalDay = false;
+                boolean isAbsenteeism = false;//改天是否存在旷工班次
 
                 boolean existAttendanceDay = false;// 非休息班次标记,当天只有有一个非休息班次就统计为true
                 // 比较当前记录日期与系统日期
                 int dateCompare = date.compareTo(systemDate);
                 //应出勤天数过滤,一天需要出勤多个班次只统计为一天
                 Map shouldAttendance = new HashMap<String,Object>();
-
                 for (Map<String, Object> record : dateRecords) {//统计次数放里面
                     String shiftName = BeanUtils.isNotEmpty("ban_ci_ming_") ? (String) record.get("ban_ci_ming_") : "";
                     String status1 = BeanUtils.isNotEmpty("zhuang_tai_1_") ? (String) record.get("zhuang_tai_1_") : "";
@@ -792,16 +792,18 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
                     if (dateCompare < 0) {
                         if (checkIn1 == null || checkIn1.isEmpty()) {
                             increment(userStats, "kuang_gong_ci_shu", 1);
+                            isAbsenteeism = true;
                         }
                         if (checkIn2 == null || checkIn2.isEmpty()) {
                             increment(userStats, "kuang_gong_ci_shu", 1);
+                            isAbsenteeism = true;
                         }
                     }
 
-                    // 8. 班次时长统计
+                    // 8. 班次时长统计,标准工作时长
                     if (shiftDuration != null && !shiftDuration.isEmpty()) {
                         try {
-                            double duration = Double.parseDouble(shiftDuration);
+                            double duration = Double.parseDouble(shiftDuration)/60;
                             addTo(userStats, "ban_ci_shi_chang", duration);
                         } catch (NumberFormatException e) {
                             // 忽略格式错误
@@ -811,7 +813,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
                     // 9. 实际工作时长统计
                     if (workDuration != null && !workDuration.isEmpty()) {
                         try {
-                            double duration = Double.parseDouble(workDuration);
+                            double duration = Double.parseDouble(workDuration)/60;
                             addTo(userStats, "gong_zuo_shi_chang", duration);
                         } catch (NumberFormatException e) {
                             // 忽略格式错误
@@ -862,8 +864,19 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
                 if (!isRestDay && isAbnormalDay && dateCompare <= 0) {
                     increment(userStats, "yi_chang_tian_shu", 1);
                 }
-            }
 
+               /* //旷工天数
+                if(!isRestDay && existAttendanceDay && isAbsenteeism && dateCompare < 0){
+                    increment(userStats, "kuang_gong_tian_shu", 1);
+                }*/
+            }
+            //异常次数需要包含旷工次数,异常天数也需要包含旷工天数
+            int numkgcs = (Integer) userStats.get("kuang_gong_ci_shu");
+            int numyccs = (Integer) userStats.get("yi_chang_ci_shu");
+            int yiChangCiShu = (numkgcs + numyccs);
+            userStats.put("yi_chang_ci_shu",yiChangCiShu);
+            //String yiChangTianShu = userStats.get("yi_chang_tian_shu").toString() + userStats.get("kuang_gong_tian_shu").toString();
+            //userStats.put("yi_chang_tian_shu",yiChangTianShu);
             // 将用户统计结果添加到List中
             resultList.add(userStats);
         }
@@ -887,6 +900,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
         stats.put("user_name_",userRecords.get(0).get("user_name_"));
         stats.put("pos_name_",userRecords.get(0).get("pos_name_"));
         stats.put("gong_hao_",userRecords.get(0).get("gong_hao_"));
+        stats.put("kuang_gong_tian_shu", 0);
         return stats;
     }