Esempio n. 1
0
  /**
   * 支付宝支付
   *
   * @author zhliu
   * @date 2015年6月30日
   * @param request
   * @param subOrderId : 子订单ID
   * @param subOrderNo:子订单号
   * @param payWay :线上支付渠道(1:积分支付;2支付宝支付;3:混合支付)
   * @return
   */
  @RequestMapping("onlinePaySetPayment")
  public String onlinePaySetPayment(
      HttpServletRequest request, String subOrderId, String subOrderNo, String payWay) {

    try {

      // 更新 订单 实付金额
      SubOrder subOrder = new SubOrder();
      subOrder.setSubOrderNo(subOrderNo);
      subOrder = subOrderManager.getBySample(subOrder).get(0);

      if (payWay != null
          && payWay.equals(String.valueOf(IBSConstants.PAY_WAY_ON_LINE_INTEGRAL))) { // 积分支付
        subOrder.setActuallyAmount(0.0);
        subOrder.setActuallyIntegral(subOrder.getPayableAmount());
      } else if (payWay != null
          && payWay.equals(String.valueOf(IBSConstants.PAY_WAY_ON_LINE_ALIPAY))) { // 支付宝支付
        subOrder.setActuallyAmount(subOrder.getPayableAmount());
        subOrder.setActuallyIntegral(0.0);
      } else {
        return null;
      }

      subOrderManager.save(subOrder);

      return "redirect:/onlinePay/aliPay/" + subOrderId;

    } catch (Exception e) {
      e.printStackTrace();
      logger.error(e.getMessage());
    }
    return null;
  }
Esempio n. 2
0
  /**
   * 积分支付
   *
   * @author zhliu
   * @date 2015年6月30日
   * @param request
   * @param response
   * @param subOrderNo:子订单号
   * @param payWay :线上支付渠道(1:积分支付;2支付宝支付;3:混合支付)
   * @param password :支付密码
   * @return
   */
  @RequestMapping("integralPaySetPayment")
  public String integralPaySetPayment(
      HttpServletRequest request,
      String subOrderId,
      String subOrderNo,
      String payWay,
      String password,
      Long orderId) {

    try {
      User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER);

      // 更新 订单 实付金额
      SubOrder subOrder = new SubOrder();
      subOrder.setSubOrderNo(subOrderNo);
      subOrder = subOrderManager.getBySample(subOrder).get(0);

      if (payWay != null
          && payWay.equals(String.valueOf(IBSConstants.PAY_WAY_ON_LINE_INTEGRAL))) { // 积分支付
        subOrder.setActuallyAmount(0.0);
        subOrder.setActuallyIntegral(subOrder.getPayableAmount());
      } else if (payWay != null
          && payWay.equals(String.valueOf(IBSConstants.PAY_WAY_ON_LINE_ALIPAY))) { // 支付宝支付
        subOrder.setActuallyAmount(subOrder.getPayableAmount());
        subOrder.setActuallyIntegral(0.0);
      } else {
        return null;
      }
      subOrderManager.save(subOrder);

      // 积分支付
      Map resultMap = orderManager.integralPay(subOrderId, user.getObjectId(), password);

      request.setAttribute("message", resultMap.get("message")); // 支付信息
      /*if(orderId == null){//子订单ID
      	return "redirect:"+"buyWelfareSubOrderSuc/"+subOrderId;
      }else{//总订单ID
      	return "redirect:"+"buyWelfareOrderSuc/"+orderId;
      }*/

      return "redirect:" + "buyWelfareSubOrderSuc/" + subOrderId;

    } catch (Exception e) {
      e.printStackTrace();
      logger.error(e.getMessage());
    }

    return null;
  }
Esempio n. 3
0
  /**
   * 购买福利-生成订单 -- 根据子订单 ID 进行支付
   *
   * @author zhliu
   * @date 2015年7月3日
   * @parm
   * @param request
   * @param response
   * @param objectId : 子订单ID
   * @return
   */
  @RequestMapping("/buyWelfareSubOrderSuc/{objectId}")
  public String buyWelfareSubOrderSuc(HttpServletRequest request, @PathVariable Long objectId) {

    User user = (User) request.getSession().getAttribute(SecurityConstants.SESSION_USER);
    SubOrder subOrder = new SubOrder();
    double totalAmount = 0.0; // 应付总额
    Double sumPoint = 0.0; // 员工 积分
    Order order = new Order(); // 总订单
    try {
      // 查询剩余积分
      sumPoint = userManager.getUserBalance(user.getObjectId());
      subOrder = subOrderManager.getByObjectId(objectId);
      order = orderManager.getByObjectId(subOrder.getGeneralOrderId());
      totalAmount = subOrder.getPayableAmount();

      request.setAttribute("sumPoint", sumPoint);
      request.setAttribute("subOrder", subOrder);
      request.setAttribute("totalAmount", totalAmount);

      if (order.getPaymentWay() != null && order.getPaymentWay() == 2) {
        return HOME_DIR + "/buyWelfareOrder";
      } else {
        return HOME_DIR + "/buyWelfareOrderPayOffline";
      }

    } catch (Exception e) {
      e.printStackTrace();
      logger.error(e.getMessage());
    }

    return HOME_DIR + "/buyWelfareOrder";
  }