|
@@ -65,6 +65,8 @@ public class OrderPayService {
|
|
|
private final AlipayClient alipayClient;
|
|
private final AlipayClient alipayClient;
|
|
|
private final AlipayProperties alipayProperties;
|
|
private final AlipayProperties alipayProperties;
|
|
|
private final AlipayService alipayService;
|
|
private final AlipayService alipayService;
|
|
|
|
|
+ private final PhotoAssetRepo photoAssetRepo;
|
|
|
|
|
+ private final PhotoAssetService photoAssetService;
|
|
|
|
|
|
|
|
public static void setPayChannel(String payChannel) {
|
|
public static void setPayChannel(String payChannel) {
|
|
|
log.info("set pay channel {}", payChannel);
|
|
log.info("set pay channel {}", payChannel);
|
|
@@ -127,11 +129,14 @@ public class OrderPayService {
|
|
|
|
|
|
|
|
String qrCode = aliRequest(orderId, order.getTotalPrice(), order.getName(), Constants.OrderNotifyType.ORDER);
|
|
String qrCode = aliRequest(orderId, order.getTotalPrice(), order.getName(), Constants.OrderNotifyType.ORDER);
|
|
|
|
|
|
|
|
- String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
|
|
|
|
|
|
|
+ String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
|
|
|
|
|
+ .getHeader("User-Agent");
|
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
|
- return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
|
|
|
|
+ return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder
|
|
|
|
|
+ .encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
+ "&orderId=" + orderId + "&type=order&returnUrl="
|
|
+ "&orderId=" + orderId + "&type=order&returnUrl="
|
|
|
- + URLEncoder.encode(generalProperties.resolveFrontUrl(order.getCompanyId(), "/store"), StandardCharsets.UTF_8);
|
|
|
|
|
|
|
+ + URLEncoder
|
|
|
|
|
+ .encode(generalProperties.resolveFrontUrl(order.getCompanyId(), "/store"), StandardCharsets.UTF_8);
|
|
|
} else {
|
|
} else {
|
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
|
}
|
|
}
|
|
@@ -154,7 +159,8 @@ public class OrderPayService {
|
|
|
if (order.getStatus() != OrderStatus.NOT_PAID) {
|
|
if (order.getStatus() != OrderStatus.NOT_PAID) {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
}
|
|
|
- IdentityAuth identityAuth = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
|
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
return sandPayService.payQuickBind(orderId + "", order.getName(), order.getTotalPrice(),
|
|
return sandPayService.payQuickBind(orderId + "", order.getName(), order.getTotalPrice(),
|
|
|
order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.ORDER,
|
|
order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.ORDER,
|
|
@@ -168,7 +174,8 @@ public class OrderPayService {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
}
|
|
|
checkTradeCode(userId, tradeCode, order.getUserId());
|
|
checkTradeCode(userId, tradeCode, order.getUserId());
|
|
|
- BalanceRecord record = userBalanceService.balancePay(order.getUserId(), order.getTotalPrice(), orderId, order.getName());
|
|
|
|
|
|
|
+ BalanceRecord record = userBalanceService
|
|
|
|
|
+ .balancePay(order.getUserId(), order.getTotalPrice(), orderId, order.getName());
|
|
|
rocketMQTemplate.syncSend(generalProperties.getOrderNotifyTopic(),
|
|
rocketMQTemplate.syncSend(generalProperties.getOrderNotifyTopic(),
|
|
|
new OrderNotifyEvent(orderId, PayMethod.BALANCE, record.getId().toString(),
|
|
new OrderNotifyEvent(orderId, PayMethod.BALANCE, record.getId().toString(),
|
|
|
System.currentTimeMillis()));
|
|
System.currentTimeMillis()));
|
|
@@ -219,7 +226,8 @@ public class OrderPayService {
|
|
|
return hmPayService.requestAlipay(orderId + "", order.getGasPrice(),
|
|
return hmPayService.requestAlipay(orderId + "", order.getGasPrice(),
|
|
|
"转赠" + order.getAssetId(),
|
|
"转赠" + order.getAssetId(),
|
|
|
HMPayService.getTimeout(order.getCreatedAt(), 180),
|
|
HMPayService.getTimeout(order.getCreatedAt(), 180),
|
|
|
- Constants.OrderNotifyType.GIFT, generalProperties.resolveFrontUrl(order.getCompanyId(), "/store"));
|
|
|
|
|
|
|
+ Constants.OrderNotifyType.GIFT, generalProperties
|
|
|
|
|
+ .resolveFrontUrl(order.getCompanyId(), "/store"));
|
|
|
}
|
|
}
|
|
|
throw new BusinessException(Constants.PAY_ERR_MSG);
|
|
throw new BusinessException(Constants.PAY_ERR_MSG);
|
|
|
}
|
|
}
|
|
@@ -233,11 +241,14 @@ public class OrderPayService {
|
|
|
|
|
|
|
|
String qrCode = aliRequest(orderId, order.getGasPrice(), "转赠", Constants.OrderNotifyType.GIFT);
|
|
String qrCode = aliRequest(orderId, order.getGasPrice(), "转赠", Constants.OrderNotifyType.GIFT);
|
|
|
|
|
|
|
|
- String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
|
|
|
|
|
|
|
+ String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
|
|
|
|
|
+ .getHeader("User-Agent");
|
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
|
- return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
|
|
|
|
+ return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder
|
|
|
|
|
+ .encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
+ "&orderId=" + orderId + "&type=gift&returnUrl="
|
|
+ "&orderId=" + orderId + "&type=gift&returnUrl="
|
|
|
- + URLEncoder.encode(generalProperties.resolveFrontUrl(order.getCompanyId(), "/store"), StandardCharsets.UTF_8);
|
|
|
|
|
|
|
+ + URLEncoder
|
|
|
|
|
+ .encode(generalProperties.resolveFrontUrl(order.getCompanyId(), "/store"), StandardCharsets.UTF_8);
|
|
|
} else {
|
|
} else {
|
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
|
}
|
|
}
|
|
@@ -260,7 +271,8 @@ public class OrderPayService {
|
|
|
if (order.getStatus() != OrderStatus.NOT_PAID) {
|
|
if (order.getStatus() != OrderStatus.NOT_PAID) {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
}
|
|
|
- IdentityAuth identityAuth = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
|
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
return sandPayService.payQuickBind(orderId + "", "转赠" + order.getAssetId(), order.getGasPrice(),
|
|
return sandPayService.payQuickBind(orderId + "", "转赠" + order.getAssetId(), order.getGasPrice(),
|
|
|
order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.GIFT,
|
|
order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.GIFT,
|
|
@@ -309,7 +321,8 @@ public class OrderPayService {
|
|
|
return hmPayService.requestAlipay(orderId + "", order.getGasPrice(),
|
|
return hmPayService.requestAlipay(orderId + "", order.getGasPrice(),
|
|
|
"铸造活动:" + order.getMintActivityId(),
|
|
"铸造活动:" + order.getMintActivityId(),
|
|
|
HMPayService.getTimeout(order.getCreatedAt(), 180),
|
|
HMPayService.getTimeout(order.getCreatedAt(), 180),
|
|
|
- Constants.OrderNotifyType.MINT, generalProperties.resolveFrontUrl(order.getCompanyId(), "/home"));
|
|
|
|
|
|
|
+ Constants.OrderNotifyType.MINT, generalProperties
|
|
|
|
|
+ .resolveFrontUrl(order.getCompanyId(), "/home"));
|
|
|
}
|
|
}
|
|
|
throw new BusinessException("绿洲宇宙冷却系统已启动,请稍后支付");
|
|
throw new BusinessException("绿洲宇宙冷却系统已启动,请稍后支付");
|
|
|
}
|
|
}
|
|
@@ -321,13 +334,17 @@ public class OrderPayService {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String qrCode = aliRequest(orderId, order.getGasPrice(), "铸造活动:" + order.getMintActivityId(), Constants.OrderNotifyType.MINT);
|
|
|
|
|
|
|
+ String qrCode = aliRequest(orderId, order.getGasPrice(), "铸造活动:" + order
|
|
|
|
|
+ .getMintActivityId(), Constants.OrderNotifyType.MINT);
|
|
|
|
|
|
|
|
- String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
|
|
|
|
|
|
|
+ String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
|
|
|
|
|
+ .getHeader("User-Agent");
|
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
|
- return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
|
|
|
|
+ return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder
|
|
|
|
|
+ .encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
+ "&orderId=" + orderId + "&type=mintOrder&returnUrl="
|
|
+ "&orderId=" + orderId + "&type=mintOrder&returnUrl="
|
|
|
- + URLEncoder.encode(generalProperties.resolveFrontUrl(order.getCompanyId(), "/home"), StandardCharsets.UTF_8);
|
|
|
|
|
|
|
+ + URLEncoder
|
|
|
|
|
+ .encode(generalProperties.resolveFrontUrl(order.getCompanyId(), "/home"), StandardCharsets.UTF_8);
|
|
|
} else {
|
|
} else {
|
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
|
}
|
|
}
|
|
@@ -350,7 +367,8 @@ public class OrderPayService {
|
|
|
if (order.getStatus() != MintOrderStatus.NOT_PAID) {
|
|
if (order.getStatus() != MintOrderStatus.NOT_PAID) {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
}
|
|
|
- IdentityAuth identityAuth = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
|
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
return sandPayService.payQuickBind(orderId + "", "铸造活动:" + order.getMintActivityId(),
|
|
return sandPayService.payQuickBind(orderId + "", "铸造活动:" + order.getMintActivityId(),
|
|
|
order.getGasPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.MINT,
|
|
order.getGasPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.MINT,
|
|
@@ -401,7 +419,8 @@ public class OrderPayService {
|
|
|
private Long getCompanyId() {
|
|
private Long getCompanyId() {
|
|
|
Long companyId = 1L;
|
|
Long companyId = 1L;
|
|
|
try {
|
|
try {
|
|
|
- String hCompanyId = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("companyId");
|
|
|
|
|
|
|
+ String hCompanyId = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
|
|
|
|
|
+ .getHeader("companyId");
|
|
|
if (StringUtils.isNotBlank(hCompanyId)) {
|
|
if (StringUtils.isNotBlank(hCompanyId)) {
|
|
|
companyId = Long.parseLong(hCompanyId);
|
|
companyId = Long.parseLong(hCompanyId);
|
|
|
}
|
|
}
|
|
@@ -457,11 +476,14 @@ public class OrderPayService {
|
|
|
|
|
|
|
|
String qrCode = aliRequest(order.getId(), order.getAmount(), "余额充值", Constants.OrderNotifyType.RECHARGE);
|
|
String qrCode = aliRequest(order.getId(), order.getAmount(), "余额充值", Constants.OrderNotifyType.RECHARGE);
|
|
|
|
|
|
|
|
- String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
|
|
|
|
|
|
|
+ String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
|
|
|
|
|
+ .getHeader("User-Agent");
|
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
|
- return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
|
|
|
|
+ return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder
|
|
|
|
|
+ .encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
+ "&orderId=" + order.getId() + "&type=recharge&returnUrl="
|
|
+ "&orderId=" + order.getId() + "&type=recharge&returnUrl="
|
|
|
- + URLEncoder.encode(generalProperties.resolveFrontUrl(getCompanyId(), "/home"), StandardCharsets.UTF_8);
|
|
|
|
|
|
|
+ + URLEncoder
|
|
|
|
|
+ .encode(generalProperties.resolveFrontUrl(getCompanyId(), "/home"), StandardCharsets.UTF_8);
|
|
|
} else {
|
|
} else {
|
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
|
}
|
|
}
|
|
@@ -521,7 +543,8 @@ public class OrderPayService {
|
|
|
if (amount.compareTo(new BigDecimal("50000")) > 0) {
|
|
if (amount.compareTo(new BigDecimal("50000")) > 0) {
|
|
|
throw new BusinessException("充值金额不能大于50000");
|
|
throw new BusinessException("充值金额不能大于50000");
|
|
|
}
|
|
}
|
|
|
- IdentityAuth identityAuth = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(userId, AuthStatus.SUCCESS)
|
|
|
|
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(userId, AuthStatus.SUCCESS)
|
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
RechargeOrder order = RechargeOrder.builder()
|
|
RechargeOrder order = RechargeOrder.builder()
|
|
|
.id(snowflakeIdWorker.nextId())
|
|
.id(snowflakeIdWorker.nextId())
|
|
@@ -625,13 +648,17 @@ public class OrderPayService {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String qrCode = aliRequest(orderId, order.getTotalPrice(), "拍卖:" + order.getName(), Constants.OrderNotifyType.AUCTION);
|
|
|
|
|
|
|
+ String qrCode = aliRequest(orderId, order.getTotalPrice(), "拍卖:" + order
|
|
|
|
|
+ .getName(), Constants.OrderNotifyType.AUCTION);
|
|
|
|
|
|
|
|
- String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
|
|
|
|
|
|
|
+ String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
|
|
|
|
|
+ .getHeader("User-Agent");
|
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
if (ua.toLowerCase().contains("micromessenger")) {
|
|
|
- return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
|
|
|
|
+ return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder
|
|
|
|
|
+ .encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
+ "&orderId=" + orderId + "&type=auctionOrder&returnUrl="
|
|
+ "&orderId=" + orderId + "&type=auctionOrder&returnUrl="
|
|
|
- + URLEncoder.encode(generalProperties.resolveFrontUrl(getCompanyId(), "/home"), StandardCharsets.UTF_8);
|
|
|
|
|
|
|
+ + URLEncoder
|
|
|
|
|
+ .encode(generalProperties.resolveFrontUrl(getCompanyId(), "/home"), StandardCharsets.UTF_8);
|
|
|
} else {
|
|
} else {
|
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
|
}
|
|
}
|
|
@@ -643,7 +670,8 @@ public class OrderPayService {
|
|
|
if (order.getStatus() != AuctionOrderStatus.NOT_PAID) {
|
|
if (order.getStatus() != AuctionOrderStatus.NOT_PAID) {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
}
|
|
|
- IdentityAuth identityAuth = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
|
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
return sandPayService.payQuick(orderId + "", "拍卖:" + order.getName(),
|
|
return sandPayService.payQuick(orderId + "", "拍卖:" + order.getName(),
|
|
|
order.getTotalPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.AUCTION,
|
|
order.getTotalPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.AUCTION,
|
|
@@ -656,7 +684,8 @@ public class OrderPayService {
|
|
|
if (order.getStatus() != AuctionOrderStatus.NOT_PAID) {
|
|
if (order.getStatus() != AuctionOrderStatus.NOT_PAID) {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
}
|
|
|
- IdentityAuth identityAuth = identityAuthRepo.findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
|
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
.orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
return sandPayService.payQuickBind(orderId + "", "拍卖:" + order.getName(),
|
|
return sandPayService.payQuickBind(orderId + "", "拍卖:" + order.getName(),
|
|
|
order.getTotalPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.AUCTION,
|
|
order.getTotalPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.AUCTION,
|
|
@@ -690,4 +719,101 @@ public class OrderPayService {
|
|
|
return payEaseService.pay("拍卖:" + order.getAuctionId(), orderId.toString(), order.getTotalPrice(),
|
|
return payEaseService.pay("拍卖:" + order.getAuctionId(), orderId.toString(), order.getTotalPrice(),
|
|
|
order.getUserId().toString(), bindCardId, Constants.OrderNotifyType.AUCTION);
|
|
order.getUserId().toString(), bindCardId, Constants.OrderNotifyType.AUCTION);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Cacheable(value = "payOrder", key = "'picOrder#'+#orderId")
|
|
|
|
|
+ public String payPicOrder(Long orderId) {
|
|
|
|
|
+ PhotoAsset order = photoAssetRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ if (order.getOrderStatus() != OrderStatus.NOT_PAID) {
|
|
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ switch (PAY_CHANNEL) {
|
|
|
|
|
+ case Constants.PayChannel.SAND:
|
|
|
|
|
+ return sandPayService.pay(orderId + "", "星图:" + order.getPicName(), order.getPrice(),
|
|
|
|
|
+ order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.PIC);
|
|
|
|
|
+ case Constants.PayChannel.HM:
|
|
|
|
|
+ return hmPayService.requestAlipay(orderId + "", order.getPrice(),
|
|
|
|
|
+ "星图:" + order.getPicName(), HMPayService.getTimeout(order.getCreatedAt(), 180),
|
|
|
|
|
+ Constants.OrderNotifyType.PIC, generalProperties.resolveFrontUrl(getCompanyId(), "/orderDetail?id=" + orderId));
|
|
|
|
|
+ }
|
|
|
|
|
+ throw new BusinessException("绿洲宇宙冷却系统已启动,请稍后支付");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Cacheable(value = "payOrder", key = "'picOrder#'+#orderId")
|
|
|
|
|
+ public String payPicAli(Long orderId) {
|
|
|
|
|
+ PhotoAsset order = photoAssetRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ if (order.getOrderStatus() != OrderStatus.NOT_PAID) {
|
|
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String qrCode = aliRequest(orderId, order.getPrice(), "星图:" + order
|
|
|
|
|
+ .getPicName(), Constants.OrderNotifyType.PIC);
|
|
|
|
|
+
|
|
|
|
|
+ String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest()
|
|
|
|
|
+ .getHeader("User-Agent");
|
|
|
|
|
+ if (ua.toLowerCase().contains("micromessenger")) {
|
|
|
|
|
+ return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder
|
|
|
|
|
+ .encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
|
|
|
|
|
+ + "&orderId=" + orderId + "&type=pic&returnUrl="
|
|
|
|
|
+ + URLEncoder
|
|
|
|
|
+ .encode(generalProperties.resolveFrontUrl(getCompanyId(), "/orderDetail?id=" + orderId), StandardCharsets.UTF_8);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return Constants.ALIPAY_URL_SCHEME + qrCode;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Cacheable(value = "payOrder", key = "'picOrder#'+#orderId")
|
|
|
|
|
+ public String payPicQuick(Long orderId) {
|
|
|
|
|
+ PhotoAsset order = photoAssetRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ if (order.getOrderStatus() != OrderStatus.NOT_PAID) {
|
|
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
|
|
+ .orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
|
|
+ return sandPayService.payQuick(orderId + "", "星图:" + order.getPicName(),
|
|
|
|
|
+ order.getPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.PIC,
|
|
|
|
|
+ generalProperties.resolveFrontUrl(getCompanyId(), "/orderDetail?id=" + orderId));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Cacheable(value = "payOrder", key = "'picOrder#'+#orderId")
|
|
|
|
|
+ public String payPicQuickBind(Long orderId) {
|
|
|
|
|
+ PhotoAsset order = photoAssetRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ if (order.getOrderStatus() != OrderStatus.NOT_PAID) {
|
|
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ IdentityAuth identityAuth = identityAuthRepo
|
|
|
|
|
+ .findFirstByUserIdAndStatusAndDelFalseOrderByCreatedAtDesc(order.getUserId(), AuthStatus.SUCCESS)
|
|
|
|
|
+ .orElseThrow(new BusinessException("请先完成实名认证"));
|
|
|
|
|
+ return sandPayService.payQuickBind(orderId + "", "星图:" + order.getPicName(),
|
|
|
|
|
+ order.getPrice(), order.getCreatedAt().plusMinutes(3), Constants.OrderNotifyType.PIC,
|
|
|
|
|
+ generalProperties.resolveFrontUrl(getCompanyId(), "/orderDetail?id=" + orderId),
|
|
|
|
|
+ order.getUserId(), identityAuth.getRealName(), identityAuth.getIdNo());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void payPicOrderBalance(Long orderId, Long userId, String tradeCode) {
|
|
|
|
|
+ PhotoAsset order = photoAssetRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ if (order.getOrderStatus() != OrderStatus.NOT_PAID) {
|
|
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ checkTradeCode(userId, tradeCode, order.getUserId());
|
|
|
|
|
+ BalanceRecord record = userBalanceService.balancePay(order.getUserId(), order.getPrice(), orderId, "星图");
|
|
|
|
|
+ photoAssetService.notify(orderId, PayMethod.BALANCE, record.getId().toString());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Cacheable(value = "payOrder", key = "'picOrder#'+#orderId")
|
|
|
|
|
+ public Map<String, Object> payPicOrderAgreement(Long orderId, String bindCardId) {
|
|
|
|
|
+ PhotoAsset order = photoAssetRepo.findById(orderId).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ if (order.getOrderStatus() != OrderStatus.NOT_PAID) {
|
|
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isEmpty(bindCardId)) {
|
|
|
|
|
+ bindCardId = userBankCardRepo.findByUserId(order.getUserId())
|
|
|
|
|
+ .stream().map(UserBankCard::getBindCardId).findFirst().orElse(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isEmpty(bindCardId)) {
|
|
|
|
|
+ throw new BusinessException("请先绑定银行卡");
|
|
|
|
|
+ }
|
|
|
|
|
+ return payEaseService.pay("星图:" + order.getPicName(), orderId.toString(), order.getPrice(),
|
|
|
|
|
+ order.getUserId().toString(), bindCardId, Constants.OrderNotifyType.PIC);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|