|
|
@@ -1,7 +1,10 @@
|
|
|
package com.goafanti.app.controller;
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -18,12 +21,15 @@ import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
import com.goafanti.common.controller.BaseApiController;
|
|
|
import com.goafanti.common.model.JpushEasemobAccount;
|
|
|
+import com.goafanti.common.model.MessageConsumer;
|
|
|
import com.goafanti.common.model.MessageFromSystem;
|
|
|
+import com.goafanti.common.model.MessageProducer;
|
|
|
import com.goafanti.common.model.User;
|
|
|
import com.goafanti.common.utils.DateUtils;
|
|
|
import com.goafanti.core.shiro.token.TokenManager;
|
|
|
import com.goafanti.easemob.EasemobUtils;
|
|
|
import com.goafanti.easemob.bo.EasemobInfo;
|
|
|
+import com.goafanti.message.bo.MessageBo;
|
|
|
import com.goafanti.message.bo.MessageListBo;
|
|
|
import com.goafanti.message.service.MessageService;
|
|
|
import com.goafanti.user.service.UserService;
|
|
|
@@ -115,6 +121,31 @@ public class AppApiController extends BaseApiController {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "必须指定消息类型"));
|
|
|
return res;
|
|
|
}
|
|
|
+ User u = TokenManager.getUserToken();
|
|
|
+ if(u != null){
|
|
|
+ List<MessageBo> boList = messageService.selectSendMessage(u.getId());
|
|
|
+ if(boList != null && boList.size()>0){
|
|
|
+ List<MessageProducer> producers = new ArrayList<MessageProducer>();
|
|
|
+ List<MessageConsumer> consumers = new ArrayList<MessageConsumer>();
|
|
|
+ MessageProducer mp = null;
|
|
|
+ MessageConsumer mc = null;
|
|
|
+ Date date = new Date();
|
|
|
+ for(MessageBo bo : boList){
|
|
|
+ mp = new MessageProducer();
|
|
|
+ mp.setId(bo.getId());
|
|
|
+ mp.setSendTime(date);
|
|
|
+ producers.add(mp);
|
|
|
+ mc = new MessageConsumer();
|
|
|
+ mc.setId(UUID.randomUUID().toString());
|
|
|
+ mc.setConsumerId(TokenManager.getUserId());
|
|
|
+ mc.setMessageId(bo.getMessageId());
|
|
|
+ consumers.add(mc);
|
|
|
+ }
|
|
|
+ if(producers.size()>0)messageService.updateMessageProducer(producers);
|
|
|
+ //新增 message_consumer
|
|
|
+ if(consumers.size()>0)messageService.insertBatchConsumer(consumers);
|
|
|
+ }
|
|
|
+ }
|
|
|
res.setData(messageService.listPersonalMessage(subject,sourceType,pageNo,pageSize));
|
|
|
return res;
|
|
|
}
|