支付宝支付-update

This commit is contained in:
2026-03-28 14:09:38 +08:00
parent 37cf579539
commit 774b4eb2d8
24 changed files with 142 additions and 446 deletions

View File

@@ -375,6 +375,8 @@ CREATE INDEX idx_tup_uid ON common_tour_info (user_id);
INSERT INTO mall_category (id, category_name, image_url, pid, level, sort, is_deleted, create_time, create_user, update_time, update_user, status, create_dept) VALUES (2033413707249164290, '自营商品', '', null, 1, 0, 0, '2026-03-16 13:23:01.460000', 1123598821738675201, '2026-03-16 13:23:01.460000', 1123598821738675201, 1, 1123598813738675201);
INSERT INTO mall_category (id, category_name, image_url, pid, level, sort, is_deleted, create_time, create_user, update_time, update_user, status, create_dept) VALUES (2033413760969809921, '生态产品', '', null, 1, 0, 0, '2026-03-16 13:23:14.280000', 1123598821738675201, '2026-03-16 13:23:14.280000', 1123598821738675201, 1, 1123598813738675201);
--------------------------------------------- 系统参数 -app支付宝aesKey ---------------------------------------------
INSERT INTO blade_param (id, param_name, param_key, param_value, remark, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2037772595062923266, 'app支付宝aesKey', 'yichuyilu.app.ali.aes.key', 'VS14+f0md0HjJ1D0Wp3Lgw==', 'app支付宝aesKey', null, null, '2026-03-28 14:03:41.282000', null, '2026-03-28 14:03:41.282000', 1, 0);

View File

