✨ 新增BFI供应商查询接口A901-1

This commit is contained in:
刘泉佳
2026-10-28 00:22:27 +08:00
parent deb08d8af5
commit 9a55670d42
7 changed files with 450 additions and 0 deletions
@@ -65,6 +65,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiPayBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiRecBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiReceivedInvoiceVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiSupplierVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiTokenVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiVerifyTokenVO;
import org.springframework.cloud.openfeign.FeignClient;
@@ -99,6 +100,7 @@ public interface IBfiClient {
String PAY_BILL_QUERY_URL = "${thirdParty.bfi.payBillQueryUrl:/ierp/kapi/v2/awrp/cas/cas_paybill/query}";
String CUSTOMER_QUERY_URL = "${thirdParty.bfi.customerQueryUrl:/ierp/kapi/v2/awrp/basedata/bd_customer/query}";
String CUSTOMER_SAVE_URL = "${thirdParty.bfi.customerSaveUrl:/ierp/kapi/v2/awrp/basedata/bd_customer/save}";
String SUPPLIER_QUERY_URL = "${thirdParty.bfi.supplierQueryUrl:/ierp/kapi/v2/awrp/basedata/bd_supplier/query}";
String AP_BILL_SAVE_URL = "${thirdParty.bfi.apBillSaveUrl:/ierp/kapi/v2/awrp/ap/ap/ap_finapbill/save}";
String AP_BILL_QUERY_URL = "${thirdParty.bfi.apBillQueryUrl:/ierp/kapi/v2/awrp/ap/ap_finapbill/query}";
String AR_BILL_SAVE_URL = "${thirdParty.bfi.arBillSaveUrl:/ierp/kapi/v2/awrp/ar/ar/ar_finarbill/save}";
@@ -266,6 +268,33 @@ public interface IBfiClient {
@PostMapping(CUSTOMER_SAVE_URL)
BfiResultVO<BfiBillSaveResultVO> customerSave(@RequestHeader(BfiConstant.HEADER_ACCESS_TOKEN) String accessToken, @RequestBody BfiCustomerSaveBodyDTO param);
/**
* A901-1 供应商查询
*
* @param accessToken 访问令牌,通过 getToken 获取
* @param pageNo 页码,从1开始
* @param pageSize 页数
* @param enable 使用状态
* @param status 数据状态
* @param createorgNumber 创建组织.编码
* @param societycreditcode 统一社会信用代码(个人填写身份证号或手机号)
* @param idno 身份证号
* @param modifytimeS 修改时间-开始
* @param modifytimeE 修改时间-结束
* @return 供应商分页数据
*/
@GetMapping(SUPPLIER_QUERY_URL)
BfiResultVO<BfiPageVO<BfiSupplierVO>> supplierQuery(@RequestHeader(BfiConstant.HEADER_ACCESS_TOKEN) String accessToken,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "enable", required = false) String enable,
@RequestParam(value = "status", required = false) String status,
@RequestParam(value = "createorg_number", required = false) String createorgNumber,
@RequestParam(value = "societycreditcode", required = false) List<String> societycreditcode,
@RequestParam(value = "idno", required = false) List<String> idno,
@RequestParam(value = "modifytimeS", required = false) String modifytimeS,
@RequestParam(value = "modifytimeE", required = false) String modifytimeE);
/**
* A102-2 财务应付单保存
*
@@ -0,0 +1,83 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.thirdparty.bfi.pojo.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* 业财融合(BFI)A901-1 供应商查询参数
*
* @author Chill
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BfiSupplierQueryDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 【必填】页码,从1开始
*/
private Integer pageNo;
/**
* 【必填】页数
*/
private Integer pageSize;
/**
* 使用状态[0:禁用, 1:可用]
*/
private String enable;
/**
* 数据状态[A:暂存, B:已提交, C:已审核]
*/
private String status;
/**
* 创建组织.编码
*/
@JsonProperty("createorg_number")
private String createorgNumber;
/**
* 修改时间-开始,格式:yyyy-MM-dd HH:mm:ss,限定时间范围不可超过6个月
*/
private String modifytimeS;
/**
* 修改时间-结束,格式:yyyy-MM-dd HH:mm:ss
*/
private String modifytimeE;
/**
* 统一社会信用代码(个人填写身份证号或手机号)
*/
private List<String> societycreditcode;
/**
* 身份证号
*/
private List<String> idno;
}
@@ -0,0 +1,114 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.thirdparty.bfi.pojo.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 业财融合(BFI)A901-1 供应商查询 银行信息分录
*
* @author Chill
*/
@Data
public class BfiSupplierBankVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 分录行号
*/
private Integer seq;
/**
* 银行账号
*/
private String bankaccount;
/**
* 账户名称
*/
private String accountname;
/**
* 默认
*/
@JsonProperty("isdefault_bank")
private Boolean isdefaultBank;
/**
* 银行账户类型
*/
private String bankaccounttype;
/**
* 账户性质[0:公司, 1:个人]
*/
@JsonProperty("account_property")
private String accountProperty;
/**
* 默认手续费承担方[1:付款方, 2:收款方]
*/
private String commissionbearer;
/**
* 币种(货币代码)
*/
private Currency currency;
/**
* 开户银行(编码)
*/
private Bank bank;
/**
* 币种引用
*/
@Data
public static class Currency implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 货币代码
*/
private String number;
}
/**
* 开户银行引用
*/
@Data
public static class Bank implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 编码(行号)
*/
private String number;
}
}
@@ -0,0 +1,181 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.thirdparty.bfi.pojo.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.List;
/**
* 业财融合(BFI)A901-1 供应商查询返回结果
*
* @author Chill
*/
@Data
public class BfiSupplierVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
/**
* 编码
*/
private String number;
/**
* 名称
*/
private String name;
/**
* 数据状态[A:暂存, B:已提交, C:已审核]
*/
private String status;
/**
* 使用状态[0:禁用, 1:可用]
*/
private String enable;
/**
* 创建时间
*/
private String createtime;
/**
* 修改时间
*/
private String modifytime;
/**
* 控制策略[1:逐级分配, 2:自由分配, 5:全局共享, 6:管控范围内共享, 7:私有]
*/
private String ctrlstrategy;
/**
* 简称
*/
private String simplename;
/**
* 伙伴类型[1:法人企业, 2:非法人企业, 3:非企业单位, 4:个人, 5:个体户, 6:大陆以外的企业]
*/
private String type;
/**
* 统一社会信用代码(个人填写身份证号或手机号)
*/
private String societycreditcode;
/**
* 电子邮箱
*/
@JsonProperty("postal_code")
private String postalCode;
/**
* 身份证号
*/
private String idno;
/**
* 供应商分组.编码
*/
@JsonProperty("group_number")
private String groupNumber;
/**
* 详细地址
*/
@JsonProperty("bizpartner_address")
private String bizpartnerAddress;
/**
* 联系人
*/
private String linkman;
/**
* 联系电话
*/
@JsonProperty("bizpartner_phone")
private String bizpartnerPhone;
/**
* 传真
*/
@JsonProperty("bizpartner_fax")
private String bizpartnerFax;
/**
* 纳税人识别号
*/
@JsonProperty("tx_register_no")
private String txRegisterNo;
/**
* 法人代表
*/
private String artificialperson;
/**
* 注册资本
*/
private String regcapital;
/**
* 营业期限
*/
private String businessterm;
/**
* 成立日期
*/
private String establishdate;
/**
* 经营范围
*/
private String businessscope;
/**
* 业务职能[1:采购, 2:结算, 3:收款, 4:供货]
*/
private String bizfunction;
/**
* 简拼
*/
private String simplepinyin;
/**
* 税号
*/
private String taxno;
/**
* 是否为贸易客商[A:是, B:否]
*/
@JsonProperty("awrp_supfortrade")
private String awrpSupfortrade;
/**
* 数据来源系统[XH:星瀚, WCY:物产云, JCZX:检测中心, NBERP:南北ERP, WCCK:城矿ERP, WY:维云(服务), CMS:合同系统, DTP:数据中台]
*/
@JsonProperty("awrp_datasourcesys")
private String awrpDatasourcesys;
/**
* 备注
*/
@JsonProperty("awrp_sppfbeizhu")
private String awrpSppfbeizhu;
/**
* 银行信息分录
*/
@JsonProperty("entry_bank")
private List<BfiSupplierBankVO> entryBank;
}
@@ -48,6 +48,7 @@ import org.springblade.thirdparty.bfi.pojo.dto.BfiPayBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceSaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiRecBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiSupplierQueryDTO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiApBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiArBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiAttachmentUploadVO;
@@ -65,6 +66,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiPayApplyVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiPayBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiReceivedInvoiceVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiRecBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiSupplierVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiTokenVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiVerifyTokenVO;
@@ -183,6 +185,14 @@ public interface IBfiService {
*/
BfiBillSaveResultVO saveCustomer(BfiCustomerSaveDTO param);
/**
* A901-1 供应商查询
*
* @param param 查询参数,页码从1开始,修改时间范围不可超过6个月
* @return 供应商分页数据
*/
BfiPageVO<BfiSupplierVO> querySupplier(BfiSupplierQueryDTO param);
/**
* A102-2 财务应付单保存
*
@@ -72,6 +72,7 @@ import org.springblade.thirdparty.bfi.pojo.dto.BfiRecBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceSaveBodyDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceSaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiSupplierQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiTokenDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiVerifyTokenDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiWithdrawTokenDTO;
@@ -95,6 +96,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiPayBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiRecBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiReceivedInvoiceVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiSupplierVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiTokenVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiVerifyTokenVO;
import org.springblade.thirdparty.bfi.service.IBfiService;
@@ -332,6 +334,18 @@ public class BfiServiceImpl implements IBfiService {
return result.getData();
}
@Override
public BfiPageVO<BfiSupplierVO> querySupplier(BfiSupplierQueryDTO param) {
if (param == null || param.getPageNo() == null || param.getPageSize() == null) {
throw new BfiException("查询BFI供应商失败,分页参数不能为空");
}
String accessToken = getAccessToken();
BfiResultVO<BfiPageVO<BfiSupplierVO>> result = commonCall("供应商查询", () -> client.supplierQuery(accessToken,
param.getPageNo(), param.getPageSize(), param.getEnable(), param.getStatus(), param.getCreateorgNumber(),
param.getSocietycreditcode(), param.getIdno(), param.getModifytimeS(), param.getModifytimeE()));
return result.getData();
}
@Override
public BfiBillSaveResultVO saveApBill(BfiApBillSaveDTO param) {
if (param == null || StringUtil.isBlank(param.getAwrpSrcSys()) || StringUtil.isBlank(param.getAwrpSrcCode())) {
@@ -65,6 +65,7 @@ import org.springblade.thirdparty.bfi.pojo.dto.BfiRecBillQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceSaveDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiReceivedInvoiceSaveEntryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiSupplierQueryDTO;
import org.springblade.thirdparty.bfi.pojo.dto.BfiTokenDTO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiApBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiArBillVO;
@@ -78,6 +79,7 @@ import org.springblade.thirdparty.bfi.pojo.vo.BfiPageVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiRecBillVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiReceivedInvoiceVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiResultVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiSupplierVO;
import org.springblade.thirdparty.bfi.pojo.vo.BfiTokenVO;
import org.springblade.thirdparty.bfi.service.impl.BfiServiceImpl;
import org.springframework.data.redis.core.ValueOperations;
@@ -212,6 +214,23 @@ class BfiServiceImplTest {
assertThrows(BfiException.class, () -> service.queryCustomer(new BfiCustomerQueryDTO()));
}
@Test
void querySupplierShouldReturnPage() {
mockAccessToken();
BfiPageVO<BfiSupplierVO> page = new BfiPageVO<>();
when(client.supplierQuery(eq("token-1"), eq(1), eq(10), any(), any(), any(), any(), any(), any(), any()))
.thenReturn(success(page));
BfiSupplierQueryDTO param = new BfiSupplierQueryDTO();
param.setPageNo(1);
param.setPageSize(10);
assertEquals(page, service.querySupplier(param));
}
@Test
void querySupplierShouldThrowWhenPageEmpty() {
assertThrows(BfiException.class, () -> service.querySupplier(new BfiSupplierQueryDTO()));
}
@Test
void saveCustomerShouldValidateRequiredFields() {
BfiCustomerSaveDTO noName = new BfiCustomerSaveDTO();