|
|
@@ -693,10 +693,10 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
// 按用户ID分组
|
|
|
Map<String, List<Map<String, Object>>> recordsByUser = new HashMap<>();
|
|
|
|
|
|
- // 存储每个用户的考勤统计结果(改为List)
|
|
|
+ // 存储每个用户的考勤统计结果
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
- // 存储每个用户的考勤概况结果(改为List)
|
|
|
- List<Map<String, Object>> resultList2 = new ArrayList<>();
|
|
|
+ // 存储每个用户的考勤概况结果
|
|
|
+ List<Map<String, Object>> attendanceSummaryList = new ArrayList<>();
|
|
|
|
|
|
if(attendanceRecords.isEmpty()){
|
|
|
return resultList;
|
|
|
@@ -725,7 +725,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
recordsByDate.computeIfAbsent(date, k -> new ArrayList<>()).add(record);
|
|
|
}
|
|
|
|
|
|
- // 统计每个日期的数据
|
|
|
+ // 统计每个用户每个日期的数据
|
|
|
for (Map.Entry<String, List<Map<String, Object>>> dateEntry : recordsByDate.entrySet()) {//统计天数
|
|
|
Map<String, Object> initUserEveryDayStats = initUserStatsEveryDay(userRecords);//考勤概况,每个用户每天统计一次
|
|
|
String date = dateEntry.getKey();
|
|
|
@@ -743,6 +743,8 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
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_") : "";
|
|
|
@@ -763,27 +765,27 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
workDuration = record.get("gong_zuo_shi_chan").toString();
|
|
|
}
|
|
|
|
|
|
- // 1. 应出勤天数统计(多个班次只有一个不是休息就算应出勤)
|
|
|
- if (!REST_SHIFT.equals(shiftName) && !shouldAttendance.containsKey(date)) {
|
|
|
+ // 1. 应出勤天数统计 港大没有排班不清楚应出勤天数是多少,暂时统计应出勤天数就是实际打卡天数,不打卡的不统计
|
|
|
+ if (!shouldAttendance.containsKey(date)) {
|
|
|
increment(userStats, "ying_chu_qin_tian_shu", 1);
|
|
|
shouldAttendance.put(date,1);
|
|
|
existAttendanceDay = true;
|
|
|
}
|
|
|
|
|
|
- // 2. 休息天数统计
|
|
|
+ /* // 2. 休息天数统计
|
|
|
if (REST_SHIFT.equals(shiftName)) {
|
|
|
// increment(userStats, "xiu_xi_tian_shu", 1);
|
|
|
isRestDay = true;
|
|
|
getAttendanceResult(initUserEveryDayStats);
|
|
|
- resultList2.add(initUserEveryDayStats);// 休息日不参与其他统计考勤概况后面会丢失这条休息数据,故在这里加上
|
|
|
+ attendanceSummaryList.add(initUserEveryDayStats);// 休息日不参与其他统计考勤概况后面会丢失这条休息数据,故在这里加上
|
|
|
continue; // 休息日不参与其他统计
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// 3. 实际出勤天数统计(有打卡记录)
|
|
|
if ((checkIn1 != null && !checkIn1.isEmpty()) ||
|
|
|
(checkIn2 != null && !checkIn2.isEmpty())) {
|
|
|
//考勤统计
|
|
|
- hasAttendance = true;
|
|
|
+ hasAttendance = true;
|
|
|
//考勤概况
|
|
|
if(checkIn1 != null && !checkIn1.isEmpty()){
|
|
|
increment(initUserEveryDayStats, "da_ka_ci_shu_", 1);
|
|
|
@@ -813,7 +815,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
|
|
|
// 4. 异常次数统计(不再把旷工统计到异常里面,只有异常统计为异常)
|
|
|
if (dateCompare <= 0) { // 只统计今天及之前的记录
|
|
|
- if (dateCompare < 0) {
|
|
|
+ //if (dateCompare < 0) {
|
|
|
// 历史日期
|
|
|
//if (status1 == null || status1.isEmpty() || ABNORMAL_STATUS.equals(status1)) {
|
|
|
if (ABNORMAL_STATUS.equals(status1)) {
|
|
|
@@ -823,7 +825,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
if (ABNORMAL_STATUS.equals(status2)) {
|
|
|
increment(userStats, "yi_chang_ci_shu", 1);
|
|
|
}
|
|
|
- } else {
|
|
|
+ /*} else {
|
|
|
// 当天日期
|
|
|
if (ABNORMAL_STATUS.equals(status1)) {
|
|
|
increment(userStats, "yi_chang_ci_shu", 1);
|
|
|
@@ -831,17 +833,17 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
if (ABNORMAL_STATUS.equals(status2)) {
|
|
|
increment(userStats, "yi_chang_ci_shu", 1);
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
- // 5. 迟到次数统计-上班异常算迟到,提前下班也算迟到(迟到/早退)
|
|
|
- if (ABNORMAL_STATUS.equals(status1)) {
|
|
|
+ // 5. 迟到次数统计-上班异常算迟到,提前下班算早退(迟到/早退)
|
|
|
+ if (ABNORMAL_STATUS.equals(status1) && BeanUtils.isNotEmpty(checkIn1)) {//打下班卡的时候如果上班卡没有打卡会自动设置为异常所以这里需要去掉这次异常统计
|
|
|
increment(userStats, "chi_dao_ci_shu", 1);
|
|
|
increment(initUserEveryDayStats, "chi_dao_ci_shu", 1);
|
|
|
}
|
|
|
- if (ABNORMAL_STATUS.equals(status2)) {
|
|
|
- increment(userStats, "chi_dao_ci_shu", 1);
|
|
|
- increment(initUserEveryDayStats, "chi_dao_ci_shu", 1);
|
|
|
+ if (ABNORMAL_STATUS.equals(status2) && BeanUtils.isNotEmpty(checkIn2)) {
|
|
|
+ increment(userStats, "zao_tui_ci_shu", 1);
|
|
|
+ increment(initUserEveryDayStats, "zao_tui_ci_shu", 1);
|
|
|
}
|
|
|
|
|
|
// 6. 迟到时长统计
|
|
|
@@ -945,7 +947,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
increment(userStats, "kuang_gong_tian_shu", 1);
|
|
|
}*/
|
|
|
getAttendanceResult(initUserEveryDayStats);
|
|
|
- resultList2.add(initUserEveryDayStats);
|
|
|
+ attendanceSummaryList.add(initUserEveryDayStats);
|
|
|
}
|
|
|
//异常次数需要包含旷工次数,异常天数也需要包含旷工天数
|
|
|
int numkgcs = (Integer) userStats.get("kuang_gong_ci_shu");
|
|
|
@@ -959,7 +961,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
}
|
|
|
//type 为2时候返回考勤概况数据,其他情况默认返回考勤统计数据
|
|
|
if("2".equals(type)){
|
|
|
- return resultList2;
|
|
|
+ return attendanceSummaryList;
|
|
|
}
|
|
|
return resultList;
|
|
|
}
|
|
|
@@ -970,11 +972,17 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
|
|
|
int chiDaoCount = (Integer) initUserEveryDayStats.get("chi_dao_ci_shu");
|
|
|
int queQinCount = (Integer) initUserEveryDayStats.get("que_qin_ci_shu");
|
|
|
+ int zaoTuiCount = (Integer) initUserEveryDayStats.get("zao_tui_ci_shu");
|
|
|
|
|
|
if (chiDaoCount > 0) {
|
|
|
statusBuilder.append("迟到").append(chiDaoCount).append("次");
|
|
|
}
|
|
|
-
|
|
|
+ if (zaoTuiCount > 0) {
|
|
|
+ if (statusBuilder.length() > 0) {
|
|
|
+ statusBuilder.append(",");
|
|
|
+ }
|
|
|
+ statusBuilder.append("早退").append(zaoTuiCount).append("次");
|
|
|
+ }
|
|
|
if (queQinCount > 0) {
|
|
|
if (statusBuilder.length() > 0) {
|
|
|
statusBuilder.append(",");
|
|
|
@@ -1022,6 +1030,8 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
stats.put("chi_dao_ci_shu", 0);
|
|
|
stats.put("que_qin_ci_shu", 0);
|
|
|
|
|
|
+ stats.put("zao_tui_ci_shu", 0);
|
|
|
+
|
|
|
return stats;
|
|
|
}
|
|
|
|