package com.chinacreator.video.util;

import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TreeMap;

import org.apache.commons.lang.StringUtils;

public class Test {

	public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException {
	       // d3fe1e186e41475ea965f4722f5488a8\\15093\\1公共设施
        String str1 = "d3fe1e186e41475ea965f4722f5488a8";
        String str2 = "5093";
        String str3 = "公共设施";

        String str = str1 + "\1" + str2 + "\1" + str3;
        System.out.println(str);
        // 也就是下面的字符串，分隔符为 \u0001
        str = "d3fe1e186e41475ea965f4722f5488a8\u00015093\u0001公共设施";
        System.out.println("============str="+str);
        String[] split = str.split("\1");
        for (String s : split) {
            System.out.println(s);
        }
        System.out.println(split.length);
System.out.println("==============================");
		str = "\u00015093\u0001公共设施";
        split = str.split("\1");
        for (String s : split) {
            System.out.println("s:"+s);
        }
		long retimeout = 86400;
		Calendar nowTime = Calendar.getInstance();
		int hours = nowTime.get(Calendar.HOUR);
		int hours2 = nowTime.get(Calendar.HOUR_OF_DAY);
		int minutes = nowTime.get(Calendar.MINUTE);
		int seconds = nowTime.get(Calendar.SECOND);
		int timeout = 86400;
		
		//System.out.println("hours=>"+hours+", minutes=>"+minutes+", seconds=>"+seconds+", hours2=>"+hours2);
		//System.out.println(nowTime.get(Calendar.DAY_OF_MONTH));
		//System.out.println(new Date().getHours());
		nowTime.add(Calendar.DATE, -2);
		int beforMonth = nowTime.get(Calendar.MONTH);
		//System.out.println(beforMonth);
		nowTime.add(Calendar.SECOND, (int)retimeout);
		int afterMonth = nowTime.get(Calendar.MONTH);
		//System.out.println(afterMonth);
		if(beforMonth != afterMonth){
			timeout = timeout - (hours2 * 3600 + minutes * 60 + seconds);
			//System.out.println(timeout);
		}
		String vsa = "2.34";
		Double df = Double.parseDouble(vsa==""?"0.0":vsa);
		Short mflow = df.shortValue();
		//System.out.println(df.toString());
		//System.out.println(mflow);
		//System.out.println(Test.valiOrderDate("20200123091745"));
	}
	
	public static boolean valiOrderDate(String valitime){
		boolean res = false;
	    try {
	    	System.out.println("valitime:"+valitime);
	    	//当前时间
	    	Calendar cal_1 = Calendar.getInstance();
			Calendar cal_2 = Calendar.getInstance();
			cal_2.setTime(new SimpleDateFormat("yyyyMMddHHmmss").parse(valitime));//设置时间
			//加一个月
			cal_2.add(Calendar.MONTH, 1);
			//验证时间加一个月大于或等于当前月份，且当前日大于或等于5
			if(cal_1.get(Calendar.YEAR) >= cal_2.get(Calendar.YEAR)
					&& cal_1.get(Calendar.MONTH) >= cal_2.get(Calendar.MONTH)
					&& cal_1.get(Calendar.DATE) >= 5){
				res = true;
			}

			System.out.println("cal_1-MONTH:"+cal_1.get(Calendar.MONTH));
			System.out.println("cal_2:"+cal_2.get(Calendar.MONTH));
			System.out.println("cal_1-DATE:"+cal_1.get(Calendar.DATE));
			System.out.println("cal_2-DATE:"+cal_2.get(Calendar.DATE));
		} catch (Exception e) {
			e.printStackTrace();
		} 
		return res;
	}
}


