|
@@ -1,9 +1,11 @@
|
|
|
package com.xjrsoft.module.job;
|
|
package com.xjrsoft.module.job;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
+import cn.hutool.db.Entity;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.xjrsoft.common.mybatis.SqlRunnerAdapter;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.common.utils.WeChatUtil;
|
|
import com.xjrsoft.common.utils.WeChatUtil;
|
|
|
import com.xjrsoft.module.attendance.entity.AttendanceRuleDetails;
|
|
import com.xjrsoft.module.attendance.entity.AttendanceRuleDetails;
|
|
@@ -14,7 +16,6 @@ import com.xjrsoft.module.concat.service.IXjrUserService;
|
|
|
import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
|
|
import com.xjrsoft.module.organization.dto.WeChatSendMessageDto;
|
|
|
import com.xjrsoft.module.organization.service.IWeChatService;
|
|
import com.xjrsoft.module.organization.service.IWeChatService;
|
|
|
import com.xjrsoft.module.system.entity.WechatMessageLog;
|
|
import com.xjrsoft.module.system.entity.WechatMessageLog;
|
|
|
-import com.xjrsoft.module.system.service.IWechatMessageLogService;
|
|
|
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -56,9 +57,6 @@ public class AttenDanceWarnNoticeTask {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private WeChatUtil weChatUtil;
|
|
private WeChatUtil weChatUtil;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private IWechatMessageLogService wechatMessageLogService;
|
|
|
|
|
-
|
|
|
|
|
@Scheduled(cron = "0 */1 * * * ?")
|
|
@Scheduled(cron = "0 */1 * * * ?")
|
|
|
public void RefreshConnectionPool() {
|
|
public void RefreshConnectionPool() {
|
|
|
String active = SpringUtil.getActiveProfile();
|
|
String active = SpringUtil.getActiveProfile();
|
|
@@ -106,12 +104,12 @@ public class AttenDanceWarnNoticeTask {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
String wechatTemplate = weChatUtil.getAttenDanceWarnTemplate();
|
|
String wechatTemplate = weChatUtil.getAttenDanceWarnTemplate();
|
|
|
- List<WechatMessageLog> list = wechatMessageLogService.list(
|
|
|
|
|
- new QueryWrapper<WechatMessageLog>().lambda()
|
|
|
|
|
- .select(WechatMessageLog.class, x -> VoToColumnUtil.fieldsToColumns(WechatMessageLog.class).contains(x.getProperty()))
|
|
|
|
|
- .eq(WechatMessageLog::getSendTime, recentlyTime)
|
|
|
|
|
- .eq(WechatMessageLog::getTemplateId, wechatTemplate)
|
|
|
|
|
- );
|
|
|
|
|
|
|
+// List<WechatMessageLog> list = wechatMessageLogService.list(
|
|
|
|
|
+// new QueryWrapper<WechatMessageLog>().lambda()
|
|
|
|
|
+// .select(WechatMessageLog.class, x -> VoToColumnUtil.fieldsToColumns(WechatMessageLog.class).contains(x.getProperty()))
|
|
|
|
|
+// .eq(WechatMessageLog::getSendTime, recentlyTime)
|
|
|
|
|
+// .eq(WechatMessageLog::getTemplateId, wechatTemplate)
|
|
|
|
|
+// );
|
|
|
// if(!list.isEmpty()){//已经推送过,不再进行推送
|
|
// if(!list.isEmpty()){//已经推送过,不再进行推送
|
|
|
// return;
|
|
// return;
|
|
|
// }
|
|
// }
|
|
@@ -121,10 +119,6 @@ public class AttenDanceWarnNoticeTask {
|
|
|
//判断所有当前时间下,哪几条规则需要进行提醒
|
|
//判断所有当前时间下,哪几条规则需要进行提醒
|
|
|
Map<Long, Integer> ruleDetailsJudgeMap = judgeExecuteNotice(now, ruleDetailsList, recentlyTime);
|
|
Map<Long, Integer> ruleDetailsJudgeMap = judgeExecuteNotice(now, ruleDetailsList, recentlyTime);
|
|
|
|
|
|
|
|
- WechatMessageLog messageLog = new WechatMessageLog();
|
|
|
|
|
- messageLog.setTemplateId(wechatTemplate);
|
|
|
|
|
- messageLog.setSendTime(recentlyTime);
|
|
|
|
|
-
|
|
|
|
|
List<XjrUser> userList = getUserList(allTodyRule.keySet());
|
|
List<XjrUser> userList = getUserList(allTodyRule.keySet());
|
|
|
for (XjrUser xjrUser : userList) {
|
|
for (XjrUser xjrUser : userList) {
|
|
|
AttendanceRuleDetails ruleDetails = allTodyRule.get(xjrUser.getId());
|
|
AttendanceRuleDetails ruleDetails = allTodyRule.get(xjrUser.getId());
|
|
@@ -173,9 +167,13 @@ public class AttenDanceWarnNoticeTask {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- messageLog.setCreateDate(new Date());
|
|
|
|
|
- messageLog.setContent("消息推送人数:" + userList.size());
|
|
|
|
|
- wechatMessageLogService.save(messageLog);
|
|
|
|
|
|
|
+ String table = "wechat_message_log";
|
|
|
|
|
+ Entity entity = Entity.create(table);
|
|
|
|
|
+ entity.set("content", "消息推送人数:" + userList.size());
|
|
|
|
|
+ entity.set("create_date", new Date());
|
|
|
|
|
+ entity.set("template_id", wechatTemplate);
|
|
|
|
|
+ entity.set("send_time", recentlyTime);
|
|
|
|
|
+ SqlRunnerAdapter.db().dynamicInsert(table, entity);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|