Example #1
0
  /**
   * 支付成功
   *
   * @param orderBean
   */
  public boolean paySuccessSms(OrderBean orderBean) {
    SMSChannel smsChannel = this.getSmsChannel(orderBean);
    SmsParam smsMessageVo = new SmsParam();

    smsMessageVo.setSys_name(smsTrade);
    smsMessageVo.setArea_code(orderBean.getUserAreaCode1());
    smsMessageVo.setMobile(orderBean.getUserMobile1());
    OrderType orderType = OrderType.getType(orderBean.getOrderType());

    if (SMSChannel.APP.equals(smsChannel)) {
      smsMessageVo.setTemplate_id(SmsTemplate.PAYSUCCESS_APP.getTemplateId());
      smsMessageVo.setParams(new String[] {orderType.name, orderBean.getOrderNo()});
    } else if (SMSChannel.fenxiao.equals(smsChannel)) {
      smsMessageVo.setTemplate_id(SmsTemplate.PAYSUCCESS_FENXIAO.getTemplateId());
      smsMessageVo.setParams(
          new String[] {orderBean.getAgentName(), orderType.name, orderBean.getOrderNo()});
    } else if (SMSChannel.zhixiao.equals(smsChannel)) {
      smsMessageVo.setTemplate_id(SmsTemplate.PAYSUCCESS_ZHIXIAO.getTemplateId());
      smsMessageVo.setParams(
          new String[] {orderBean.getAgentName(), orderType.name, orderBean.getOrderNo()});
    } else {
      log.error(
          orderBean.getOrderNo()
              + " 既不属于 分销 也不属于直销 或者app,检查["
              + orderBean.getAgentId()
              + "] ["
              + orderBean.getOrderChannel()
              + "]");
      return Boolean.FALSE;
    }
    return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSPAYSUCCESS);
  }
Example #2
0
  public void editOrderSMS(OrderBean orderBean) {
    SMSChannel smsChannel = getSmsChannel(orderBean);
    // 亲爱的,您从<皇包车天猫店>预订的<接机/送机/包车/次租>服务(订单号<J1506247268>)已取消成功,退款办理中,登陆APP查看退款进度及详情
    SmsParam smsMessageVo = new SmsParam();

    smsMessageVo.setSys_name(smsTrade);
    smsMessageVo.setArea_code(orderBean.getUserAreaCode1());
    smsMessageVo.setMobile(orderBean.getUserMobile1());

    OrderType orderType = OrderType.getType(orderBean.getOrderType());

    if (SMSChannel.APP.equals(smsChannel)) {

    } else if (SMSChannel.fenxiao.equals(smsChannel)) {
      smsMessageVo.setTemplate_id(SmsTemplate.EDIT_ORDER_FENXIAO.getTemplateId());
      smsMessageVo.setParams(
          new String[] {orderBean.getAgentName(), orderType.name, orderBean.getOrderNo()});
      noticeSmsCenter(orderBean, smsMessageVo, AlarmType.editOrderSMS);
    } else if (SMSChannel.zhixiao.equals(smsChannel)) {
      smsMessageVo.setTemplate_id(SmsTemplate.EDIT_ORDER_ZHIXIAO.getTemplateId());
      smsMessageVo.setParams(
          new String[] {orderBean.getAgentName(), orderType.name, orderBean.getOrderNo()});
      noticeSmsCenter(orderBean, smsMessageVo, AlarmType.editOrderSMS);
    } else {
      log.error(
          orderBean.getOrderNo()
              + " 既不属于 分销 也不属于直销 或者app,检查["
              + orderBean.getAgentId()
              + "] ["
              + orderBean.getOrderChannel()
              + "]");
    }
  }
