shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.iplatform.chat.support;
 
import com.iplatform.chat.ChatEngine;
import com.iplatform.chat.ChatService;
import com.iplatform.chat.ChatSession;
import com.iplatform.chat.ChatSessionCache;
import com.iplatform.chat.service.ChatDialogServiceImpl;
import com.iplatform.chat.util.ChatUtils;
import com.iplatform.model.po.ChatDialog;
import com.iplatform.model.vo.ChatVo;
import com.walker.infrastructure.utils.DateUtils;
 
@Deprecated
public class SimpleChatEngine extends ChatEngine {
 
    @Override
    protected boolean saveChatData(ChatVo chatVo) {
        this.chatService.execInsertChat(chatVo);
        return true;
    }
 
    @Override
    protected ChatSession createChatDialog(long chatDialogId, ChatVo chatVo) {
        ChatDialog chatDialog = new ChatDialog();
        chatDialog.setId(chatDialogId);
        chatDialog.setCreateTime(DateUtils.getDateTimeNumber());
        chatDialog.setCustomerService(chatVo.getCustomerService());
        chatDialog.setUserId(chatVo.getMe());
        chatDialog.setBizId(chatVo.getBizId());
        chatDialog.setEndTime(0l);
 
        this.chatDialogService.insert(chatDialog);
 
        ChatSession session = ChatUtils.acquireChatSession(chatDialog);
        this.chatSessionCache.save(session);
        return session;
    }
 
    @Override
    protected ChatSession acquireChatDialog(long chatDialogId) {
        return this.chatSessionCache.get(chatDialogId);
    }
 
    public void setChatSessionCache(ChatSessionCache chatSessionCache) {
        this.chatSessionCache = chatSessionCache;
    }
 
    public void setChatDialogService(ChatDialogServiceImpl chatDialogService) {
        this.chatDialogService = chatDialogService;
    }
 
    public void setChatService(ChatService chatService) {
        this.chatService = chatService;
    }
 
    private ChatService chatService;
    private ChatDialogServiceImpl chatDialogService;
    private ChatSessionCache chatSessionCache;
}