|
@@ -1,6 +1,7 @@
|
|
|
package com.yonge.cooleshow.biz.dal.service.impl;
|
|
|
|
|
|
import com.dayaedu.cbs.common.enums.EAppKey;
|
|
|
+import com.dayaedu.cbs.common.enums.EClientType;
|
|
|
import com.dayaedu.cbs.common.enums.message.EMessageSendMode;
|
|
|
import com.dayaedu.cbs.common.enums.message.ESendStatus;
|
|
|
import com.dayaedu.cbs.openfeign.client.MessageFeignClientService;
|
|
@@ -25,6 +26,7 @@ import com.yonge.toolset.mybatis.dal.BaseDAO;
|
|
|
import com.yonge.toolset.mybatis.service.impl.BaseServiceImpl;
|
|
|
import com.yonge.toolset.thirdparty.message.MessageSenderPluginContext.MessageSender;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -80,7 +82,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
CbsMessageWrapper.MessageParam messageParam = new CbsMessageWrapper.MessageParam();
|
|
|
messageParam.setUserId(user.getUserId());
|
|
|
messageParam.setAppKey(EAppKey.KLX);
|
|
|
- messageParam.setClientType(jpushType);
|
|
|
+ messageParam.setClientType(getClientType(jpushType));
|
|
|
messageParam.setType(type.getCode());
|
|
|
messageParam.setUrl(url);
|
|
|
Map<Long, String> params = new HashMap<>();
|
|
@@ -103,6 +105,18 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
messageFeignClientService.sysMessageBatchSendMessage(messageParams);
|
|
|
}
|
|
|
|
|
|
+ public EClientType getClientType(String jpushType){
|
|
|
+ if(StringUtils.isEmpty(jpushType)){
|
|
|
+ return null;
|
|
|
+ }else if(jpushType.contains("STUDENT")){
|
|
|
+ return EClientType.STUDENT;
|
|
|
+ }else if(jpushType.contains("TEACHER")){
|
|
|
+ return EClientType.TEACHER;
|
|
|
+ }else {
|
|
|
+ return EClientType.BACKEND;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public boolean sendSecurityCode(MessageSender messageSender, Long userId, MessageTypeEnum messageType, String receiver, String platform) {
|
|
@@ -160,7 +174,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
public List<Mapper> queryCountOfUnread(MessageSendMode type, Long userId, String jpushType) {
|
|
|
CbsMessageWrapper.SysMessageQuery query = new CbsMessageWrapper.SysMessageQuery();
|
|
|
query.setUserId(userId);
|
|
|
- query.setClientType(jpushType);
|
|
|
+ query.setClientType(getClientType(jpushType));
|
|
|
query.setStatus(ESendStatus.SUCCESSED);
|
|
|
query.setAppKey(EAppKey.KLX);
|
|
|
query.setSendMode(type == null?null:type == MessageSendMode.SMS?EMessageSendMode.SMS:
|
|
@@ -211,7 +225,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
CbsMessageWrapper.MessageRead messageRead = new CbsMessageWrapper.MessageRead();
|
|
|
messageRead.setUserId(userId);
|
|
|
messageRead.setAppKey(EAppKey.KLX);
|
|
|
- messageRead.setClientType(jpushType);
|
|
|
+ messageRead.setClientType(getClientType(jpushType));
|
|
|
return messageFeignClientService.batchSetRead(messageRead).feignData();
|
|
|
}
|
|
|
|
|
@@ -240,7 +254,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
public List<SysMessageWrapper.MessageUnreadStat> userMessageUnreadStat(SysMessageWrapper.SysMessageQuery param) {
|
|
|
CbsMessageWrapper.SysMessageQuery query = new CbsMessageWrapper.SysMessageQuery();
|
|
|
query.setUserId(param.getUserId());
|
|
|
- query.setClientType(param.getClientType().getCode());
|
|
|
+ query.setClientType(getClientType(param.getClientType().getCode()));
|
|
|
query.setStatus(ESendStatus.SUCCESSED);
|
|
|
query.setAppKey(EAppKey.KLX);
|
|
|
query.setSendMode(param.getType() == null?null:param.getType() == MessageSendMode.SMS?EMessageSendMode.SMS:
|
|
@@ -270,7 +284,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
queryInfo.getType() == 2?EMessageSendMode.EMAIL:
|
|
|
queryInfo.getType() == 3?EMessageSendMode.PUSH:EMessageSendMode.SEO);
|
|
|
query.setTitle(queryInfo.getTitle());
|
|
|
- query.setClientId(queryInfo.getClientId());
|
|
|
+ query.setClientId(getClientType(queryInfo.getClientId()));
|
|
|
query.setReadStatus(queryInfo.getReadStatus() == null?null:queryInfo.getReadStatus()==1);
|
|
|
query.setGroup(queryInfo.getGroup());
|
|
|
R<PageInfo<CbsMessageWrapper.SysMessage>> pageInfoR = messageFeignClientService.sysMessagePage(query);
|
|
@@ -305,7 +319,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
|
|
|
message.setReadStatus(sysMessage.getReadStatus()?1:0);
|
|
|
}
|
|
|
message.setGroup(sysMessage.getGroup());
|
|
|
- message.setClientId(sysMessage.getClientId());
|
|
|
+ message.setClientId(sysMessage.getClientId().getCode());
|
|
|
message.setImg(sysMessage.getIcon());
|
|
|
sysMessages.add(message);
|
|
|
});
|