将业务逻辑迁移出去
This commit is contained in:
parent
ee045eea03
commit
198241bfac
@ -6,6 +6,7 @@ import cn.axzo.msg.center.api.request.CmsMsgQueryReq;
|
||||
import cn.axzo.msg.center.api.request.MessageNewRes;
|
||||
import cn.axzo.msg.center.api.response.MessageTotalRes;
|
||||
import cn.axzo.msg.center.common.page.PageResult;
|
||||
import cn.axzo.msg.center.domain.enums.UserTypeEnum;
|
||||
|
||||
/**
|
||||
* @author : liuchuntao
|
||||
@ -19,7 +20,7 @@ public interface MessageCoreService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MessageTotalRes statisticsMsg();
|
||||
MessageTotalRes statisticsMsg(Long personId, Long identityId, UserTypeEnum userTypeEnum);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package cn.axzo.msg.center.inside.notices.service.impl;
|
||||
|
||||
import cn.axzo.basics.common.util.AssertUtil;
|
||||
import cn.axzo.framework.auth.domain.ContextInfoHolder;
|
||||
import cn.axzo.msg.center.api.request.CmsMsgQueryReq;
|
||||
import cn.axzo.msg.center.api.request.MessageNewRes;
|
||||
@ -29,7 +28,6 @@ import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.axzo.framework.auth.domain.TerminalInfo.NT_CM_APP_GENERAL;
|
||||
import static cn.axzo.msg.center.domain.enums.MsgRouteTypeEnum.WECHAT_MINI_PROGRAM;
|
||||
|
||||
/**
|
||||
@ -91,19 +89,7 @@ public class MessageCoreServiceImpl implements MessageCoreService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MessageTotalRes statisticsMsg() {
|
||||
Long personId = ContextInfoHolder.get().getUserInfo().getPersonId();
|
||||
AssertUtil.isTrue(0L != personId, "数据异常, 当前登录用户的自然人 ID 为 0, 无法执行消息统计查询!, ContextInfo : "
|
||||
+ JSON.toJSONString(ContextInfoHolder.get()));
|
||||
|
||||
// 如果是工人 APP,则需要走特殊的查询逻辑, 需要将施工业务的对应身份数据查询出来,交易业务全量数据查询出来,合并为一个列表返回
|
||||
// if(Objects.equals(NT_CM_APP_GENERAL, ContextInfoHolder.get().getSystemAndDeviceInfo().getLoginDevice())) {
|
||||
// personId = ContextInfoHolder.get().getUserInfo().getPersonId();
|
||||
// }
|
||||
|
||||
Long identityId = ContextInfoHolder.get().getUserInfo().getIdentityId();
|
||||
UserTypeEnum userTypeEnum = getUserType();
|
||||
|
||||
public MessageTotalRes statisticsMsg(Long personId,Long identityId,UserTypeEnum userTypeEnum) {
|
||||
//根据用户和当前身份获取未读和待办消息
|
||||
return messageRecordService.statisticsMsg4Total(personId, identityId, userTypeEnum);
|
||||
}
|
||||
@ -118,14 +104,14 @@ public class MessageCoreServiceImpl implements MessageCoreService {
|
||||
@Override
|
||||
public PageResult<MessageNewRes> listMsgInfo(CmsMsgQueryReq req) {
|
||||
PageResult<MessageNewRes> resPageResult;
|
||||
Long identityId = ContextInfoHolder.get().getUserInfo().getIdentityId();
|
||||
/*Long identityId = ContextInfoHolder.get().getUserInfo().getIdentityId();
|
||||
Long personId = null;
|
||||
|
||||
// 如果是工人 APP,则需要走特殊的查询逻辑, 需要将施工业务的对应身份数据查询出来,交易业务全量数据查询出来,合并为一个列表返回
|
||||
if (Objects.equals(NT_CM_APP_GENERAL, ContextInfoHolder.get().getSystemAndDeviceInfo().getLoginDevice())) {
|
||||
personId = ContextInfoHolder.get().getUserInfo().getPersonId();
|
||||
}
|
||||
resPageResult = messageRecordService.pageMsgInfo(req, personId, identityId, getUserType());
|
||||
}*/
|
||||
resPageResult = messageRecordService.pageMsgInfo(req, req.getPersonId(), req.getIdentityId(), getUserType());
|
||||
|
||||
List<MessageNewRes> resList = refineMessageRes(resPageResult, req);
|
||||
|
||||
|
||||
@ -39,5 +39,15 @@ public class CmsMsgQueryReq extends PageRequest {
|
||||
* 待办、消息模块类型Id - 针对待办使用
|
||||
*/
|
||||
private Long moduleId;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "自然人id不能为空")
|
||||
private Long personId;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "identityId不能为空")
|
||||
private Long identityId;
|
||||
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import cn.axzo.msg.center.api.request.MessageNewRes;
|
||||
import cn.axzo.msg.center.api.request.MsgReturnParamRes;
|
||||
import cn.axzo.msg.center.api.response.MessageTotalRes;
|
||||
import cn.axzo.msg.center.common.page.PageResult;
|
||||
import cn.axzo.msg.center.domain.enums.UserTypeEnum;
|
||||
import cn.axzo.msg.center.inside.notices.service.MessageCoreService;
|
||||
import cn.axzo.msg.center.inside.notices.service.MessageRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -38,7 +39,7 @@ public class MessageController {
|
||||
|
||||
|
||||
/**
|
||||
* 新增推送消息接口
|
||||
* 新增推送消息接口,发送push消息,站内信
|
||||
*
|
||||
* @param message
|
||||
* @return 消息唯一主键
|
||||
@ -55,9 +56,9 @@ public class MessageController {
|
||||
*/
|
||||
@GetMapping("v1/msg/total")
|
||||
//@PreBuildContext
|
||||
public Result<MessageTotalRes> msgTotal() {
|
||||
public Result<MessageTotalRes> msgTotal(Long personId, Long identityId, UserTypeEnum userTypeEnum) {
|
||||
log.info("msgTotal executing...");
|
||||
return Results.ok(messageCoreService.statisticsMsg());
|
||||
return Results.ok(messageCoreService.statisticsMsg(personId,identityId,userTypeEnum));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user