|
@@ -34,26 +34,13 @@ import java.io.IOException;
|
|
|
import java.lang.String;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.sql.SQLException;
|
|
|
-import java.text.MessageFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceExceptionFacadeControllerBean {
|
|
|
private static Logger logger = Logger.getLogger(AttendanceExceptionFacadeControllerBean.class);
|
|
|
private Properties propt = new Properties();
|
|
|
- //通知员工个人消息模板
|
|
|
- //private static final String NOTIFYEMPLOYEEMSGTEMPLATE = "##### <font color=#6192f2>HR系统</font>\\n#### 考勤异常提醒:\\n您在{0}出现考勤异常,请及时处理! \\n###### (如有审批中的假勤单据,请及时催办)";
|
|
|
- //通知员工个人消息标题
|
|
|
- //private static final String NOTIFYEMPLOYEEMSGTITLE = "【考勤异常提醒】";
|
|
|
- //通知员工个人消息模板
|
|
|
- //private static final String NOTIFYEMPLOYEECUMULATIVEMSGTEMPLATE = "##### <font color=#6192f2>HR系统</font>\\n#### 员工考勤提醒:\\n您在{0}考勤异常次数已经达到{1}次,请您注意本月考勤 \\n###### (如有审批中的假勤单据,请及时催办)";
|
|
|
- //通知员工个人消息标题
|
|
|
- //private static final String NOTIFYEMPLOYEECUMULATIVEMSGTITLE = "【员工考勤提醒】";
|
|
|
- //通知提醒中心负责人异常消息模板
|
|
|
- //private static final String NOTIFYALERTLEADEREXCEPTIONMSGTEMPLATE = "##### <font color=#6192f2>HR系统</font>\\n#### 中心考勤异常周报:\\n#####时间:{0}-{1}\\n#####内容:{2}考勤人数{3}人,考勤异常人数{4}人,迟到{5}人,早退{6}人,旷工{7}人 \\n###### (如有审批中的假勤单据,请及时催办)";
|
|
|
- //通知提醒中心负责人异常消息标题
|
|
|
- //private static final String NOTIFYALERTLEADEREXCEPTIONMSGTITLE = "【考勤异常周报】";
|
|
|
-
|
|
|
//来源标识
|
|
|
private static final String SOURCE = "EHR";
|
|
|
|
|
@@ -170,7 +157,7 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
Date preDay = AtsDateUtils.getPreDay(today);
|
|
|
logger.error("_notifyEmployeeCumulativeException preDay: " + sdf.format(preDay));
|
|
|
//查询异常数据
|
|
|
- Map<String, List<SyncAttendanceDataBean>> exceptionData = getAttendanceExceptionData(ctx, currentFirstDay, preDay, pushTypeEnum, 0);
|
|
|
+ Map<String, List<SyncAttendanceDataBean>> exceptionData = getAttendanceExceptionData(ctx, currentFirstDay, preDay, pushTypeEnum, limit);
|
|
|
String yearMonth = DateTimeUtils.format(today, "yyyy年MM月");
|
|
|
for (String personNumber : exceptionData.keySet()) {
|
|
|
String msgId = UUID.randomUUID().toString();
|
|
@@ -362,35 +349,33 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
IRowSet iRowSet = DBUtil.executeQuery(ctx, sql);
|
|
|
Map<String, List<SyncAttendanceDataBean>> result = new HashMap<>();
|
|
|
Map<String, Integer> personExceptionTimes = new HashMap<>();
|
|
|
- if (!PushTypeEnum.CENTERLEADERREMINDER.equals(pushType)) {
|
|
|
- //非中心负责人提醒
|
|
|
- while (iRowSet.next()) {
|
|
|
- //设置考勤结果和次数
|
|
|
- SyncAttendanceDataBean data = setAttendanceResult(iRowSet, sdf);
|
|
|
- int times = data.getTimes();
|
|
|
- String personNumber = data.getEmployeeId();
|
|
|
- //累计员工期间总异常次数
|
|
|
- if (personExceptionTimes.containsKey(personNumber)) {
|
|
|
- Integer i = personExceptionTimes.get(personNumber);
|
|
|
- personExceptionTimes.put(personNumber, i + times);
|
|
|
- } else {
|
|
|
- personExceptionTimes.put(personNumber, times);
|
|
|
- }
|
|
|
- if (!result.containsKey(personNumber)) {
|
|
|
- result.put(personNumber, new ArrayList<>());
|
|
|
- }
|
|
|
- result.get(personNumber).add(data);
|
|
|
+ //非中心负责人提醒
|
|
|
+ while (iRowSet.next()) {
|
|
|
+ //设置考勤结果和次数
|
|
|
+ SyncAttendanceDataBean data = setAttendanceResult(iRowSet, sdf);
|
|
|
+ int times = data.getTimes();
|
|
|
+ String personNumber = data.getEmployeeId();
|
|
|
+ //累计员工期间总异常次数
|
|
|
+ if (personExceptionTimes.containsKey(personNumber)) {
|
|
|
+ Integer i = personExceptionTimes.get(personNumber);
|
|
|
+ personExceptionTimes.put(personNumber, i + times);
|
|
|
+ } else {
|
|
|
+ personExceptionTimes.put(personNumber, times);
|
|
|
}
|
|
|
- if (PushTypeEnum.EMPLOYEEEXCEPTIONALERT.equals(pushType)) {
|
|
|
- String yearMonth = DateTimeUtils.format(startDate, "yyyy年MM月");
|
|
|
- //获取提醒记录
|
|
|
- Set<String> remindRecord = getRemindRecord(ctx, yearMonth);
|
|
|
- //员工累计异常提醒
|
|
|
- for (Map.Entry<String, Integer> entry : personExceptionTimes.entrySet()) {
|
|
|
- if (entry.getValue() < limit || remindRecord.contains(entry.getKey())) {
|
|
|
- //移除没有达到预警上限的数据,获取已经提醒过的人员
|
|
|
- result.remove(entry.getKey());
|
|
|
- }
|
|
|
+ if (!result.containsKey(personNumber)) {
|
|
|
+ result.put(personNumber, new ArrayList<>());
|
|
|
+ }
|
|
|
+ result.get(personNumber).add(data);
|
|
|
+ }
|
|
|
+ if (PushTypeEnum.EMPLOYEEEXCEPTIONALERT.equals(pushType)) {
|
|
|
+ String yearMonth = DateTimeUtils.format(startDate, "yyyy年MM月");
|
|
|
+ //获取提醒记录
|
|
|
+ Set<String> remindRecord = getRemindRecord(ctx, yearMonth);
|
|
|
+ //员工累计异常提醒
|
|
|
+ for (Map.Entry<String, Integer> entry : personExceptionTimes.entrySet()) {
|
|
|
+ if (entry.getValue() < limit || remindRecord.contains(entry.getKey())) {
|
|
|
+ //移除没有达到预警上限的数据,获取已经提醒过的人员
|
|
|
+ result.remove(entry.getKey());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -683,7 +668,11 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
}
|
|
|
String params = JSON.toJSONString(list);
|
|
|
logInfo.setDataPushRequest(params);
|
|
|
- OkHttpClient client = new OkHttpClient();
|
|
|
+ OkHttpClient client = new OkHttpClient.Builder()
|
|
|
+ .connectTimeout(120, TimeUnit.SECONDS)
|
|
|
+ .writeTimeout(120, TimeUnit.SECONDS)
|
|
|
+ .readTimeout(120, TimeUnit.SECONDS)
|
|
|
+ .build();
|
|
|
MediaType mediaType = MediaType.parse("application/json");
|
|
|
RequestBody body = RequestBody.create(mediaType, params);
|
|
|
Request request = new Request.Builder()
|
|
@@ -696,6 +685,7 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
.addHeader("Content-Type", "application/json")
|
|
|
.build();
|
|
|
Response response = client.newCall(request).execute();
|
|
|
+ logger.error("pushAttendanceExceptionData response----" + response.isSuccessful());
|
|
|
if (response.isSuccessful()) {
|
|
|
String resultBody = response.body().string();
|
|
|
logInfo.setDataPushResponse(resultBody);
|