|
@@ -695,10 +695,10 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
|
|
|
|
|
// 初始化统计指标
|
|
// 初始化统计指标
|
|
|
Map<String, Object> userStats = initUserStats(userRecords);//考勤统计
|
|
Map<String, Object> userStats = initUserStats(userRecords);//考勤统计
|
|
|
- Map<String, Object> initUserEveryDayStats = initUserStatsEveryDay(userRecords);//考勤概况
|
|
|
|
|
|
|
+ //Map<String, Object> initUserEveryDayStats = initUserStatsEveryDay(userRecords);//考勤概况
|
|
|
|
|
|
|
|
userStats.put("user_id_", userId); // 添加用户ID到结果中
|
|
userStats.put("user_id_", userId); // 添加用户ID到结果中
|
|
|
- initUserEveryDayStats.put("user_id_", userId); // 添加用户ID到结果中
|
|
|
|
|
|
|
+ //initUserEveryDayStats.put("user_id_", userId); // 添加用户ID到结果中
|
|
|
|
|
|
|
|
// 按日期分组
|
|
// 按日期分组
|
|
|
Map<String, List<Map<String, Object>>> recordsByDate = new HashMap<>();
|
|
Map<String, List<Map<String, Object>>> recordsByDate = new HashMap<>();
|
|
@@ -709,9 +709,11 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
|
|
|
|
|
// 统计每个日期的数据
|
|
// 统计每个日期的数据
|
|
|
for (Map.Entry<String, List<Map<String, Object>>> dateEntry : recordsByDate.entrySet()) {//统计天数
|
|
for (Map.Entry<String, List<Map<String, Object>>> dateEntry : recordsByDate.entrySet()) {//统计天数
|
|
|
|
|
+ Map<String, Object> initUserEveryDayStats = initUserStatsEveryDay(userRecords);//考勤概况,每个用户每天统计一次
|
|
|
String date = dateEntry.getKey();
|
|
String date = dateEntry.getKey();
|
|
|
List<Map<String, Object>> dateRecords = dateEntry.getValue();//某个日期下的多个班次数据,同时存在早班,晚班等
|
|
List<Map<String, Object>> dateRecords = dateEntry.getValue();//某个日期下的多个班次数据,同时存在早班,晚班等
|
|
|
initUserEveryDayStats.put("ri_qi_", date); // 添加日期到考勤概况
|
|
initUserEveryDayStats.put("ri_qi_", date); // 添加日期到考勤概况
|
|
|
|
|
+ initUserEveryDayStats.put("user_id_", userId); // 添加用户ID到结果中
|
|
|
boolean isRestDay = false;
|
|
boolean isRestDay = false;
|
|
|
boolean hasAttendance = false;
|
|
boolean hasAttendance = false;
|
|
|
boolean isNormalDay = true;
|
|
boolean isNormalDay = true;
|
|
@@ -754,6 +756,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
if (REST_SHIFT.equals(shiftName)) {
|
|
if (REST_SHIFT.equals(shiftName)) {
|
|
|
// increment(userStats, "xiu_xi_tian_shu", 1);
|
|
// increment(userStats, "xiu_xi_tian_shu", 1);
|
|
|
isRestDay = true;
|
|
isRestDay = true;
|
|
|
|
|
+ getAttendanceResult(initUserEveryDayStats);
|
|
|
resultList2.add(initUserEveryDayStats);// 休息日不参与其他统计考勤概况后面会丢失这条休息数据,故在这里加上
|
|
resultList2.add(initUserEveryDayStats);// 休息日不参与其他统计考勤概况后面会丢失这条休息数据,故在这里加上
|
|
|
continue; // 休息日不参与其他统计
|
|
continue; // 休息日不参与其他统计
|
|
|
}
|
|
}
|
|
@@ -898,9 +901,10 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
isRestDay = false;
|
|
isRestDay = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 休息天数统计
|
|
|
|
|
|
|
+ // 休息天数统计(该日没有非休息的应出勤班次)
|
|
|
if (isRestDay) {
|
|
if (isRestDay) {
|
|
|
increment(userStats, "xiu_xi_tian_shu", 1);
|
|
increment(userStats, "xiu_xi_tian_shu", 1);
|
|
|
|
|
+ initUserEveryDayStats.put("kao_qing_jie_guo", "休息"); // 该天班次全为休息
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
// 实际出勤天数统计(按日期)
|
|
// 实际出勤天数统计(按日期)
|
|
@@ -922,6 +926,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
if(!isRestDay && existAttendanceDay && isAbsenteeism && dateCompare < 0){
|
|
if(!isRestDay && existAttendanceDay && isAbsenteeism && dateCompare < 0){
|
|
|
increment(userStats, "kuang_gong_tian_shu", 1);
|
|
increment(userStats, "kuang_gong_tian_shu", 1);
|
|
|
}*/
|
|
}*/
|
|
|
|
|
+ getAttendanceResult(initUserEveryDayStats);
|
|
|
resultList2.add(initUserEveryDayStats);
|
|
resultList2.add(initUserEveryDayStats);
|
|
|
}
|
|
}
|
|
|
//异常次数需要包含旷工次数,异常天数也需要包含旷工天数
|
|
//异常次数需要包含旷工次数,异常天数也需要包含旷工天数
|
|
@@ -941,6 +946,29 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
return resultList;
|
|
return resultList;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private void getAttendanceResult(Map<String, Object> initUserEveryDayStats) {
|
|
|
|
|
+ // 组装考勤状态信息
|
|
|
|
|
+ StringBuilder statusBuilder = new StringBuilder();
|
|
|
|
|
+
|
|
|
|
|
+ int chiDaoCount = (Integer) initUserEveryDayStats.get("chi_dao_ci_shu");
|
|
|
|
|
+ int queQinCount = (Integer) initUserEveryDayStats.get("que_qin_ci_shu");
|
|
|
|
|
+
|
|
|
|
|
+ if (chiDaoCount > 0) {
|
|
|
|
|
+ statusBuilder.append("迟到").append(chiDaoCount).append("次");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (queQinCount > 0) {
|
|
|
|
|
+ if (statusBuilder.length() > 0) {
|
|
|
|
|
+ statusBuilder.append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ statusBuilder.append("缺勤").append(queQinCount).append("次");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (statusBuilder.length() == 0) {
|
|
|
|
|
+ statusBuilder.append("正常");
|
|
|
|
|
+ }
|
|
|
|
|
+ initUserEveryDayStats.put("kao_qin_zhuang_tai", statusBuilder.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private Map<String, Object> initUserStats(List<Map<String, Object>> userRecords) {
|
|
private Map<String, Object> initUserStats(List<Map<String, Object>> userRecords) {
|
|
|
Map<String, Object> stats = new HashMap<>();
|
|
Map<String, Object> stats = new HashMap<>();
|
|
|
stats.put("yi_chang_ci_shu", 0);
|
|
stats.put("yi_chang_ci_shu", 0);
|
|
@@ -972,7 +1000,7 @@ public class SwdlServiceImpl extends GenericProvider implements SwdlService {
|
|
|
stats.put("da_ka_ci_shu_", 0);
|
|
stats.put("da_ka_ci_shu_", 0);
|
|
|
stats.put("ban_ci_shi_chang", 0.0);
|
|
stats.put("ban_ci_shi_chang", 0.0);
|
|
|
stats.put("gong_zuo_shi_chang", 0.0);
|
|
stats.put("gong_zuo_shi_chang", 0.0);
|
|
|
- stats.put("kao_qing_jie_guo", "");
|
|
|
|
|
|
|
+ stats.put("kao_qin_zhuang_tai", "");
|
|
|
stats.put("chi_dao_ci_shu", 0);
|
|
stats.put("chi_dao_ci_shu", 0);
|
|
|
stats.put("que_qin_ci_shu", 0);
|
|
stats.put("que_qin_ci_shu", 0);
|
|
|
|
|
|