Merge #68 into master from cc_20260313_ws_wallet

网商钱包分账对接

* cc_20260313_ws_wallet: (9 commits squashed)

  - fix:新店开通网商钱包

  - fix:网商钱包开通回调修改

  - fix

  - fix

  - fix:关闭网商开通回调接口验签

  - Merge branch 'master' into cc_20260313_ws_wallet
    
    # Conflicts:
    #	coolstore-partner-service/src/main/java/com/cool/store/service/wallet/WalletService.java
    #	coolstore-partner-service/src/main/java/com/cool/store/service/wallet/impl/WalletServiceImpl.java
    #	coolstore-partner-web/src/main/java/com/cool/store/controller/webc/MiniWalletController.java

  - fix:钱包批量转账新增钱包类型字段

  - fix:网商钱包分账对接

  - fix

Signed-off-by: 王非凡 <accounts_67eba0c5fee9c49c80c8e2b4@mail.teambition.com>
Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com>

CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/68
This commit is contained in:
王非凡
2026-03-23 09:00:24 +00:00
committed by 正新
parent 3b1e6f6cb9
commit 728bd0f8ef
20 changed files with 218 additions and 14 deletions

View File

@@ -25,6 +25,12 @@ public interface WalletPayInfoService {
*/
Boolean pay(WalletPayRequest request, String oldPayNo);
/**
* 查询并更新批量支付结果
* @param batchCode 批次编号
*/
void queryAndUpdateBatchTransferStatus(String batchCode);
/**
* 重新支付
* @param request 钱包重新支付Request

View File

@@ -15,6 +15,7 @@ import com.cool.store.dao.fees.WalletPayInfoDAO;
import com.cool.store.dao.wallet.WalletTradeDAO;
import com.cool.store.dto.wallet.AccountInfoDTO;
import com.cool.store.dto.wallet.BatchTransferDTO;
import com.cool.store.request.wallet.BatchTransferQueryRequest;
import com.cool.store.request.wallet.BatchTransferRequest;
import com.cool.store.dto.wallet.TransferDTO;
import com.cool.store.entity.FranchiseFeeDO;
@@ -123,7 +124,7 @@ public class WalletPayInfoServiceImpl implements WalletPayInfoService {
assert feeItem != null;
return new BatchTransferRequest.TransDataRequest(payNo, feeItem.getFeeItemId(), shopAllocationInfoDO.getPayeeCode(), null, payAmount.toString(), feeItem.getDesc());
});
BatchTransferRequest transRequest = new BatchTransferRequest(shopInfo.getStoreId(), request.getPayPwd(), transDataList);
BatchTransferRequest transRequest = new BatchTransferRequest(2, shopInfo.getStoreId(), request.getPayPwd(), transDataList);
BatchTransferDTO batchTransferDTO = walletApiService.batchTransfer(transRequest);
if (CollectionUtils.isEmpty(batchTransferDTO.getTransArray())) {
throw new ServiceException(ErrorCodeEnum.WALLET_TRANS_FAIL);
@@ -134,7 +135,8 @@ public class WalletPayInfoServiceImpl implements WalletPayInfoService {
WalletPayInfoDO walletPayInfoDO = new WalletPayInfoDO(
WalletTradeModuleEnum.FRANCHISE_PAY.getModule(), request.getShopId(), transResult.getReqNo(), user.getUsername(), new BigDecimal(transResult.getAmount()), feeItemEnum.getExpenseType(), user.getPartnerId(), String.valueOf(transResult.getTradeId())
);
// 这里只返回成功或失败
walletPayInfoDO.setBatchCode(batchTransferDTO.getBatchCode());
// 平安这里只返回成功或失败,网商只返回处理中
walletPayInfoDO.setPayStatus(batchTransferDTO.getTradeStatus());
if (StringUtils.isNotBlank(oldPayNo)) {
walletRePayInfoList.add(walletPayInfoDO);
@@ -179,6 +181,35 @@ public class WalletPayInfoServiceImpl implements WalletPayInfoService {
return true;
}
@Override
@Transactional
public void queryAndUpdateBatchTransferStatus(String batchCode) {
BatchTransferDTO batchTransferDTO = walletApiService.queryBatchTransfer(new BatchTransferQueryRequest(batchCode));
// 根据批次号更新交易单
walletTradeDAO.updatePayStatusByBatchCode(batchCode, batchTransferDTO.getTradeStatus());
// 根据批次号更新业务单
List<WalletPayInfoDO> payInfoList = walletPayInfoDAO.getByBatchCode(batchCode);
if (CollectionUtils.isEmpty(payInfoList)) {
log.error("查询并更新批量转账状态异常,业务单为空");
return;
}
walletPayInfoDAO.updatePayStatusByBatchCode(batchCode, batchTransferDTO.getTradeStatus());
// 更新分账信息
Long shopId = payInfoList.get(0).getShopId();
List<String> expenseTypes = CollStreamUtil.toList(payInfoList, WalletPayInfoDO::getExpenseTypes);
shopAllocationInfoDAO.updateStatusByShopId(shopId, expenseTypes, batchTransferDTO.getTradeStatus());
// 校验并流转流程
if (AllocationPayStatusEnum.PAID.getStatus().equals(batchTransferDTO.getTradeStatus())) {
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(shopId);
// 校验并流转流程
verifyAndProcessFlow(shopInfo.getId());
// 推送缴费单数据到新管家
if (CollectionUtils.isNotEmpty(payInfoList)) {
pushReceiptRequest(payInfoList, shopInfo);
}
}
}
/**
* 推送账单到新管家
*/

View File

@@ -954,6 +954,7 @@ public class MiniStoreOrderServiceImpl implements MiniStoreOrderService {
BatchTransferRequest batchTransferRequest = new BatchTransferRequest();
batchTransferRequest.setOutStoreId(shopInfo.getStoreId());
batchTransferRequest.setPayPwd(request.getPayPwd());
batchTransferRequest.setWalletType(2);
List<BatchTransferRequest.TransDataRequest> transArray = new ArrayList<>();
for (PreAllocationRecordDO record : allocationRecords) {

View File

@@ -275,4 +275,11 @@ public class WalletApiService {
public WsPayAccountDTO wsPayAccountQuery(OutStoreIdRequest request) {
return walletHttpClientRest.postWithSign(walletBaseUrl + "/open/crm/account/ws/v1/queryCollectionAccount", request, WsPayAccountDTO.class);
}
/**
* 批量转账分账查询
*/
public BatchTransferDTO queryBatchTransfer(BatchTransferQueryRequest request) {
return walletHttpClientRest.postWithSign(walletBaseUrl + "/open/crm/trans/v1/queryBatchTransfer", request, BatchTransferDTO.class);
}
}