/**
   * 保存佣金调整
   *
   * @return
   */
  public String saveAdjust() {
    // 防止重复提交
    if (isRepeatSubmit()) {
      return forwardError("请不要重复提交,谢谢!");
    }
    String opLogonID = CookieUtils.getCookieValue(request, "operaterId");
    opLogonID = opLogonID == null ? "" : opLogonID;
    String agentCode = CookieUtils.getCookieValue(request, "agentCode");
    agentCode = agentCode == null ? "" : agentCode;

    Map params = super.getParams();
    float hotelStar = Float.valueOf(params.get("hotelStar").toString());
    int intStar = Math.round(hotelStar);
    if (hotelStar > 10) {
      String strHotelStar =
          resourceManager.getDescription("res_hotelStarToNum", Math.round(hotelStar));
      hotelStar = Float.parseFloat(strHotelStar);
    }
    // save to db
    priceLst = MyBeanUtil.getBatchObjectFromParam(params, CommisionAdjust.class, priceRowNum);
    List<CommisionAdjust> newLst = new ArrayList();
    for (CommisionAdjust ca : priceLst) {
      // 对ca进行数据补充
      ca.setB2BCd("0");
      ca.setHotelId(hotelId);
      ca.setHotelStar(String.valueOf(intStar));
      String temp = ca.getRoomAndPricetypeTemp();
      if (null != ca && !"".equals(ca)) {
        String arr[] = temp.split("&&");
        ca.setRoomTypeId(Long.parseLong(arr[0]));
        ca.setChildRoomId(Long.parseLong(arr[1]));
      }
      ca.setCreateById(opLogonID);
      ca.setCreateBy(agentCode);
      ca.setCreateDate(new Date());
      CommisionAdjust newRecord = new CommisionAdjust();
      try {
        BeanUtils.copyProperties(newRecord, ca);
        newLst.add(newRecord);
      } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        return super.forwardError("B2bAgentCommissionAdjustAction保存错误" + ex.getMessage());
      }
    }
    b2bService.batchUpdate(newLst);
    return super.SUCCESS;
  }
  private void adjustUtil(CommisionAdjust addComm, List<CommisionAdjust> oldComms)
      throws IllegalAccessException, InvocationTargetException {

    DateComponent dateComponent = new DateComponent();
    dateComponent.setBeginDate(addComm.getStartDate());
    dateComponent.setEndDate(addComm.getEndDate());
    List dateCops = new ArrayList();
    Map resultMap = new HashMap();
    for (int ii = 0; ii < oldComms.size(); ii++) {
      CommisionAdjust curcomm = oldComms.get(ii);
      DateComponent aComponent = new DateComponent();
      aComponent.setId(curcomm.getAdjustID());
      aComponent.setBeginDate(curcomm.getStartDate());
      aComponent.setEndDate(curcomm.getEndDate());
      dateCops.add(aComponent);
    }
    resultMap = CutDate.cut(dateComponent, CutDate.sort(dateCops));
    List removeList = (List) resultMap.get("remove");
    List updateList = (List) resultMap.get("update");
    List results = new ArrayList();
    for (int jj = 0; jj < removeList.size(); jj++) {
      DateComponent bb = (DateComponent) removeList.get(jj);
      b2bService.remove(CommisionAdjust.class, bb.getId());
    }
    // 根据拆分的时间段重新组装数据
    boolean nullFlag = false;
    for (int i = 0; i < oldComms.size(); i++) {
      CommisionAdjust aRecord = oldComms.get(i);
      int doubleFlag = 0;
      for (int j = 0; j < updateList.size(); j++) {
        DateComponent dateCop = (DateComponent) updateList.get(j);
        if (dateCop.getId() != null) {
          if (dateCop.getId().equals(aRecord.getAdjustID())) {
            doubleFlag++;
            // 如果存在多个相同的id则只有第一个id保留,其他的id都赋值为null
            if (doubleFlag > 1) {
              CommisionAdjust newRecord = new CommisionAdjust();
              BeanUtils.copyProperties(newRecord, aRecord);
              newRecord.setAdjustID(null);
              newRecord.setStartDate(dateCop.getBeginDate());
              newRecord.setEndDate(dateCop.getEndDate());
              results.add(newRecord);
            } else {
              aRecord.setStartDate(dateCop.getBeginDate());
              aRecord.setEndDate(dateCop.getEndDate());
              results.add(aRecord);
            }
          }
        } else if (nullFlag == false) {
          if (addComm.getAdjustID() != null) { // 处理修改情况				
            CommisionAdjust record = new CommisionAdjust();
            BeanUtils.copyProperties(record, addComm);
            record.setAdjustID(null);
            results.add(record);
          } else { // 处理新增情况
            results.add(addComm);
          }
          nullFlag = true;
        }
      }
    }
    b2bService.batchUpdate(results);
  }