MainTest.java 1.58 KB
package com.viontech.fanxing.ops;

import com.viontech.fanxing.commons.feign.TaskFeignClient;
import com.viontech.fanxing.commons.model.Task;
import com.viontech.fanxing.commons.vo.ChannelVo;
import com.viontech.fanxing.ops.service.adapter.ChannelService;
import com.viontech.keliu.util.JsonMessageUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * .
 *
 * @author 谢明辉
 * @date 2021/9/2
 */
@SpringBootTest
@RunWith(SpringRunner.class)
public class MainTest {

    @Resource
    private ChannelService channelService;
    @Resource
    private TaskFeignClient taskFeignClient;

    @Test
    public void nvs3000CodeTest() {
        ChannelVo channelVo = new ChannelVo();
        channelVo.setChannelUnid("123");
        ArrayList<ChannelVo> objects = new ArrayList<>();
        objects.add(channelVo);

        Map<String, List<ChannelVo>> addressUnid_channel_map = objects.stream().map(ChannelVo::new).collect(Collectors.groupingBy(ChannelVo::getAddressUnid, Collectors.toList()));
        System.out.println(addressUnid_channel_map);

    }

    @Test
    public void getTaskByChannelTest() {
        JsonMessageUtil.JsonMessage<List<Task>> taskByChannelUnid =
                taskFeignClient.getTaskByChannelUnid("5e19f4e3-ee71-44d9-82ad-99391b1031b5");
        System.out.println(taskByChannelUnid.toString());
    }

}