예제 #1
0
  private void openPrize(LotteryTerm term) {
    term = termService.findById(term.getId());
    if (term.getTermStatus().equals(TermStatus.销售截止)
        || term.getTermStatus().equals(TermStatus.未开奖)) {
      term.setTermStatus(TermStatus.未开奖);
      termService.update(term);
      if (term.isAutoOpen()) {
        try {
          if (LotteryType.KuaiKaiTypeMap.containsKey(term.getType().getName_EN())) {
            // 快开抓取开奖结果不同
            TicketTreatmentWork work =
                ticketBusinessFactory.getTreatmentTicketByType(term.getOutPoint());
            work.getOpenResult(term);
          } else {
            try {
              term = baseHandle.fetchPrizeLevel(term);
            } catch (Exception e) {
              logger.warn(term + "开奖结果抓取有异常", e);
              SystemWarningNotify.addWarningDescription(term + "开奖结果抓取有异常,请查看日志");
              throw e;
            }
          }
          if (StringUtils.isEmpty(term.getResult())) {
            // throw new Exception("开奖结果抓取失败");
            return;
          }
          term = termService.saveLotteryTermOrPrizeLevel(term);

          if (LotteryType.KuaiKaiTypeMap.containsKey(term.getType().getName_EN())) {
            // Thread.sleep(20000);
            termService.openPrizeSyncTreatment(term);
            //                    	termService.openPrize(term); //自己开奖

          } else {
            termService.openPrize(term);
          }
        } catch (Exception e) {
          logger.warn(term.toString() + " 开奖时有异常情况", e);
          SystemWarningNotify.addWarningDescription(term + " 开奖时有异常情况,请查看日志");
          term.setTermStatus(TermStatus.未开奖);
          termService.update(term);
        }
      }
    }
  }
예제 #2
0
 // 兑奖
 private void checkWin(LotteryTerm term) {
   term = termService.findById(term.getId());
   if (term.getTermStatus().equals(TermStatus.已开奖) && term.isAutoCheckWin()) {
     try {
       termService.checkWin(term);
     } catch (Exception e) {
       SystemWarningNotify.addWarningDescription(term + "兑奖时有异常情况");
       logger.warn(term + "兑奖时有异常情况", e);
       term.setTermStatus(TermStatus.未兑奖);
       termService.update(term);
     }
   } else if (term.getTermStatus().equals(TermStatus.已开奖)) {
     term.setTermStatus(TermStatus.未兑奖);
     termService.update(term);
   }
 }