package com.ningdatech.carapi.safe.utils;

import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * @Classname InitDataUtil
 * @Description
 * @Date 2022/10/26 15:42
 * @Created by PoffyZhang
 */
public class InitDataUtil {
    private static JSONObject MONTHS = JSON.parseObject("{\"01\":0,\"02\":0,\"03\":0,\"04\":0,\"05\":0,\"06\":0" +
            ",\"07\":0,\"08\":0,,\"09\":0,\"10\":0,\"11\":0,\"12\":0}");

    public static Map<String,Map<String,Object>> initThreeYears(){
        Map<String,Map<String,Object>> res = Maps.newHashMap();
        res.put(String.valueOf(LocalDateTime.now().minusYears(2).getYear()),BeanUtil.beanToMap(MONTHS));
        res.put(String.valueOf(LocalDateTime.now().minusYears(1).getYear()),BeanUtil.beanToMap(MONTHS));
        res.put(String.valueOf(LocalDateTime.now().getYear()),BeanUtil.beanToMap(MONTHS));
        return res;
    }

    public static Map<String,Map<String,Object>> initTwoYears(){
        Map<String,Map<String,Object>> res = Maps.newHashMap();
        res.put(String.valueOf(LocalDateTime.now().minusYears(1).getYear()),BeanUtil.beanToMap(MONTHS));
        res.put(String.valueOf(LocalDateTime.now().getYear()),BeanUtil.beanToMap(MONTHS));
        return res;
    }
}
