public static void main(String[] args) {
   String propertiesName = "poiDB.properties";
   String taday = PropertiesParse.parse("taday", propertiesName);
   String yesterday = PropertiesParse.parse("yesterday", propertiesName);
   int setNum = Integer.valueOf(PropertiesParse.parse("setNum", propertiesName));
   System.out.println(taday + "  " + yesterday);
   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   Date date = new Date();
   String currentTime = sdf.format(date);
   Calendar cal = Calendar.getInstance();
   //		Calendar cal2 = Calendar.getInstance();
   //		Calendar cal3 = Calendar.getInstance();
   while (!taday.equals("2015-08-23")) {
     System.out.println("执行今日日期:" + taday);
     System.out.println("&&&&&&&&&&&&&&&8月23日以前版本!!!&&&&&&&&&&&&&&&&&");
     System.out.println("&&&&&&&&&&&&&&&FaceBook&&&&&&&&&&&&&&&&&");
     try {
       Calendar cal2 = Calendar.getInstance();
       Calendar cal3 = Calendar.getInstance();
       new ChannelQueryFaceBook().oper(taday, setNum);
       Date myDate = sdf.parse(taday);
       cal.setTime(myDate);
       cal2.setTime(cal.getTime());
       cal2.add(Calendar.DATE, -1);
       cal3.setTime(cal.getTime());
       cal3.add(Calendar.DATE, +1);
       yesterday = sdf.format(cal2.getTime());
       cal.add(Calendar.DATE, +1);
       System.out.println("执行昨日日期:" + yesterday);
       new ChannelQueryFaceBook().oper(yesterday, setNum);
       // new ChannelZengLiangFaceBook().oper(taday,yesterday);
       System.out.println("即将处理数据日期为:" + cal3.getTime());
       System.out.println("taday:" + taday + "  ;  yesterday:" + yesterday);
       taday = sdf.format(cal.getTime());
       System.out.println();
       System.out.println();
       System.out.println();
       System.out.println();
     } catch (ParseException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   while (!yesterday.equals(currentTime)) {
     System.out.println("执行今日日期:" + taday);
     System.out.println("^^^^^^^^^^^^^^^^^^^^^^8月23日以后版本!!!^^^^^^^^^^^^^^^^^^^^");
     System.out.println("&&&&&&&&&&&&&&&FaceBook&&&&&&&&&&&&&&&&&");
     try {
       Calendar cal2 = Calendar.getInstance();
       Calendar cal3 = Calendar.getInstance();
       new ChannelQueryFaceBook().operNew(taday, setNum);
       Date myDate = sdf.parse(taday);
       cal.setTime(myDate);
       cal2.setTime(cal.getTime());
       cal2.add(Calendar.DATE, -1);
       cal3.setTime(cal.getTime());
       cal3.add(Calendar.DATE, +1);
       yesterday = sdf.format(cal2.getTime());
       cal.add(Calendar.DATE, +1);
       System.out.println("执行昨日日期:" + yesterday);
       new ChannelQueryFaceBook().operNew(yesterday, setNum);
       new ChannelZengLiangFaceBook().oper(taday, yesterday);
       System.out.println("即将处理数据日期为:" + cal3.getTime());
       System.out.println("taday:" + taday + "  ;  yesterday:" + yesterday);
       taday = sdf.format(cal.getTime());
       System.out.println();
       System.out.println();
       System.out.println();
       System.out.println();
     } catch (ParseException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
 }
示例#2
0
  public void toTemp() {
    String propertiesName = "poiDB.properties";
    String taday = PropertiesParse.parse("taday", propertiesName);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    Date date = new Date();
    String currentTime = sdf.format(date);
    Calendar cal = Calendar.getInstance();

    while (!taday.equals(currentTime)) {
      System.out.println("执行今日日期:" + taday);
      System.out.println("&&&&&&&&&&&&&&&    平台日榜中间表           &&&&&&&&&&&&&&&&&");
      try {
        Calendar cal2 = Calendar.getInstance();
        Calendar cal3 = Calendar.getInstance();
        Date myDate = sdf.parse(taday);
        cal.setTime(myDate);
        cal2.setTime(cal.getTime());
        cal2.add(Calendar.DATE, -1);
        cal3.setTime(cal.getTime());
        cal3.add(Calendar.DATE, +1);
        cal.add(Calendar.DATE, +1);
        new YtbQueryIntoTempDay().oper(taday);
        new TwitterQueryIntoTempDay().oper(taday);
        new FacebookQueryIntoTempDay().oper(taday);
        new GgplusQueryIntoTempDay().oper(taday);
        taday = sdf.format(cal.getTime());
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println();
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    System.out.println("   *********************************");
    System.out.println("  *                                   *");
    System.out.println("*     四大平台日榜中间表 已生成!!!                            *");
    System.out.println("  *                                   *");
    System.out.println("   *********************************");
    System.out.println();
    System.out.println();
    System.out.println();
    System.out.println();

    String tadayForWeek = PropertiesParse.parse("tadayForWeek", propertiesName);
    // taday = "2015-08-17";
    while (!tadayForWeek.equals(currentTime)) {
      System.out.println("执行今日日期:" + tadayForWeek);
      System.out.println("&&&&&&&&&&&&&&&   平台周榜中间表          &&&&&&&&&&&&&&&&&");
      try {
        Calendar cal2 = Calendar.getInstance();
        Calendar cal3 = Calendar.getInstance();
        Date myDate = sdf.parse(tadayForWeek);
        cal.setTime(myDate);
        cal2.setTime(cal.getTime());
        cal2.add(Calendar.DATE, -1);
        cal3.setTime(cal.getTime());
        cal3.add(Calendar.DATE, +1);
        cal.add(Calendar.DATE, +1);
        new YtbQueryIntoTempWeek().oper(tadayForWeek);
        new TwitterQueryIntoTempWeek().oper(tadayForWeek);
        new FacebookQueryIntoTempWeek().oper(tadayForWeek);
        new GgplusQueryIntoTempWeek().oper(tadayForWeek);
        System.out.println("taday:" + tadayForWeek);
        tadayForWeek = sdf.format(cal.getTime());
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println();
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    System.out.println("   *********************************");
    System.out.println("  *                                   *");
    System.out.println("*     四大平台周榜中间表 已生成!!!                            *");
    System.out.println("  *                                   *");
    System.out.println("   *********************************");
    System.out.println();
    System.out.println();
    System.out.println();
    System.out.println();

    String tadayForMonth = PropertiesParse.parse("tadayForMonth", propertiesName);
    // taday = "2015-09-01";
    while (!tadayForMonth.equals(currentTime)) {
      System.out.println("执行今日日期:" + tadayForMonth);
      System.out.println("&&&&&&&&&&&&&&&   平台月榜中间表          &&&&&&&&&&&&&&&&&");
      try {
        Calendar cal2 = Calendar.getInstance();
        Calendar cal3 = Calendar.getInstance();
        Date myDate = sdf.parse(tadayForMonth);
        cal.setTime(myDate);
        cal2.setTime(cal.getTime());
        cal2.add(Calendar.DATE, -1);
        cal3.setTime(cal.getTime());
        cal3.add(Calendar.DATE, +1);
        cal.add(Calendar.DATE, +1);
        new YtbQueryIntoTempMonth().oper(tadayForMonth);
        new TwitterQueryIntoTempMonth().oper(tadayForMonth);
        new FacebookQueryIntoTempMonth().oper(tadayForMonth);
        new GgplusQueryIntoTempMonth().oper(tadayForMonth);
        System.out.println("taday:" + tadayForMonth);
        tadayForMonth = sdf.format(cal.getTime());
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println();
      } catch (ParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    System.out.println("   *********************************");
    System.out.println("  *                                   *");
    System.out.println("*     四大平台月榜中间表 已生成!!!                            *");
    System.out.println("  *                                   *");
    System.out.println("   *********************************");
    System.out.println();
    System.out.println();
    System.out.println();
    System.out.println();

    //		String tadayForTotal = PropertiesParse.parse("tadayForTotal", propertiesName);
    //		System.out.println("执行今日日期:"+tadayForTotal);
    //		System.out.println("&&&&&&&&&&&&&&&   平台总榜中间表          &&&&&&&&&&&&&&&&&");
    //		try {
    //			Calendar cal2 = Calendar.getInstance();
    //			Calendar cal3 = Calendar.getInstance();
    //			Date myDate = sdf.parse(tadayForTotal);
    //			cal.setTime(myDate);
    //			cal2.setTime(cal.getTime());
    //			cal2.add(Calendar.DATE, -1);
    //			cal3.setTime(cal.getTime());
    //			cal3.add(Calendar.DATE, +1);
    //			cal.add(Calendar.DATE, +1);
    //			new YtbQueryIntoTempTotal().oper(tadayForTotal);
    //			//new TwitterQueryIntoTempTotal().oper(tadayForTotal);
    //			//new FacebookQueryIntoTempTotal().oper(tadayForTotal);
    //			//new GgplusQueryIntoTempTotal().oper(tadayForTotal);
    //			System.out.println("taday:"+tadayForTotal);
    //			tadayForTotal = sdf.format(cal.getTime());
    //			System.out.println();
    //			System.out.println();
    //			System.out.println();
    //			System.out.println();
    //		} catch (ParseException e) {
    //			// TODO Auto-generated catch block
    //			e.printStackTrace();
    //		}
    //		System.out.println("   *********************************");
    //		System.out.println("  *                                   *");
    //		System.out.println("*     四大平台总榜榜中间表 已生成!!!                            *");
    //		System.out.println("  *                                   *");
    //		System.out.println("   *********************************");
    //		System.out.println();
    //		System.out.println();
    //		System.out.println();
    //		System.out.println("中间表全部生成完毕!!!");
  }