|
@@ -148,19 +148,21 @@ public class ServerChatStart {
|
|
GroupConversationMiddle groupConversation = GroupConversationMiddle.dao.findFirst(sql.toString());
|
|
GroupConversationMiddle groupConversation = GroupConversationMiddle.dao.findFirst(sql.toString());
|
|
if( null != groupConversation ){
|
|
if( null != groupConversation ){
|
|
Conversation conversation = Conversation.dao.findById(groupConversation.getLong("conversation_id"));
|
|
Conversation conversation = Conversation.dao.findById(groupConversation.getLong("conversation_id"));
|
|
- Timestamp endTime = conversation.getTimestamp("end_time");
|
|
|
|
- Integer conversationLenth = conversation.getInt("conversation_lenth");
|
|
|
|
- if( null == endTime && null == conversationLenth ){
|
|
|
|
- //需要更改会话结束时间 和 对话时长
|
|
|
|
- long currentTimeMillis = System.currentTimeMillis();
|
|
|
|
- //当前时间的格林威治时间 毫秒数
|
|
|
|
- Timestamp currentTime = new Timestamp(currentTimeMillis);
|
|
|
|
- Timestamp createTime = conversation.getTimestamp("create_time");
|
|
|
|
- //会话创建时间的格林威治时间 毫秒数
|
|
|
|
- long createTimeMillis = createTime.getTime();
|
|
|
|
- if(currentTimeMillis > createTimeMillis){
|
|
|
|
- conversation.set("end_time",currentTime);
|
|
|
|
- conversation.set("conversation_lenth",Integer.valueOf( String.valueOf( (currentTimeMillis - createTimeMillis)/1000 )));
|
|
|
|
|
|
+ if(conversation != null){
|
|
|
|
+ Timestamp endTime = conversation.getTimestamp("end_time");
|
|
|
|
+ Integer conversationLenth = conversation.getInt("conversation_lenth");
|
|
|
|
+ if( null == endTime && null == conversationLenth ){
|
|
|
|
+ //需要更改会话结束时间 和 对话时长
|
|
|
|
+ long currentTimeMillis = System.currentTimeMillis();
|
|
|
|
+ //当前时间的格林威治时间 毫秒数
|
|
|
|
+ Timestamp currentTime = new Timestamp(currentTimeMillis);
|
|
|
|
+ Timestamp createTime = conversation.getTimestamp("create_time");
|
|
|
|
+ //会话创建时间的格林威治时间 毫秒数
|
|
|
|
+ long createTimeMillis = createTime.getTime();
|
|
|
|
+ if(currentTimeMillis > createTimeMillis){
|
|
|
|
+ conversation.set("end_time",currentTime);
|
|
|
|
+ conversation.set("conversation_lenth",Integer.valueOf( String.valueOf( (currentTimeMillis - createTimeMillis)/1000 )));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|