/** * 提供给订单校验的接口 需要更改priceList里面的价格和orderitems的价格 * * @param order * @return */ public OrOrder modifyOrderIncreasePrice(OrOrder order) { long hotelId = order.getHotelId(); long priceTypeId = order.getChildRoomTypeId(); Date inDate = order.getCheckinDate(); Date outDate = order.getCheckoutDate(); List<Long> hotelIdParams = new ArrayList<Long>(); hotelIdParams.add(hotelId); List<Long> priceTypeIdParams = new ArrayList<Long>(); priceTypeIdParams.add(priceTypeId); List<HtlB2bIncrease> htlB2bIncreases = htlB2bDao.queryIncreasePrice(hotelIdParams, priceTypeIdParams, inDate, outDate); double sum = 0; for (HtlB2bIncrease htlB2bIncrease : htlB2bIncreases) { // priceList for (OrPriceDetail priceDetail : order.getPriceList()) { if (priceDetail.getNight().getTime() == htlB2bIncrease.getAbleSaleDate().getTime()) { priceDetail.setBasePrice(htlB2bIncrease.getBasePrice()); priceDetail.setSalePrice(htlB2bIncrease.getIncreasePrice()); } } // orderitems for (OrOrderItem orderItem : order.getOrderItems()) { if (orderItem.getNight().getTime() == htlB2bIncrease.getAbleSaleDate().getTime()) { orderItem.setSalePrice(htlB2bIncrease.getIncreasePrice()); orderItem.setAgentReadComissionPrice(htlB2bIncrease.getIncreasePrice()); // 设置佣金价 orderItem.setAgentReadComissionRate(0); // 返佣率设置为0 orderItem.setAgentReadComission(0); // 佣金额设置为0 } } sum += htlB2bIncrease.getIncreasePrice(); } sum = sum * order.getRoomQuantity(); // 注意还需要乘房间数量 order.setSum(Math.ceil(sum)); // 设置原币种 if (order.getRateId() == 0) { double sumRmb = sum * CurrencyBean.getRateToRMB(order.getPaymentCurrency()); // 设置RMB币种 } double sumRmb = sum * order.getRateId(); order.setSumRmb(Math.ceil(sumRmb)); // 逢一进十 return order; }
/** * 插入或更新obj * * @param obj */ public void saveOrUpdate(OrOrderItem obj) { // parasoft-suppress PB.IMC "父类重名,暂不修改。" if (null == obj.getID()) { insertObject(obj); } else updateObject(obj); }