feat:钱包接口对接

This commit is contained in:
苏竹红
2025-11-15 15:11:14 +08:00
parent 7d810b2a0d
commit 0646022baf
20 changed files with 530 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
package com.cool.store.http;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.utils.RsaSignUtil;
@@ -14,6 +15,7 @@ import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@@ -167,16 +169,11 @@ public class WalletHttpClientRest {
*/
@SuppressWarnings("unchecked")
private <T> T parseResponse(String responseJson, Class<T> responseType) throws Exception {
if (responseType == String.class) {
return (T) responseJson;
}
// 解析为通用响应格式
Map<String, Object> responseMap = objectMapper.readValue(responseJson,
new TypeReference<Map<String, Object>>() {});
// 如果返回类型是Map直接返回
if (responseType == Map.class) {
return (T) responseMap;
@@ -185,6 +182,10 @@ public class WalletHttpClientRest {
// 提取data字段
Object data = responseMap.get("data");
if (data != null && responseType != Object.class) {
if (data instanceof List) {
// 保持List结构让调用方处理具体类型转换
return (T)JSONObject.toJSONString(data);
}
return objectMapper.convertValue(data, responseType);
}

View File

@@ -1,11 +1,14 @@
package com.cool.store.service.wallet;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.wallet.*;
import com.cool.store.http.WalletHttpClientRest;
import com.cool.store.request.wallet.*;
import com.cool.store.utils.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
@@ -77,8 +80,12 @@ public class WalletApiService {
* @param request
* @return
*/
public AccountInfoDTO getAccountInfo(OutStoreIdRequest request){
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/account/v1/getAccountInfo", request, AccountInfoDTO.class);
public List<AccountInfoDTO> getAccountInfo(OutStoreIdRequest request){
String accountInfoStr = walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/account/v1/queryAccountInfo", request, String.class);
if (StringUtil.isNotEmpty(accountInfoStr)){
return JSONObject.parseArray(accountInfoStr, AccountInfoDTO.class);
}
return null;
}
/**
@@ -87,7 +94,7 @@ public class WalletApiService {
* @return
*/
public LargePaymentDTO largePayment(LargePaymentRequest request){
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/payment/v1/largePayment", request, LargePaymentDTO.class);
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/trans/v1/largePayment", request, LargePaymentDTO.class);
}
/**
@@ -99,6 +106,52 @@ public class WalletApiService {
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/trans/v1/largePaymentQuery", request, PaymentDTO.class);
}
/**
* 门店账户向公司分账转账接口
* @param request
* @return
*/
public TransferDTO transfer(TransferRequest request){
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/trans/v1/transfer", request, TransferDTO.class);
}
/**
* 门店签约账户,退款提现至提现卡
* @param request
* @return
*/
public WithDrawerDTO withdraw(WithDrawerRequest request){
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/trans/v1/withdraw", request, WithDrawerDTO.class);
}
/**
* 账单详情
* @param request
* @return
*/
public BillDetailDTO getBillDetail(BillDetailRequest request){
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/trans/v1/billDetail", request, BillDetailDTO.class);
}
/**
* 获取门店账户流水
* @param request
* @return
*/
public BillPageDTO getBillPage(BillPageRequest request){
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/trans/v1/billPage", request, BillPageDTO.class);
}
/**
* 获取门店账户信息
* @param request
* @return
*/
public CompanyListDTO getCompanyInfo(FindPageCompanyRequest request){
return walletHttpClientRest.postWithSign("https://api.dev.wenmatech.com:443/open/crm/base/v1/findPageCompany", request, CompanyListDTO.class);
}
/**
* 获取支行信息
* @param request