package com.fs.app.controller;//package com.fs.app.controller;
//
//import com.alibaba.fastjson.JSON;
//import com.fs.app.service.QwDataCallbackService;
//import com.fs.common.core.redis.RedisCache;
//import com.fs.fastGpt.service.AiNewService;
//import com.fs.fastGpt.service.AiService;
//import com.fs.qw.domain.QwMessageGather;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
//@Service
//public class testTask {
//
//    @Autowired
//    QwDataCallbackService qwDataCallbackService;
//    @Autowired
//    private AiNewService aiService;
//
//    @Scheduled(fixedRate = 5000) // 每10执行一次
//    public void getMsg(){
//        // 拉取会话存档内容
//        List<String> chatContents = qwDataCallbackService.getChatData("wweb0666cc79d79da5");
//        for (String chatContent : chatContents) {
//            QwMessageGather qwMessageGather = JSON.parseObject(chatContent, QwMessageGather.class);
//            if (!qwMessageGather.getAction().equals("send")){
//                System.out.println("非send");
//                continue;
//            }
//            if (!qwMessageGather.getMsgtype().equals("text")){
//                System.out.println("非text");
//                continue;
//            }
//            if (qwMessageGather.getRoomid()!=null&&!qwMessageGather.getRoomid().equals("")){
//                System.out.println("群聊消息");
//                continue;
//            }
//            String from = qwMessageGather.getFrom();
//            if (from.startsWith("wo")||from.startsWith("wm")){
//                System.out.println("用户发消息");
//                aiService.qwHookNotifyAiReply(qwMessageGather,"wweb0666cc79d79da5");
//            }else {
//                aiService.qwHookNotifyAddMsg(qwMessageGather,"wweb0666cc79d79da5");
//                System.out.println("客服发送消息");
//            }
//            QwMessageGather.TextContent text = qwMessageGather.getText();
//            System.out.println(text.getContent());
//        }
//    }
//}
