|
@@ -14,6 +14,7 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
import com.huifu.adapay.model.Payment;
|
|
import com.huifu.adapay.model.Payment;
|
|
|
import com.izouma.nineth.config.AdapayProperties;
|
|
import com.izouma.nineth.config.AdapayProperties;
|
|
|
import com.izouma.nineth.config.AlipayProperties;
|
|
import com.izouma.nineth.config.AlipayProperties;
|
|
|
|
|
+import com.izouma.nineth.config.GeneralProperties;
|
|
|
import com.izouma.nineth.config.WxPayProperties;
|
|
import com.izouma.nineth.config.WxPayProperties;
|
|
|
import com.izouma.nineth.domain.Asset;
|
|
import com.izouma.nineth.domain.Asset;
|
|
|
import com.izouma.nineth.domain.GiftOrder;
|
|
import com.izouma.nineth.domain.GiftOrder;
|
|
@@ -49,17 +50,18 @@ import java.util.Map;
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
|
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;
|
|
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public GiftOrder gift(Long userId, Long assetId, Long toUserId) {
|
|
public GiftOrder gift(Long userId, Long assetId, Long toUserId) {
|
|
@@ -112,6 +114,7 @@ public class GiftOrderService {
|
|
|
public void payOrderAlipay(Long id, Model model) {
|
|
public void payOrderAlipay(Long id, Model model) {
|
|
|
try {
|
|
try {
|
|
|
GiftOrder order = giftOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
|
|
GiftOrder order = giftOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
|
|
|
|
|
+ Asset asset = assetRepo.findById(order.getAssetId()).orElseThrow(new BusinessException("藏品不存在"));
|
|
|
|
|
|
|
|
if (order.getStatus() != OrderStatus.NOT_PAID) {
|
|
if (order.getStatus() != OrderStatus.NOT_PAID) {
|
|
|
throw new BusinessException("订单状态错误");
|
|
throw new BusinessException("订单状态错误");
|
|
@@ -136,7 +139,12 @@ public class GiftOrderService {
|
|
|
bizContent.put("body", body.toJSONString());
|
|
bizContent.put("body", body.toJSONString());
|
|
|
|
|
|
|
|
AlipayTradeWapPayRequest alipayRequest = new AlipayTradeWapPayRequest();
|
|
AlipayTradeWapPayRequest alipayRequest = new AlipayTradeWapPayRequest();
|
|
|
- alipayRequest.setReturnUrl(alipayProperties.getReturnUrl());
|
|
|
|
|
|
|
+ if (asset.getProjectId() == 1) {
|
|
|
|
|
+ alipayRequest.setReturnUrl(generalProperties.getHost() + "/cosmos/home");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ alipayRequest.setReturnUrl(generalProperties.getHost() + "/9th/home");
|
|
|
|
|
+ }
|
|
|
|
|
+ alipayRequest.setReturnUrl(generalProperties.getHost() + "/");
|
|
|
alipayRequest.setNotifyUrl(alipayProperties.getNotifyUrl());
|
|
alipayRequest.setNotifyUrl(alipayProperties.getNotifyUrl());
|
|
|
alipayRequest.setBizContent(JSON.toJSONString(bizContent));
|
|
alipayRequest.setBizContent(JSON.toJSONString(bizContent));
|
|
|
|
|
|