|
@@ -1,5 +1,6 @@
|
|
package com.management.platform.task;
|
|
package com.management.platform.task;
|
|
|
|
|
|
|
|
+import com.alibaba.excel.util.DateUtils;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -83,34 +84,13 @@ public class TimingTask {
|
|
@Resource
|
|
@Resource
|
|
private UserMapper userMapper;
|
|
private UserMapper userMapper;
|
|
@Resource
|
|
@Resource
|
|
- private DepartmentMapper departmentMapper;
|
|
|
|
- @Resource
|
|
|
|
- private ReportMapper reportMapper;
|
|
|
|
- @Resource
|
|
|
|
- private TimeAutoExcludeMapper timeAutoExcludeMapper;
|
|
|
|
- @Resource
|
|
|
|
private WxCorpInfoService wxCorpInfoService;
|
|
private WxCorpInfoService wxCorpInfoService;
|
|
@Resource
|
|
@Resource
|
|
private WxCorpInfoMapper wxCorpInfoMapper;
|
|
private WxCorpInfoMapper wxCorpInfoMapper;
|
|
- @Resource
|
|
|
|
- private ReportLogMapper reportLogMapper;
|
|
|
|
- @Resource
|
|
|
|
- private OperationRecordService operationRecordService;
|
|
|
|
@Value(value = "${upload.path}")
|
|
@Value(value = "${upload.path}")
|
|
private String path;
|
|
private String path;
|
|
-
|
|
|
|
- @Resource
|
|
|
|
- private SysConfigMapper sysConfigMapper;
|
|
|
|
- @Resource
|
|
|
|
- private ThirdPartyInterfaceMapper thirdPartyInterfaceMapper;
|
|
|
|
- @Resource
|
|
|
|
- private ThirdPartyInterfaceService thirdPartyInterfaceService;
|
|
|
|
@Resource
|
|
@Resource
|
|
private TimeTypeService timeTypeService;
|
|
private TimeTypeService timeTypeService;
|
|
- @Resource
|
|
|
|
- private SysRoleMapper sysRoleMapper;
|
|
|
|
- @Resource
|
|
|
|
- private UserService userService;
|
|
|
|
|
|
|
|
private static final List<Integer> VALID_TOKEN_CHARS = new ArrayList<>();
|
|
private static final List<Integer> VALID_TOKEN_CHARS = new ArrayList<>();
|
|
static {
|
|
static {
|
|
@@ -187,54 +167,41 @@ public class TimingTask {
|
|
DateTimeFormatter dt = DateTimeFormatter.ofPattern("HH:mm");
|
|
DateTimeFormatter dt = DateTimeFormatter.ofPattern("HH:mm");
|
|
String str = dt.format(now);
|
|
String str = dt.format(now);
|
|
String date = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(localDate);
|
|
String date = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(localDate);
|
|
- List<TimeType> typeList = timeTypeMapper.selectList(new QueryWrapper<TimeType>().isNotNull("alert_time")
|
|
|
|
- .ge("alert_time", str));
|
|
|
|
- typeList.forEach(t->{
|
|
|
|
- if (str.equals(t.getAlertTime())) {
|
|
|
|
- //节假日是否提醒
|
|
|
|
- Boolean workDay = timeTypeService.isWorkDay(t.getCompanyId(), localDate);
|
|
|
|
- if (!workDay){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- //发送推送提醒
|
|
|
|
- Company company = companyMapper.selectById(t.getCompanyId());
|
|
|
|
- //过期公司不提醒
|
|
|
|
- if(company.getExpirationDate().isBefore(LocalDateTime.now())){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- //开通了OA功能,有请假模块的,需要把当前请假的排除掉
|
|
|
|
- List<Map<String, Object>> userList = null;
|
|
|
|
- if (company.getPackageOa() == 1) {
|
|
|
|
- userList = userMapper.getPushUserList(t.getCompanyId(),t.getAlertType(), date);
|
|
|
|
- } else {
|
|
|
|
- userList = userMapper.getPushUserList(t.getCompanyId(),t.getAlertType(), null);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<WxCorpInfo> cpList = wxCorpInfoMapper.selectList(new QueryWrapper<WxCorpInfo>().eq("company_id", t.getCompanyId()));
|
|
|
|
- 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();
|
|
|
|
- jsonObj.put("key", "提示");
|
|
|
|
- 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>");
|
|
|
|
- }else {
|
|
|
|
- json.put("template_id","tty9TkCAAAYoevY-40ciWD5lDncDfR5w");
|
|
|
|
- json.put("url", "https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
|
|
|
|
- json.put("content_item",dataJson);
|
|
|
|
- }
|
|
|
|
- if (cpList.size() > 0) {
|
|
|
|
- wxCorpInfoService.sendWXCorpTemplateMsg(cpList.get(0), corpUid, json);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+ List<WxCorpInfo> wxCorpInfoList = wxCorpInfoMapper.selectList(null);
|
|
|
|
+ for (WxCorpInfo wxCorpInfo : wxCorpInfoList) {
|
|
|
|
+ //节假日是否提醒
|
|
|
|
+ boolean workDay = WorkDayCalculateUtils.isWorkDay(localDate);
|
|
|
|
+ if (!workDay){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ //发送推送提醒
|
|
|
|
+ Company company = companyMapper.selectById(wxCorpInfo.getCompanyId());
|
|
|
|
+ //过期公司不提醒
|
|
|
|
+ if(company.getExpirationDate().isBefore(LocalDateTime.now())){
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+ List<Map<String, Object>> userList = userMapper.getPushUserList(wxCorpInfo.getCompanyId(), date);
|
|
|
|
+ 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();
|
|
|
|
+ jsonObj.put("key", "提示");
|
|
|
|
+ jsonObj.put("value", "请尽快填写昨日的报工");
|
|
|
|
+ dataJson.add(jsonObj);
|
|
|
|
+ if(isPrivateDeploy){
|
|
|
|
+ json.put("content","请尽快填写昨日的报工"+"\\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>");
|
|
|
|
+ }else {
|
|
|
|
+ json.put("template_id","tty9TkCAAAYoevY-40ciWD5lDncDfR5w");
|
|
|
|
+ json.put("url", "https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri=http://worktime.ttkuaiban.com/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect");
|
|
|
|
+ json.put("content_item",dataJson);
|
|
|
|
+ }
|
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpUid, json);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|