|
@@ -1403,28 +1403,55 @@ public class TimingTask {
|
|
|
}
|
|
|
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");
|
|
|
+// 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", "提示");
|
|
|
+// if (t.getAlertType() == 3) {
|
|
|
+// //每月提醒上个月的
|
|
|
+// if ((Integer)u.get("days") > 3) {
|
|
|
+// jsonObj.put("value", "您上个月有"+u.get("daysTxt")+"...共"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
+// } else {
|
|
|
+// jsonObj.put("value", "您上个月有"+u.get("daysTxt")+"共"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// 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>");
|
|
|
+// }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) {
|
|
|
+//// System.out.println("发送企业微信漏填提醒:" + LocalDateTime.now().toString() + ", corpUid=" + corpUid + ", json=" + json.toJSONString());
|
|
|
+// wxCorpInfoService.sendWXCorpTemplateMsg(cpList.get(0), corpUid, json);
|
|
|
+// }
|
|
|
+// } else if (u.get("wxOpenid") != null) {
|
|
|
+// push(u, t.getAlertMsg());
|
|
|
+// }
|
|
|
+// });
|
|
|
+ //今天或者明天统一提醒,提醒内容大家都一样
|
|
|
+ if (t.getAlertType() == 0 || t.getAlertType() == 1) {
|
|
|
+ //判断是企业微信用户还是微信用户
|
|
|
+ List<String> corpUidList = userList.stream().filter(u -> u.get("corpwxUserid") != null).map(u -> (String) u.get("corpwxUserid")).distinct().collect(Collectors.toList());
|
|
|
+ if (corpUidList.size() > 0) {
|
|
|
+ //给企业微信用户发送
|
|
|
JSONObject json=new JSONObject();
|
|
|
JSONArray dataJson = new JSONArray();
|
|
|
JSONObject jsonObj = new JSONObject();
|
|
|
jsonObj.put("key", "提示");
|
|
|
- if (t.getAlertType() == 3) {
|
|
|
- //每月提醒上个月的
|
|
|
- if ((Integer)u.get("days") > 3) {
|
|
|
- jsonObj.put("value", "您上个月有"+u.get("daysTxt")+"...共"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
- } else {
|
|
|
- jsonObj.put("value", "您上个月有"+u.get("daysTxt")+"共"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (finalLastWeekNotFill) {
|
|
|
- jsonObj.put("value", "您上周有"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
- } else {
|
|
|
- jsonObj.put("value", StringUtils.isEmpty(t.getAlertMsg())?"":t.getAlertMsg());
|
|
|
- }
|
|
|
- }
|
|
|
+ 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>");
|
|
@@ -1434,13 +1461,61 @@ 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);
|
|
|
+ String collectCPIds = corpUidList.stream().collect(Collectors.joining("|"));
|
|
|
+ if (!StringUtils.isEmpty(collectCPIds)) {
|
|
|
+// System.out.println("发送企业微信漏填提醒:" + LocalDateTime.now().toString() + ", corpUid=" + collectCPIds + ", json=" + json.toJSONString());
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(cpList.get(0), collectCPIds, json);
|
|
|
+ }
|
|
|
}
|
|
|
- } else if (u.get("wxOpenid") != null) {
|
|
|
- push(u, t.getAlertMsg());
|
|
|
}
|
|
|
- });
|
|
|
+ //给微信用户发送
|
|
|
+ userList.forEach(u->{
|
|
|
+ if (u.get("corpwxUserid") == null && u.get("wxOpenid") != null) {
|
|
|
+ push(u, t.getAlertMsg());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ //修改代码
|
|
|
+ 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", "提示");
|
|
|
+ if (t.getAlertType() == 3) {
|
|
|
+ //每月提醒上个月的
|
|
|
+ if ((Integer)u.get("days") > 3) {
|
|
|
+ jsonObj.put("value", "您上个月有"+u.get("daysTxt")+"...共"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
+ } else {
|
|
|
+ jsonObj.put("value", "您上个月有"+u.get("daysTxt")+"共"+(Integer)u.get("days")+"天未填写工时报告,请尽快填写");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ 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>");
|
|
|
+ }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) {
|
|
|
+// System.out.println("发送企业微信漏填提醒:" + LocalDateTime.now().toString() + ", corpUid=" + corpUid + ", json=" + json.toJSONString());
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(cpList.get(0), corpUid, json);
|
|
|
+ }
|
|
|
+ } else if (u.get("wxOpenid") != null) {
|
|
|
+ push(u, t.getAlertMsg());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
if (isDev) {
|