Skip to content

Commit

Permalink
添加message回执,添加chat-route模块
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony committed Feb 23, 2015
1 parent 55c6c01 commit fdb7c70
Show file tree
Hide file tree
Showing 69 changed files with 522 additions and 304 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
> dispatch(IMConnection, IMRequest)<br>
#### 业务处理流程<br>
> Received:
> findHandler(id).dispatch() -> UserHandler
> Received:<br>
> findHandler(id).dispatch() -> UserHandler<br>
>
> UserHandler.dispatch()
> switch(cmdId)
> // doCommand
> UserHandler.dispatch()<br>
> switch(cmdId)<br>
> // doCommand<br>
>
> UserHandler <- UserService <- UserRepository<br>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz;
package io.ganguo.chat.route.biz;

import com.mongodb.Mongo;
import com.mongodb.MongoClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz.bean;
package io.ganguo.chat.route.biz.bean;

/**
* Created by Tony on 2/19/15.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz.bean;
package io.ganguo.chat.route.biz.bean;

/**
* @author Tony
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz.bean;
package io.ganguo.chat.route.biz.bean;

/**
* Created by Tony on 2/21/15.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.ganguo.chat.biz.entity;
package io.ganguo.chat.route.biz.entity;

import org.springframework.data.annotation.Id;

import java.math.BigInteger;

/**
* Created by Tony on 2/19/15.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.ganguo.chat.biz.entity;
package io.ganguo.chat.route.biz.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz.entity;
package io.ganguo.chat.route.biz.entity;


import org.springframework.data.mongodb.core.mapping.Document;
Expand All @@ -11,9 +11,12 @@ public class Message extends BaseEntity {
// uin
private long to;
private long from;

private byte type;
private boolean read;
private String message;
private long createAt;
private long readAt;

public long getTo() {
return to;
Expand All @@ -39,6 +42,14 @@ public void setType(byte type) {
this.type = type;
}

public boolean isRead() {
return read;
}

public void setRead(boolean read) {
this.read = read;
}

public String getMessage() {
return message;
}
Expand All @@ -55,6 +66,14 @@ public void setCreateAt(long createAt) {
this.createAt = createAt;
}

public long getReadAt() {
return readAt;
}

public void setReadAt(long readAt) {
this.readAt = readAt;
}

@Override
public String toString() {
return "Message{" +
Expand All @@ -68,8 +87,8 @@ public String toString() {

public enum Type {
SESSION_MSG(0), // 临时会话消息
BUDDY_MSG(1), // 好友消息
GROUP_MSG(2); // 群消息
USER_MSG(1), // 好友消息
ROOM_MSG(2); // 群消息

private byte mValue = 0;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz.entity;
package io.ganguo.chat.route.biz.entity;

import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz.entity;
package io.ganguo.chat.route.biz.entity;

/**
* @author Tony
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.ganguo.chat.route.biz.repository;

import io.ganguo.chat.route.biz.entity.Login;
import org.springframework.data.repository.CrudRepository;

import java.math.BigInteger;

/**
* Created by Tony on 2/20/15.
*/
public interface LoginRepository extends CrudRepository<Login, BigInteger> {

Login findByUin(long uin);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.ganguo.chat.route.biz.repository;

import io.ganguo.chat.route.biz.entity.Message;
import org.springframework.data.repository.CrudRepository;

import java.math.BigInteger;

/**
* Created by Tony on 2/23/15.
*/
public interface MessageRepository extends CrudRepository<Message, BigInteger> {

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.ganguo.chat.biz.repository;
package io.ganguo.chat.route.biz.repository;

import io.ganguo.chat.biz.entity.User;
import org.springframework.data.mongodb.repository.Query;
import io.ganguo.chat.route.biz.entity.User;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.ganguo.chat.route.biz.service;

/**
* Created by Tony on 2/23/15.
*/
public interface MessageService {


}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.ganguo.chat.biz.service;
package io.ganguo.chat.route.biz.service;

import io.ganguo.chat.biz.entity.Login;
import io.ganguo.chat.biz.entity.User;
import io.ganguo.chat.route.biz.entity.Login;
import io.ganguo.chat.route.biz.entity.User;

/**
* Created by Tony on 2/20/15.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package io.ganguo.chat.route.biz.service.impl;

import io.ganguo.chat.route.biz.service.MessageService;

/**
* Created by Tony on 2/23/15.
*/
public class MessageServiceImpl implements MessageService {

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package io.ganguo.chat.biz.service.impl;
package io.ganguo.chat.route.biz.service.impl;

import io.ganguo.chat.biz.entity.Login;
import io.ganguo.chat.biz.entity.User;
import io.ganguo.chat.biz.repository.LoginRepository;
import io.ganguo.chat.biz.repository.UserRepository;
import io.ganguo.chat.biz.service.UserService;
import io.ganguo.chat.route.biz.entity.Login;
import io.ganguo.chat.route.biz.entity.User;
import io.ganguo.chat.route.biz.repository.LoginRepository;
import io.ganguo.chat.route.biz.repository.UserRepository;
import io.ganguo.chat.route.biz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz;
package io.ganguo.chat.route.biz;

import org.junit.Before;
import org.junit.runner.RunWith;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz;
package io.ganguo.chat.route.biz;

import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.ganguo.chat.biz;
package io.ganguo.chat.route.biz;

import java.util.UUID;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package io.ganguo.chat.biz.user;
package io.ganguo.chat.route.biz.user;

import io.ganguo.chat.biz.AbstractIntegrationTest;
import io.ganguo.chat.biz.entity.User;
import io.ganguo.chat.biz.repository.UserRepository;
import io.ganguo.chat.route.biz.AbstractIntegrationTest;
import io.ganguo.chat.route.biz.entity.User;
import io.ganguo.chat.route.biz.repository.UserRepository;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigInteger;
import java.util.Iterator;
import java.util.List;

/**
* Created by Tony on 2/20/15.
Expand All @@ -21,9 +19,9 @@ public class TestUserRepository extends AbstractIntegrationTest {
@Test
public void testSave() {
User user = new User();
user.setUin(0L);
user.setAccount("test");
user.setPassword("test");
user.setUin(2L);
user.setAccount("test2");
user.setPassword("test2");
user = userRepository.save(user);

System.out.println("##### " + user);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package io.ganguo.chat.biz.user;
package io.ganguo.chat.route.biz.user;

import io.ganguo.chat.biz.AbstractIntegrationTest;
import io.ganguo.chat.biz.entity.Login;
import io.ganguo.chat.biz.entity.User;
import io.ganguo.chat.biz.service.impl.UserServiceImpl;
import io.ganguo.chat.route.biz.AbstractIntegrationTest;
import io.ganguo.chat.route.biz.entity.Login;
import io.ganguo.chat.route.biz.service.impl.UserServiceImpl;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.UUID;

import static org.junit.Assert.assertNotNull;

/**
Expand Down

This file was deleted.

Loading

0 comments on commit fdb7c70

Please sign in to comment.