package com.api.test;

import com.alibaba.fastjson.JSONObject;
import com.heyu.api.data.utils.DateUtils;
import com.heyu.api.data.utils.MapUtils;
import org.junit.Test;

import java.util.Date;
import java.util.Map;

public class Test1 {

    public static void main(String[] args) {
        System.out.println("11111111");
        System.out.println("22222222");

        System.out.println(DateUtils.addDays(new Date(),-1).getTime());
    }

    @Test
    public void test1() {

            String a = "{\n" +
                    "    \"words_result_num\": 9,\n" +
                    "    \"words_result\": {\n" +
                    "        \"card_number\": [\n" +
                    "            {\n" +
                    "                \"word\": \"C00000000\"\n" +
                    "            }\n" +
                    "        ],\n" +
                    "        \"name_chn\": [\n" +
                    "            {\n" +
                    "                \"word\": \"证件样本\"\n" +
                    "            }\n" +
                    "        ],\n" +
                    "        \"name_eng\": [\n" +
                    "            {\n" +
                    "                \"word\": \"ZHENGJIAN,YANGBEN\"\n" +
                    "            }\n" +
                    "        ],\n" +
                    "        \"birthday\": [\n" +
                    "            {\n" +
                    "                \"word\": \"1981.08.03\"\n" +
                    "            }\n" +
                    "        ],\n" +
                    "        \"sex\": [\n" +
                    "            {\n" +
                    "                \"word\": \"女\"\n" +
                    "            }\n" +
                    "        ],\n" +
                    "        \"valid_date\": [\n" +
                    "            {\n" +
                    "                \"word\": \"2014.04.21-2024.04.20\"\n" +
                    "            }\n" +
                    "        ],\n" +
                    "        \"issue_authority\": [\n" +
                    "            {\n" +
                    "                \"word\": \"公安部出入境管理局\"\n" +
                    "            }\n" +
                    "        ],\n" +
                    "        \"issue_place\": [\n" +
                    "            {\n" +
                    "                \"word\": \"广东\"\n" +
                    "            }\n" +
                    "        ],\n" +
                    "        \"MRZCode\": [\n" +
                    "            {\n" +
                    "                \"word\": \"CSC000000004<2404200<8108038<6\"\n" +
                    "            }\n" +
                    "        ]\n" +
                    "    },\n" +
                    "    \"direction\": 0,\n" +
                    "    \"log_id\": 1645241609425709013\n" +
                    "}\n" +
                    "     ";

            System.out.println(a);
            Map<String,Object> data = JSONObject.parseObject(a,Map.class);
            String b = MapUtils.getByExpr(data,"words_result.card_number.[0].word");
            System.out.println(b);


    }


    @Test
    public void test5(){

        int buyerId1 = 1;
        int buyerId2 = 2;
        //int i = 32289328;
        int i = 322525;

        int a = i* 10000 + buyerId1 % 10000;


        a = Math.abs(a ) % 1000% 1024;


        System.out.println("a = "+ a);



    }

}
