fix(finance): expose sample recharge QR in dev

This commit is contained in:
2026-09-05 08:56:02 +08:00
parent cf955477d8
commit 3df6fb511f
4 changed files with 31 additions and 6 deletions
@@ -55,14 +55,22 @@ public class FinanceWalletService {
FinanceDocumentNumberGenerator numberGenerator,
@Value("${baiyue.security.internal-service-token:}") String internalToken,
@Value("${baiyue.finance.recharge.wechat-qr-code-url:}") String wechatQrCodeUrl,
@Value("${baiyue.finance.recharge.alipay-qr-code-url:}") String alipayQrCodeUrl) {
@Value("${baiyue.finance.recharge.alipay-qr-code-url:}") String alipayQrCodeUrl,
@Value("${spring.profiles.active:}") String activeProfiles) {
this.jdbc = jdbc;
this.objectMapper = objectMapper;
this.fileClient = fileClient;
this.numberGenerator = numberGenerator;
this.internalToken = internalToken;
this.wechatQrCodeUrl = blankToNull(wechatQrCodeUrl);
this.alipayQrCodeUrl = blankToNull(alipayQrCodeUrl);
boolean development = List.of(activeProfiles.split(",")).stream()
.map(String::trim).anyMatch("dev"::equalsIgnoreCase);
this.wechatQrCodeUrl = rechargeQrCode(wechatQrCodeUrl, development);
this.alipayQrCodeUrl = rechargeQrCode(alipayQrCodeUrl, development);
}
private static String rechargeQrCode(String configured, boolean development) {
String value = blankToNull(configured);
return value == null && development ? "/customer-recharge-qr.svg" : value;
}
public WalletAccount account(long customerId) {