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

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.viontech.fanxing.commons.model.DictCode;
import com.viontech.fanxing.commons.vo.ChannelVo;
import com.viontech.fanxing.ops.service.adapter.ChannelService;
import com.viontech.fanxing.ops.service.adapter.DictCodeService;
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;

    @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);

    }

}