コード例 #1
0
 /**
  * 统计销售总量跟中奖金额
  *
  * @return
  * @throws WebDataException
  */
 public String stat() throws WebDataException {
   AdminUser adminUser = getAdminUser();
   if (null == adminUser) {
     throw new WebDataException("你还没有登录!");
   }
   String startDate = "";
   String endDate = "";
   if (StringUtils.isNotBlank(queryForm.getStartDate())) {
     startDate = queryForm.getStartDate();
   }
   if (StringUtils.isNotBlank(queryForm.getEndDate())) {
     endDate = queryForm.getEndDate();
   }
   List list = kenoService.moneyAnalye(startDate, endDate);
   HashMap result = new HashMap();
   if (null != list && list.size() > 0) {
     result.put("totalSales", (BigDecimal) list.get(0));
     result.put("totalHits", (BigDecimal) list.get(1));
     result.put("success", true);
   } else {
     result.put("totalSales", "0");
     result.put("totalHits", "0");
     result.put("success", false);
   }
   Struts2Utils.renderJson(result);
   return null;
 }
コード例 #2
0
 /**
  * 暂停/启动销售
  *
  * @return
  * @throws WebDataException
  */
 public String pause() throws WebDataException {
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     AdminUser adminUser = getAdminUser();
     if (null == adminUser) {
       throw new WebDataException("你还没有登录!");
     }
     kenoService.pauseOrStartLottery();
     pause = kenoService.findPauseOrStart();
     String alertString = "";
     if ("true".equals(pause)) {
       /// 停止了
       alertString = "暂停";
       addActionMessage("操作成功.");
       // 记录操作日志
       eventLogManager.saveSimpleEventLog(
           null, getLottery(), adminUser, EventLogType.PauseSale, "");
     } else if ("false".equals(pause)) {
       /// 启动了
       alertString = "启动";
       addActionMessage("操作成功.");
       // 记录操作日志
       eventLogManager.saveSimpleEventLog(
           null, getLottery(), adminUser, EventLogType.ResumeSale, "");
     }
     map.put("success", true);
     map.put("msg", alertString + "销售成功");
   } catch (Exception e) {
     e.printStackTrace();
     map.put("success", false);
     map.put("msg", "暂停/启动销售发生异常!");
   }
   Struts2Utils.renderJson(map);
   return null;
 }
コード例 #3
0
 /** 强制出票 */
 public String batchForcePrint() {
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     AdminUser adminUser = getAdminUser();
     if (null == adminUser) {
       throw new WebDataException("你还没有登录!");
     }
     if (this.id == null) {
       throw new DataException("方案ID不能为空.");
     }
     S s = kenoService.forcePrint(this.id);
     // 记录操作日志
     eventLogManager.saveSimpleEventLog(
         null,
         getLottery(),
         adminUser,
         EventLogType.ForcePrint,
         "方案为ID:" + s.getId() + "方案号为+" + s.getSchemeNumber());
     map.put("success", true);
     map.put("msg", "强制出票成功");
   } catch (ServiceException e) {
     e.printStackTrace();
     map.put("success", false);
     map.put("msg", e.getMessage());
   } catch (Exception e) {
     e.printStackTrace();
     map.put("success", false);
     map.put("msg", "强制出票发生异常!");
   }
   Struts2Utils.renderJson(map);
   return null;
 }
コード例 #4
0
 /**
  * 设置全部结束
  *
  * @return
  * @throws WebDataException
  */
 public String setIssueClose() {
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     AdminUser adminUser = getAdminUser();
     if (null == adminUser) {
       throw new WebDataException("你还没有登录!");
     }
     if (this.id == null) {
       throw new DataException("期号ID不能为空.");
     }
     kenoService.updateIssueState(this.getId(), IssueState.ISSUE_SATE_FINISH);
     I issueData = kenoService.findIssueDataById(this.getId());
     // 同传统彩的期实体传数据
     Period period = new Period();
     period.setId(issueData.getId());
     period.setPeriodNumber(issueData.getPeriodNumber());
     // 记录操作日志
     eventLogManager.saveSimpleEventLog(
         period, getLottery(), adminUser, EventLogType.CloseIssue, "期号为ID:" + this.getId());
     map.put("success", true);
     map.put("msg", "期号设置结束成功");
   } catch (DataException e) {
     e.printStackTrace();
     map.put("success", false);
     map.put("msg", e.getMessage());
   } catch (Exception e) {
     e.printStackTrace();
     map.put("success", false);
     map.put("msg", "期号设置结束发生异常!");
   }
   Struts2Utils.renderJson(map);
   return null;
 }
