/** 启动任务调度器 */
  public void run() throws Exception {
    if (running) {
      throw new Exception(lotteryType.name() + " 彩期守护线程已经正常工作, 此次启动忽略!");
    } else {
      if (currentTerm == null) {
        currentTerm = termService.getCurrentTerm(lotteryType);
      }

      if (currentTerm == null) {
        throw new Exception(lotteryType.name() + " 无彩期, 无法启动守护线程");
      }
      logger.info(currentTerm.getType().name() + " 彩期守护启动...");
      running = true;
      CommonScheduledThreadPoolExecutor.getInstance().execute(getStartSaleTask(currentTerm));
    }
  }
Exemple #2
0
  public String index() {
    Customer customer = this.getCurCustomer();
    if (null != customer) {
      list = lotteryOrderService.getOrder(customer, LotteryType.enToType(type));
    }

    if (list != null && list.size() >= 10) {
      list = list.subList(0, 9);
    }

    return "result";
  }
Exemple #3
0
  public static void run() {
    // LotteryTerm nextTerm = new LotteryTerm();
    // nextTerm.setCurrent(true);
    // nextTerm.setTermNo("201001");
    // nextTerm.setType(LotteryType.大乐透);
    //
    // Calendar now = DateUtil.parse("2010-08-20 16:10:00",
    // "yyyy-MM-dd HH:mm:ss");
    // //Calendar now = DateUtil.now();
    // Calendar StopTogether = DateUtil.now();
    // Calendar StopSale = DateUtil.now();
    // Calendar OpenPrize = DateUtil.now();
    // Calendar SendPrize = DateUtil.now();
    //
    // nextTerm.setStartSaleTime(now);
    //
    // StopTogether.setTime(now.getTime());
    // StopTogether.add(Calendar.MINUTE, 1);
    // nextTerm.setStopTogetherSaleTime(StopTogether);
    //
    // StopSale.setTime(StopTogether.getTime());
    // StopSale.add(Calendar.MINUTE, 1);
    // nextTerm.setStopSaleTime(StopSale);
    //
    // OpenPrize.setTime(StopSale.getTime());
    // OpenPrize.add(Calendar.MINUTE, 1);
    // nextTerm.setOpenPrizeTime(OpenPrize);
    //
    // SendPrize.setTime(OpenPrize.getTime());
    // SendPrize.add(Calendar.MINUTE, 1);
    // nextTerm.setSendPrizeTime(SendPrize);
    // nextTerm.setTicketPlat(SendTicketPlat.博众);

    // nex
    LotteryTermService termservice = (LotteryTermService) Launcher.getBean("lotteryTermService");
    LotteryTerm lotteryTerm = termservice.getByTypeAndTermNo("10109", LotteryType.valueOf("大乐透"));
    System.out.println(lotteryTerm.getId() + lotteryTerm.getTermNo());
    // termservice.stopSale(nextTerm);
    // LotteryTermTaskFactory factory = (LotteryTermTaskFactory)
    // Launcher.getBean("lotteryTermTaskFactory");
    // factory.startAllLottery();
    // System.out.println(factory.getDelayedQueueTaskerMap().get(LotteryType.jx_11x5.ordinal()).getTaskQuantity());
  }