|
@@ -570,36 +570,64 @@ public class TimingTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //每天9点10分提醒去审核
|
|
|
- @Scheduled(cron = "0 10 9 ? * *")
|
|
|
+ //每分钟校验是否有需要提醒待审核的内容
|
|
|
+ @Scheduled(fixedRate = 60 * 1000)
|
|
|
private void alertWaitingApprove() {
|
|
|
if (isDev) return;
|
|
|
- List<CompanyDingding> list = companyDingdingMapper.getDingdingCompanyList();
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ DateTimeFormatter df=DateTimeFormatter.ofPattern("HH:mm");
|
|
|
+ List<TimeType> timeTypeList = timeTypeMapper.selectList(new QueryWrapper<TimeType>().eq("wait_check_alert_time", df.format(now.toLocalTime())));
|
|
|
+ List<Integer> companyIds = timeTypeList.stream().map(TimeType::getCompanyId).distinct().collect(Collectors.toList());
|
|
|
+ companyIds.add(-1);
|
|
|
+ List<CompanyDingding> list = companyDingdingMapper.getDingdingCompanyList(companyIds);
|
|
|
for (CompanyDingding companyDingding : list) {
|
|
|
- List<Map<String, Object>> result = reportMapper.getWaitingApproveCnt(companyDingding.getCompanyId());
|
|
|
+ List<Map<String, Object>> result = reportMapper.getProWaitingApproveCnt(companyDingding.getCompanyId());
|
|
|
+ List<Map<String, Object>> result1 = reportMapper.getDeptWaitingApproveCnt(companyDingding.getCompanyId());
|
|
|
+ List<Object> resultCorpwxUserIds = result.stream().map(rl -> rl.get("auditorDDId")).collect(Collectors.toList());
|
|
|
for (Map<String, Object> map : result) {
|
|
|
-// if (companyDingding.getCompanyId() == 434) {
|
|
|
+ Optional<Map<String, Object>> first = result1.stream().filter(r1 -> r1.get("auditorDDId").equals(map.get("auditorDDId"))).findFirst();
|
|
|
+ Long num = Long.valueOf(String.valueOf(map.get("num")));
|
|
|
+ BigDecimal bigDecimal=new BigDecimal(num);
|
|
|
+ if(first.isPresent()){
|
|
|
+ bigDecimal=bigDecimal.add(new BigDecimal(String.valueOf(first.get().get("num"))));
|
|
|
+ }
|
|
|
+ companyDingdingService.sendReportWaitingApplyMsg(companyDingding.getCompanyId(), companyDingding.getAgentId(),
|
|
|
+ bigDecimal.longValue(), (String)map.get("auditorDDId"));
|
|
|
+ }
|
|
|
+ for (Map<String, Object> map : result1) {
|
|
|
+ if(!resultCorpwxUserIds.stream().anyMatch(ol->((String)ol).equals(map.get("auditorDDId")))){
|
|
|
+ Long num = Long.valueOf(String.valueOf(map.get("num")));
|
|
|
+ BigDecimal bigDecimal=new BigDecimal(num);
|
|
|
companyDingdingService.sendReportWaitingApplyMsg(companyDingding.getCompanyId(), companyDingding.getAgentId(),
|
|
|
- (Long)map.get("num"), (String)map.get("auditorDDId"));
|
|
|
-// }
|
|
|
+ bigDecimal.longValue(), (String)map.get("auditorDDId"));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- List<WxCorpInfo> wxCorpInfoList = wxCorpInfoMapper.getWxCompanyList();
|
|
|
+ List<WxCorpInfo> wxCorpInfoList = wxCorpInfoMapper.getWxCompanyList(companyIds);
|
|
|
for (WxCorpInfo wxCorpInfo : wxCorpInfoList) {
|
|
|
if (wxCorpInfo!=null) {
|
|
|
- List<Map<String, Object>> result = reportMapper.getWaitingApproveCnt(wxCorpInfo.getCompanyId());
|
|
|
- for (Map<String, Object> map : result) {
|
|
|
- if(map.get("corpwxUserid")!=null){
|
|
|
+ List<Map<String, Object>> result = reportMapper.getProWaitingApproveCnt(wxCorpInfo.getCompanyId());
|
|
|
+ List<Map<String, Object>> result1 = reportMapper.getDeptWaitingApproveCnt(wxCorpInfo.getCompanyId());
|
|
|
+ List<Object> resultCorpwxUserIds = result.stream().map(rl -> rl.get("corpwxUserid")).collect(Collectors.toList());
|
|
|
+ for (Map<String, Object> map : result) {
|
|
|
+ Optional<Map<String, Object>> first = result1.stream().filter(r1 -> r1.get("corpwxUserid").equals(map.get("corpwxUserid"))).findFirst();
|
|
|
+ if(map.get("corpwxUserid")!=null){
|
|
|
String corpwxUserid = (String) map.get("corpwxUserid");
|
|
|
//推送到企业微信
|
|
|
JSONObject json=new JSONObject();
|
|
|
JSONArray dataJson=new JSONArray();
|
|
|
JSONObject jsonObj=new JSONObject();
|
|
|
+ Integer num = Integer.valueOf(String.valueOf(map.get("num")));
|
|
|
+ BigDecimal bigDecimal=new BigDecimal(num);
|
|
|
+ if(first.isPresent()){
|
|
|
+ bigDecimal=bigDecimal.add(new BigDecimal(String.valueOf(first.get().get("num"))));
|
|
|
+ }
|
|
|
+ System.out.println("进来了-----------------------------------------------------------");
|
|
|
jsonObj.put("key", "待审核数量");
|
|
|
- jsonObj.put("value",StringUtils.isEmpty(map.get("num"))?"":map.get("num"));
|
|
|
+ jsonObj.put("value",bigDecimal.toPlainString());
|
|
|
dataJson.add(jsonObj);
|
|
|
if(isPrivateDeploy){
|
|
|
- json.put("content","待审核数量: "+(StringUtils.isEmpty(map.get("num"))?"":map.get("num"))+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri="+pcUrl+"/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去审核</a>");
|
|
|
+ json.put("content","待审核数量: "+(bigDecimal.toPlainString())+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri="+pcUrl+"/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去审核</a>");
|
|
|
}else {
|
|
|
json.put("template_id","tty9TkCAAAuPvPjabDdQXGocnG0K24EQ");
|
|
|
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=review#wechat_redirect");
|
|
@@ -608,6 +636,30 @@ public class TimingTask {
|
|
|
wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
|
|
|
}
|
|
|
}
|
|
|
+ for (Map<String, Object> map : result1) {
|
|
|
+ if(!resultCorpwxUserIds.stream().anyMatch(ol->((String)ol).equals(map.get("corpwxUserid")))){
|
|
|
+ if(map.get("corpwxUserid")!=null){
|
|
|
+ String corpwxUserid = (String) map.get("corpwxUserid");
|
|
|
+ //推送到企业微信
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
+ JSONArray dataJson=new JSONArray();
|
|
|
+ JSONObject jsonObj=new JSONObject();
|
|
|
+ Integer num = Integer.valueOf(String.valueOf(map.get("num")));
|
|
|
+ BigDecimal bigDecimal=new BigDecimal(num);
|
|
|
+ jsonObj.put("key", "待审核数量");
|
|
|
+ jsonObj.put("value",bigDecimal.toPlainString());
|
|
|
+ dataJson.add(jsonObj);
|
|
|
+ if(isPrivateDeploy){
|
|
|
+ json.put("content","待审核数量: "+(bigDecimal.toPlainString())+"\\n<a href=\\\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww4e237fd6abb635af&redirect_uri="+pcUrl+"/api/corpWXAuth&response_type=code&scope=snsapi_base&state=0#wechat_redirect\\\">去审核</a>");
|
|
|
+ }else {
|
|
|
+ json.put("template_id","tty9TkCAAAuPvPjabDdQXGocnG0K24EQ");
|
|
|
+ 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=review#wechat_redirect");
|
|
|
+ json.put("content_item",dataJson);
|
|
|
+ }
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|