|
@@ -1278,9 +1278,8 @@ public class TimingTask {
|
|
|
}
|
|
|
//开通了OA功能,有请假模块的,需要把当前请假的排除掉
|
|
|
List<Map<String, Object>> userList = new ArrayList<>();
|
|
|
- boolean recentlyNotFill;
|
|
|
+ boolean lastWeekNotFill = false;
|
|
|
if (t.getAlertType() == 0 || t.getAlertType() == 1) {
|
|
|
- recentlyNotFill = false;
|
|
|
if (company.getPackageOa() == 1) {
|
|
|
userList = userMapper.getPushUserList(t.getCompanyId(),t.getAlertType(), date);
|
|
|
} else {
|
|
@@ -1305,16 +1304,21 @@ public class TimingTask {
|
|
|
}
|
|
|
transfDay = transfDay.plusDays(1);
|
|
|
}
|
|
|
- //如果今天就是最后一个工作日
|
|
|
- if (lastWorkDay.isEqual(localDate)) {
|
|
|
- recentlyNotFill = false;
|
|
|
+ //如果今天就是最后一个工作日;或者周六周日,需要提醒本周
|
|
|
+ if (lastWorkDay.isEqual(localDate) || localDate.getDayOfWeek().getValue() == 6 || localDate.getDayOfWeek().getValue() == 7) {
|
|
|
LocalDate startDate = localDate.with(DayOfWeek.MONDAY);
|
|
|
userList = reportService.getNotFullReportUserList(company.getId(), startDate, lastDay);
|
|
|
} else {
|
|
|
- //检查之前10天是否存在未填的
|
|
|
- LocalDate startDate = localDate.minusDays(10);
|
|
|
- userList = reportService.getNotFullReportUserList(company.getId(), startDate, localDate.minusDays(1));
|
|
|
- recentlyNotFill = true;
|
|
|
+ LocalDate startDate = localDate.minusDays(7);
|
|
|
+ //从2023-11-10号以后开始算
|
|
|
+ if (startDate.isAfter(LocalDate.parse("2023-11-05"))) {
|
|
|
+ //检查上周日报是否漏填
|
|
|
+ LocalDate lastSunday = localDate.with(DayOfWeek.SUNDAY).minusWeeks(1);
|
|
|
+ LocalDate lastMonday = lastSunday.minusDays(6);
|
|
|
+ userList = reportService.getNotFullReportUserList(company.getId(), lastMonday, lastSunday);
|
|
|
+// System.out.println("上周未填人员数量="+userList.size());
|
|
|
+ lastWeekNotFill = true;
|
|
|
+ }
|
|
|
}
|
|
|
} else if (t.getAlertType() == 3) {
|
|
|
//3--每月固定日期提醒上个月的
|
|
@@ -1328,19 +1332,16 @@ public class TimingTask {
|
|
|
LocalDate endDate = localDate.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth());
|
|
|
userList = reportService.getNotFullReportUserList(company.getId(), startDate, endDate);
|
|
|
}
|
|
|
- recentlyNotFill = false;
|
|
|
- } else {
|
|
|
- recentlyNotFill = false;
|
|
|
}
|
|
|
-
|
|
|
List<WxCorpInfo> cpList = wxCorpInfoMapper.selectList(new QueryWrapper<WxCorpInfo>().eq("company_id", t.getCompanyId()));
|
|
|
+ final boolean finalLastWeekNotFill = lastWeekNotFill;
|
|
|
userList.forEach(u->{
|
|
|
if (u.get("corpwxUserid") != null){
|
|
|
//推送到企业微信
|
|
|
String corpUid = (String) u.get("corpwxUserid");
|
|
|
JSONObject json=new JSONObject();
|
|
|
- JSONArray dataJson=new JSONArray();
|
|
|
- JSONObject jsonObj=new JSONObject();
|
|
|
+ JSONArray dataJson = new JSONArray();
|
|
|
+ JSONObject jsonObj = new JSONObject();
|
|
|
jsonObj.put("key", "提示");
|
|
|
if (t.getAlertType() == 3) {
|
|
|
//每月提醒上个月的
|
|
@@ -1350,14 +1351,12 @@ public class TimingTask {
|
|
|
jsonObj.put("value", "您上个月有"+u.get("daysTxt")+"共"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
}
|
|
|
} else {
|
|
|
- if (recentlyNotFill) {
|
|
|
- jsonObj.put("value", "您近期有"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
+ if (finalLastWeekNotFill) {
|
|
|
+ jsonObj.put("value", "您上周有"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
} else {
|
|
|
jsonObj.put("value", StringUtils.isEmpty(t.getAlertMsg())?"":t.getAlertMsg());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
dataJson.add(jsonObj);
|
|
|
if(isPrivateDeploy){
|
|
|
json.put("content",StringUtils.isEmpty(t.getAlertMsg())?"":t.getAlertMsg()+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid="+suitId+"&redirect_uri="+pcUrl+"/api/corpInsideWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去填写</a>");
|
|
@@ -1367,6 +1366,7 @@ public class TimingTask {
|
|
|
json.put("content_item",dataJson);
|
|
|
}
|
|
|
if (cpList.size() > 0) {
|
|
|
+// System.out.println("发送企业微信漏填提醒:" + LocalDateTime.now().toString() + ", corpUid=" + corpUid + ", json=" + json.toJSONString());
|
|
|
wxCorpInfoService.sendWXCorpTemplateMsg(cpList.get(0), corpUid, json);
|
|
|
}
|
|
|
} else if (u.get("wxOpenid") != null) {
|