/*
package com.huimv.produce.service;

import com.huimv.common.utils.PercentUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.Calendar;


*/
/**
 * @Project : huimv.shiwan
 * @Package : com.huimv.biosafety.uface.controller
 * @Description : TODO
 * @Version : 1.0
 * @Author : ZhuoNing
 * @Create : 2020-12-25
 **//*

@SpringBootTest
@RunWith(SpringRunner.class)
public class Test1 {

    @Test
    public void test1() {
        // 上月第一天
        String firstDay = getLastXMonthFirstDay(3);
        System.out.println("firstDay=" + firstDay);
        // 上月最后一天
        String lastDay = getLastXMonthLastDay(3);
        System.out.println("lastDay=" + lastDay);
    }

    private String getLastXMonthLastDay() {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        int month = calendar.get(Calendar.MONTH);
        calendar.set(Calendar.MONTH, month - 1);
        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
        System.out.println("上个月最后一天：" + sf.format(calendar.getTime()));
        return null;
    }

    public String getLastXMonthFirstDay() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MONTH, -1);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        System.out.println("上个月第一天：" + format.format(calendar.getTime()));
        return null;
    }

    private String getLastXMonthLastDay(Integer n) {
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        int month = calendar.get(Calendar.MONTH);
        calendar.set(Calendar.MONTH, month - n);
        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
//        System.out.println("上个月最后一天："+sf.format(calendar.getTime()));
        return sf.format(calendar.getTime());
    }

    public String getLastXMonthFirstDay(Integer n) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
//        calendar.add(Calendar.MONTH, -n);
        int month = calendar.get(Calendar.MONTH);
        calendar.set(Calendar.MONTH, month - n);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
//        System.out.println("上个月第一天："+format.format(calendar.getTime()));
        return format.format(calendar.getTime());
    }

    @Test
    public void test2() {
        String v1 = "8000";
        String v2 = "9000";
        BigDecimal v1Bd = new BigDecimal(v1);
        BigDecimal v2Bd = new BigDecimal(v2);
        System.out.println("v1Bd="+v1Bd.toString());
        System.out.println("v2Bd="+v2Bd.toString());

        BigDecimal bd1 = v1Bd.subtract(v2Bd).abs();
        System.out.println("bd1="+bd1.toString());
//        System.out.println("bd2="+bd1.abs().toString());
        System.out.println("v2Bd="+v2Bd.toString());

        BigDecimal bd2 = bd1.divide(v2Bd,4,BigDecimal.ROUND_HALF_UP);
        System.out.println("bd2="+bd2.toString());

        String t2 = PercentUtil.getGrowth(Double.parseDouble(v1),Double.parseDouble(v2));
        System.out.println("t2="+t2);
    }
}
*/