Example #3
0
  @Transactional
  public void payByOnlyCoup(OrderBean orderBean, CoupParm coupParm) {
    couponServiceParty.lockCoup(orderBean.getOrderNo(), coupParm.getCoupId());
    couponServiceParty.useCoup(coupParm.getCoupId(), orderBean.getOrderNo());
    orderService.updateOrderStatus(
        orderBean.getOrderNo(), OrderStatus.INITSTATE, OrderStatus.PAYSUCCESS);

    OrderType orderType = OrderType.getType(orderBean.getOrderType());
    BizType bizType = FundBizEnumConvter.getFundBizType(orderType);

    TradePayment tradePayment = new TradePayment();
    Date curtime = new Date(System.currentTimeMillis());
    tradePayment.setCreateTime(curtime);
    tradePayment.setOrderNo(orderBean.getOrderNo());
    tradePayment.setOrderPrice(orderBean.getPriceChannel());
    tradePayment.setPayActual(0.00d);
    tradePayment.setPayFee(0.00d);
    tradePayment.setPayNo(IDGenerotor.generatePayNo());
    tradePayment.setPaySubject("HBC券支付");
    tradePayment.setPayShould(orderBean.getPriceChannel());
    tradePayment.setPayGetway(GetWayEnum.COUP.value);
    tradePayment.setPayGatewayName(GetWayEnum.COUP.name);
    tradePayment.setUserAccountNo(orderBean.getUserAccount());
    tradePayment.setCoupId(coupParm.getCoupId());
    tradePayment.setCoupPay(
        DoubleUtil.subtractionDouble(orderBean.getPriceChannel(), coupParm.getcActualPrice()));
    tradePayment.setCouponInfo(coupParm.getCoupInfo());
    tradePayment.setPayStatus(PayStatus.SUCCESS.value);
    if (tradePaymentMapper.insert(tradePayment) == 0) {
      throw new PayException(PayReturnCodeEnum.PAY_INSERT_FAILED, orderBean.getOrderNo());
    }

    orderService.updateCoupInfos(orderBean, coupParm.getCoupId(), tradePayment);

    fundAccountService.pay(
        AccountEnums.HBC_COUP.value, tradePayment.getCoupPay(), bizType, orderBean.getOrderNo());
    fundAccountService.pay(
        AccountEnums.HBC_Guarantee.value,
        orderBean.getPriceChannel(),
        bizType,
        orderBean.getOrderNo());

    OrderLogParamBean orderLogParamBean = new OrderLogParamBean();
    orderLogParamBean.setContent(
        OrderLogType.PAYMENT_RESULT_CONTENT(
            orderBean.getAgentName(),
            orderBean.getUserName(),
            coupParm.getCoupId(),
            JSON.toJSONString(coupParm)));
    orderLogParamBean.setLogType(OrderLogType.PAYMENT_RESULT.type);
    orderLogParamBean.setOpType(OperationType.CUSTOMER.value);
    orderLogParamBean.setOpUserId(orderBean.getUserId());
    orderLogParamBean.setOpUserName(orderBean.getUserName());
    orderLogParamBean.setOrderNo(orderBean.getOrderNo());
    orderLogService.insertOrderLog(orderLogParamBean);
  }
Example #4
0
 public OrderPriceInfo getPrice(CalculatePriceParam param) {
   Map<String, String> params = buildQueryParam(param);
   try {
     OrderPriceInfo result =
         thirdAPIService.getPriceFromAPI(params, OrderType.getType(param.getOrderType()));
     return result;
   } catch (Exception e) {
     log.error("查价失败。", e);
   }
   return null;
 }
Example #5
0
  /**
   * 开始服务提醒
   *
   * @param orderBean
   * @return
   */
  public boolean serviceStartSMS(OrderBean orderBean) {
    SmsParam smsMessageVo = new SmsParam();

    smsMessageVo.setSys_name(smsTrade);
    smsMessageVo.setArea_code(orderBean.getGuideAreaCode());
    smsMessageVo.setMobile(orderBean.getGuideMobile());

    smsMessageVo.setTemplate_id(SmsTemplate.GSERVICE_START_SMS.getTemplateId());

    OrderType orderType = OrderType.getType(orderBean.getOrderType());
    smsMessageVo.setParams(new String[] {orderType.name});
    return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.gleaverStartSMS);
  }
