暂态事件处理
This commit is contained in:
@@ -2,6 +2,7 @@ package com.njcn;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.common.reflect.TypeToken;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
@@ -11,6 +12,7 @@ import com.njcn.access.enums.AccessEnum;
|
||||
import com.njcn.access.enums.TypeEnum;
|
||||
import com.njcn.access.pojo.dto.ReqAndResDto;
|
||||
import com.njcn.access.pojo.dto.mqtt.MqttClientDto;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import io.lettuce.core.protocol.CompleteableCommand;
|
||||
import okhttp3.Credentials;
|
||||
import okhttp3.OkHttpClient;
|
||||
@@ -25,8 +27,9 @@ import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -56,12 +59,34 @@ public class AppTest
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
ReqAndResDto reqAndResParam = new ReqAndResDto();
|
||||
reqAndResParam.setMid(1);
|
||||
reqAndResParam.setDid(0);
|
||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
reqAndResParam.setType(4866);
|
||||
publisher.send("/Dev/Data1/V1/123", new Gson().toJson(reqAndResParam),1,false);
|
||||
// ReqAndResDto reqAndResParam = new ReqAndResDto();
|
||||
// reqAndResParam.setMid(1);
|
||||
// reqAndResParam.setDid(0);
|
||||
// reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
// reqAndResParam.setType(4866);
|
||||
// publisher.send("/Dev/Data1/V1/123", new Gson().toJson(reqAndResParam),1,false);
|
||||
|
||||
// String key = String.valueOf(IdUtil.getSnowflake().nextId());
|
||||
// System.out.println("key==:" + key);
|
||||
|
||||
List<CsLinePO> csLinePoList = new ArrayList<>();
|
||||
CsLinePO po1 = new CsLinePO();
|
||||
po1.setPosition("1");
|
||||
CsLinePO po2= new CsLinePO();
|
||||
po2.setPosition("2");
|
||||
CsLinePO po3= new CsLinePO();
|
||||
po3.setPosition("3");
|
||||
CsLinePO po4= new CsLinePO();
|
||||
po4.setPosition("1");
|
||||
|
||||
csLinePoList.add(po1);
|
||||
csLinePoList.add(po2);
|
||||
csLinePoList.add(po3);
|
||||
csLinePoList.add(po4);
|
||||
List<String> l = csLinePoList.stream().map(CsLinePO::getPosition).collect(Collectors.toList());
|
||||
System.out.println("l===:" + l);
|
||||
List<String> lineList = l.stream().filter(e-> Collections.frequency(l,e) > 1).distinct().collect(Collectors.toList());
|
||||
System.out.println("lineList==:" + lineList);
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
|
||||
Reference in New Issue
Block a user