feat:新增配置类,实现动态配置管理,自动化注入配置功能
This commit is contained in:
+2
-1
@@ -22,6 +22,7 @@
|
||||
<module>zlt-elasticsearch-spring-boot-starter</module>
|
||||
<module>zlt-oss-spring-boot-starter</module>
|
||||
<module>zlt-zookeeper-spring-boot-starter</module>
|
||||
<!--<module>zlt-iot-spring-boot-starter</module>-->
|
||||
<module>zlt-wechat-common-core</module>
|
||||
<module>zlt-wechat-spring-boot-starter</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.zlt.wechat.feign;
|
||||
|
||||
import com.central.common.constant.ServiceNameConstants;
|
||||
import com.zlt.wechat.feign.fallback.PrivateKeyServiceFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
*/
|
||||
@FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = PrivateKeyServiceFallbackFactory.class, dismiss404 = true)
|
||||
public interface PrivateKeyService {
|
||||
/**
|
||||
* feign rpc访问远程/wechat/config/{type}接口
|
||||
* 查询微信配置对象WechatConfig
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/wechat/config/{type}")
|
||||
String getPrivateKey(@PathVariable("type") String type, @RequestParam("tenantId") String tenantId);
|
||||
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.zlt.wechat.feign;
|
||||
|
||||
import com.central.common.constant.ServiceNameConstants;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import com.zlt.wechat.feign.fallback.WechatConfigServiceFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
*/
|
||||
@FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = WechatConfigServiceFallbackFactory.class, dismiss404 = true)
|
||||
public interface WechatConfigService {
|
||||
/**
|
||||
* feign rpc访问远程/wechat/config/{type}接口
|
||||
* 查询微信配置对象WechatConfig
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/wechat/config/{type}")
|
||||
WechatConfig getConfig(@PathVariable("type") String type,String tenantId);
|
||||
|
||||
@GetMapping(value = "/app/{id}")
|
||||
WechatConfig getConfig(String appId);
|
||||
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.zlt.wechat.feign.fallback;
|
||||
|
||||
import com.zlt.wechat.feign.PrivateKeyService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
* userService降级工场
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/1/18
|
||||
*/
|
||||
@Slf4j
|
||||
public class PrivateKeyServiceFallbackFactory implements FallbackFactory<PrivateKeyService> {
|
||||
@Override
|
||||
public PrivateKeyService create(Throwable throwable) {
|
||||
return new PrivateKeyService() {
|
||||
@Override
|
||||
public String getPrivateKey(String tenantId,String type) {
|
||||
|
||||
return "";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.zlt.wechat.feign.fallback;
|
||||
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import com.zlt.wechat.feign.WechatConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
/**
|
||||
* userService降级工场
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/1/18
|
||||
*/
|
||||
@Slf4j
|
||||
public class WechatConfigServiceFallbackFactory implements FallbackFactory<WechatConfigService> {
|
||||
@Override
|
||||
public WechatConfigService create(Throwable throwable) {
|
||||
return new WechatConfigService() {
|
||||
@Override
|
||||
public WechatConfig getConfig(String type,String tenantId) {
|
||||
|
||||
return new WechatConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WechatConfig getConfig(String appId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package com.zlt.wechat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface WechatConfigMapper extends BaseMapper<WechatConfig> {
|
||||
|
||||
@Select("<script>" +
|
||||
"SELECT * FROM wechat_config " +
|
||||
"<where>" +
|
||||
" <if test='p.type != null and p.type != \"\"'>" +
|
||||
" AND type = #{p.type}" +
|
||||
" </if>" +
|
||||
" <if test='p.merchantId != null and p.merchantId != \"\"'>" +
|
||||
" AND merchant_id = #{p.merchantId}" +
|
||||
" </if>" +
|
||||
" <if test='p.status != null'>" +
|
||||
" AND status = #{p.status}" +
|
||||
" </if>" +
|
||||
" <if test='p.tenantId != null and p.tenantId != \"\"'>" +
|
||||
" AND tenant_id = #{p.tenantId}" +
|
||||
" </if>" +
|
||||
"</where>" +
|
||||
"ORDER BY create_time DESC" +
|
||||
"</script>")
|
||||
List<WechatConfig> findList(Page<WechatConfig> page, @Param("p") Map<String, Object> params);
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package com.zlt.wechat.service;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 私钥文件管理服务
|
||||
*/
|
||||
public interface PrivateKeyService {
|
||||
|
||||
/**
|
||||
* 上传私钥文件
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param type 配置类型
|
||||
* @param inputStream 文件输入流
|
||||
* @return 文件访问路径
|
||||
*/
|
||||
String uploadPrivateKey(String tenantId, String type, InputStream inputStream);
|
||||
|
||||
/**
|
||||
* 获取私钥文件
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param type 配置类型
|
||||
* @return 私钥文件内容
|
||||
*/
|
||||
String getPrivateKey(String tenantId, String type);
|
||||
|
||||
/**
|
||||
* 删除私钥文件
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param type 配置类型
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deletePrivateKey(String tenantId, String type);
|
||||
}
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
package com.zlt.wechat.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface WechatConfigService extends IService<WechatConfig> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
PageResult<WechatConfig> findList(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取微信配置
|
||||
*
|
||||
* @param type 配置类型
|
||||
* @param tenantId 商户ID
|
||||
* @return 微信配置
|
||||
*/
|
||||
WechatConfig getConfig(String type, String tenantId);
|
||||
|
||||
/**
|
||||
* 获取微信配置
|
||||
*
|
||||
* @param appId 商户ID
|
||||
* @return 微信配置
|
||||
*/
|
||||
WechatConfig getConfig(String appId);
|
||||
|
||||
/**
|
||||
* 保存微信配置
|
||||
*
|
||||
* @param config 微信配置
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean saveConfig(WechatConfig config);
|
||||
|
||||
/**
|
||||
* 更新微信配置
|
||||
*
|
||||
* @param config 微信配置
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updateConfig(WechatConfig config);
|
||||
|
||||
/**
|
||||
* 删除微信配置
|
||||
*
|
||||
* @param id 配置ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteConfig(Long id);
|
||||
|
||||
/**
|
||||
* 切换当前使用的微信配置
|
||||
*
|
||||
* @param type 配置类型
|
||||
* @param merchantId 商户ID
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean switchConfig(String type, String merchantId);
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
package com.zlt.wechat.service;
|
||||
|
||||
import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
import com.wechat.pay.java.service.refund.model.Refund;
|
||||
import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信支付服务
|
||||
*/
|
||||
public interface WechatPayService {
|
||||
|
||||
/**
|
||||
* 创建JSAPI支付订单
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param openId 用户openId
|
||||
* @param amount 支付金额(分)
|
||||
* @param description 商品描述
|
||||
* @param outTradeNo 商户订单号
|
||||
* @return 支付参数
|
||||
*/
|
||||
PrepayWithRequestPaymentResponse createJsapiOrder(String tenantId, String openId, int amount,
|
||||
String description, String outTradeNo);
|
||||
|
||||
/**
|
||||
* 查询订单
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param outTradeNo 商户订单号
|
||||
* @return 订单信息
|
||||
*/
|
||||
Transaction queryOrder(String tenantId, String outTradeNo);
|
||||
|
||||
/**
|
||||
* 关闭订单
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param outTradeNo 商户订单号
|
||||
*/
|
||||
void closeOrder(String tenantId, String outTradeNo);
|
||||
|
||||
/**
|
||||
* 申请退款
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param outTradeNo 商户订单号
|
||||
* @param outRefundNo 商户退款单号
|
||||
* @param amount 退款金额(分)
|
||||
* @param reason 退款原因
|
||||
* @return 退款结果
|
||||
*/
|
||||
// RefundResponse refund(String tenantId, String outTradeNo, String outRefundNo,
|
||||
// int amount, String reason);
|
||||
|
||||
/**
|
||||
* 查询退款
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param outRefundNo 商户退款单号
|
||||
* @return 退款信息
|
||||
*/
|
||||
Refund queryRefund(String tenantId, String outRefundNo);
|
||||
|
||||
/**
|
||||
* 解析退款通知
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param notifyData 通知数据
|
||||
* @return 退款通知信息
|
||||
*/
|
||||
RefundNotification parseRefundNotify(String tenantId, String notifyData);
|
||||
|
||||
/**
|
||||
* 上传私钥文件
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param privateKey 私钥内容
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean uploadPrivateKey(String tenantId, String privateKey);
|
||||
|
||||
/**
|
||||
* 更新支付配置
|
||||
*
|
||||
* @param tenantId 租户ID
|
||||
* @param config 配置信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean updatePayConfig(String tenantId, Map<String, String> config);
|
||||
}
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
package com.zlt.wechat.service.impl;
|
||||
|
||||
import com.zlt.wechat.service.PrivateKeyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class PrivateKeyServiceImpl implements PrivateKeyService {
|
||||
|
||||
private static final String CACHE_KEY_PATTERN = "wechat:private_key:%s:%s";
|
||||
private static final long CACHE_EXPIRE_DAYS = 30;
|
||||
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
public String uploadPrivateKey(String tenantId, String type, InputStream inputStream) {
|
||||
try {
|
||||
// 读取私钥内容
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
StringBuilder content = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
content.append(line).append("\n");
|
||||
}
|
||||
|
||||
// 缓存私钥内容
|
||||
String cacheKey = String.format(CACHE_KEY_PATTERN, tenantId, type);
|
||||
redisTemplate.opsForValue().set(cacheKey, content.toString(), CACHE_EXPIRE_DAYS, TimeUnit.DAYS);
|
||||
|
||||
return cacheKey;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("上传私钥文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrivateKey(String tenantId, String type) {
|
||||
String cacheKey = String.format(CACHE_KEY_PATTERN, tenantId, type);
|
||||
String privateKey = redisTemplate.opsForValue().get(cacheKey);
|
||||
|
||||
if (!StringUtils.hasText(privateKey)) {
|
||||
throw new RuntimeException("私钥文件不存在");
|
||||
}
|
||||
|
||||
return privateKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deletePrivateKey(String tenantId, String type) {
|
||||
String cacheKey = String.format(CACHE_KEY_PATTERN, tenantId, type);
|
||||
return redisTemplate.delete(cacheKey);
|
||||
}
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
package com.zlt.wechat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import com.zlt.wechat.mapper.WechatConfigMapper;
|
||||
import com.zlt.wechat.service.WechatConfigService;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class WechatConfigServiceImpl extends ServiceImpl<WechatConfigMapper, WechatConfig> implements WechatConfigService {
|
||||
|
||||
private static final String CACHE_NAME = "wechat:config";
|
||||
private static final String CACHE_KEY_PATTERN = "#type + ':' + #tenantId";
|
||||
|
||||
@Override
|
||||
public PageResult<WechatConfig> findList(Map<String, Object> params) {
|
||||
Page<WechatConfig> page = new Page<>(MapUtils.getInteger(params, "page", 1), MapUtils.getInteger(params, "limit", 10));
|
||||
List<WechatConfig> list = baseMapper.findList(page, params);
|
||||
return PageResult.<WechatConfig>builder().data(list).resp_code(0).count(page.getTotal()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CACHE_NAME, key = CACHE_KEY_PATTERN, unless = "#result == null")
|
||||
public WechatConfig getConfig(String type, String tenantId) {
|
||||
return getOne(new LambdaQueryWrapper<WechatConfig>()
|
||||
.eq(WechatConfig::getType, type)
|
||||
.eq(WechatConfig::getTenantId, tenantId)
|
||||
.eq(WechatConfig::getStatus, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public WechatConfig getConfig(String appId) {
|
||||
return getOne(new LambdaQueryWrapper<WechatConfig>()
|
||||
.eq(WechatConfig::getAppId, appId)
|
||||
.eq(WechatConfig::getStatus, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = CACHE_NAME, key = CACHE_KEY_PATTERN)
|
||||
public boolean saveConfig(WechatConfig config) {
|
||||
return save(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = CACHE_NAME, key = CACHE_KEY_PATTERN)
|
||||
public boolean updateConfig(WechatConfig config) {
|
||||
return updateById(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = CACHE_NAME, allEntries = true)
|
||||
public boolean deleteConfig(Long id) {
|
||||
return removeById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = CACHE_NAME, key = CACHE_KEY_PATTERN)
|
||||
public boolean switchConfig(String type, String tenantId) {
|
||||
// 这里可以添加切换配置的具体逻辑
|
||||
return true;
|
||||
}
|
||||
}
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
//package com.zlt.wechat.service.impl;
|
||||
//
|
||||
//import com.wechat.pay.java.core.Config;
|
||||
//import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||
//import com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse;
|
||||
//import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
//import com.wechat.pay.java.service.refund.RefundService;
|
||||
//import com.wechat.pay.java.service.refund.model.Refund;
|
||||
//import com.wechat.pay.java.service.refund.model.RefundNotification;
|
||||
//import com.wechat.pay.java.service.refund.model.RefundRequest;
|
||||
//import com.wechat.pay.java.service.refund.model.RefundResponse;
|
||||
//import com.zlt.wechat.entity.WechatConfig;
|
||||
//import com.zlt.wechat.service.PrivateKeyService;
|
||||
//import com.zlt.wechat.service.WechatConfigService;
|
||||
//import com.zlt.wechat.service.WechatPayService;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import java.io.ByteArrayInputStream;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//@Service
|
||||
//public class WechatPayServiceImpl implements WechatPayService {
|
||||
//
|
||||
// @Autowired
|
||||
// private WechatConfigService configService;
|
||||
//
|
||||
// @Autowired
|
||||
// private PrivateKeyService privateKeyService;
|
||||
//
|
||||
// @Autowired
|
||||
// private JsapiServiceExtension jsapiService;
|
||||
//
|
||||
// @Autowired
|
||||
// private RefundService refundService;
|
||||
//
|
||||
// @Autowired
|
||||
// private Config wxPayConfig;
|
||||
//
|
||||
// @Override
|
||||
// public PrepayWithRequestPaymentResponse createJsapiOrder(String tenantId, String openId,
|
||||
// int amount, String description, String outTradeNo) {
|
||||
// // 切换租户配置
|
||||
// configService.switchConfig("PAY", tenantId);
|
||||
//
|
||||
// // 创建支付订单
|
||||
// /*return jsapiService.prepayWithRequestPayment(
|
||||
// openId,
|
||||
// description,
|
||||
// outTradeNo,
|
||||
// amount,
|
||||
// "CNY"
|
||||
// );*/
|
||||
// return new PrepayWithRequestPaymentResponse();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Transaction queryOrder(String tenantId, String outTradeNo) {
|
||||
// configService.switchConfig("PAY", tenantId);
|
||||
// return jsapiService.queryOrderByOutTradeNo(outTradeNo);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void closeOrder(String tenantId, String outTradeNo) {
|
||||
// configService.switchConfig("PAY", tenantId);
|
||||
// jsapiService.closeOrder(outTradeNo);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public RefundResponse refund(String tenantId, String outTradeNo, String outRefundNo,
|
||||
// int amount, String reason) {
|
||||
// configService.switchConfig("PAY", tenantId);
|
||||
//
|
||||
// RefundRequest request = new RefundRequest();
|
||||
// request.setOutTradeNo(outTradeNo);
|
||||
// request.setOutRefundNo(outRefundNo);
|
||||
// request.setAmount(new RefundRequest.Amount(amount, "CNY"));
|
||||
// request.setReason(reason);
|
||||
//
|
||||
// return refundService.refund(request);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Refund queryRefund(String tenantId, String outRefundNo) {
|
||||
// configService.switchConfig("PAY", tenantId);
|
||||
// return refundService.queryByOutRefundNo(outRefundNo);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public RefundNotification parseRefundNotify(String tenantId, String notifyData) {
|
||||
// configService.switchConfig("PAY", tenantId);
|
||||
// return refundService.parseRefundNotification(notifyData);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean uploadPrivateKey(String tenantId, String privateKey) {
|
||||
// try {
|
||||
// privateKeyService.uploadPrivateKey(tenantId, "PAY",
|
||||
// new ByteArrayInputStream(privateKey.getBytes()));
|
||||
// return true;
|
||||
// } catch (Exception e) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean updatePayConfig(String tenantId, Map<String, String> config) {
|
||||
// try {
|
||||
// WechatConfig wechatConfig = configService.getConfig("PAY", tenantId);
|
||||
// if (wechatConfig == null) {
|
||||
// wechatConfig = new WechatConfig();
|
||||
// wechatConfig.setType("PAY");
|
||||
// wechatConfig.setTenantId(tenantId);
|
||||
// }
|
||||
//
|
||||
// // 更新配置信息
|
||||
// wechatConfig.setMerchantId(config.get("merchantId"));
|
||||
// wechatConfig.setAppId(config.get("appId"));
|
||||
// wechatConfig.setMchKey(config.get("mchKey"));
|
||||
// wechatConfig.setMchSerialNo(config.get("mchSerialNo"));
|
||||
// wechatConfig.setApiV3Key(config.get("apiV3Key"));
|
||||
// wechatConfig.setNotifyUrl(config.get("notifyUrl"));
|
||||
// wechatConfig.setStatus(1);
|
||||
//
|
||||
// return configService.saveOrUpdate(wechatConfig);
|
||||
// } catch (Exception e) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
com.zlt.wechat.feign.fallback.PrivateKeyServiceFallbackFactory
|
||||
com.zlt.wechat.feign.fallback.WechatConfigServiceFallbackFactory
|
||||
|
||||
|
||||
+2
-3
@@ -13,8 +13,8 @@ import com.wechat.pay.java.service.payments.jsapi.model.SettleInfo;
|
||||
import com.wechat.pay.java.service.profitsharing.ProfitsharingService;
|
||||
import com.wechat.pay.java.service.refund.RefundService;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import com.zlt.wechat.service.WechatConfigService;
|
||||
import com.zlt.wechat.service.PrivateKeyService;
|
||||
import com.zlt.wechat.feign.PrivateKeyService;
|
||||
import com.zlt.wechat.feign.WechatConfigService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
||||
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
|
||||
@@ -161,7 +161,6 @@ public class WechatAutoConfiguration {
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前商户ID
|
||||
* 这里需要根据实际业务场景实现,可以从ThreadLocal、请求上下文等获取
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.zlt.wechat.config.WechatAutoConfiguration
|
||||
com.zlt.wechat.config.WechatAutoConfiguration
|
||||
|
||||
Reference in New Issue
Block a user