|
@@ -45,6 +45,7 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
+import java.time.temporal.ChronoUnit;
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -55,17 +56,17 @@ import java.util.Map;
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
public class GiftOrderService {
|
|
public class GiftOrderService {
|
|
|
|
|
|
|
|
- private AssetRepo assetRepo;
|
|
|
|
|
- private UserRepo userRepo;
|
|
|
|
|
- private SysConfigService sysConfigService;
|
|
|
|
|
- private GiftOrderRepo giftOrderRepo;
|
|
|
|
|
- private AlipayProperties alipayProperties;
|
|
|
|
|
- private AlipayClient alipayClient;
|
|
|
|
|
- private WxPayProperties wxPayProperties;
|
|
|
|
|
- private WxPayService wxPayService;
|
|
|
|
|
- private Environment env;
|
|
|
|
|
- private AssetService assetService;
|
|
|
|
|
- private AdapayProperties adapayProperties;
|
|
|
|
|
|
|
+ private AssetRepo assetRepo;
|
|
|
|
|
+ private UserRepo userRepo;
|
|
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
|
+ private GiftOrderRepo giftOrderRepo;
|
|
|
|
|
+ private AlipayProperties alipayProperties;
|
|
|
|
|
+ private AlipayClient alipayClient;
|
|
|
|
|
+ private WxPayProperties wxPayProperties;
|
|
|
|
|
+ private WxPayService wxPayService;
|
|
|
|
|
+ private Environment env;
|
|
|
|
|
+ private AssetService assetService;
|
|
|
|
|
+ private AdapayProperties adapayProperties;
|
|
|
private GeneralProperties generalProperties;
|
|
private GeneralProperties generalProperties;
|
|
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@@ -74,6 +75,10 @@ public class GiftOrderService {
|
|
|
if (!asset.getUserId().equals(userId)) {
|
|
if (!asset.getUserId().equals(userId)) {
|
|
|
throw new BusinessException("无权限");
|
|
throw new BusinessException("无权限");
|
|
|
}
|
|
}
|
|
|
|
|
+ int holdDays = sysConfigService.getInt("hold_days");
|
|
|
|
|
+ if (ChronoUnit.DAYS.between(asset.getCreatedAt(), LocalDateTime.now()) < holdDays) {
|
|
|
|
|
+ throw new BusinessException("需持有满" + holdDays + "天才能寄售上架");
|
|
|
|
|
+ }
|
|
|
if (toUserId.equals(userId)) {
|
|
if (toUserId.equals(userId)) {
|
|
|
throw new BusinessException("不能送给自己");
|
|
throw new BusinessException("不能送给自己");
|
|
|
}
|
|
}
|
|
@@ -207,7 +212,7 @@ public class GiftOrderService {
|
|
|
paymentParams.put("pay_amt", order.getGasPrice().setScale(2, RoundingMode.HALF_UP).toPlainString());
|
|
paymentParams.put("pay_amt", order.getGasPrice().setScale(2, RoundingMode.HALF_UP).toPlainString());
|
|
|
paymentParams.put("app_id", adapayProperties.getAppId());
|
|
paymentParams.put("app_id", adapayProperties.getAppId());
|
|
|
paymentParams.put("pay_channel", payChannel);
|
|
paymentParams.put("pay_channel", payChannel);
|
|
|
- paymentParams.put("goods_title","转赠GAS费");
|
|
|
|
|
|
|
+ paymentParams.put("goods_title", "转赠GAS费");
|
|
|
paymentParams.put("goods_desc", "转赠GAS费");
|
|
paymentParams.put("goods_desc", "转赠GAS费");
|
|
|
paymentParams.put("time_expire", DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
|
|
paymentParams.put("time_expire", DateTimeFormatter.ofPattern("yyyyMMddHHmmss")
|
|
|
.format(LocalDateTime.now().plusMinutes(5)));
|
|
.format(LocalDateTime.now().plusMinutes(5)));
|