@Action( value = "/offlinePay/loadPaymentAmount", results = @Result( name = "payPayments", type = "json", params = {"includeProperties", "actualPayFloat"})) public String loadPaymentAmount() { PayPayment payment = payPaymentService.selectByPaymentTradeNoAndObjectId(paymentTradeNo, orderId + ""); this.setActualPayFloat(PriceUtil.convertToYuan(payment.getAmount())); return "payPayments"; }
@Action("/pay/alipayWAP") public void alipayWAP() { if (payment()) { try { LOG.info("alipayWAP request init data:" + alipayWAPPostData.getRequestParams()); // 获取授权令牌 AlipayWAPResponseResult resResult = getRequestToken(); log.info(StringUtil.printParam(resResult)); String businessResult = ""; if (resResult.isSuccess()) { businessResult = resResult.getBusinessResult(); } else { // 授权令牌错误 String errorMessage = "errorCode:" + resResult.getErrorMessage().getCode() + ",subErrorCode:" + resResult.getErrorMessage().getSubCode() + ",errorMsg:" + resResult.getErrorMessage().getMsg() + ",errorDetail:" + resResult.getErrorMessage().getDetail(); log.error(errorMessage); PayPayment payment = new PayPayment(); payment.setPaymentTradeNo(alipayWAPPostData.getOutTradeNo()); payment.setCallbackInfo(errorMessage); payment.setCallbackTime(new Date()); getPayPaymentService().callBackPayPayment(payment, false); return; } XMap xmap = new XMap(); xmap.register(AlipayWAPDirectTradeCreateRes.class); AlipayWAPDirectTradeCreateRes directTradeCreateRes = (AlipayWAPDirectTradeCreateRes) xmap.load( new ByteArrayInputStream( businessResult.getBytes(alipayWAPPostData.getCharset()))); String requestToken = directTradeCreateRes.getRequestToken(); // 封装交易参数 Map<String, String> authParams = alipayWAPPostData.initExecuteParams(requestToken); String redirectURL = alipayWAPPostData.getReqUrl() + "?" + AlipayUtil.mapToUrl(authParams); log.info("redirectURL:" + redirectURL); // sendAjaxMsg(redirectURL); // getRequest().getRequestDispatcher(redirectURL).forward(getRequest(), getResponse()); getResponse().sendRedirect(redirectURL); } catch (Exception e) { e.printStackTrace(); } } }
private String buildOrderInfo(PassCode passCode) { OrdOrder ordorder = orderServiceProxy.queryOrdOrderByOrderId(passCode.getOrderId()); // 取票人/联系人的证件号 cardNum = ordorder.getContact().getCertNo(); List<PayPayment> payList = payPaymentService.selectByObjectIdAndBizType( ordorder.getOrderId(), Constant.PAYMENT_BIZ_TYPE.SUPER_ORDER.name()); for (PayPayment payment : payList) { if (payment.isSuccess()) { GugongOrder gugongorder = new GugongOrder(payment, ordorder, passCode.getSerialNo()); return gugongorder.getJSON(); } } return null; }
/** @return */ @Action(value = "/offlinePay/onlinePaySave") public void doSave() { JSONResult result = new JSONResult(); try { Assert.hasText(paymentTradeNo, "对账流水号不可以为空"); Assert.hasText(gatewayTradeNo, "银行交易流水号不可以为空"); Assert.hasText(refundSerial, "退款流水号不可以为空"); Assert.notNull(callbackTime, "交易时间不可以为空"); PayPayment payment = payPaymentService.selectByPaymentTradeNoAndObjectId(paymentTradeNo, orderId + ""); payment.setStatus(Constant.PAYMENT_SERIAL_STATUS.SUCCESS.name()); payment.setCallbackTime(callbackTime); payment.setRefundSerial(refundSerial.trim()); payment.setGatewayTradeNo(gatewayTradeNo.trim()); payment.setCallbackInfo("[线下支付]" + memo.trim()); payment.setStatus(Constant.PAYMENT_SERIAL_STATUS.SUCCESS.name()); payment.setOperator(getOperatorName()); payPaymentService.updatePayment(payment); if (payment.isPrePayment()) { // 更新预授权支付数据 payPaymentService.updatePrePayment(payment); } paymentId = payment.getPaymentId(); if (payment != null && payment.isSuccess()) { if (Constant.PAYMENT_BIZ_TYPE.SUPER_ORDER.name().equalsIgnoreCase(payment.getBizType())) { OrdOrder order = orderServiceProxy.queryOrdOrderByOrderId(payment.getObjectId()); if (payment.isPrePayment() && order.isApprovePass()) { Message msg = MessageFactory.newOrderApproveBeforePrepayMessage(order.getOrderId()); msg.setAddition(Constant.PAYMENT_BIZ_TYPE.SUPER_ORDER.name()); orderMessageProducer.sendMsg(msg); } else if (order.isApproveFail()) { orderServiceProxy.autoCreateOrderFullRefund(order, super.getOperatorName(), "资源审核不通过"); } } ComLog log = new ComLog(); log.setObjectId(payment.getPaymentId()); log.setObjectType("PAY_PAYMENT"); log.setParentId(payment.getObjectId()); log.setParentType("ORD_ORDER"); log.setLogType("PAYMENT_TYPE_OFFLINE"); log.setLogName("手工线下支付"); log.setOperatorName(this.getOperatorName()); log.setContent("由操作人员" + getOperatorName() + "使用" + payment.getPayWayZh() + "线下支付方式支付"); log.setCreateTime(new Date()); comLogService.addComLog(log); resourceMessageProducer.sendMsg( MessageFactory.newPaymentSuccessCallMessage(payment.getPaymentId())); } result.put("paymentId", paymentId); } catch (Exception ex) { result.raise(new JSONResultException(ex.getMessage())); } result.output(getResponse()); }