/** * @param orderNo * @param orderBean */ private void updateOrderStatus(String orderNo, OrderBean orderBean) { if (orderBean == null) { log.error("订单不存在,订单orderNo:" + orderNo); throw new TradeException( new ReturnCode() { @Override public String getMessage() { return QunarErrorCode.ORDER_NOT_FOUND.name(); } @Override public int getCode() { return QunarErrorCode.ORDER_NOT_FOUND.code(); } }); } OrderStatus orderMainStatus = OrderStatus.getStatus(orderBean.getOrderStatus()); switch (orderMainStatus) { case CANCEL_CLOSE: case CANCEL_NOSERVICE: case CANCEL_SERVICEED: case CANCELING: case CANCLE_CLOSE_NOPAY: case CANCLE_CLOSE_PAY_SERVICE: return; default: OrderBean record = new OrderBean(); record.setOrderStatus(OrderStatus.CANCELING.value); record.setOrderStatusName(OrderStatus.CANCELING.name); record.setOrderNo(orderNo); if (updateOrderBeanMapper.updateStatusByPrimaryKey(record) > 0) { log.info("取消订单成功:" + JSON.toJSONString(record)); } else { log.error("取消订单失败"); throw new TradeException( new ReturnCode() { @Override public String getMessage() { return QunarErrorCode.NOT_RESPONSED.name(); } @Override public int getCode() { return QunarErrorCode.NOT_RESPONSED.code(); } }); } } }