|
@@ -243,7 +243,7 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
//}
|
|
|
logger.error("_alertLeaderExceptionTotal endDate: " + sdf.format(endDate));
|
|
|
//1.查询异常数据
|
|
|
- List<Map<String, Object>> exceptionDataList = getAttendanceExceptionDataForLeader(ctx, monday, endDate);
|
|
|
+ List<Map<String, Object>> exceptionDataList = getAttendanceExceptionDataForLeader(ctx, monday, endDate, pushTypeEnum);
|
|
|
String mondayFormat = DateTimeUtils.format(monday, "yyyy年MM月dd日");
|
|
|
String endDateFormat = DateTimeUtils.format(endDate, "yyyy年MM月dd日");
|
|
|
for (String orgLongNumber : leaders.keySet()) {
|
|
@@ -268,8 +268,6 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
Set<String> earlyLeaveEmployees = new HashSet<>();
|
|
|
//旷工人数
|
|
|
Set<String> absentEmployees = new HashSet<>();
|
|
|
- //个人原因补卡人数
|
|
|
- //Set<String> personalRecheckCountEmployees = new HashSet<>();
|
|
|
//异常人数
|
|
|
Set<String> exceptionEmployees = new HashSet<>();
|
|
|
//遍历人员
|
|
@@ -296,13 +294,12 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
//旷工
|
|
|
absentEmployees.add(personNumber);
|
|
|
}
|
|
|
-// if(attendanceFlags.get("personalRecheckCountEmployees")){
|
|
|
-// //个人原因补卡
|
|
|
-// personalRecheckCountEmployees.add(personNumber);
|
|
|
-// }
|
|
|
}
|
|
|
});
|
|
|
- //发送异常消息
|
|
|
+ if (syncAttendanceDataBeans.isEmpty()) {
|
|
|
+ //没有异常数据,不发送
|
|
|
+ continue;
|
|
|
+ }
|
|
|
JSONObject dingMsgBean = new JSONObject();
|
|
|
dingMsgBean.put("msgTempCode", "work_notice_01");
|
|
|
dingMsgBean.put("toAllUser", false);
|
|
@@ -326,6 +323,7 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
//中心
|
|
|
param.put("depart", orgName);
|
|
|
dingMsgBean.put("param", param);
|
|
|
+ //发送异常消息
|
|
|
sendAttendanceExceptionMsg(dingMsgBean, logInfo);
|
|
|
//推送异常数据
|
|
|
pushAttendanceExceptionData(syncAttendanceDataBeans, logInfo);
|
|
@@ -366,16 +364,15 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
PushTypeEnum pushType,
|
|
|
int limit
|
|
|
) throws BOSException {
|
|
|
- String sql = getSql(startDate, endDate);
|
|
|
+ String sql = getSql(startDate, endDate, pushType);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
try {
|
|
|
IRowSet iRowSet = DBUtil.executeQuery(ctx, sql);
|
|
|
Map<String, List<SyncAttendanceDataBean>> result = new HashMap<>();
|
|
|
Map<String, Integer> personExceptionTimes = new HashMap<>();
|
|
|
- //非中心负责人提醒
|
|
|
while (iRowSet.next()) {
|
|
|
//设置考勤结果和次数
|
|
|
- SyncAttendanceDataBean data = setAttendanceResult(iRowSet, sdf);
|
|
|
+ SyncAttendanceDataBean data = setAttendanceResult(iRowSet, sdf, pushType);
|
|
|
int times = data.getTimes();
|
|
|
String personNumber = data.getEmployeeId();
|
|
|
//累计员工期间总异常次数
|
|
@@ -423,9 +420,10 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
protected List<Map<String, Object>> getAttendanceExceptionDataForLeader(
|
|
|
Context ctx,
|
|
|
Date startDate,
|
|
|
- Date endDate
|
|
|
+ Date endDate,
|
|
|
+ PushTypeEnum pushType
|
|
|
) throws BOSException {
|
|
|
- String sql = getSql(startDate, endDate);
|
|
|
+ String sql = getSql(startDate, endDate, pushType);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
List<Map<String, Object>> attendanceExceptionDatas = new ArrayList<Map<String, Object>>();
|
|
|
try {
|
|
@@ -433,12 +431,11 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
while (iRowSet.next()) {
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
//设置考勤结果和次数
|
|
|
- SyncAttendanceDataBean data = setAttendanceResult(iRowSet, sdf);
|
|
|
+ SyncAttendanceDataBean data = setAttendanceResult(iRowSet, sdf, pushType);
|
|
|
Map<String, Boolean> attendanceFlags = new LinkedHashMap<>();
|
|
|
attendanceFlags.put("lateEmployees", iRowSet.getInt("s19") > 0);//迟到
|
|
|
attendanceFlags.put("earlyLeaveEmployees", iRowSet.getInt("s21") > 0);//早退
|
|
|
attendanceFlags.put("absentEmployees", iRowSet.getBigDecimal("s23").compareTo(BigDecimal.ZERO) > 0);//旷工
|
|
|
- attendanceFlags.put("personalRecheckCountEmployees", iRowSet.getInt("s113") > 0);//个人原因补卡
|
|
|
map.put("data", data);
|
|
|
map.put("attendanceFlags", attendanceFlags);
|
|
|
attendanceExceptionDatas.add(map);
|
|
@@ -457,7 +454,11 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
* @param sdf
|
|
|
* @throws SQLException
|
|
|
*/
|
|
|
- protected SyncAttendanceDataBean setAttendanceResult(IRowSet iRowSet, SimpleDateFormat sdf) throws SQLException {
|
|
|
+ protected SyncAttendanceDataBean setAttendanceResult(
|
|
|
+ IRowSet iRowSet,
|
|
|
+ SimpleDateFormat sdf,
|
|
|
+ PushTypeEnum pushType
|
|
|
+ ) throws SQLException {
|
|
|
SyncAttendanceDataBean data = new SyncAttendanceDataBean();
|
|
|
data.setEmployeeId(iRowSet.getString("personNumber"));
|
|
|
data.setEmployeeName(iRowSet.getString("personName"));
|
|
@@ -480,11 +481,14 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
int s19 = iRowSet.getInt("s19");
|
|
|
int s21 = iRowSet.getInt("s21");
|
|
|
BigDecimal s23 = iRowSet.getBigDecimal("s23");
|
|
|
- int s113 = iRowSet.getInt("s113");
|
|
|
attendanceFlags.put("迟到", s19 > 0);
|
|
|
attendanceFlags.put("早退", s21 > 0);
|
|
|
attendanceFlags.put("旷工", s23.compareTo(BigDecimal.ZERO) > 0);
|
|
|
- attendanceFlags.put("个人原因补卡次数", s113 > 0);
|
|
|
+ if (PushTypeEnum.EMPLOYEEEXCEPTIONALERT.equals(pushType)) {
|
|
|
+ //员工考勤异常关怀 需要统计 个人原因补卡次数
|
|
|
+ int s113 = iRowSet.getInt("s113");
|
|
|
+ attendanceFlags.put("个人原因补卡次数", s113 > 0);
|
|
|
+ }
|
|
|
for (Map.Entry<String, Boolean> entry : attendanceFlags.entrySet()) {
|
|
|
if (entry.getValue()) {
|
|
|
times++;
|
|
@@ -510,7 +514,8 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
*/
|
|
|
protected String getSql(
|
|
|
Date startDate,
|
|
|
- Date endDate
|
|
|
+ Date endDate,
|
|
|
+ PushTypeEnum pushType
|
|
|
) throws BOSException {
|
|
|
if (startDate == null || endDate == null) {
|
|
|
logger.error("getAttendanceExceptionData startDate or endDate is null");
|
|
@@ -547,9 +552,12 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
.append(" and (").append("\n")
|
|
|
.append(" attendanceResult.s19 > 0").append("\n")
|
|
|
.append(" or attendanceResult.s21 > 0").append("\n")
|
|
|
- .append(" or attendanceResult.s23 > 0").append("\n")
|
|
|
- .append(" or attendanceResult.S113 > 0").append("\n")
|
|
|
- .append(" );").append("\n");
|
|
|
+ .append(" or attendanceResult.s23 > 0").append("\n");
|
|
|
+ if (PushTypeEnum.EMPLOYEEEXCEPTIONALERT.equals(pushType)) {
|
|
|
+ //员工考勤异常关怀 需要统计 个人原因补卡次数
|
|
|
+ sql.append(" or attendanceResult.S113 > 0").append("\n");
|
|
|
+ }
|
|
|
+ sql.append(" );").append("\n");
|
|
|
if (logger.isInfoEnabled()) {
|
|
|
logger.info(String.format("AttendanceExceptionFacadeControllerBean.getSql: %s", sql.toString()));
|
|
|
}
|