package com.jiayue.ssi.service;

import com.backcore.constant.WeightValue;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * TODO
 *
 * @author xsl
 * @version 3.0
 */
public class Test {
    public static void main(String[] args) throws Exception{
//        List<String> joList = new ArrayList<>();
//        for (int i=0;i<7;i++){
//            int j = 6-i;
//            joList.add(i+":"+j);
//            System.out.println(i+":"+j);
//        }
//        System.out.println("===============");
//        List<String> qjList = new ArrayList<>();
//        for (int i=0;i<=6;i++){
//            int j = 6 - i;
//            for (int k=0;k<=j;k++){
//                int m = j-k;
//                qjList.add(i+":"+k+":"+m);
//                System.out.println(i+":"+k+":"+m);
//            }
//        }
//
//        List<String> zhList = new ArrayList<>();
//        for (String joStr:joList){
//            for (String qjStr:qjList){
//                zhList.add(joStr+"-"+qjStr);
//            }
//        }
//        System.out.println(zhList.size());

//        SsqData s1 = new SsqData();
//        s1.setIssue("030045");
//        SsqData s2 = new SsqData();
//        s2.setIssue("001730");
//
//        List<SsqData> list = new ArrayList();
//        list.add(s1);
//        list.add(s2);
//        List<SsqData> list1 = list.stream().sorted(Comparator.comparing(SsqData::getIssue)).collect(Collectors.toList());
////        list.stream().sorted(Comparator.comparing(SsqData::getIssue));
//        for (SsqData ssqData:list1){
//            System.out.println(ssqData.getIssue());
//        }
//        Float.parseFloat()
        WeightValue totalWeightValue = new WeightValue();
        totalWeightValue.setR5(10);
        totalWeightValue.setR1(5);

        Field[] field = totalWeightValue.getClass().getDeclaredFields();
        // 遍历所有属性
        for (int j = 0; j < field.length; j++) {
            // 获取属性的名字
            String name = field[j].getName();
            if ("r".equals(name.substring(0,1))){
                name = name.substring(0, 1).toUpperCase() + name.substring(1);
                Method m = totalWeightValue.getClass().getMethod("get" + name);
                System.out.println(name+"=>"+m.invoke(totalWeightValue));
            }
        }

    }
}
