示例#1
0
  public static LinkedHashMap<Integer, String> getSelectMap(List<UnitDiscount> list) {

    LinkedHashMap<Integer, String> retMap = new LinkedHashMap<Integer, String>();
    retMap.put(0, CommonUtils.EMPTY);

    for (UnitDiscount unitDis : list) {

      retMap.put(unitDis.getId(), unitDis.getDiscountName());
    }

    return retMap;
  }
示例#2
0
  /**
   * 单元为签约,新建合同时,要显示的折扣href "新增折扣"functiont的type为ContConfirmType.CONTRACT
   *
   * @param mainId
   * @param unitId
   * @param unitDiscount
   * @return
   */
  public static String getDiscountModifyHrefForContract(
      int mainId, int unitId, UnitDiscount discount) {

    StringBuffer sb = new StringBuffer();

    // UnitDiscount discount = getUnitDiscountByTypeAndMainId(ContConfirmType.CONFIRM, mainId);
    if (discount == null || discount.getId() == 0) {

      sb.append(
              "<a href='javascript:void(0)' id='modifyDiscountId' style='float:left;' onclick='return createProjectDiscountDialog(")
          .append(unitId)
          .append(",")
          .append(mainId)
          .append(",")
          .append(ContConfirmType.CONTRACT)
          .append(")'>")
          .append("<font color='#5482DE'>新增折扣</font>")
          .append("</a>");

    } else {

      int unitDiscountId = discount.getId();
      String detailShow = getProjectDiscountShowByUnitDiscountId(unitDiscountId);

      sb.append(
              "<a href='javascript:void(0)' id='modifyDiscountId' style='float:left;' onclick='return createUpdateProjectDiscountDialog(")
          .append(unitDiscountId)
          .append(")'>")
          .append("<font color='#5482DE'>")
          .append(detailShow)
          .append("</font>")
          .append("</a>");
    }

    return sb.toString();
  }
示例#3
0
  /**
   * 根据type及mainId获取对应的折扣,如果有就返回查看的href,没有就返回新建的href
   *
   * @param type
   * @param mainId
   * @param unitId
   * @return
   */
  public static String getDiscountModifyHref(String type, int mainId, int unitId) {

    StringBuffer sb = new StringBuffer();

    UnitDiscount discount = unitDiscountServices.findUnitDiscountByTypeAndMainId(type, mainId);
    if (discount == null) {
      // <a href="#" id="addDiscountId" style="float:left;" onclick="return
      // createDiscountDialog(${selectUnit.id})">
      // <font color="#5482DE">新增折扣</font></a>

      sb.append(
              "<a href='javascript:void(0)' id='modifyDiscountId' style='float:left;' onclick='return createProjectDiscountDialog(")
          .append(unitId)
          .append(",")
          .append(mainId)
          .append(",")
          .append(type)
          .append(")'>")
          .append("<font color='#5482DE'>新增折扣</font>")
          .append("</a>");

    } else {
      // <a href="#" id="updateDiscountId" style="float:left;" onclick="return
      // createUpdateDiscountDialog(${unitDiscountId})">
      // <font color="#5482DE">98.00%*97.00%</font></a>

      int unitDiscountId = discount.getId();
      String detailShow = getProjectDiscountShowByUnitDiscountId(unitDiscountId);

      sb.append(
              "<a href='javascript:void(0)' id='modifyDiscountId' style='float:left;' onclick='return createUpdateProjectDiscountDialog(")
          .append(unitDiscountId)
          .append(")'>")
          .append("<font color='#5482DE'>")
          .append(detailShow)
          .append("</font>")
          .append("</a>");
    }

    return sb.toString();
  }