|
@@ -954,39 +954,48 @@ public class TimingTask {
|
|
|
//判断日报审核类型
|
|
|
timeTypeList.stream().filter(timeType -> timeType.getCompanyId().equals(companyId)).findFirst().ifPresent(timeType -> {
|
|
|
if (timeType.getReportAuditType() == 7) {//并行审核模式
|
|
|
- List<User> userList = userMapper.selectList(new QueryWrapper<User>().select("id,dingding_userid", "corpwx_userid").eq("company_id", companyId));
|
|
|
- List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, project_auditor_id, audit_dept_managerid,project_audit_state,department_audit_state").eq("company_id", companyId).eq("state", 0));
|
|
|
- HashMap<String, Long> auditorMap = new HashMap();
|
|
|
- for (Report report : reportList) {
|
|
|
- //按审核人汇总统计
|
|
|
- String pAuditorId = null;
|
|
|
- if (report.getProjectAuditState() == 0) {
|
|
|
- pAuditorId = report.getProjectAuditorId();
|
|
|
- if (auditorMap.get(pAuditorId) == null) {
|
|
|
- auditorMap.put(pAuditorId, 1L);
|
|
|
- } else {
|
|
|
- auditorMap.put(pAuditorId, auditorMap.get(pAuditorId) + 1);
|
|
|
- }
|
|
|
+ boolean shouldAlert = true;
|
|
|
+ if (timeType.getAlertType() == 4) {
|
|
|
+ //每周提醒一次,校验日期是否正确
|
|
|
+ if (LocalDate.now().getDayOfWeek().getValue() != timeType.getAlertCheckDay()) {
|
|
|
+ shouldAlert = false;
|
|
|
}
|
|
|
- String deptAuditorId = null;
|
|
|
- if (report.getDepartmentAuditState() == 0) {
|
|
|
- deptAuditorId = report.getAuditDeptManagerid();
|
|
|
- if (deptAuditorId != null &&!deptAuditorId.equals(pAuditorId)) {
|
|
|
- //不是同一个人,需要单独统计
|
|
|
- if (auditorMap.get(deptAuditorId) == null) {
|
|
|
- auditorMap.put(deptAuditorId, 1L);
|
|
|
+ }
|
|
|
+ if (shouldAlert) {
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().select("id,dingding_userid", "corpwx_userid").eq("company_id", companyId));
|
|
|
+ List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, project_auditor_id, audit_dept_managerid,project_audit_state,department_audit_state").eq("company_id", companyId).eq("state", 0));
|
|
|
+ HashMap<String, Long> auditorMap = new HashMap();
|
|
|
+ for (Report report : reportList) {
|
|
|
+ //按审核人汇总统计
|
|
|
+ String pAuditorId = null;
|
|
|
+ if (report.getProjectAuditState() == 0) {
|
|
|
+ pAuditorId = report.getProjectAuditorId();
|
|
|
+ if (auditorMap.get(pAuditorId) == null) {
|
|
|
+ auditorMap.put(pAuditorId, 1L);
|
|
|
} else {
|
|
|
- auditorMap.put(deptAuditorId, auditorMap.get(deptAuditorId) + 1);
|
|
|
+ auditorMap.put(pAuditorId, auditorMap.get(pAuditorId) + 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String deptAuditorId = null;
|
|
|
+ if (report.getDepartmentAuditState() == 0) {
|
|
|
+ deptAuditorId = report.getAuditDeptManagerid();
|
|
|
+ if (deptAuditorId != null &&!deptAuditorId.equals(pAuditorId)) {
|
|
|
+ //不是同一个人,需要单独统计
|
|
|
+ if (auditorMap.get(deptAuditorId) == null) {
|
|
|
+ auditorMap.put(deptAuditorId, 1L);
|
|
|
+ } else {
|
|
|
+ auditorMap.put(deptAuditorId, auditorMap.get(deptAuditorId) + 1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- for (Map.Entry<String, Long> entry : auditorMap.entrySet()) {
|
|
|
- String auditorId = entry.getKey();
|
|
|
- Long num = entry.getValue();
|
|
|
- Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(auditorId)).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- companyDingdingService.sendReportWaitingApplyMsg(companyId, companyDingding.getAgentId(), num, first.get().getDingdingUserid());
|
|
|
+ for (Map.Entry<String, Long> entry : auditorMap.entrySet()) {
|
|
|
+ String auditorId = entry.getKey();
|
|
|
+ Long num = entry.getValue();
|
|
|
+ Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(auditorId)).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ companyDingdingService.sendReportWaitingApplyMsg(companyId, companyDingding.getAgentId(), num, first.get().getDingdingUserid());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -1026,60 +1035,83 @@ public class TimingTask {
|
|
|
}
|
|
|
//判断日报审核类型
|
|
|
timeTypeList.stream().filter(timeType -> timeType.getCompanyId().equals(companyId)).findFirst().ifPresent(timeType -> {
|
|
|
+ //校验审核的日期,是否是每周提醒;目前仅景昱采用了这个模式审核,他们需要设置每周几审核
|
|
|
if (timeType.getReportAuditType() == 7) {//并行审核模式
|
|
|
- List<User> userList = userMapper.selectList(new QueryWrapper<User>().select("id,dingding_userid", "corpwx_userid").eq("company_id", companyId));
|
|
|
- List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, project_auditor_id, audit_dept_managerid,project_audit_state,department_audit_state").eq("company_id", companyId).eq("state", 0));
|
|
|
- HashMap<String, Long> auditorMap = new HashMap();
|
|
|
- for (Report report : reportList) {
|
|
|
- //按审核人汇总统计
|
|
|
- String pAuditorId = null;
|
|
|
- if (report.getProjectAuditState() == 0) {
|
|
|
- pAuditorId = report.getProjectAuditorId();
|
|
|
- if (auditorMap.get(pAuditorId) == null) {
|
|
|
- auditorMap.put(pAuditorId, 1L);
|
|
|
- } else {
|
|
|
- auditorMap.put(pAuditorId, auditorMap.get(pAuditorId) + 1);
|
|
|
- }
|
|
|
+ boolean shouldAlert = true;
|
|
|
+ if (timeType.getAlertType() == 4) {
|
|
|
+ //每周提醒一次,校验日期是否正确
|
|
|
+ if (LocalDate.now().getDayOfWeek().getValue() != timeType.getAlertCheckDay()) {
|
|
|
+ shouldAlert = false;
|
|
|
}
|
|
|
- String deptAuditorId = null;
|
|
|
- if (report.getDepartmentAuditState() == 0) {
|
|
|
- deptAuditorId = report.getAuditDeptManagerid();
|
|
|
- if (!deptAuditorId.equals(pAuditorId)) {
|
|
|
- //不是同一个人,需要单独统计
|
|
|
- if (auditorMap.get(deptAuditorId) == null) {
|
|
|
- auditorMap.put(deptAuditorId, 1L);
|
|
|
+ }
|
|
|
+ if (shouldAlert) {
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().select("id,dingding_userid", "corpwx_userid").eq("company_id", companyId));
|
|
|
+ List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, project_auditor_id, audit_dept_managerid,project_audit_state,department_audit_state").eq("company_id", companyId).eq("state", 0));
|
|
|
+ HashMap<String, Long> auditorMap = new HashMap();
|
|
|
+ for (Report report : reportList) {
|
|
|
+ //按审核人汇总统计
|
|
|
+ String pAuditorId = null;
|
|
|
+ if (report.getProjectAuditState() == 0) {
|
|
|
+ pAuditorId = report.getProjectAuditorId();
|
|
|
+ if (auditorMap.get(pAuditorId) == null) {
|
|
|
+ auditorMap.put(pAuditorId, 1L);
|
|
|
} else {
|
|
|
- auditorMap.put(deptAuditorId, auditorMap.get(deptAuditorId) + 1);
|
|
|
+ auditorMap.put(pAuditorId, auditorMap.get(pAuditorId) + 1);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- for (Map.Entry<String, Long> entry : auditorMap.entrySet()) {
|
|
|
- String auditorId = entry.getKey();
|
|
|
- Long num = entry.getValue();
|
|
|
- Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(auditorId)).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- if (first.get().getCorpwxUserid() != null) {
|
|
|
- String corpwxUserid = first.get().getCorpwxUserid();
|
|
|
- //推送到企业微信
|
|
|
- JSONObject json=new JSONObject();
|
|
|
- JSONArray dataJson=new JSONArray();
|
|
|
- JSONObject jsonObj=new JSONObject();
|
|
|
- jsonObj.put("key", "待审核数量");
|
|
|
- jsonObj.put("value",num+"");
|
|
|
- dataJson.add(jsonObj);
|
|
|
- if(isPrivateDeploy){
|
|
|
- json.put("content","待审核数量: "+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>");
|
|
|
- }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);
|
|
|
+ String deptAuditorId = null;
|
|
|
+ if (report.getDepartmentAuditState() == 0) {
|
|
|
+ deptAuditorId = report.getAuditDeptManagerid();
|
|
|
+ if (!deptAuditorId.equals(pAuditorId)) {
|
|
|
+ //不是同一个人,需要单独统计
|
|
|
+ if (auditorMap.get(deptAuditorId) == null) {
|
|
|
+ auditorMap.put(deptAuditorId, 1L);
|
|
|
+ } else {
|
|
|
+ auditorMap.put(deptAuditorId, auditorMap.get(deptAuditorId) + 1);
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Map.Entry<String, Long> entry : auditorMap.entrySet()) {
|
|
|
+ String auditorId = entry.getKey();
|
|
|
+ Long num = entry.getValue();
|
|
|
+ Optional<User> first = userList.stream().filter(ul -> ul.getId().equals(auditorId)).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ if (first.get().getCorpwxUserid() != null) {
|
|
|
+ String corpwxUserid = first.get().getCorpwxUserid();
|
|
|
+ //推送到企业微信
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
+ JSONArray dataJson=new JSONArray();
|
|
|
+ JSONObject jsonObj=new JSONObject();
|
|
|
+ if (timeType.getAlertType() == 4) {
|
|
|
+ jsonObj.put("key", "提示");
|
|
|
+ String msgContent = timeType.getAlertCheckMsg();
|
|
|
+ if (StringUtils.isEmpty(msgContent)) {
|
|
|
+ msgContent = "待审核数量:"+num;
|
|
|
+ } else {
|
|
|
+ msgContent = msgContent.replace("{0}", ""+num);
|
|
|
+ }
|
|
|
+ jsonObj.put("value",msgContent);
|
|
|
+ } else {
|
|
|
+ jsonObj.put("key", "待审核数量");
|
|
|
+ jsonObj.put("value",num+"");
|
|
|
+ }
|
|
|
+ dataJson.add(jsonObj);
|
|
|
+ if(isPrivateDeploy){
|
|
|
+ json.put("content","待审核数量: "+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>");
|
|
|
+ }else {
|
|
|
+ String templateId = timeType.getAlertType() == 4 ? "tty9TkCAAAtDDCqY796mGulF9c5Jmwng":"tty9TkCAAAuPvPjabDdQXGocnG0K24EQ";
|
|
|
+ json.put("template_id",templateId);
|
|
|
+ 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);
|
|
|
+ }
|
|
|
// System.out.println("发送企业微信消息==用户:"+first.get().getId()+", name="+first.get().getName()+", "+json.toJSONString());
|
|
|
- wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
List<Map<String, Object>> result = reportMapper.getProWaitingApproveCnt(wxCorpInfo.getCompanyId());
|
|
|
List<Map<String, Object>> result1 = reportMapper.getDeptWaitingApproveCnt(wxCorpInfo.getCompanyId());
|