fix:登录相关逻辑修复
This commit is contained in:
+5
-5
@@ -6,7 +6,7 @@ import com.central.common.model.Result;
|
||||
import com.central.user.service.PrivateKeyService;
|
||||
import com.central.user.service.WechatConfigService;
|
||||
import com.central.user.service.WechatPayService;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import com.central.wechat.wechat.entity.WechatConfig;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
@@ -48,14 +48,14 @@ public class SysWechatConfigController {
|
||||
|
||||
@Operation(summary = "获取微信配置")
|
||||
@GetMapping("/{type}")
|
||||
public Result<WechatConfig> getConfig(@PathVariable String type) {
|
||||
return Result.succeed(wechatConfigService.getConfig(type, TenantContextHolder.getTenant()));
|
||||
public WechatConfig getConfig(@PathVariable String type) {
|
||||
return wechatConfigService.getConfig(type, TenantContextHolder.getTenant());
|
||||
}
|
||||
|
||||
@Operation(summary = "获取微信配置")
|
||||
@GetMapping("/app/{id}")
|
||||
public Result<WechatConfig> getConfigByAppId(@PathVariable String appId) {
|
||||
return Result.succeed(wechatConfigService.getConfig(appId));
|
||||
public WechatConfig getConfigByAppId(@PathVariable("id") String appId) {
|
||||
return wechatConfigService.getConfig(appId);
|
||||
}
|
||||
|
||||
@Operation(summary = "保存微信配置")
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.central.user.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import com.central.wechat.wechat.entity.WechatConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.central.user.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import com.central.wechat.wechat.entity.WechatConfig;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.user.mapper.WechatConfigMapper;
|
||||
import com.central.user.service.WechatConfigService;
|
||||
import com.zlt.wechat.entity.WechatConfig;
|
||||
import com.central.wechat.wechat.entity.WechatConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
|
||||
+153
-129
@@ -1,130 +1,154 @@
|
||||
package com.central.user.service.impl;//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;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
import com.central.user.service.WechatPayService;
|
||||
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 org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class WechatPayServiceImpl implements WechatPayService {
|
||||
@Override
|
||||
public PrepayWithRequestPaymentResponse createJsapiOrder(String tenantId, String openId, int amount, String description, String outTradeNo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction queryOrder(String tenantId, String outTradeNo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeOrder(String tenantId, String outTradeNo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Refund queryRefund(String tenantId, String outRefundNo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RefundNotification parseRefundNotify(String tenantId, String notifyData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean uploadPrivateKey(String tenantId, String privateKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updatePayConfig(String tenantId, Map<String, String> config) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*@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;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user