|
@@ -302,6 +302,64 @@ public class SandPayService {
|
|
|
return res.getJSONObject("body").getString("credential");
|
|
return res.getJSONObject("body").getString("credential");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Cacheable(value = "sandPayQuick", key = "#orderId")
|
|
|
|
|
+ public String payGiftQuick(Long orderId) {
|
|
|
|
|
+ GiftOrder order = giftOrderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ if (order.getStatus() != OrderStatus.NOT_PAID) {
|
|
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONObject extend = new JSONObject();
|
|
|
|
|
+ extend.put("type", "gift");
|
|
|
|
|
+ extend.put("id", orderId);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject res = requestQuick(orderId.toString(), order.getGasPrice(), "转增" + order.getAssetId(),
|
|
|
|
|
+ "转增" + order.getAssetId(), 180, extend.toJSONString(),
|
|
|
|
|
+ generalProperties.getHost() + "/9th/");
|
|
|
|
|
+ if (res == null)
|
|
|
|
|
+ throw new BusinessException("下单失败,请稍后再试");
|
|
|
|
|
+
|
|
|
|
|
+ if (!"000000".equals(res.getJSONObject("head").getString("respCode"))) {
|
|
|
|
|
+ String msg = res.getJSONObject("head").getString("respMsg");
|
|
|
|
|
+ if (msg.contains("超限")) {
|
|
|
|
|
+ throw new BusinessException("超过商户单日额度");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (msg.contains("商户状态")) {
|
|
|
|
|
+ throw new BusinessException("超过商户单日额度");
|
|
|
|
|
+ }
|
|
|
|
|
+ throw new BusinessException(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ return res.getJSONObject("body").getString("credential");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Cacheable(value = "sandPayQuick", key = "#orderId")
|
|
|
|
|
+ public String payMintQuick(Long orderId) {
|
|
|
|
|
+ MintOrder order = mintOrderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ if (order.getStatus() != MintOrderStatus.NOT_PAID) {
|
|
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONObject extend = new JSONObject();
|
|
|
|
|
+ extend.put("type", "mintOrder");
|
|
|
|
|
+ extend.put("id", orderId);
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject res = requestQuick(orderId.toString(), order.getGasPrice(),
|
|
|
|
|
+ "铸造活动:" + order.getMintActivityId(), "铸造活动:" + order.getMintActivityId(),
|
|
|
|
|
+ 180, extend.toJSONString(), generalProperties.getHost() + "/9th/");
|
|
|
|
|
+ if (res == null)
|
|
|
|
|
+ throw new BusinessException("下单失败,请稍后再试");
|
|
|
|
|
+
|
|
|
|
|
+ if (!"000000".equals(res.getJSONObject("head").getString("respCode"))) {
|
|
|
|
|
+ String msg = res.getJSONObject("head").getString("respMsg");
|
|
|
|
|
+ if (msg.contains("超限")) {
|
|
|
|
|
+ throw new BusinessException("超过商户单日额度");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (msg.contains("商户状态")) {
|
|
|
|
|
+ throw new BusinessException("超过商户单日额度");
|
|
|
|
|
+ }
|
|
|
|
|
+ throw new BusinessException(msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ return res.getJSONObject("body").getString("credential");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Cacheable(value = "sandPay", key = "#orderId")
|
|
@Cacheable(value = "sandPay", key = "#orderId")
|
|
|
public String payGiftOrder(Long orderId) {
|
|
public String payGiftOrder(Long orderId) {
|
|
|
GiftOrder order = giftOrderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
GiftOrder order = giftOrderRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|