|
|
@@ -254,7 +254,10 @@ public class OrderService {
|
|
|
Order order = orderRepo.findByIdAndDelFalse(id).orElseThrow(new BusinessException("订单不存在"));
|
|
|
Collection collection = collectionRepo.findById(order.getCollectionId())
|
|
|
.orElseThrow(new BusinessException("藏品不存在"));
|
|
|
- User invitor = userRepo.findById(order.getInvitor()).orElse(null);
|
|
|
+ User invitor = null;
|
|
|
+ if (order.getInvitor() != null) {
|
|
|
+ invitor = userRepo.findById(order.getInvitor()).orElse(null);
|
|
|
+ }
|
|
|
if (order.getStatus() != OrderStatus.NOT_PAID) {
|
|
|
throw new BusinessException("订单状态错误");
|
|
|
}
|
|
|
@@ -265,6 +268,7 @@ public class OrderService {
|
|
|
paymentParams.put("app_id", adapayProperties.getAppId());
|
|
|
paymentParams.put("pay_channel", payChannel);
|
|
|
paymentParams.put("goods_title", collection.getName());
|
|
|
+ paymentParams.put("goods_desc", collection.getName());
|
|
|
paymentParams.put("time_expire", DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
|
|
|
.format(LocalDateTime.now().plusMinutes(5)));
|
|
|
paymentParams.put("notify_url", adapayProperties.getNotifyUrl() + "/order/" + order.getId());
|
|
|
@@ -288,7 +292,10 @@ public class OrderService {
|
|
|
restAmount = divMoney(order.getTotalPrice(), restAmount, divMembers, "0",
|
|
|
-1, true);
|
|
|
}
|
|
|
- paymentParams.put("div_members", JSON.toJSONString(divMembers));
|
|
|
+ if (divMembers.size() > 1) {
|
|
|
+ paymentParams.put("div_members", JSON.toJSONString(divMembers));
|
|
|
+ }
|
|
|
+
|
|
|
if (restAmount.compareTo(BigDecimal.ZERO) != 0) {
|
|
|
log.error("分账出错 {}", JSON.toJSONString(divMembers, SerializerFeature.PrettyFormat));
|
|
|
throw new BusinessException("分账出错");
|
|
|
@@ -313,9 +320,9 @@ public class OrderService {
|
|
|
switch (payChannel) {
|
|
|
case "alipay_wap":
|
|
|
case "alipay":
|
|
|
- MapUtils.getString(MapUtils.getMap(response, "expend"), "pay_info");
|
|
|
+ return MapUtils.getString(MapUtils.getMap(response, "expend"), "pay_info");
|
|
|
case "alipay_qr":
|
|
|
- MapUtils.getString(MapUtils.getMap(response, "expend"), "qrcode_url");
|
|
|
+ return MapUtils.getString(MapUtils.getMap(response, "expend"), "qrcode_url");
|
|
|
}
|
|
|
return response;
|
|
|
}
|