|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.dragon.tj.portal.auth.model.LoginUser;
|
|
import com.dragon.tj.portal.auth.model.LoginUser;
|
|
|
|
+import com.dragon.tj.portal.auth.util.SecurityUtils;
|
|
import com.dragon.tj.portal.auth.web.service.SysDeptService;
|
|
import com.dragon.tj.portal.auth.web.service.SysDeptService;
|
|
import com.dragon.tj.portal.common.base.R;
|
|
import com.dragon.tj.portal.common.base.R;
|
|
import com.dragon.tj.portal.common.constants.BusinessConstants;
|
|
import com.dragon.tj.portal.common.constants.BusinessConstants;
|
|
@@ -20,6 +21,7 @@ import com.dragon.tj.portal.common.enums.message.ScopeEnums;
|
|
import com.dragon.tj.portal.common.vo.message.MessageInfoParam;
|
|
import com.dragon.tj.portal.common.vo.message.MessageInfoParam;
|
|
import com.dragon.tj.portal.common.vo.message.MessageInfoVO;
|
|
import com.dragon.tj.portal.common.vo.message.MessageInfoVO;
|
|
import com.dragon.tj.portal.common.vo.message.MessagePageParam;
|
|
import com.dragon.tj.portal.common.vo.message.MessagePageParam;
|
|
|
|
+import com.dragon.tj.portal.common.vo.message.MsgCountVO;
|
|
import com.dragon.tj.portal.component.exception.message.MessageInfoException;
|
|
import com.dragon.tj.portal.component.exception.message.MessageInfoException;
|
|
import com.dragon.tj.portal.component.message.KafkaInitialConfiguration;
|
|
import com.dragon.tj.portal.component.message.KafkaInitialConfiguration;
|
|
import com.dragon.tj.portal.component.message.MessageProducer;
|
|
import com.dragon.tj.portal.component.message.MessageProducer;
|
|
@@ -27,6 +29,7 @@ import com.dragon.tj.portal.entity.MessageInfo;
|
|
import com.dragon.tj.portal.entity.MessageInfoScope;
|
|
import com.dragon.tj.portal.entity.MessageInfoScope;
|
|
import com.dragon.tj.portal.entity.MsgRecord;
|
|
import com.dragon.tj.portal.entity.MsgRecord;
|
|
import com.dragon.tj.portal.mapper.MessageInfoMapper;
|
|
import com.dragon.tj.portal.mapper.MessageInfoMapper;
|
|
|
|
+import com.dragon.tj.portal.mapper.NoticeInfoMapper;
|
|
import com.dragon.tj.portal.service.MessageInfoScopeService;
|
|
import com.dragon.tj.portal.service.MessageInfoScopeService;
|
|
import com.dragon.tj.portal.service.MessageInfoService;
|
|
import com.dragon.tj.portal.service.MessageInfoService;
|
|
import com.dragon.tj.portal.service.MsgRecordService;
|
|
import com.dragon.tj.portal.service.MsgRecordService;
|
|
@@ -41,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -76,6 +80,9 @@ public class MessageInfoServiceImpl extends ServiceImpl<MessageInfoMapper, Messa
|
|
@Value("${message-secret:false}")
|
|
@Value("${message-secret:false}")
|
|
private boolean messageSecret;
|
|
private boolean messageSecret;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private NoticeInfoMapper noticeInfoMapper;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public R push(MessageInfoReq messageInfoReq, LoginUser loginUser) {
|
|
public R push(MessageInfoReq messageInfoReq, LoginUser loginUser) {
|
|
return R.ok(this.doMessage(messageInfoReq, loginUser));
|
|
return R.ok(this.doMessage(messageInfoReq, loginUser));
|
|
@@ -95,25 +102,25 @@ public class MessageInfoServiceImpl extends ServiceImpl<MessageInfoMapper, Messa
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean read(Long id) {
|
|
public boolean read(Long id) {
|
|
- MessageInfo messageInfo = this.getById(id);
|
|
|
|
|
|
+ MessageInfoScope messageInfo = messageInfoScopeService.getById(id);
|
|
Integer readStatus = messageInfo.getReadStatus();
|
|
Integer readStatus = messageInfo.getReadStatus();
|
|
if (ReadStatusEnum.YES.value().equals(readStatus)) {
|
|
if (ReadStatusEnum.YES.value().equals(readStatus)) {
|
|
throw new MessageInfoException(MessageInfoErrorEnums.Code.MESSAGE_READ_ALREADY);
|
|
throw new MessageInfoException(MessageInfoErrorEnums.Code.MESSAGE_READ_ALREADY);
|
|
}
|
|
}
|
|
messageInfo.setReadStatus(ReadStatusEnum.YES.value());
|
|
messageInfo.setReadStatus(ReadStatusEnum.YES.value());
|
|
- return this.updateById(messageInfo);
|
|
|
|
|
|
+ return messageInfoScopeService.updateById(messageInfo);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean reads(List<Long> ids) {
|
|
public boolean reads(List<Long> ids) {
|
|
- List<MessageInfo> list = Lists.newArrayList();
|
|
|
|
|
|
+ List<MessageInfoScope> list = Lists.newArrayList();
|
|
ids.forEach(e -> {
|
|
ids.forEach(e -> {
|
|
- MessageInfo messageInfo = new MessageInfo();
|
|
|
|
|
|
+ MessageInfoScope messageInfo = new MessageInfoScope();
|
|
messageInfo.setReadStatus(ReadStatusEnum.YES.value());
|
|
messageInfo.setReadStatus(ReadStatusEnum.YES.value());
|
|
messageInfo.setId(e);
|
|
messageInfo.setId(e);
|
|
|
|
|
|
});
|
|
});
|
|
- return this.updateBatchById(list);
|
|
|
|
|
|
+ return messageInfoScopeService.updateBatchById(list);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -122,6 +129,25 @@ public class MessageInfoServiceImpl extends ServiceImpl<MessageInfoMapper, Messa
|
|
return queryPage;
|
|
return queryPage;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public MsgCountVO getCount() {
|
|
|
|
+ LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
|
+ String idCard = loginUser.getIdCard();
|
|
|
|
+ MsgCountVO msgCountVO = new MsgCountVO();
|
|
|
|
+ Integer noticeY = noticeInfoMapper.getCount(idCard, ReadStatusEnum.YES.value());
|
|
|
|
+ Integer noticeN = noticeInfoMapper.getCount(idCard,ReadStatusEnum.NO.value());
|
|
|
|
+
|
|
|
|
+ Integer msgY = this.baseMapper.getCount(idCard,ReadStatusEnum.YES.value());
|
|
|
|
+ Integer msgN = this.baseMapper.getCount(idCard,ReadStatusEnum.NO.value());
|
|
|
|
+
|
|
|
|
+ log.info("getCount-{}-{}-{}-{}-{}",idCard,noticeN,noticeY,msgN,msgY);
|
|
|
|
+ msgCountVO.setNoticeNCount(noticeN);
|
|
|
|
+ msgCountVO.setNoticeYCount(noticeY);
|
|
|
|
+ msgCountVO.setMessageYCount(msgY);
|
|
|
|
+ msgCountVO.setNoticeNCount(msgN);
|
|
|
|
+ return msgCountVO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author huey China.
|
|
* @author huey China.
|