Merge branch 'feature/REQ-1465' of axzsource.com:universal/infrastructure/backend/msg-center-plat into dev

This commit is contained in:
luofu 2023-10-24 16:00:54 +08:00
commit 3d42520dba
4 changed files with 61 additions and 7 deletions

View File

@ -196,7 +196,8 @@ public class MessageRelationServiceImpl implements MessageRelationService {
} }
return messageRelationDao.lambdaQuery() return messageRelationDao.lambdaQuery()
.in(MessageRelation::getModuleId, moduleIds) .in(MessageRelation::getModuleId, moduleIds)
.eq(MessageRelation::getIsDelete, 0) .eq(MessageRelation::getIsDelete, TableIsDeleteEnum.NORMAL.value)
.select(MessageRelation::getId)
.list().stream() .list().stream()
.map(MessageRelation::getId) .map(MessageRelation::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -1,11 +1,16 @@
package cn.axzo.msg.center.message.controller; package cn.axzo.msg.center.message.controller;
import cn.axzo.msg.center.api.request.CmsMsgQueryReq;
import cn.axzo.msg.center.api.response.MessageNewRes;
import cn.axzo.msg.center.message.service.GeneralMessageOldService;
import cn.axzo.msg.center.message.service.GeneralMessageService; import cn.axzo.msg.center.message.service.GeneralMessageService;
import cn.axzo.msg.center.service.dto.PersonDTO;
import cn.axzo.msg.center.service.general.client.GeneralMessageClient; import cn.axzo.msg.center.service.general.client.GeneralMessageClient;
import cn.axzo.msg.center.service.general.request.GeneralMessageOldDataStatisticRequest; import cn.axzo.msg.center.service.general.request.GeneralMessageOldDataStatisticRequest;
import cn.axzo.msg.center.service.general.request.GeneralMessageSendRequest; import cn.axzo.msg.center.service.general.request.GeneralMessageSendRequest;
import cn.axzo.msg.center.service.general.response.GeneralMessageOldDataStatisticResponse; import cn.axzo.msg.center.service.general.response.GeneralMessageOldDataStatisticResponse;
import cn.azxo.framework.common.model.CommonResponse; import cn.azxo.framework.common.model.CommonResponse;
import cn.azxo.framework.common.model.Page;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -21,15 +26,27 @@ import org.springframework.web.bind.annotation.RestController;
public class GeneralMessageController implements GeneralMessageClient { public class GeneralMessageController implements GeneralMessageClient {
private final GeneralMessageService generalMessageService; private final GeneralMessageService generalMessageService;
private final GeneralMessageOldService generalMessageOldService;
@Override @Override
public CommonResponse<String> statisticOldData(GeneralMessageSendRequest request) { public CommonResponse<String> pageQueryOldMessage(GeneralMessageSendRequest request) {
return CommonResponse.success(generalMessageService.batchSendMessage(request)); return CommonResponse.success(generalMessageService.batchSendMessage(request));
} }
@Override @Override
public CommonResponse<GeneralMessageOldDataStatisticResponse> statisticOldData( public CommonResponse<GeneralMessageOldDataStatisticResponse> pageQueryOldMessage(
GeneralMessageOldDataStatisticRequest request) { GeneralMessageOldDataStatisticRequest request) {
return CommonResponse.success(generalMessageService.statisticOldData(request)); return CommonResponse.success(generalMessageService.statisticOldData(request));
} }
@Override
public CommonResponse<Integer> countUnreadFromOldMessage(GeneralMessageOldDataStatisticRequest request) {
PersonDTO person = PersonDTO.from(request.getPersonId(), request.getIdentityId(), request.getIdentityType());
return CommonResponse.success(generalMessageOldService.countUnread(person));
}
@Override
public CommonResponse<Page<MessageNewRes>> pageQueryOldMessage(CmsMsgQueryReq request) {
return CommonResponse.success(generalMessageOldService.pageMsgInfo(request));
}
} }

View File

@ -1,10 +1,13 @@
package cn.axzo.msg.center.service.general.client; package cn.axzo.msg.center.service.general.client;
import cn.axzo.msg.center.api.request.CmsMsgQueryReq;
import cn.axzo.msg.center.api.response.MessageNewRes;
import cn.axzo.msg.center.service.general.request.GeneralMessageOldDataStatisticRequest; import cn.axzo.msg.center.service.general.request.GeneralMessageOldDataStatisticRequest;
import cn.axzo.msg.center.service.general.request.GeneralMessageSendRequest; import cn.axzo.msg.center.service.general.request.GeneralMessageSendRequest;
import cn.axzo.msg.center.service.general.response.GeneralMessageOldDataStatisticResponse; import cn.axzo.msg.center.service.general.response.GeneralMessageOldDataStatisticResponse;
import cn.axzo.msg.center.service.pending.client.fallback.PendingMessageClientFallback; import cn.axzo.msg.center.service.pending.client.fallback.PendingMessageClientFallback;
import cn.azxo.framework.common.model.CommonResponse; import cn.azxo.framework.common.model.CommonResponse;
import cn.azxo.framework.common.model.Page;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -32,7 +35,7 @@ public interface GeneralMessageClient {
* @return 消息的唯一标识 * @return 消息的唯一标识
*/ */
@PostMapping(value = "/general-message/send", produces = {MediaType.APPLICATION_JSON_VALUE}) @PostMapping(value = "/general-message/send", produces = {MediaType.APPLICATION_JSON_VALUE})
CommonResponse<String> statisticOldData(@RequestBody @Valid GeneralMessageSendRequest request); CommonResponse<String> pageQueryOldMessage(@RequestBody @Valid GeneralMessageSendRequest request);
/** /**
* 统计旧消息的未读数以及最新一条消息内容 * 统计旧消息的未读数以及最新一条消息内容
@ -41,6 +44,24 @@ public interface GeneralMessageClient {
* @return 消息未读数&最新一条消息内容 * @return 消息未读数&最新一条消息内容
*/ */
@PostMapping(value = "/general-message/old-data/statistic", produces = {MediaType.APPLICATION_JSON_VALUE}) @PostMapping(value = "/general-message/old-data/statistic", produces = {MediaType.APPLICATION_JSON_VALUE})
CommonResponse<GeneralMessageOldDataStatisticResponse> statisticOldData( CommonResponse<GeneralMessageOldDataStatisticResponse> pageQueryOldMessage(
@RequestBody @Valid GeneralMessageOldDataStatisticRequest request); @RequestBody @Valid GeneralMessageOldDataStatisticRequest request);
/**
* 统计旧消息的未读数
*
* @param request 消息所需参数
* @return 消息未读数
*/
@PostMapping(value = "/general-message/old-data/count-unread", produces = {MediaType.APPLICATION_JSON_VALUE})
CommonResponse<Integer> countUnreadFromOldMessage(@RequestBody @Valid GeneralMessageOldDataStatisticRequest request);
/**
* 旧消息的分页查询入口
*
* @param request 分页查询所需参数
* @return 旧消息的分页列表
*/
@PostMapping(value = "/general-message/old-data/page", produces = {MediaType.APPLICATION_JSON_VALUE})
CommonResponse<Page<MessageNewRes>> pageQueryOldMessage(@RequestBody @Valid CmsMsgQueryReq request);
} }

