Package main

Source Code of main.MainWrite

/**
* (C) Copyright 2012 ZWW
*/
package main;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import thread.ACServiceThread;
import thread.LCServiceThread;
import thread.TBServiceThread;
import thread.WYServiceThread;
import cputils.CPHMTBService;


/**
* @author ZWW
* @date 2014-3-22 下午7:38:11
* @version V1.0
*/
public class MainWrite {

  public static String[] weekDay = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
  public static String[] game = {"SSQ","DLT"};
  //public static List<String> issueList = null;
 
  /**
   * @param args
   */
  public static void main(String[] args) {
    Calendar c = Calendar.getInstance();
    //c.setTime(new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-16"));
    int week = c.get(Calendar.DAY_OF_WEEK);
    String game = "DLT";
    if(c.get(Calendar.HOUR_OF_DAY)>20){
      game = "SSQ";
    }
    if (week == 1 || week == 3 || week == 5) {
      game = "SSQ";
      if(c.get(Calendar.HOUR_OF_DAY)>20){
        game = "DLT";
      }
    }
   
    Map<String,Object> last = CPHMTBService.lastIssuoInfo(game);
   
    String onsaleNo = (String) last.get("onsaleIssueNo");
   
    System.out.println(new SimpleDateFormat("yyyy-MM-dd E").format(c.getTime())
        +" "+game+" onsaleIssueNo:"+onsaleNo);
    String issueNo = onsaleNo;
    //String no = "2014035";
   
    //for (String no : noList) {
      boolean onsale = issueNo.equals(onsaleNo)?true:false;
      Thread tb = new  Thread(new TBServiceThread(issueNo,"",onsale))
      Thread wy = new  Thread(new WYServiceThread(issueNo, onsale))
      Thread ac = new  Thread(new ACServiceThread(issueNo))
      Thread lc = new  Thread(new LCServiceThread(issueNo,"",onsale))
          ExecutorService es = Executors.newCachedThreadPool()
          es.execute(tb)
          es.execute(wy)
          es.execute(ac)
          es.execute(lc);
          es.shutdown();
    //}
//    ExecutorService es = Executors.newCachedThreadPool(); 
//    Thread tb1 = new  Thread(new TBServiceThread("2014037","",false));
//    Thread tb2 = new  Thread(new TBServiceThread("2014038","",false));
//    Thread tb3 = new  Thread(new TBServiceThread("2014039","",false));
////    Thread tb4 = new  Thread(new TBServiceThread("2014040","",false));
////    Thread tb5 = new  Thread(new TBServiceThread("2014041","",false));
////    Thread tb6 = new  Thread(new TBServiceThread("2014042","",false));
////    Thread tb7 = new  Thread(new TBServiceThread("2014043","",false));
////    Thread tb8 = new  Thread(new TBServiceThread("2014044","",false));
////    Thread tb9 = new  Thread(new TBServiceThread("2014045","",false));
//    es.execute(tb1);
//    es.execute(tb2);
//    es.execute(tb3);
////    es.execute(tb4);
////    es.execute(tb5);
////    es.execute(tb6);
////    es.execute(tb7);
////    es.execute(tb8);
////    es.execute(tb9);
//    es.shutdown();
    
  }

}
TOP

Related Classes of main.MainWrite

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.