コード例 #5
0
 public String oprIssueTime() {
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     if (null == dateStar) throw new WebDataException("开始时间不能为空!");
     if (null == dateEnd) throw new WebDataException("结束时间不能为空!");
     if (dateEnd.getTime() <= dateStar.getTime()) throw new WebDataException("结束时间不能少于开始时间!");
     if (dateEnd.getTime() - dateStar.getTime() > 1000 * 60 * 60 * 24 * 3)
       throw new WebDataException("结束时间减去开始时间不能大于3天!");
     if (null == oprType) throw new WebDataException("操作类型不能为空!");
     if (null == dateMin) throw new WebDataException("操作时间不能为空!");
     if (0 >= dateMin) throw new WebDataException("操作时间不能小于0!");
     AdminUser adminUser = getAdminUser();
     if (null == adminUser) {
       throw new WebDataException("你还没有登录!");
     }
     if (Byte.valueOf("0").equals(oprType)) {
       dateMin = dateMin;
     } else if (Byte.valueOf("1").equals(oprType)) {
       dateMin = -dateMin;
     } else {
       throw new WebDataException("操作类型出错!");
     }
     kenoService.oprIssueTime(dateStar, dateEnd, dateMin);
     // 记录操作日志
     eventLogManager.saveSimpleEventLog(
         null,
         getLottery(),
         adminUser,
         EventLogType.SetTime,
         "开始时间为:" + dateStar + "结束时间为" + dateEnd + "时间为【" + dateMin + "】分钟");
     map.put("success", true);
     map.put("msg", "期号时间设置结束成功");
   } catch (WebDataException e) {
     e.printStackTrace();
     map.put("success", false);
     map.put("msg", e.getMessage());
   } catch (ServiceException e) {
     e.printStackTrace();
     map.put("success", false);
     map.put("msg", e.getMessage());
   } catch (Exception e) {
     e.printStackTrace();
     map.put("success", false);
     map.put("msg", "期号时间设置发生异常!");
   }
   Struts2Utils.renderJson(map);
   return null;
 }
コード例 #6
0
  public String lsbd() {
    if (count == null || count <= 0) {
      count = 50;
    }
    formatNum();
    DetachedCriteria c = DetachedCriteria.forClass(SsqPeriodData.class);
    c.add(Restrictions.isNotNull("result"));
    c.addOrder(Order.desc("id"));
    List<SsqPeriodData> list = periodDataEntityManagerImpl.findByDetachedCriteria(c, 0, count);

    List<Long> periodIdList = new ArrayList<Long>();
    for (SsqPeriodData data : list) {
      periodIdList.add(data.getPeriodId());
      String[] rs = data.getRsultArr();
      if (red1 == null) {
        red1 = rs[0];
        red2 = rs[1];
        red3 = rs[2];
        red4 = rs[3];
        red5 = rs[4];
        red6 = rs[5];
        blue = rs[6];
        data.setPrizePool(7l);
      } else {
        long hits = 0;
        String[] rs1 = (String[]) ArrayUtils.subarray(rs, 0, 6);
        if (ArrayUtils.contains(rs1, red1)) {
          hits++;
        }
        if (ArrayUtils.contains(rs1, red2)) {
          hits++;
        }
        if (ArrayUtils.contains(rs1, red3)) {
          hits++;
        }
        if (ArrayUtils.contains(rs1, red4)) {
          hits++;
        }
        if (ArrayUtils.contains(rs1, red5)) {
          hits++;
        }
        if (ArrayUtils.contains(rs1, red6)) {
          hits++;
        }
        if (blue.equals(rs[6])) {
          hits++;
        }
        data.setPrizePool(hits);
      }
    }
    Collections.sort(
        list,
        new Comparator<SsqPeriodData>() {
          @Override
          public int compare(SsqPeriodData o1, SsqPeriodData o2) {
            if (o1.getPrizePool() < o2.getPrizePool()) {
              return 1;
            }
            return -1;
          }
        });
    c = DetachedCriteria.forClass(Period.class);
    c.add(Restrictions.in("id", periodIdList));
    c.addOrder(Order.desc("id"));
    List<Period> periodList = periodDataEntityManagerImpl.findByDetachedCriteria(c);
    Map<Long, Period> periodMap = new HashMap<Long, Period>();
    for (Period data : periodList) {
      periodMap.put(data.getId(), data);
    }
    Struts2Utils.setAttribute("periodMap", periodMap);
    Struts2Utils.setAttribute("list", list);

    loadForecastAndSkillsNewsList();

    return "lsbd";
  }