REQ-3282: 替换接口
This commit is contained in:
parent
6eee6b7c9c
commit
1a77c14233
@ -1,8 +1,6 @@
|
|||||||
package cn.axzo.msg.center.message.service.impl;
|
package cn.axzo.msg.center.message.service.impl;
|
||||||
|
|
||||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
import cn.axzo.foundation.result.ApiResult;
|
||||||
import cn.axzo.maokai.api.client.OrganizationalTeamOuRelationApi;
|
|
||||||
import cn.axzo.maokai.api.vo.response.OrganizationalTeamOuRelationResp;
|
|
||||||
import cn.axzo.msg.center.common.enums.TableIsDeleteEnum;
|
import cn.axzo.msg.center.common.enums.TableIsDeleteEnum;
|
||||||
import cn.axzo.msg.center.common.utils.BizAssertions;
|
import cn.axzo.msg.center.common.utils.BizAssertions;
|
||||||
import cn.axzo.msg.center.dal.MessageGroupNodeDao;
|
import cn.axzo.msg.center.dal.MessageGroupNodeDao;
|
||||||
@ -10,6 +8,8 @@ import cn.axzo.msg.center.domain.entity.MessageGroupNode;
|
|||||||
import cn.axzo.msg.center.domain.persistence.BaseEntityExt;
|
import cn.axzo.msg.center.domain.persistence.BaseEntityExt;
|
||||||
import cn.axzo.msg.center.inside.notices.config.PendingMessageBizConfig;
|
import cn.axzo.msg.center.inside.notices.config.PendingMessageBizConfig;
|
||||||
import cn.axzo.msg.center.service.enums.AppTerminalTypeEnum;
|
import cn.axzo.msg.center.service.enums.AppTerminalTypeEnum;
|
||||||
|
import cn.axzo.orggateway.api.orgteamourelation.OrgTeamOuRelationFeignApi;
|
||||||
|
import cn.axzo.orggateway.api.orgteamourelation.resp.OrgTeamOuRelationResp;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -39,7 +39,7 @@ import static java.util.stream.Collectors.toSet;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PendingMessageNewServiceImpl {
|
public class PendingMessageNewServiceImpl {
|
||||||
|
|
||||||
private final OrganizationalTeamOuRelationApi organizationalTeamOuRelationApi;
|
private final OrgTeamOuRelationFeignApi orgTeamOuRelationFeignApi;
|
||||||
private final PendingMessageBizConfig pendingMessageBizConfig;
|
private final PendingMessageBizConfig pendingMessageBizConfig;
|
||||||
private final MessageGroupNodeDao messageGroupNodeDao;
|
private final MessageGroupNodeDao messageGroupNodeDao;
|
||||||
|
|
||||||
@ -82,12 +82,12 @@ public class PendingMessageNewServiceImpl {
|
|||||||
ouIds.add(ouId);
|
ouIds.add(ouId);
|
||||||
// 2. 查询ouId下面所有的平台班组id当成ouId
|
// 2. 查询ouId下面所有的平台班组id当成ouId
|
||||||
if (ouId != 0) {
|
if (ouId != 0) {
|
||||||
ApiResult<List<OrganizationalTeamOuRelationResp>> resp =
|
ApiResult<List<OrgTeamOuRelationResp>> resp =
|
||||||
organizationalTeamOuRelationApi.teamOuRelationList(ouId);
|
orgTeamOuRelationFeignApi.teamOuRelationList(ouId);
|
||||||
List<OrganizationalTeamOuRelationResp> relations =
|
List<OrgTeamOuRelationResp> relations =
|
||||||
BizAssertions.assertResponse(resp, "获取平台班组id失败");
|
BizAssertions.assertResponse(resp, "获取平台班组id失败");
|
||||||
relations.stream()
|
relations.stream()
|
||||||
.map(OrganizationalTeamOuRelationResp::getTeamOuId)
|
.map(OrgTeamOuRelationResp::getTeamOuId)
|
||||||
.distinct()
|
.distinct()
|
||||||
.forEach(ouIds::add);
|
.forEach(ouIds::add);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,4 +132,20 @@ public class BizAssertions {
|
|||||||
return response.getData();
|
return response.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T assertResponse(cn.axzo.foundation.result.ApiResult<T> response) {
|
||||||
|
return assertResponse(response, "error resp={}", JSON.toJSONString(response));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T assertResponse(cn.axzo.foundation.result.ApiResult<T> response, String message, Object... args) {
|
||||||
|
if (!response.isSuccess()) {
|
||||||
|
String finalMsg = MessageFormatter.arrayFormat(message, args).getMessage();
|
||||||
|
if (StringUtils.isNotBlank(response.getMsg())) {
|
||||||
|
finalMsg += ": " + response.getMsg();
|
||||||
|
}
|
||||||
|
ServiceException e = new ServiceException(finalMsg);
|
||||||
|
log.warn("remote call response with error. response={}", JSON.toJSONString(response), e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
return response.getData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -28,7 +28,8 @@ import org.springframework.core.env.Environment;
|
|||||||
"cn.axzo.msg.center.inside.notices.service.impl",
|
"cn.axzo.msg.center.inside.notices.service.impl",
|
||||||
"cn.axzo.meepo.api",
|
"cn.axzo.meepo.api",
|
||||||
"cn.axzo.riven.client.feign",
|
"cn.axzo.riven.client.feign",
|
||||||
"cn.axzo.epic.client.feign"
|
"cn.axzo.epic.client.feign",
|
||||||
|
"cn.axzo.orggateway.api.orgteamourelation"
|
||||||
})
|
})
|
||||||
/*@EnableAsync*/
|
/*@EnableAsync*/
|
||||||
public class MsgCenterApplication {
|
public class MsgCenterApplication {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user