View File

@ -1,10 +1,13 @@
package cn.axzo.msg.center.service.general.client.fallback; package cn.axzo.msg.center.service.general.client.fallback;
import cn.axzo.msg.center.api.request.CmsMsgQueryReq;
import cn.axzo.msg.center.api.response.MessageNewRes;
import cn.axzo.msg.center.service.general.client.GeneralMessageClient; import cn.axzo.msg.center.service.general.client.GeneralMessageClient;
import cn.axzo.msg.center.service.general.request.GeneralMessageOldDataStatisticRequest; import cn.axzo.msg.center.service.general.request.GeneralMessageOldDataStatisticRequest;
import cn.axzo.msg.center.service.general.request.GeneralMessageSendRequest; import cn.axzo.msg.center.service.general.request.GeneralMessageSendRequest;
import cn.axzo.msg.center.service.general.response.GeneralMessageOldDataStatisticResponse; import cn.axzo.msg.center.service.general.response.GeneralMessageOldDataStatisticResponse;
import cn.azxo.framework.common.model.CommonResponse; import cn.azxo.framework.common.model.CommonResponse;
import cn.azxo.framework.common.model.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -18,15 +21,27 @@ import org.springframework.stereotype.Component;
public class GeneralMessageClientFallback implements GeneralMessageClient { public class GeneralMessageClientFallback implements GeneralMessageClient {
@Override @Override
public CommonResponse<String> statisticOldData(GeneralMessageSendRequest request) { public CommonResponse<String> pageQueryOldMessage(GeneralMessageSendRequest request) {
log.error("fall back while sending message. req:{}", request); log.error("fall back while sending message. req:{}", request);
return CommonResponse.error("fall back while sending message"); return CommonResponse.error("fall back while sending message");
} }
@Override @Override
public CommonResponse<GeneralMessageOldDataStatisticResponse> statisticOldData( public CommonResponse<GeneralMessageOldDataStatisticResponse> pageQueryOldMessage(
GeneralMessageOldDataStatisticRequest request) { GeneralMessageOldDataStatisticRequest request) {
log.error("fall back while statistic old message. req:{}", request); log.error("fall back while statistic old message. req:{}", request);
return CommonResponse.error("fall back while statistic old message"); return CommonResponse.error("fall back while statistic old message");
} }
@Override
public CommonResponse<Integer> countUnreadFromOldMessage(GeneralMessageOldDataStatisticRequest request) {
log.error("fall back while counting unread old message. request:{}", request);
return CommonResponse.error("fall back while counting unread old message");
}
@Override
public CommonResponse<Page<MessageNewRes>> pageQueryOldMessage(CmsMsgQueryReq request) {
log.error("fall back while statistic old message. request:{}", request);
return CommonResponse.error("fall back while statistic old message");
}
} }