Exemplo n.º 1
0
  /**
   * 中奖描述
   *
   * @return
   * @throws DataException
   */
  public String getResultDesc() throws DataException {
    List<WinItem> list = this.getWinItemList();
    if (list == null || list.isEmpty()) throw new DataException("中奖信息为空!");

    VariableString varWonLineText = new VariableString(Constant.WON_LINE_TMPLATE, null);
    StringBuffer sb = new StringBuffer();
    for (WinItem item : list) {
      varWonLineText.setVar("PRIZENAME", item.getWinName());
      varWonLineText.setVar("WINUNITS", item.getWinUnit());
      sb.append(varWonLineText.toString());
    }
    return sb.toString();
  }
Exemplo n.º 2
0
  /**
   * 奖金描述
   *
   * @return
   */
  public String getPrizeDetail() {
    VariableString varWonLineText = new VariableString(prizeTemplate, null);
    String prizeDesc = "";
    int prize = 0;
    Integer unit = this.getNormalOneWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.NormalOne.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.NormalOne.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    unit = this.getRandomTwoWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.RandomTwo.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.RandomTwo.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    unit = this.getForeTwoGroupWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.ForeTwoGroup.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.ForeTwoGroup.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    unit = this.getForeTwoDirectWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.ForeTwoDirect.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.ForeTwoDirect.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    unit = this.getRandomThreeWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.RandomThree.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.RandomThree.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    unit = this.getForeThreeGroupWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.ForeThreeGroup.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.ForeThreeGroup.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    unit = this.getForeThreeDirectWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.ForeThreeDirect.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.ForeThreeDirect.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    unit = this.getRandomFourWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.RandomFour.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.RandomFour.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    unit = this.getRandomFiveWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.RandomFive.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.RandomFive.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }

    unit = this.getRandomSixWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.RandomSix.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.RandomSix.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }

    unit = this.getRandomSevenWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.RandomSeven.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.RandomSeven.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }

    unit = this.getRandomEightWinUnits();
    if (unit != null && unit > 0) {
      prize = SdEl11to5PlayType.RandomEight.getPrize();
      varWonLineText.setVar("PRIZEITEM", SdEl11to5PlayType.RandomEight.getTypeName());
      varWonLineText.setVar("WINUNITS", unit);
      varWonLineText.setVar("PRIZE", prize >= 10000.0d ? unit * prize * 0.8d : unit * prize);
      prizeDesc += varWonLineText.toString();
    }
    return prizeDesc;
  }