FeiShuEventService.java 1.82 KB
package com.pipihelper.project.feishu.service;

import com.pipihelper.project.feishu.dto.FeiShuConfig;
import com.pipihelper.project.feishu.dto.FeiShuEventDTO;
import com.pipihelper.project.feishu.dto.FeiShuEventHeaderDTO;
import com.pipihelper.project.feishu.dto.FeiShuEventReceiveMessageDTO;
import com.pipihelper.project.tx.dto.TxConfig;
import com.pipihelper.project.tx.service.TxApiService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

/**
 * @Description: TODO
 * @author: charles
 * @date: 2022年04月11日 17:01
 */

@Service
public class FeiShuEventService {
    @Resource
    private FeiShuConfig feiShuConfig;


    @Resource
    private FeiShuApiService feiShuApiService;



    @Autowired
    private TxApiService txApiService;



    @Autowired
    private TxConfig txConfig;



    @Async
    public void imMessageReceiveV1(FeiShuEventDTO feiShuEventDTO){
        FeiShuEventHeaderDTO feiShuEventHeaderDTO = feiShuEventDTO.getHeader();
        FeiShuEventReceiveMessageDTO feiShuEventReceiveMessageDTO = feiShuEventDTO.getEvent().toJavaObject(FeiShuEventReceiveMessageDTO.class);
        FeiShuEventReceiveMessageDTO.Sender sender= feiShuEventReceiveMessageDTO.getSender();
        FeiShuEventReceiveMessageDTO.Message message= feiShuEventReceiveMessageDTO.getMessage();
        //单独处理群消息
        if (message.getChat_id().equals(feiShuConfig.getFkChatId())
                || message.getChat_id().equals(feiShuConfig.getFkChatIdTest())) { //判断是否为指定群消息
            return;
        }
        else {
            //如果是单聊
            if(message.getChat_type().equals("p2p")) {
//                robotTalk(feiShuEventDTO);
            }
        }
    }


}