|
@@ -36,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -62,7 +63,7 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
|
|
private ISysUserDepartService sysUserDepartService;
|
|
|
@Autowired
|
|
|
private ISysPositionService sysPositionService;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysAnnouncementSendMapper sysAnnouncementSendMapper;
|
|
|
|
|
|
@Override
|
|
@@ -661,6 +662,7 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
|
|
* @param verifyConfig
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Override
|
|
|
public boolean sendMessage(MessageDTO message, boolean verifyConfig) {
|
|
|
Response<String> response = this.sendMessageResponse(message, verifyConfig);
|
|
|
if (response != null) {
|
|
@@ -681,15 +683,13 @@ public class ThirdAppDingtalkServiceImpl implements IThirdAppService {
|
|
|
String content = message.getContent();
|
|
|
int agentId = thirdAppConfig.getDingtalk().getAgentIdInt();
|
|
|
Message<TextMessage> textMessage = new Message<>(agentId, new TextMessage(content));
|
|
|
- if (message.isToAll()) {
|
|
|
- textMessage.setTo_all_user(true);
|
|
|
- } else {
|
|
|
+
|
|
|
String[] toUsers = message.getToUser().split(",");
|
|
|
// 通过第三方账号表查询出第三方userId
|
|
|
List<SysThirdAccount> thirdAccountList = sysThirdAccountService.listThirdUserIdByUsername(toUsers, ThirdAppConfig.DINGTALK.toLowerCase());
|
|
|
List<String> dtUserIds = thirdAccountList.stream().map(SysThirdAccount::getThirdUserId).collect(Collectors.toList());
|
|
|
textMessage.setUserid_list(dtUserIds);
|
|
|
- }
|
|
|
+
|
|
|
return JdtMessageAPI.sendTextMessage(textMessage, accessToken);
|
|
|
}
|
|
|
|