|
@@ -70,6 +70,10 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> implements ReportService {
|
|
|
+ @Value("${configEnv.isPrivateDeploy}")
|
|
|
+ private boolean isPrivateDeploy;
|
|
|
+ @Value("${privateDeployURL.pcUrl}")
|
|
|
+ private String pcUrl;
|
|
|
// @Resource
|
|
|
// AsyncTaskExecutor asyncTaskExecutor;//注入线程池对象
|
|
|
private final static Executor executor = Executors.newFixedThreadPool(3);//启用多线程
|
|
@@ -1345,6 +1349,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//检查是否为企业微信用户
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
|
|
|
if (wxCorpInfo != null) {
|
|
|
+ List<String> auditorCorpwxUserids = new ArrayList<>();
|
|
|
for (Report report : reportList) {
|
|
|
String corpwxUserid = userMapper.selectById(report.getProjectAuditorId()).getCorpwxUserid();
|
|
|
//推送到企业微信
|
|
@@ -1365,17 +1370,42 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
jsonObj.put("value","1");
|
|
|
}
|
|
|
dataJson.add(jsonObj);
|
|
|
-// if(isPrivateDeploy){
|
|
|
-// json.put("content","待审核数量: "+1+"\\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 {
|
|
|
+ if(isPrivateDeploy){
|
|
|
+ json.put("content","待审核数量: "+1+"\\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);
|
|
|
-// }
|
|
|
+ }
|
|
|
+ auditorCorpwxUserids.add(corpwxUserid);
|
|
|
// System.out.println("发送企业微信消息==用户:"+corpwxUserid+", "+json.toJSONString());
|
|
|
wxCorpInfoService.sendWXCorpTemplateMsg(wxCorpInfo, corpwxUserid, json);
|
|
|
}
|
|
|
+ //如果开启了抄送给部门负责人,需要发送消息通知
|
|
|
+ if (timeType.getCcDeptManager()) {
|
|
|
+ User creator = userMapper.selectById(reportList.get(0).getCreatorId());
|
|
|
+ if (creator.getDepartmentId() != null && creator.getDepartmentId() != 0) {
|
|
|
+ Department department = departmentMapper.selectById(creator.getDepartmentId());
|
|
|
+ //获取部门主要负责人和其他负责人
|
|
|
+ List<String> managerIds = new ArrayList<>();
|
|
|
+ if (department.getManagerId() != null) {
|
|
|
+ managerIds.add(department.getManagerId());
|
|
|
+ }
|
|
|
+ List<DepartmentOtherManager> otherManagers = departmentOtherManagerMapper.selectList(new LambdaQueryWrapper<DepartmentOtherManager>().eq(DepartmentOtherManager::getDepartmentId, creator.getDepartmentId()));
|
|
|
+ if (otherManagers.size() > 0) {
|
|
|
+ managerIds.addAll(otherManagers.stream().map(DepartmentOtherManager::getOtherManagerId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ //获取部门负责人
|
|
|
+ List<User> managers = userMapper.selectList(new QueryWrapper<User>().in("id", managerIds).eq("company_id", companyId));
|
|
|
+ String managerUserIds = managers.stream().filter(m -> m.getCorpwxUserid() != null && !auditorCorpwxUserids.contains(m.getCorpwxUserid()))
|
|
|
+ .map(User::getCorpwxUserid).collect(Collectors.joining("|"));
|
|
|
+ if (!StringUtils.isEmpty(managerUserIds)) {
|
|
|
+// System.out.println("发送企业微信消息==用户:"+managerUserIds+", "+"员工$userName="+creator.getCorpwxUserid()+"$提交了日报");
|
|
|
+ wxCorpInfoService.sendWXCorpMsg(wxCorpInfo, managerUserIds, "员工$userName="+creator.getCorpwxUserid()+"$提交了日报", null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_SUBMIT);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|