Example #6
0
  /**
   * 临行前给G端发送短信
   *
   * @param orderBean
   * @return
   */
  public boolean gleaverStartSMS(OrderBean orderBean) {
    SmsParam smsMessageVo = new SmsParam();

    smsMessageVo.setSys_name(smsTrade);
    smsMessageVo.setArea_code(orderBean.getGuideAreaCode());
    smsMessageVo.setMobile(orderBean.getGuideMobile());

    smsMessageVo.setTemplate_id(SmsTemplate.GLEAVE_SMS.getTemplateId());

    Date serviceTime = orderBean.getServiceTime();
    OrderType orderType = OrderType.getType(orderBean.getOrderType());
    smsMessageVo.setParams(
        new String[] {
          TimeConverter.formatDate(serviceTime), orderType.name, orderBean.getUserName()
        });
    return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.gleaverStartSMS);
  }
Example #7
0
  /**
   * 临行前 C端发送短信
   *
   * @param orderBean
   */
  public boolean leaveStartSMSConfirm(OrderBean orderBean) {
    SMSChannel smsChannel = getSmsChannel(orderBean);
    SmsParam smsMessageVo = new SmsParam();

    smsMessageVo.setSys_name(smsTrade);
    smsMessageVo.setArea_code(orderBean.getUserAreaCode1());
    smsMessageVo.setMobile(orderBean.getUserMobile1());
    OrderType orderType = OrderType.getType(orderBean.getOrderType());
    Date serviceTime = orderBean.getServiceTime();

    Date curTime = orderServiceTime.getServiceCityCurTime(orderBean.getServiceCityId());
    long hour = (serviceTime.getTime() - curTime.getTime()) / (60 * 60 * 1000);

    if (hour >= 23 && hour <= 24) {
      if ("泰国".equalsIgnoreCase(orderBean.getServiceCountryName())
          && OrderType.PICKUPORDER.equals(orderType)) {
        // 待完成
        // 素万那普国际机场4号门内侧铁栏杆处/廊曼机场2号门/普吉国际机场出口左转TMB旁,taxi接机牌候客区/清迈国际机场8号门
        String msgStr = taiguoGetMsgInfo(orderBean.getFlightDestCode());
        smsMessageVo.setParams(
            new String[] {orderType.name, hour + "", orderBean.getGuideName(), msgStr});
        if (SMSChannel.APP.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LININ_MORE_TAIGUO_APP.getTemplateId());
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else if (SMSChannel.fenxiao.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LININ_MORE_TAIGUO_FENXIAO.getTemplateId());
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else if (SMSChannel.zhixiao.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LININ_MORE_TAIGUO_ZHIXIAO.getTemplateId());
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else {
          log.error(
              orderBean.getOrderNo()
                  + " 既不属于 分销 也不属于直销 或者app,检查["
                  + orderBean.getAgentId()
                  + "] ["
                  + orderBean.getOrderChannel()
                  + "]");
        }
      } else {
        if (SMSChannel.APP.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LINXIN_MORE_APP.getTemplateId());
          smsMessageVo.setParams(new String[] {orderType.name, hour + ""});
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else if (SMSChannel.fenxiao.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LINXIN_MORE_FENXIAO.getTemplateId());
          smsMessageVo.setParams(
              new String[] {
                orderType.name, hour + "", orderBean.getGuideAreaCode() + orderBean.getGuideMobile()
              });
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else if (SMSChannel.zhixiao.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LINXIN_MORE_ZHIXIAO.getTemplateId());
          smsMessageVo.setParams(new String[] {orderType.name, hour + ""});
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else {
          log.error(
              orderBean.getOrderNo()
                  + " 既不属于 分销 也不属于直销 或者app,检查["
                  + orderBean.getAgentId()
                  + "] ["
                  + orderBean.getOrderChannel()
                  + "]");
        }
      }
    } else if (hour < 23 && hour > 0) {
      if ("泰国".equalsIgnoreCase(orderBean.getServiceCountryName())
          && OrderType.PICKUPORDER.equals(orderType)) {
        String msgStr = taiguoGetMsgInfo(orderBean.getFlightDestCode());
        smsMessageVo.setParams(
            new String[] {orderType.name, hour + "", orderBean.getGuideName(), msgStr});

        if (SMSChannel.APP.equals(smsChannel)) {
          // 11
          smsMessageVo.setTemplate_id(SmsTemplate.LININ_LESS_TAIGUO_APP.getTemplateId());
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else if (SMSChannel.fenxiao.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LININ_LESS_TAIGUO_FENXIAO.getTemplateId());
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else if (SMSChannel.zhixiao.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LININ_LESS_TAIGUO_ZHIXIAO.getTemplateId());
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else {
          log.error(
              orderBean.getOrderNo()
                  + " 既不属于 分销 也不属于直销 或者app,检查["
                  + orderBean.getAgentId()
                  + "] ["
                  + orderBean.getOrderChannel()
                  + "]");
        }
      } else {
        if (SMSChannel.APP.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LINXIN_LESS_APP.getTemplateId());
          smsMessageVo.setParams(new String[] {orderType.name, hour + ""});
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else if (SMSChannel.fenxiao.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LINXIN_LESS_FENXIAO.getTemplateId());
          smsMessageVo.setParams(
              new String[] {orderType.name, hour + "", orderBean.getAgentName()});
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else if (SMSChannel.zhixiao.equals(smsChannel)) {
          smsMessageVo.setTemplate_id(SmsTemplate.LINXIN_LESS_ZHIXIAO.getTemplateId());
          smsMessageVo.setParams(new String[] {orderType.name, hour + ""});
          return noticeSmsCenter(orderBean, smsMessageVo, AlarmType.SMSLOGKEAVING);
        } else {
          log.error(
              orderBean.getOrderNo()
                  + " 既不属于 分销 也不属于直销 或者app,检查["
                  + orderBean.getAgentId()
                  + "] ["
                  + orderBean.getOrderChannel()
                  + "]");
        }
      }
    } else {
      log.warn("订单[" + orderBean.getOrderNo() + "] 没到发送时间");
    }

    return false;
  }
Example #8
0
  /** @param param */
  @Transactional
  public void updateOrder(OrderModifyParam param) {
    TradeThirdOrder tradeThirdOrder =
        getThirdOrderBythirdTradeNo(param.getServicePartner(), param.getThirdTradeNo());
    if (tradeThirdOrder == null) {
      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();
            }
          });
    }
    OrderBean orderBean = orderQueryService.getOrderByNo(tradeThirdOrder.getOrderNo());
    if (orderBean == null) {
      log.error(
          "订单不存在。订单号为:" + tradeThirdOrder.getOrderNo() + ",三方订单号是:" + param.getThirdTradeNo());
      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();
            }
          });
    }
    orderBean.setUserName(param.getUserName());
    orderBean.setUserAreaCode1(param.getUserAreaCode1());
    orderBean.setUserMobile1(param.getUserMobile1());
    orderBean.setUserAreaCode2(param.getUserAreaCode2());
    orderBean.setUserMobile2(param.getUserMobile2());
    orderBean.setUserAreaCode3(param.getUserAreaCode3());
    orderBean.setUserMobile3(param.getUserMobile3());
    orderBean.setUserRemark(param.getUserRemark());
    orderBean.setIsArrivalVisa(param.getIsArrivalVisa());
    switch (OrderType.getType(orderBean.getOrderType())) {
      case PICKUPORDER:
        updateOrderService.updatePickUpOrder(orderBean);
        break;
      case TRANSFER:
        updateOrderService.updateTransferOrder(orderBean);
        break;
      default:
        log.error("订单类型不支持。参数:" + JSON.toJSONString(orderBean));
        throw new TradeException(
            new ReturnCode() {
              @Override
              public String getMessage() {
                return QunarErrorCode.ERR_PARAM.name();
              }

              @Override
              public int getCode() {
                return QunarErrorCode.ERR_PARAM.code();
              }
            });
    }
  }