处理钉钉消息

This commit is contained in:
wenc000 2020-10-28 19:01:34 +08:00
parent 6317c19141
commit 5fd3a080cc
2 changed files with 15 additions and 12 deletions

10
pom.xml
View File

@ -108,11 +108,11 @@
<version>${activiti.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.cm</groupId>-->
<!-- <artifactId>cloud-central-control-client</artifactId>-->
<!-- <version>1.0.1-SNAPSHOT</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.cm</groupId>
<artifactId>cloud-central-control-client</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>

View File

@ -2,7 +2,9 @@ package com.cm.inspection.service.dingding.impl;
import com.cm.common.config.properties.ApiPathProperties;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.plugin.IApiConsts;
import com.cm.common.plugin.oauth.service.user.IUserService;
import com.cm.common.plugin.oauth.token.ClientTokenManager;
import com.cm.common.plugin.pojo.bos.UserResourceBO;
import com.cm.common.plugin.utils.RestTemplateUtil;
import com.cm.inspection.pojo.dtos.check.CheckDTO;
@ -84,7 +86,12 @@ public class DingDingMsgServiceImpl extends BaseService implements IDingDingMsgS
LOG.debug("通知网格员为空");
return;
}
LOG.debug("获取网格员用户列表");
List<UserResourceBO> userResourceBOs = userService.listUserResourceByIds(userIds);
sendDingDingMessage(userResourceBOs, "您有超时的检查请登录APP进行处理。");
// 获取网格员领导userId列表
/*
Map<String, Set<String>> leaderUserMap = new HashMap<>(16);
for (GridPersonnelDTO gridPersonnelDTO : gridPersonnelDTOs) {
String userId = gridPersonnelDTO.getUserId().split("\\|")[0];
@ -97,9 +104,6 @@ public class DingDingMsgServiceImpl extends BaseService implements IDingDingMsgS
}
gridPersonnelUserIdSet.add(userId);
}
LOG.debug("获取网格员用户列表");
List<UserResourceBO> userResourceBOs = userService.listUserResourceByIds(userIds);
sendDingDingMessage(userResourceBOs, "您有超时的检查请登录APP进行处理。");
LOG.debug("通知领导数量:{}", leaderUserMap.size());
if (!leaderUserMap.isEmpty()) {
LOG.debug("获取领导用户列表");
@ -110,6 +114,7 @@ public class DingDingMsgServiceImpl extends BaseService implements IDingDingMsgS
List<UserResourceBO> leaderUserResourceBOs = userService.listUserResourceByIds(leaderUserIds);
sendDingDingMessage(leaderUserResourceBOs, "您的下级网格员有超时的检查项,请尽快处理。");
}
*/
long endTime = System.currentTimeMillis();
LOG.debug(">>>> 整理超时案件 end耗时{}ms <<<<", endTime - startTime);
}
@ -150,12 +155,11 @@ public class DingDingMsgServiceImpl extends BaseService implements IDingDingMsgS
}
phoneSB.append(userResourceBO.getUserPhone());
}
System.out.println(phoneSB.toString());
/*
Map<String, Object> params = new HashMap<>(10);
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
params.put("phones", phoneSB.toString());
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.LIST_DYNAMIC_USER_INFO_BY_IDS, apiPathProperties.getUserCenter()), params);
params.put("content", content);
String result = restTemplateUtil.doPostFormNormal(String.format(IApiConsts.SEND_DINGDING_MSG_BY_PHONES, apiPathProperties.getUserCenter()), params);
LOG.debug("DingDing result: {}", result);
if (result == null) {
LOG.error("认证失败");
@ -163,6 +167,5 @@ public class DingDingMsgServiceImpl extends BaseService implements IDingDingMsgS
if (result.isEmpty()) {
LOG.error("发送钉钉消息失败");
}
*/
}
}