//package com.mortals.xhx.stream;
//
//import com.alibaba.fastjson.JSON;
//
//import com.mortals.xhx.base.framework.config.InterceptorConfig;
//import com.mortals.xhx.base.framework.ws.message.SendToOneRequest;
//import com.mortals.xhx.base.framework.ws.util.WebSocketUtil;
//import com.mortals.xhx.common.pdu.flow.FlowTaskNotifyPdu;
//import com.mortals.xhx.tools.uid.ISeqGeneratorService;
//import com.mortals.xhx.utils.stream.messaging.ProcessTaskSink;
//import lombok.extern.apachecommons.CommonsLog;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cloud.stream.annotation.StreamListener;
//import org.springframework.stereotype.Component;
//
///**
// * @author karlhoo
// */
//@CommonsLog
//@Component
//public class TaskProcessStreamListener {
//
//    @Autowired
//     private InterceptorConfig interceptorConfig;
//    @Autowired
//    private ISeqGeneratorService seqGeneratorService;
//
//    /**
//     * 接收流程管理器任务
//     */
//    @StreamListener(ProcessTaskSink.INPUT)
//    public void receiveTask(FlowTaskNotifyPdu task) {
//        log.debug("comsumer message processTask:"+ JSON.toJSONString(task));
//
//        if(interceptorConfig.getTenantId().equals(task.getTenantId())){
//             log.debug("本节点代办任务通知事件");
//            // TODO 通过websocket刷新页面消息
//            task.getUserNameList().stream().peek(item->{
//                //针对所有在线的发送
//                SendToOneRequest sendToOneRequest = new SendToOneRequest();
//                sendToOneRequest.setToUser(item);
//                sendToOneRequest.setMsgId(seqGeneratorService.nextOrderId(1)+"");
//                sendToOneRequest.setContent("notify");
//                WebSocketUtil.send(item,SendToOneRequest.TYPE,sendToOneRequest);
//            }).count();
//        }
//    }
//
//}
