feat: 收款信息开户行匹配金蝶行名行号带出联行号并保存前校验
- 新增 A905-3 行名行号查询能力(BfiBankQueryDTO/BfiBankVO/IBfiClient.bebankQuery/IBfiService.queryBank) - 客商档案新增 query-bank 按行名精确匹配(失焦回显联行号)与 query-bank-by-number 按行号校验(保存前拦截,异常上抛便于区分查不到与校验失败) - 清理 BfiServiceImpl 内置发票查询 mock,统一走 BfiClientMock 桩文件
This commit is contained in:
+21
@@ -38,6 +38,7 @@ import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBankVO;
|
||||
import org.springblade.transport.support.TransportBusinessSupport;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
@@ -208,6 +209,26 @@ public class CustomerArchiveController extends BladeController {
|
||||
return R.data(customerArchiveService.querySupplierCode(creditCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 金蝶开户行查询(A905-3,收款信息填写开户行失焦精确匹配联行号用)
|
||||
*/
|
||||
@GetMapping("/query-bank")
|
||||
@ApiOperationSupport(order = 12)
|
||||
@Operation(summary = "金蝶开户行查询", description = "A905-3 按行名精确匹配金蝶行名行号档案,返回行名与联行号,查不到返回空")
|
||||
public R<BfiBankVO> queryBank(@Parameter(description = "开户行名称", required = true) @RequestParam String bankName) {
|
||||
return R.data(customerArchiveService.queryKingdeeBank(bankName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 金蝶联行号校验(A905-3,收款信息保存前校验联行号真实存在用)
|
||||
*/
|
||||
@GetMapping("/query-bank-by-number")
|
||||
@ApiOperationSupport(order = 12)
|
||||
@Operation(summary = "金蝶联行号校验", description = "A905-3 按行号精确匹配金蝶行名行号档案,查不到返回空,接口异常返回错误")
|
||||
public R<BfiBankVO> queryBankByNumber(@Parameter(description = "联行号", required = true) @RequestParam String cnapsCode) {
|
||||
return R.data(customerArchiveService.queryKingdeeBankByNumber(cnapsCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 评分明细模板
|
||||
*/
|
||||
|
||||
+17
@@ -25,6 +25,7 @@ package org.springblade.transport.service;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBankVO;
|
||||
import org.springblade.transport.excel.CustomerArchiveExcel;
|
||||
import org.springblade.transport.pojo.entity.CustomerArchive;
|
||||
import org.springblade.transport.pojo.vo.CustomerArchiveVO;
|
||||
@@ -204,6 +205,22 @@ public interface ICustomerArchiveService extends BaseService<CustomerArchive> {
|
||||
*/
|
||||
String querySupplierCode(String unifiedCreditCode);
|
||||
|
||||
/**
|
||||
* A905-3 按行名精确匹配金蝶行名行号档案(收款信息填写开户行后失焦回显联行号用),查不到返回 null
|
||||
*
|
||||
* @param bankName 开户行名称(行名全称)
|
||||
* @return 匹配到的行名行号档案,含联行号
|
||||
*/
|
||||
BfiBankVO queryKingdeeBank(String bankName);
|
||||
|
||||
/**
|
||||
* A905-3 按行号精确匹配金蝶行名行号档案(收款信息保存前校验联行号真实存在用),查不到返回 null,接口异常上抛由全局异常处理返回
|
||||
*
|
||||
* @param cnapsCode 联行号(行号)
|
||||
* @return 匹配到的行名行号档案
|
||||
*/
|
||||
BfiBankVO queryKingdeeBankByNumber(String cnapsCode);
|
||||
|
||||
/**
|
||||
* 推送失败状态落库(独立事务):推送主事务已回滚,失败状态与原因单独落库供页面展示与手动重推
|
||||
*
|
||||
|
||||
+63
@@ -46,8 +46,10 @@ import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.constant.HcsSyncConstant;
|
||||
import org.springblade.transport.excel.CustomerArchiveExcel;
|
||||
import org.springblade.thirdparty.bfi.constant.BfiConstant;
|
||||
import org.springblade.thirdparty.bfi.pojo.dto.BfiBankQueryDTO;
|
||||
import org.springblade.thirdparty.bfi.pojo.dto.BfiCustomerQueryDTO;
|
||||
import org.springblade.thirdparty.bfi.pojo.dto.BfiSupplierQueryDTO;
|
||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBankVO;
|
||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultErrorVO;
|
||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultItemVO;
|
||||
import org.springblade.thirdparty.bfi.pojo.vo.BfiBillSaveResultVO;
|
||||
@@ -672,6 +674,67 @@ public class CustomerArchiveServiceImpl extends BaseServiceImpl<CustomerArchiveM
|
||||
return this.queryKingdeeSupplierNumber(unifiedCreditCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* A905-3 按行名查询金蝶行名行号档案:收款信息填写开户行失焦时实时精确匹配取联行号,
|
||||
* 接口异常返回 null 不阻断录入,由前端提示未查询到
|
||||
*/
|
||||
@Override
|
||||
public BfiBankVO queryKingdeeBank(String bankName) {
|
||||
if (Func.isEmpty(bankName)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
BfiBankQueryDTO param = new BfiBankQueryDTO();
|
||||
param.setPageNo(1);
|
||||
param.setPageSize(10);
|
||||
param.setStatus(BfiConstant.BILL_STATUS_AUDITED);
|
||||
param.setEnable(BfiConstant.ENABLE_ENABLED);
|
||||
param.setName(List.of(bankName.trim()));
|
||||
BfiPageVO<BfiBankVO> page = bfiService.queryBank(param);
|
||||
List<BfiBankVO> rows = page == null ? null : page.getRows();
|
||||
if (rows == null || rows.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// 金蝶侧按行名过滤若为模糊匹配,本地再按全称精确比对取第一条
|
||||
String trimmedName = bankName.trim();
|
||||
return rows.stream()
|
||||
.filter(bank -> trimmedName.equals(bank.getName()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
} catch (Exception exception) {
|
||||
log.warn("A905-3行名行号查询失败,bankName={}", bankName, exception);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A905-3 按行号查询金蝶行名行号档案:收款信息保存前校验联行号真实存在,查不到返回 null 由前端拦截保存;
|
||||
* 与 {@link #queryKingdeeBank(String)} 不同,接口异常不上抛吞掉而是直接抛出,便于前端区分「查不到」与「校验失败」
|
||||
*/
|
||||
@Override
|
||||
public BfiBankVO queryKingdeeBankByNumber(String cnapsCode) {
|
||||
if (Func.isEmpty(cnapsCode)) {
|
||||
return null;
|
||||
}
|
||||
BfiBankQueryDTO param = new BfiBankQueryDTO();
|
||||
param.setPageNo(1);
|
||||
param.setPageSize(10);
|
||||
param.setStatus(BfiConstant.BILL_STATUS_AUDITED);
|
||||
param.setEnable(BfiConstant.ENABLE_ENABLED);
|
||||
param.setNumber(List.of(cnapsCode.trim()));
|
||||
BfiPageVO<BfiBankVO> page = bfiService.queryBank(param);
|
||||
List<BfiBankVO> rows = page == null ? null : page.getRows();
|
||||
if (rows == null || rows.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
// 金蝶侧按行号过滤若为模糊匹配,本地再按编码精确比对取第一条
|
||||
String trimmedCode = cnapsCode.trim();
|
||||
return rows.stream()
|
||||
.filter(bank -> trimmedCode.equals(bank.getNumber()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 金蝶已存在档案时,客商编号(customer_code)采纳金蝶客商编码,后续业务接口沿用客商编号即拿到金蝶编码;
|
||||
* 金蝶编码为空或与当前编号一致时无需处理;同租户下已被其他客商占用时跳过回填,避免违反 uk_customer_archive_code 唯一约束
|
||||
|
||||
Reference in New Issue
Block a user