@@ -6,14 +6,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.date.DateUtil;
import org.springblade.modules.api.constant.AppAliPayConstant;
import org.springblade.modules.api.service.PaymentFacade;
import org.springblade.modules.common.eums.OrderStatus;
import org.springblade.modules.common.eums.PaymentStatus;
import org.springblade.modules.common.pojo.entity.CommonPayOrderEntity;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.service.ICommonPayOrderService;
import org.springblade.modules.common.service.ICommonUserOrderService;
import org.springblade.plugin.pay.config.AliPayConfiguration;
import org.springblade.plugin.pay.service.IAliPayService;
import org.springblade.plugin.pay.service.IOrderService;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@@ -37,11 +37,11 @@ public class AliUserOrderCloseProcessor implements BasicProcessor {
private final ICommonPayOrderService commonPayOrderService;
private final ICommonUserOrderService commonUserOrderService;
private final IAliPayService aliPayService;
private final AliPayConfiguration aliPayConfig;
private final PaymentFacade paymentFacade;
private final IOrderService orderService;
@Override
public ProcessResult process(TaskContext taskContext) throws Exception {
@@ -108,11 +108,7 @@ public class AliUserOrderCloseProcessor implements BasicProcessor {
}
AlipayTradeQueryResponse response = aliPayService.query(
orderNo,
aliPayConfig.getAppId(),
aliPayConfig.getMachId()
);
AlipayTradeQueryResponse response = paymentFacade.aliQuery(orderNo);
if (response == null) {
@@ -121,9 +117,9 @@ public class AliUserOrderCloseProcessor implements BasicProcessor {
}
if (response.getTradeStatus().equalsIgnoreCase("TRADE_SUCCESS") || response.getTradeStatus().equalsIgnoreCase("TRADE_FINISHED")){
orderService.paySuccess(orderNo, aliPayConfig.getMachId(), response.getTradeNo(), DateUtil.convertFromDate(response.getSendPayDate() , "yyyy-MM-dd HH:mm:ss"), response.getBuyerUserId());
orderService.paySuccess(orderNo, String.valueOf(AppAliPayConstant.ALI_MACH_ID), response.getTradeNo(), DateUtil.convertFromDate(response.getSendPayDate() , "yyyy-MM-dd HH:mm:ss"), response.getBuyerUserId());
}else {
Boolean isClosed = aliPayService.closeOrder(orderNo, aliPayConfig.getAppId(), aliPayConfig.getMachId());
Boolean isClosed = paymentFacade.aliCloseOrder(orderNo);
if (!Boolean.TRUE.equals(isClosed)) {
log.error("订单 {} 调用支付宝关闭失败,保留本地状态等待下次重试", orderNo);
// 策略:不更新本地状态,下次定时任务再试。防止误关。

View File

@@ -13,6 +13,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.modules.api.request.*;
import org.springblade.modules.api.response.CreateOrderResponse;
import org.springblade.modules.api.response.PaymentResponse;
import org.springblade.modules.api.service.PaymentFacade;
import org.springblade.modules.api.vo.*;
import org.springblade.modules.common.service.*;
import org.springblade.modules.system.service.IUserService;
@@ -42,6 +43,8 @@ public class APPUserController {
private final ICommonLotteryPrizeService lotteryPrizeService;
private final PaymentFacade paymentFacade;
/**
* 是否修改过密码
@@ -80,7 +83,7 @@ public class APPUserController {
@ApiOperationSupport(order = 5)
@Operation(summary = "支付", description = "传入PaymentRequest")
public R<PaymentResponse> aliPay(@Valid @RequestBody PaymentRequest request) {
return R.data(orderService.aliPay(request));
return R.data(paymentFacade.aliAppPay(request));
}
/**
@@ -90,7 +93,7 @@ public class APPUserController {
@ApiOperationSupport(order = 6)
@Operation(summary = "支付", description = "传入PaymentRequest")
public R<PaymentResponse> wxPay(@Valid @RequestBody PaymentRequest request) {
return R.data(orderService.wxPay(request));
return R.data(paymentFacade.wxAppPay(request));
}

View File

@@ -0,0 +1,9 @@
package org.springblade.modules.api.constant;
public interface AppAliPayConstant {
Long ALI_APP_ID = 2088380917299813L;
Long ALI_MACH_ID = 2021006137661681L;
String APP_ALI_AES_KEY = "yichuyilu.app.ali.aes.key";
}

View File

@@ -0,0 +1,19 @@
package org.springblade.modules.api.service;
import com.alipay.api.response.AlipayTradeQueryResponse;
import org.springblade.modules.api.request.PaymentRequest;
import org.springblade.modules.api.response.PaymentResponse;
public interface PaymentFacade {
PaymentResponse aliAppPay(PaymentRequest request) ;
AlipayTradeQueryResponse aliQuery(String orderNo);
Boolean aliCloseOrder(String orderNo);
PaymentResponse wxAppPay(PaymentRequest request);
}

View File

@@ -0,0 +1,91 @@
package org.springblade.modules.api.service.impl;
import com.alipay.api.response.AlipayTradeQueryResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.modules.api.constant.AppAliPayConstant;
import org.springblade.modules.api.request.PaymentRequest;
import org.springblade.modules.api.response.PaymentResponse;
import org.springblade.modules.common.eums.BusinessModule;
import org.springblade.modules.common.eums.PaymentType;
import org.springblade.modules.api.service.PaymentFacade;
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
import org.springblade.modules.common.service.ICommonUserOrderService;
import org.springblade.plugin.pay.service.IAliPayService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
@AllArgsConstructor
public class PaymentFacadeImpl implements PaymentFacade {
private final ICommonUserOrderService commonUserOrderService;
private final IAliPayService aliPayService;
@Override
@Transactional(rollbackFor = Exception.class)
public PaymentResponse aliAppPay(PaymentRequest request) {
if (!request.getPaymentType().equals(PaymentType.ALI.getCode())){
throw new ServiceException("请选择正确的支付方式");
}
CommonUserOrderEntity order = commonUserOrderService.getById(Long.valueOf(request.getOrderId()));
if (order == null) {
throw new ServiceException("无效订单");
}
if (order.getPaymentType().equals(PaymentType.OFFLINE.getCode())) {
throw new ServiceException("无效订单");
}
try {
String content = aliPayService.appPay(
String.valueOf(AppAliPayConstant.ALI_APP_ID),
String.valueOf(AppAliPayConstant.ALI_MACH_ID),
order.getItemName(),
String.valueOf(order.getActualAmount()),
null,
order.getItemName(),
PaymentType.ALI.getAbbr() + BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).getAbbr(),
order.getId()
);
return new PaymentResponse()
.setPaymentType(PaymentType.ALI.getCode())
.setParams(content)
.setPayChannel(PaymentType.ALI.getName())
;
}catch (Exception e){
log.error("支付异常 : {}" , e.getMessage());
throw new RuntimeException(e.getMessage());
}
}
@Override
public AlipayTradeQueryResponse aliQuery(String orderNo) {
return aliPayService.query(
orderNo,
String.valueOf(AppAliPayConstant.ALI_APP_ID),
String.valueOf(AppAliPayConstant.ALI_MACH_ID)
);
}
@Override
public Boolean aliCloseOrder(String orderNo) {
return aliPayService.closeOrder(
orderNo,
String.valueOf(AppAliPayConstant.ALI_APP_ID),
String.valueOf(AppAliPayConstant.ALI_MACH_ID)
);
}
@Override
public PaymentResponse wxAppPay(PaymentRequest request) {
throw new ServiceException("当前微信支付未开放");
}
}

View File

@@ -1,18 +0,0 @@
package org.springblade.modules.common.client;
import com.dtflys.forest.annotation.Get;
import com.dtflys.forest.annotation.Query;
import com.dtflys.forest.annotation.Var;
import org.springblade.modules.common.request.GeoInfoRequest;
import org.springblade.modules.common.response.GeoInfoResponse;
public interface AMapClient {
@Get("{baseUrl}/geocode/geo")
GeoInfoResponse geoInfo(@Var("baseUrl") String baseUrl, @Query GeoInfoRequest request);
}

View File

@@ -1,16 +0,0 @@
package org.springblade.modules.common.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "amap")
public class AMapConfiguration {
private String key;
private String baseUrl;
}

View File

@@ -1,16 +0,0 @@
package org.springblade.modules.common.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "tianditumap")
public class TianDiTuConfiguration {
private String key;
private String baseUrl;
}

View File

@@ -1,18 +0,0 @@
package org.springblade.modules.common.request;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@Accessors(chain = true)
public class GeoInfoRequest implements Serializable {
private String key;
private String address;
private String output = "json";
}

View File

@@ -1,57 +0,0 @@
package org.springblade.modules.common.response;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
@Data
@Accessors(chain = true)
public class GeoInfoResponse implements Serializable {
private String status;
private String info;
@JSONField(name = "infocode")
private String infoCode;
private String count;
@JSONField(name = "geocodes")
private List<GeoInfo> geoInfos;
@Data
@Accessors(chain = true)
public static class GeoInfo implements Serializable{
@JSONField(name = "formatted_address")
private String formattedAddress;
private String country;
private String province;
private String city;
private String district;
private String street;
private String number;
private String location;
private String level;
@JSONField(name = "citycode")
private String cityCode;
@JSONField(name = "adcode")
private String adCode;
}
}

View File

@@ -1,10 +0,0 @@
package org.springblade.modules.common.service;
import org.springblade.modules.common.pojo.dto.LocationDTO;
public interface AMapService {
LocationDTO defaultLocation(String address);
}

View File

@@ -81,9 +81,6 @@ public interface ICommonUserOrderService extends IService<CommonUserOrderEntity>
CreateOrderResponse createTravelOrder(CreateTravelOrderRequest request);
PaymentResponse aliPay(PaymentRequest request);
PaymentResponse wxPay(PaymentRequest request);
IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder);

View File

@@ -1,39 +0,0 @@
package org.springblade.modules.common.service.impl;
import jakarta.annotation.Resource;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.modules.common.client.AMapClient;
import org.springblade.modules.common.config.AMapConfiguration;
import org.springblade.modules.common.pojo.dto.LocationDTO;
import org.springblade.modules.common.request.GeoInfoRequest;
import org.springblade.modules.common.response.GeoInfoResponse;
import org.springblade.modules.common.service.AMapService;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@AllArgsConstructor
public class AMapServiceImpl implements AMapService {
@Resource
private AMapClient client;
private final AMapConfiguration configuration;
@Override
public LocationDTO defaultLocation(String address) {
GeoInfoResponse geoInfoResponse = client.geoInfo(configuration.getBaseUrl(), new GeoInfoRequest().setKey(configuration.getKey()).setAddress(address));
log.info("地址解析结果:{}", geoInfoResponse);
if (geoInfoResponse.getStatus().equals("1")) {
GeoInfoResponse.GeoInfo geoInfo = geoInfoResponse.getGeoInfos().get(0);
String[] location = geoInfo.getLocation().split(StringPool.COMMA);
return new LocationDTO().setLongitude(Double.parseDouble(location[0])).setLatitude(Double.parseDouble(location[1]));
}
throw new ServiceException(String.valueOf(geoInfoResponse));
}
}

View File

@@ -61,9 +61,7 @@ import org.springblade.modules.mall.service.IMallProductService;
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
import org.springblade.modules.market.service.IMarketInfoService;
import org.springblade.modules.market.service.IMarketUserCommissionService;
import org.springblade.plugin.pay.api.PaymentFacade;
import org.springblade.plugin.pay.dto.APPPayDto;
import org.springblade.plugin.pay.response.APPPayResult;
import org.springblade.modules.api.service.PaymentFacade;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
@@ -94,10 +92,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
private final ITourOrderDetailService tourOrderDetailService;
private final IMarketUserCommissionService commissionService;
private final IMarketInfoService marketInfoService;
private final PaymentFacade paymentFacade;
private final ICommonOrderConfirmLogService orderConfirmLogService;
@@ -357,78 +352,8 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
return new CreateOrderResponse(String.valueOf(order.getId()), actualAmount, totalAmount, discount);
}
@Override
public PaymentResponse aliPay(PaymentRequest request) {
if (!request.getPaymentType().equals(PaymentType.ALI.getCode())){
throw new ServiceException("请选择正确的支付方式");
}
CommonUserOrderEntity order = getById(Long.valueOf(request.getOrderId()));
if (order == null) {
throw new ServiceException("无效订单");
}
if (order.getPaymentType().equals(PaymentType.OFFLINE.getCode())) {
throw new ServiceException("无效订单");
}
try {
APPPayResult appPayResult = paymentFacade.appPay(
new APPPayDto()
.setOrderId(Long.valueOf(request.getOrderId()))
.setPaymentType(PaymentType.fromCode(request.getPaymentType()))
.setBusinessModule(BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()))
.setAmount(order.getActualAmount())
.setBody(order.getItemName())
.setRemark(order.getItemName())
);
return new PaymentResponse()
.setPaymentType(appPayResult.getPaymentTypeEnum().getCode())
.setParams(appPayResult.getContent())
.setPayChannel(appPayResult.getPaymentTypeEnum().getName())
;
}catch (Exception e){
log.error("支付异常 : {}" , e.getMessage());
throw new RuntimeException(e.getMessage());
}
}
@Override
public PaymentResponse wxPay(PaymentRequest request) {
throw new ServiceException("当前微信支付未开放");
// if (!request.getPaymentType().equals(PaymentType.WECHAT.getCode())){
// throw new ServiceException("请选择正确的支付方式");
// }
//
// CommonUserOrderEntity order = getById(Long.valueOf(request.getOrderId()));
// if (order == null) {
// throw new ServiceException("无效订单");
// }
// if (order.getPaymentType().equals(PaymentType.OFFLINE.getCode())) {
// throw new ServiceException("无效订单");
// }
// try {
// APPPayResult appPayResult = paymentFacade.appPay(
// new APPPayDto()
// .setOrderId(Long.valueOf(request.getOrderId()))
// .setPaymentType(PaymentType.fromCode(request.getPaymentType()))
// .setBusinessModule(BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()))
// .setAmount(order.getActualAmount())
// .setBody(order.getItemName())
// .setRemark(order.getItemName())
// );
// return new PaymentResponse()
// .setPaymentType(appPayResult.getPaymentTypeEnum().getCode())
// .setParams(appPayResult.getContent())
// .setPayChannel(appPayResult.getPaymentTypeEnum().getName())
// ;
// }catch (Exception e){
// log.error("支付异常 : {}" , e.getMessage());
// throw new RuntimeException(e.getMessage());
// }
}
@Override
public IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder) {

View File

@@ -12,7 +12,6 @@ import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
import org.springblade.modules.common.pojo.entity.MerchantFlagshipStoreEntity;
import org.springblade.modules.common.pojo.vo.MerchantFlagshipStoreVO;
import org.springblade.modules.common.mapper.MerchantFlagshipStoreMapper;
import org.springblade.modules.common.service.AMapService;
import org.springblade.modules.common.service.ICommonRegionsInfoService;
import org.springblade.modules.common.service.IMerchantFlagshipStoreService;
import org.springblade.modules.common.service.TianDiTuMapService;
@@ -33,7 +32,6 @@ import java.util.List;
@AllArgsConstructor
public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFlagshipStoreMapper, MerchantFlagshipStoreEntity> implements IMerchantFlagshipStoreService {
private final AMapService mapService;
private final ICommonRegionsInfoService commonRegionsInfoService;
private final TianDiTuMapService tianDiTuMapService;
@@ -52,7 +50,6 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
if (regionsInfo == null){
throw new ServiceException("请选择正确的地址");
}
// LocationDTO locationDTO = mapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
LocationDTO locationDTO = tianDiTuMapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
@@ -86,7 +83,6 @@ public class MerchantFlagshipStoreServiceImpl extends BaseServiceImpl<MerchantFl
throw new ServiceException("请选择正确的地址");
}
// LocationDTO locationDTO = mapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
LocationDTO locationDTO = tianDiTuMapService.defaultLocation(regionsInfo.getFullName() + storeVO.getAddressDetail());
MerchantFlagshipStoreEntity store = new MerchantFlagshipStoreEntity();

View File

@@ -5,7 +5,6 @@ import com.alibaba.fastjson2.JSONObject;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.modules.common.config.TianDiTuConfiguration;
import org.springblade.modules.common.pojo.dto.LocationDTO;
import org.springblade.modules.common.response.TianDiTuGeoResponse;
import org.springblade.modules.common.service.TianDiTuMapService;
@@ -20,7 +19,8 @@ import java.util.HashMap;
public class TianDiTuMapServiceImpl implements TianDiTuMapService {
private final TianDiTuConfiguration configuration;
private final String key = "481fce07effc76be3bcf1dd7a5869f84";
private static String ADDRESS_TEMPLATE = """
{"keyWord":"%s"}
@@ -31,9 +31,9 @@ public class TianDiTuMapServiceImpl implements TianDiTuMapService {
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("ds", ADDRESS_TEMPLATE.formatted(address));
paramMap.put("tk", configuration.getKey());
paramMap.put("tk", key);
String result = HttpUtil.get(configuration.getBaseUrl() + "/geocoder", paramMap);
String result = HttpUtil.get( "https://api.tianditu.gov.cn/geocoder", paramMap);
TianDiTuGeoResponse response = JSONObject.parseObject(result, TianDiTuGeoResponse.class);
if (response.getStatus().equals("0")) {
TianDiTuGeoResponse.LocationInfo locationInfo = response.getLocation();

View File

@@ -1,11 +0,0 @@
package org.springblade.plugin.pay.api;
import org.springblade.plugin.pay.dto.APPPayDto;
import org.springblade.plugin.pay.response.APPPayResult;
public interface PaymentFacade {
APPPayResult appPay(APPPayDto dto) throws Exception;
}

View File

@@ -1,83 +0,0 @@
package org.springblade.plugin.pay.api.impl;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.modules.common.eums.BusinessModule;
import org.springblade.modules.common.eums.PaymentType;
import org.springblade.plugin.pay.api.PaymentFacade;
import org.springblade.plugin.pay.config.AliPayConfiguration;
import org.springblade.plugin.pay.config.WxPayConfiguration;
import org.springblade.plugin.pay.dto.APPPayDto;
import org.springblade.plugin.pay.response.APPPayResult;
import org.springblade.plugin.pay.service.IAliPayService;
import org.springblade.plugin.pay.service.IWxPayService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
@Slf4j
@Service
@AllArgsConstructor
public class PaymentFacadeImpl implements PaymentFacade {
private final IAliPayService aliPayService;
private final AliPayConfiguration aliPayConfig;
private final IWxPayService wxPayService;
private final WxPayConfiguration wxPayConfig;
@Override
@Transactional(rollbackFor = Exception.class)
public APPPayResult appPay(APPPayDto dto) {
PaymentType paymentType = dto.getPaymentType();
BusinessModule businessModule = dto.getBusinessModule();
APPPayResult result = new APPPayResult();
String content = "success";
switch (paymentType) {
case ALI:
content = aliPayService.appPay(
aliPayConfig.getAppId(),
aliPayConfig.getMachId(),
dto.getBody(),
String.valueOf(dto.getAmount()),
aliPayConfig.getNotifyUrl(),
dto.getRemark(),
paymentType.getAbbr() + businessModule.getAbbr(),
dto.getOrderId()
);
break;
case WECHAT:
Map<String, String> stringStringMap = wxPayService.appPay(
wxPayConfig.getAppId(),
wxPayConfig.getMachId(),
dto.getBody(),
String.valueOf(dto.getAmount()),
wxPayConfig.getNotifyUrl(),
dto.getRemark(),
paymentType.getAbbr() + businessModule.getAbbr(),
dto.getOrderId()
);
log.info("微信APP支付结果:{}", stringStringMap);
//todo 微信app支付结果处理
break;
default:
throw new RuntimeException("支付类型错误");
}
return result
.setSuccess(Boolean.TRUE)
.setContent(content)
.setPaymentTypeEnum(paymentType);
}
}

View File

@@ -1,18 +0,0 @@
package org.springblade.plugin.pay.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "alipay")
public class AliPayConfiguration {
private String appId;
private String machId;
private String aesKey;
private String notifyUrl;
}

View File

@@ -1,16 +0,0 @@
package org.springblade.plugin.pay.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "wechatpay")
public class WxPayConfiguration {
private String appId;
private String machId;
private String notifyUrl;
}

View File

@@ -1,21 +0,0 @@
package org.springblade.plugin.pay.response;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.modules.common.eums.PaymentType;
import java.io.Serializable;
@Data
@Accessors(chain = true)
public class APPPayResult implements Serializable {
private Boolean success = false;
private String content = StringPool.EMPTY;
PaymentType paymentTypeEnum;
}

View File

@@ -5,9 +5,10 @@ import com.alipay.api.*;
import com.alipay.api.request.AlipayTradeAppPayRequest;
import lombok.AllArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springblade.common.cache.ParamCache;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.modules.api.constant.AppAliPayConstant;
import org.springblade.plugin.pay.common.AliPayException;
import org.springblade.plugin.pay.config.AliPayConfiguration;
import org.springblade.plugin.pay.entity.AliPayAccountConfig;
import org.springframework.stereotype.Component;
@@ -23,7 +24,6 @@ public class AliPayHttpUtil {
private static final String JSON = "json";
private static final String CHARSETUTF8 = "UTF-8";
private final AliPayConfiguration aliPayConfiguration;
/**
* 发送POST请求
@@ -170,7 +170,7 @@ public class AliPayHttpUtil {
String pubKey = aliPayAccountConfig.getPubKey();
String signType = aliPayAccountConfig.getSignType();
aliPayClient = new DefaultAlipayClient(serviceUrl, appId, privateKey, JSON, CHARSETUTF8, pubKey, signType);
((DefaultAlipayClient)aliPayClient).setEncryptKey(aliPayConfiguration.getAesKey());
((DefaultAlipayClient)aliPayClient).setEncryptKey(ParamCache.getValue(AppAliPayConstant.APP_ALI_AES_KEY));
} catch (Exception e) {
e.printStackTrace();

View File

@@ -163,7 +163,7 @@ powerjob:
port: 27777
# server-address: 192.168.31.132:7700
server-address: 172.24.19.16:7700
# server-address: 192.168.1.3:7700
# server-address: 192.168.1.4:7700
#blade配置
blade:
@@ -257,7 +257,6 @@ blade:
- /app-tour/product-list
- /app-tour/product-top-list
- /blade-pay/callback/**
- /api/alipay/**
#授权认证配置
auth:
@@ -332,23 +331,5 @@ forest:
max-retry-interval: 1000 # 为最大重试时间间隔, 单位为毫秒
log-response-content: true
amap:
baseUrl: https://restapi.amap.com/v3
key: f33d1181359ec73e9f1e8ee7b8cef2a2
tianditumap:
baseUrl: http://api.tianditu.gov.cn
key: 481fce07effc76be3bcf1dd7a5869f84
alipay:
machId: 2088380917299813
appId: 2021006137661681
aesKey: VS14+f0md0HjJ1D0Wp3Lgw==
# notifyUrl: http://3230y29s53.wicp.vip/blade-pay/callback/alipay
returnUrl: https://app.yicha1lu.com/api/callback/alipay
wechatpay:
machId: 2088721098867961
appId: 9021000162633022
notifyUrl: https://3230qu2bo953.vicp.fun/blade-pay/callback/alipay