Ejemplo n.º 1
0
  public String addSettleMargin() throws Exception {
    this.logger.debug("enter addSettleMargin");

    FirmSettleMargin settleMargin = (FirmSettleMargin) this.entity;
    boolean flag = existCommoditySpecial(settleMargin.getFirmID(), settleMargin.getCommodityID());
    if (flag) {
      addReturnValue(-1, 151103L, new Object[] {"添加特殊商品交收保证金失败,已存在!"});
    } else {
      FirmSettleMargin firmSettleMargin = (FirmSettleMargin) this.entity;

      if (firmSettleMargin.getSettleMarginAlgr_B().intValue() == 1) {
        firmSettleMargin.setSettleMarginRate_B(
            Double.valueOf(
                Arith.div(
                    firmSettleMargin.getSettleMarginRate_B().doubleValue(),
                    new Double(100.0D).doubleValue())));
      }
      if (firmSettleMargin.getSettleMarginAlgr_S().intValue() == 1) {
        firmSettleMargin.setSettleMarginRate_S(
            Double.valueOf(
                Arith.div(
                    firmSettleMargin.getSettleMarginRate_S().doubleValue(),
                    new Double(100.0D).doubleValue())));
      }
      if (firmSettleMargin.getPayoutAlgr().intValue() == 1) {
        firmSettleMargin.setPayoutRate(
            Double.valueOf(
                Arith.div(
                    firmSettleMargin.getPayoutRate().doubleValue(),
                    new Double(100.0D).doubleValue())));
      }

      firmSettleMargin.setModifyTime(getService().getSysDate());

      getService().add(firmSettleMargin);

      addReturnValue(1, 119901L);

      writeOperateLog(
          1505,
          "添加特殊商品交收保证金!交易商ID:"
              + firmSettleMargin.getFirmID()
              + ",商品ID:"
              + firmSettleMargin.getCommodityID(),
          1,
          "");
    }

    return "success";
  }
Ejemplo n.º 2
0
  public String updateSettleMargin() throws Exception {
    this.logger.debug("enter updateSettleMargin");

    FirmSettleMargin firmSettleMargin = (FirmSettleMargin) this.entity;

    if (firmSettleMargin.getSettleMarginAlgr_B().intValue() == 1) {
      firmSettleMargin.setSettleMarginRate_B(
          Double.valueOf(
              Arith.div(
                  firmSettleMargin.getSettleMarginRate_B().doubleValue(),
                  new Double(100.0D).doubleValue())));
    }
    if (firmSettleMargin.getSettleMarginAlgr_S().intValue() == 1) {
      firmSettleMargin.setSettleMarginRate_S(
          Double.valueOf(
              Arith.div(
                  firmSettleMargin.getSettleMarginRate_S().doubleValue(),
                  new Double(100.0D).doubleValue())));
    }
    if (firmSettleMargin.getPayoutAlgr().intValue() == 1) {
      firmSettleMargin.setPayoutRate(
          Double.valueOf(
              Arith.div(
                  firmSettleMargin.getPayoutRate().doubleValue(),
                  new Double(100.0D).doubleValue())));
    }

    firmSettleMargin.setModifyTime(getService().getSysDate());

    getService().update(firmSettleMargin);

    addReturnValue(1, 119902L);

    writeOperateLog(
        1505,
        "修改特殊商品交收保证金! 交易商ID:"
            + firmSettleMargin.getFirmID()
            + ",商品ID:"
            + firmSettleMargin.getCommodityID(),
        1,
        "");

    return "success";
  }