package com.post;

import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.commons.collections.BagUtils;

import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

public class Test03 {
    public static void main(String[] args) {
        //可以替换大部分空白字符， 不限于空格 ； \s 可以匹配空格、制表符、换页符等空白字符的其中任意一个。
//        this.nickName = nickName == null ? null : nickName.replaceAll("\\s*", "");
        String nickName = "李  强";

        System.out.println(nickName.length());
        System.out.println(nickName);

        nickName = nickName.replaceAll("\\s*", "");
        System.out.println(nickName.length());
        System.out.println(nickName);


        System.out.println("=======================================");
        System.out.println("=======================================");
        List<SysUser> userList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            SysUser sysUser = new SysUser();
            sysUser.setUserId((long) i);
            sysUser.setNickName(i + "");
            if (i % 2 == 0) {
                sysUser.setPostId((long) i);
            }
            userList.add(sysUser);
        }
        Set<SysUser> userPostSet = userList.stream().filter(element -> element.getPostId() != null).collect(Collectors.toSet());
        int userCount = userPostSet.size();
        System.out.println("用户数量 = " + userCount);

        for (SysUser user : userPostSet) {
            System.out.println("user = " + user.getUserId() + "\t" + user.getPostId());
        }


        System.out.println();
        System.out.println();
        System.out.println();

        BigDecimal b1 = new BigDecimal("1");
        BigDecimal b2 = new BigDecimal("2");
        BigDecimal b3 = new BigDecimal("3");
        List<BigDecimal> peerEvaluationScoreList = new ArrayList<>();
        peerEvaluationScoreList.add(b1);
        peerEvaluationScoreList.add(b3);
        peerEvaluationScoreList.add(b2);

        peerEvaluationScoreList.add(b1);
        peerEvaluationScoreList.add(b3);
        peerEvaluationScoreList.add(b2);


        System.out.println("BigDecimal = "+peerEvaluationScoreList);
        Collections.sort(peerEvaluationScoreList);
        System.out.println("BigDecimal Collections.sort = "+peerEvaluationScoreList);

//
//        System.out.println();
//        System.out.println();
//        System.out.println();
//
//        List<Integer> linkedList = new ArrayList<>();
//        linkedList.add(1);
//        linkedList.add(3);
//        linkedList.add(2);
//
//        linkedList.add(1);
//        linkedList.add(3);
//        linkedList.add(2);
//
//        System.out.println("Integer = "+linkedList);
//        Collections.sort(linkedList);
//        System.out.println("Integer sort = "+linkedList);


        System.out.println("==================== ");
//        String.format("%0" + 6 + "d", problemNum);//6位字符串左补0
        TreeSet<Long> lastNoSet = new TreeSet<>();
        lastNoSet.add(Long.parseLong("000005"));
        lastNoSet.add(Long.parseLong("000003"));
        lastNoSet.add(Long.parseLong("000006"));
        lastNoSet.add(Long.parseLong("000001"));
        lastNoSet.add(Long.parseLong("000004"));

        Long nextNo = lastNoSet.last();

        System.out.println("lastNoSet = " + lastNoSet);
        System.out.println("nextNo = " + nextNo);
        System.out.println("String.format = " + String.format("%0" + 6 + "d", nextNo+""));



        /*


        t1.checked_dept_name,
	        t1.checked_post_name,
            t1.rectification_responsible_name,
            t1.speciality_department_reviewer_name,
            t1.review_department_reviewer_name


         */
    }
}
