This commit is contained in:
parent
3b974ca698
commit
8d7911f7c8
66
go.mod
66
go.mod
|
@ -5,69 +5,9 @@ go 1.23.0
|
|||
toolchain go1.23.10
|
||||
|
||||
require (
|
||||
github.com/ZZMarquis/gm v1.3.2
|
||||
github.com/bwmarrin/snowflake v0.3.0
|
||||
gitea.cdlsxd.cn/self-tools/l_request v1.0.7
|
||||
github.com/clbanning/mxj v1.8.4
|
||||
github.com/duke-git/lancet/v2 v2.3.7
|
||||
github.com/go-kratos/kratos/contrib/config/nacos/v2 v2.0.0-20250716060240-ac92cbe5701c
|
||||
github.com/go-kratos/kratos/contrib/registry/nacos/v2 v2.0.0-20250716060240-ac92cbe5701c
|
||||
github.com/go-kratos/kratos/v2 v2.8.4
|
||||
github.com/golang-jwt/jwt/v5 v5.1.0
|
||||
github.com/golang/protobuf v1.5.4
|
||||
github.com/google/wire v0.6.0
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/nacos-group/nacos-sdk-go v1.1.5
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pupuk/addr v0.0.3
|
||||
github.com/shimingyah/pool v1.0.0
|
||||
github.com/tjfoc/gmsm v1.4.1
|
||||
github.com/xuri/excelize/v2 v2.9.1
|
||||
go.opentelemetry.io/otel v1.24.0
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0
|
||||
go.opentelemetry.io/otel/sdk v1.24.0
|
||||
go.uber.org/automaxprocs v1.5.1
|
||||
golang.org/x/crypto v0.38.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240528184218-531527333157
|
||||
google.golang.org/grpc v1.65.0
|
||||
google.golang.org/protobuf v1.34.1
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
dario.cat/mergo v1.0.0 // indirect
|
||||
gitea.cdlsxd.cn/self-tools/l_request v1.0.7 // indirect
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/clbanning/mxj v1.8.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/go-errors/errors v1.0.1 // indirect
|
||||
github.com/go-kratos/aegis v0.2.0 // indirect
|
||||
github.com/go-logr/logr v1.4.1 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-playground/form/v4 v4.2.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect
|
||||
github.com/json-iterator/go v1.1.6 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
|
||||
github.com/richardlehane/mscfb v1.0.4 // indirect
|
||||
github.com/richardlehane/msoleps v1.0.4 // indirect
|
||||
github.com/tiendc/go-deepcopy v1.6.0 // indirect
|
||||
github.com/xuri/efp v0.0.1 // indirect
|
||||
github.com/xuri/nfp v0.0.1 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.24.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.24.0 // indirect
|
||||
go.uber.org/atomic v1.6.0 // indirect
|
||||
go.uber.org/multierr v1.5.0 // indirect
|
||||
go.uber.org/zap v1.15.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20221208152030-732eee02a75a // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sync v0.14.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.25.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
|
||||
gopkg.in/ini.v1 v1.42.0 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
require golang.org/x/text v0.25.0 // indirect
|
||||
|
|
39
pkg/func.go
39
pkg/func.go
|
@ -104,21 +104,38 @@ func XMLToByte(xmlBytes []byte) ([]byte, error) {
|
|||
return nil, fmt.Errorf("无效的XML结构: 缺少stream节点")
|
||||
}
|
||||
// 处理list节点
|
||||
if lists, ok := stream["list"].([]interface{}); ok {
|
||||
for _, listItem := range lists {
|
||||
if listMap, ok := listItem.(map[string]interface{}); ok {
|
||||
// 获取name属性
|
||||
if name, ok := listMap["-name"].(string); ok && name != "" {
|
||||
// 用name作为key,替换原来的list数组
|
||||
if rowList, ok := listMap["row"].(map[string]interface{}); ok {
|
||||
stream[name] = []map[string]interface{}{rowList}
|
||||
} else {
|
||||
stream[name] = listMap["row"]
|
||||
}
|
||||
if lists, ok := stream["list"]; ok {
|
||||
switch lists.(type) {
|
||||
case []interface{}:
|
||||
for _, listItem := range lists.([]interface{}) {
|
||||
if listMap, ok := listItem.(map[string]interface{}); ok {
|
||||
// 获取name属性
|
||||
if name, ok := listMap["-name"].(string); ok && name != "" {
|
||||
// 用name作为key,替换原来的list数组
|
||||
if rowList, ok := listMap["row"].(map[string]interface{}); ok {
|
||||
stream[name] = []map[string]interface{}{rowList}
|
||||
} else {
|
||||
stream[name] = listMap["row"]
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
case map[string]interface{}:
|
||||
listMap := lists.(map[string]interface{})
|
||||
if name, ok := listMap["-name"].(string); ok && name != "" {
|
||||
// 用name作为key,替换原来的list数组
|
||||
if rowList, ok := listMap["row"].(map[string]interface{}); ok {
|
||||
stream[name] = []map[string]interface{}{rowList}
|
||||
} else {
|
||||
stream[name] = listMap["row"]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
// 删除原始的list节点
|
||||
delete(stream, "list")
|
||||
}
|
||||
|
|
48
tysk.go
48
tysk.go
|
@ -79,3 +79,51 @@ func (g *Tysk) ReceiptDownload(receiptDownloadReq tysk_entity.ReceiptDownloadReq
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (g *Tysk) TransHisQueryApply(TransHisQueryApplyReq tysk_entity.TransHisQueryApplyReq) (res tysk_entity.TransHisQueryApplyResp, err error) {
|
||||
err = g.handleRequest(tysk_constant.TransHisQueryApply, g.handleReqStructToMap(TransHisQueryApplyReq), &res)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (g *Tysk) TransHisQuery(transHisReq tysk_entity.TransHisQueryReq) (res tysk_entity.TransHisQueryResp, err error) {
|
||||
err = g.handleRequest(tysk_constant.TransHisQuery, g.handleReqStructToMap(transHisReq), &res)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (g *Tysk) BalanceHisQueryApply(BalanceHisQueryApplyReq tysk_entity.BalanceHisQueryApplyReq) (res tysk_entity.BalanceHisQueryApplyResp, err error) {
|
||||
err = g.handleRequest(tysk_constant.BalanceHisQueryApply, g.handleReqStructToMap(BalanceHisQueryApplyReq), &res)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (g *Tysk) BalanceHisQuery(BalanceHisQueryReq tysk_entity.BalanceHisQueryReq) (res tysk_entity.BalanceHisQueryResp, err error) {
|
||||
err = g.handleRequest(tysk_constant.BalanceHisQuery, g.handleReqStructToMap(BalanceHisQueryReq), &res)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (g *Tysk) AccountsTransHisQuery(AccountsTransHisQueryReq tysk_entity.AccountsTransHisQueryReq) (res tysk_entity.AccountsTransHisQueryResp, err error) {
|
||||
err = g.handleRequest(tysk_constant.AccountsTransHisQuery, g.handleReqStructToMap(AccountsTransHisQueryReq), &res)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (g *Tysk) SinglePay(singlePayReq tysk_entity.SinglePayReq) (res tysk_entity.SinglePayResp, err error) {
|
||||
err = g.handleRequest(tysk_constant.SinglePay, g.handleReqStructToMap(singlePayReq), &res)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ import (
|
|||
|
||||
// TyskFacade 定义了司库系统的外观接口
|
||||
type TyskFacade interface {
|
||||
Account
|
||||
Account //账户中心
|
||||
Settle //结算中心
|
||||
|
||||
}
|
||||
|
||||
// Account 定义了账户相关的操作接口
|
||||
|
@ -70,4 +72,47 @@ type Account interface {
|
|||
//6.文件压缩后最大大小为:2M
|
||||
//7.在输入中新增“文件格式”字段,非必输,字典项为“OFD优先”、“PDF优先”。
|
||||
ReceiptDownload(receiptDownloadReq tysk_entity.ReceiptDownloadReq) (res tysk_entity.ReceiptDownloadResp, err error)
|
||||
|
||||
// TransHisQueryApply 历史明细查询申请
|
||||
//使用该接口提交账户历史交易明细查询请求
|
||||
// 注意事项:
|
||||
//请求使用的银企直联用户需有相关账号的查询权限。
|
||||
TransHisQueryApply(transHisReq tysk_entity.TransHisQueryApplyReq) (res tysk_entity.TransHisQueryApplyResp, err error)
|
||||
|
||||
// TransHisQuery 历史明细查询申请
|
||||
//使该接口用于查询账户的历史交易明细信息。
|
||||
// 注意事项:
|
||||
//1.请求使用的银企直联用户需有相关账号的查询权限 ;
|
||||
//2.该交易使用分页查询,起始记录号从1开始,每页最多显示100条记录。报文中的交易流水号sumTranNo由司库系统产生,用于标识客户交易明细数据唯一性;
|
||||
//3.历史明细:申请(SKTRNHCL),查询(SKTRNHCT)可查司库已有境外银行数据(渣打、汇丰)
|
||||
TransHisQuery(transHisReq tysk_entity.TransHisQueryReq) (res tysk_entity.TransHisQueryResp, err error)
|
||||
|
||||
// BalanceHisQueryApply 历史余额查询申请
|
||||
//客户可使用该接口提交账户历史余额查询申请
|
||||
// 注意事项:
|
||||
//1.请求使用的银企直联用户需有相关账号的查询权限;
|
||||
//2.账户历史余额查询申请每次支持不多于20个账户的查询。
|
||||
//3.可向前申请1年以内的历史余额数据,并且起始日期、终止日期之间的日期间隔不得大于90天。
|
||||
BalanceHisQueryApply(BalanceHisQueryApplyReq tysk_entity.BalanceHisQueryApplyReq) (res tysk_entity.BalanceHisQueryApplyResp, err error)
|
||||
|
||||
// BalanceHisQuery 历史余额结果查询
|
||||
//客户可使用历史余额查询申请中提交的记录申请编号,来查询账户的历史余额数据。
|
||||
// 注意事项:
|
||||
//1.请求使用的银企直联用户需有相关账号的查询权限;
|
||||
//2.余额数据支持三种来源:01银行接口返回,即通过调用各银行的历史余额接口来获取数据;02银行明细返回,当对方行没有历史余额接口,而通过其当日最后一条银行流水明细中的余额字段来获取数据;03 明细数据计算,当对方行不支持历史余额接口、其明细也没有余额字段时,通过某日的余额基准数据,结合其间交易明细轧差计算,得出的历史余额数据;
|
||||
//3.数据状态01获取中,为余额数据获取的中间状态,如对方银行接口已调用,但尚未返回;02 已返回、03获取失败为余额数据获取的终态,其中返回03时,余额金额字段为空;
|
||||
//4.当数据来源01和02的时候,数据状态包括02或03;数据来源是03时,数据状态根据接口调用状态分别展示01、02或03.
|
||||
//5.历史余额:申请(SKBALHSQ),查询(SKBALHCX)可查司库已有境外银行数据(渣打、汇丰)
|
||||
BalanceHisQuery(BalanceHisQueryReq tysk_entity.BalanceHisQueryReq) (res tysk_entity.BalanceHisQueryResp, err error)
|
||||
|
||||
// AccountsTransHisQuery 多账户历史明细查询
|
||||
//该接口用于查询多账户的历史交易明细信息。
|
||||
// 注意事项:
|
||||
//1.请求使用的银企直联用户需有相关账号的查询权限;
|
||||
//2.该交易使用分页查询,起始记录号从1开始,每页最多显示100条记录。报文中的交易流水号sumTranNo由司库系统产生,用于标识客户交易明细数据唯一性。
|
||||
AccountsTransHisQuery(AccountsTransHisQueryReq tysk_entity.AccountsTransHisQueryReq) (res tysk_entity.AccountsTransHisQueryResp, err error)
|
||||
}
|
||||
|
||||
type Settle interface {
|
||||
SinglePay(singlePayReq tysk_entity.SinglePayReq) (res tysk_entity.SinglePayRes, err error)
|
||||
}
|
||||
|
|
|
@ -6,15 +6,15 @@ type AccountNo string
|
|||
type TranType string
|
||||
|
||||
const (
|
||||
All TranType = "01" //所有
|
||||
Out TranType = "02" //支出<借>
|
||||
In TranType = "03" //收入<贷>
|
||||
TranTypeAll TranType = "01" //所有
|
||||
TranTypeOut TranType = "02" //支出<借>
|
||||
TranTypeIn TranType = "03" //收入<贷>
|
||||
)
|
||||
|
||||
var TranTypeMap = map[TranType]string{
|
||||
All: "所有",
|
||||
Out: "支出<借>",
|
||||
In: "收入<贷>",
|
||||
TranTypeAll: "所有",
|
||||
TranTypeOut: "支出<借>",
|
||||
TranTypeIn: "收入<贷>",
|
||||
}
|
||||
|
||||
// AccCgyId 账户性质(原:账户类型)
|
||||
|
@ -153,3 +153,72 @@ var FileTypeMap = map[FileType]string{
|
|||
FileTypePDF: "PDF优先",
|
||||
IsFrgnAccOFD: "OFD优先",
|
||||
}
|
||||
|
||||
// LinkPayFlag 联动支付
|
||||
type CommonBool string
|
||||
|
||||
const (
|
||||
CommonBoolTrue CommonBool = "01"
|
||||
CommonBoolFalse CommonBool = "00"
|
||||
)
|
||||
|
||||
var CommonBoolMap = map[CommonBool]string{
|
||||
CommonBoolTrue: "是",
|
||||
CommonBoolFalse: "否",
|
||||
}
|
||||
|
||||
// IsCheckRcvpartyDepbnkId 是否准确校验开户行行名
|
||||
type IsCheckRcvpartyDepbnkId string
|
||||
|
||||
const (
|
||||
IsCheckRcvpartyDepbnkIdIS IsCheckRcvpartyDepbnkId = "00"
|
||||
IsCheckRcvpartyDepbnkIdNot IsCheckRcvpartyDepbnkId = "01"
|
||||
)
|
||||
|
||||
var IsCheckRcvpartyDepbnkIdMap = map[IsCheckRcvpartyDepbnkId]string{
|
||||
IsCheckRcvpartyDepbnkIdIS: "是",
|
||||
IsCheckRcvpartyDepbnkIdNot: "否",
|
||||
}
|
||||
|
||||
// TxnCntprTp 交易对手类型
|
||||
type TxnCntprTp string
|
||||
|
||||
const (
|
||||
TxnCntprTpCus TxnCntprTp = "01"
|
||||
TxnCntprTpSupplier TxnCntprTp = "02"
|
||||
TxnCntprTpSaler TxnCntprTp = "03"
|
||||
TxnCntprTpOther TxnCntprTp = "04"
|
||||
)
|
||||
|
||||
var TxnCntprTpMap = map[TxnCntprTp]string{
|
||||
TxnCntprTpCus: "客户",
|
||||
TxnCntprTpSupplier: "供应商",
|
||||
TxnCntprTpSaler: "经销商",
|
||||
TxnCntprTpOther: "其他",
|
||||
}
|
||||
|
||||
// PyAccTp 付款种类
|
||||
type PyAccTp string
|
||||
|
||||
const (
|
||||
PyAccTpPub PyAccTp = "00"
|
||||
PyAccTpPri PyAccTp = "01"
|
||||
)
|
||||
|
||||
var PyAccTpMap = map[PyAccTp]string{
|
||||
PyAccTpPub: "对公",
|
||||
PyAccTpPri: "对私",
|
||||
}
|
||||
|
||||
// IsInterbnk 是否跨行
|
||||
type IsInterbnk string
|
||||
|
||||
const (
|
||||
IsInterbnkNo IsInterbnk = "00"
|
||||
IsInterbnkIs IsInterbnk = "01"
|
||||
)
|
||||
|
||||
var IsInterbnkMap = map[IsInterbnk]string{
|
||||
IsInterbnkNo: "不跨行",
|
||||
IsInterbnkIs: "跨行",
|
||||
}
|
||||
|
|
|
@ -3,12 +3,18 @@ package tysk_constant
|
|||
type RequestCode string
|
||||
|
||||
const (
|
||||
GetAccountBalance RequestCode = "SKBALQRY"
|
||||
GetTodayTransHis RequestCode = "SKTRNCOL"
|
||||
GetAccountInfo RequestCode = "SKBACQRY"
|
||||
ReceiptApply RequestCode = "SKEDDRSQ"
|
||||
ReceiptQuery RequestCode = "SKEDDQRY"
|
||||
ReceiptDownload RequestCode = "SKEDCDTD"
|
||||
GetAccountBalance RequestCode = "SKBALQRY"
|
||||
GetTodayTransHis RequestCode = "SKTRNCOL"
|
||||
GetAccountInfo RequestCode = "SKBACQRY"
|
||||
ReceiptApply RequestCode = "SKEDDRSQ"
|
||||
ReceiptQuery RequestCode = "SKEDDQRY"
|
||||
ReceiptDownload RequestCode = "SKEDCDTD"
|
||||
TransHisQueryApply RequestCode = "SKTRNHCL"
|
||||
TransHisQuery RequestCode = "SKTRNHCT"
|
||||
BalanceHisQueryApply RequestCode = "SKBALHSQ"
|
||||
BalanceHisQuery RequestCode = "SKBALHCX"
|
||||
AccountsTransHisQuery RequestCode = "SKTRNNCT"
|
||||
SinglePay RequestCode = "SKDLTTRN"
|
||||
)
|
||||
|
||||
type ResponseCode string
|
||||
|
|
|
@ -59,4 +59,77 @@ type (
|
|||
FileType tysk_constant.FileType `json:"fileType,omitempty" comment:"文件格式"` // 文件格式(char(1),选填):PDF/OFD,默认PDF
|
||||
RcptNums []string `json:"userDataList.rcptNum" comment:"回单下载列表" validate:"required,dive"` // 回单下载列表(必填)
|
||||
}
|
||||
|
||||
//TransHisQueryApplyReq 历史明细查询申请
|
||||
TransHisQueryApplyReq struct {
|
||||
ClientID string `json:"clientId" comment:"记录申请编号" validate:"required,max=20"` // 客户查询自定义的流水号(varchar(20),必填,仅支持数字或字母组合)
|
||||
AccountNo tysk_constant.AccountNo `json:"accountNo" comment:"账号" validate:"required,max=40"` // 银行账号(varchar(40),必填,允许输入0-9a-zA-Z空格-?:().,'+/,不能首尾空格,至少一个数字)
|
||||
StartDate string `json:"startDate" comment:"起始日期" validate:"required,len=8"` // 查询开始日期(char(8),必填,yyyyMMdd格式,与结束日期间隔≤95天)
|
||||
EndDate string `json:"endDate" comment:"终止日期" validate:"required,len=8"` // 查询结束日期(char(8),必填,yyyyMMdd格式,与开始日期间隔≤95天)
|
||||
}
|
||||
|
||||
//TransHisQueryReq 历史明细结果查询
|
||||
TransHisQueryReq struct {
|
||||
ClientID string `json:"clientId" comment:"记录申请编号" validate:"required,max=20,alphanum"` // 交易申请流水号(varchar(20),必填,仅支持数字或字母组合)
|
||||
StartDate *string `json:"startDate,omitempty" comment:"起始日期" validate:"omitempty,len=8,datetime=20060102"` // 查询开始日期(char(8),选填,yyyyMMdd格式,默认取SKTRNHCL输入的起始日期)
|
||||
EndDate *string `json:"endDate,omitempty" comment:"终止日期" validate:"omitempty,len=8,datetime=20060102"` // 查询结束日期(char(8),选填,yyyyMMdd格式,默认取SKTRNHCL输入的终止日期)
|
||||
TranType tysk_constant.TranType `json:"tranType" comment:"交易类型" validate:"required,oneof=01 02 03"` // 交易类型(char(2),必填:01-全部交易/02-账户支出/03-账户收入)
|
||||
StartRecord int32 `json:"startRecord" comment:"起始记录号" validate:"required,len=4,numeric"` // 查询起始记录编号(char(4),必填,从1开始)
|
||||
PageNumber int32 `json:"pageNumber" comment:"请求记录条数" validate:"required,len=4,numeric,max=100"` // 每页记录数(char(4),必填,最大100条)
|
||||
}
|
||||
|
||||
// BalanceHisQueryApplyReq 历史余额查询申请
|
||||
BalanceHisQueryApplyReq struct {
|
||||
ClientID string `json:"clientID" comment:"记录申请编号" validate:"required,max=20,alphanum"` // 客户查询自定义的流水号(varchar(20),必填,仅支持数字或字母组合)
|
||||
StartDate string `json:"startDate" comment:"起始日期" validate:"required,len=8,datetime=20060102"` // 查询余额范围的开始日期(char(8),必填,yyyyMMdd格式)
|
||||
EndDate string `json:"endDate" comment:"终止日期" validate:"required,len=8,datetime=20060102"` // 查询余额范围的结束日期(char(8),必填,yyyyMMdd格式)
|
||||
AccountNo AccountList `json:"userDataList.accountNo"` // 银行账号列表(varchar(40),必填,允许输入0-9a-zA-Z空格-?:().,'+/,不能首尾空格,至少一个数字)
|
||||
}
|
||||
|
||||
// BalanceHisQueryReq 历史余额查询请求
|
||||
BalanceHisQueryReq struct {
|
||||
ClientID string `json:"clientID" comment:"记录申请编号" validate:"required,len=20,alphanum"` // 客户查询自定义的流水号(char(20),必填,仅支持数字或字母组合)
|
||||
StartDate *string `json:"startDate,omitempty" comment:"起始日期" validate:"omitempty,len=8,datetime=20060102,balanceDateRange"` // 查询余额范围的开始日期(char(8),选填,yyyyMMdd格式)
|
||||
EndDate *string `json:"endDate,omitempty" comment:"终止日期" validate:"omitempty,len=8,datetime=20060102,balanceDateRange"` // 查询余额范围的结束日期(char(8),选填,yyyyMMdd格式)
|
||||
StartRecord int32 `json:"startRecord" comment:"起始记录号" validate:"required,len=4,numeric"` // 查询开始的记录编号(char(4),必填,从1开始)
|
||||
PageNumber int32 `json:"pageNumber" comment:"请求记录条数" validate:"required,len=4,numeric,max=20"` // 每次查询请求的记录数量(char(4),必填,最多支持20条记录)
|
||||
}
|
||||
|
||||
// AccountsTransHisQueryReq 多账户历史明细查询
|
||||
AccountsTransHisQueryReq struct {
|
||||
StartDate string `json:"startDate" validate:"required,len=8,datetime=20060102,dateRange"` // 起始日期(char(8),必填,yyyyMMdd格式)
|
||||
EndDate string `json:"endDate" validate:"required,len=8,datetime=20060102,dateRange"` // 终止日期(char(8),必填,yyyyMMdd格式)
|
||||
TranType tysk_constant.TranType `json:"tranType" validate:"required,len=2,oneof=01 02 03"` // 借贷方向(char(2),必填:01-全部交易;02-借;03-贷)
|
||||
StartRecord int32 `json:"startRecord" validate:"required,len=4,numeric,min=1"` // 起始记录号(char(4),必填,从1开始)
|
||||
PageNumber int32 `json:"pageNumber" validate:"required,len=4,numeric,max=100"` // 请求记录条数(char(4),必填,最多100条)
|
||||
AccountNo AccountList `json:"userDataList.accountNo" validate:"required,dive"` // 账号列表(必填,最多10个账号)
|
||||
}
|
||||
|
||||
// SinglePayReq 单笔支付
|
||||
SinglePayReq struct {
|
||||
Action string `json:"action" comment:"接口请求代码" validate:"required,max=8"` // 标识要请求的接口,交易代码
|
||||
UserName string `json:"userName" comment:"登录名" validate:"required,max=50"` // 银企直联用户名
|
||||
ExternalNum string `json:"externalNum" comment:"外部请求流水号" validate:"required,max=50"` // 最大长度为50,不能重复
|
||||
LinkPayFlag *tysk_constant.CommonBool `json:"linkPayFlag" comment:"联动支付" validate:"omitempty,oneof=00 01"` // 00:否,01:是 默认为否
|
||||
PypartyAccnum string `json:"pypartyAccnum" comment:"付方账号" validate:"required,max=32,accountFormat"` // 允许输入特定字符,至少一个数字
|
||||
RcvpyAccnum string `json:"rcvpyAccnum" comment:"收方账号" validate:"required,max=32,accountFormat"` // 允许输入特定字符,至少一个数字
|
||||
RcvpyAccnm string `json:"rcvpyAccnm" comment:"收方户名" validate:"required,max=300,nameFormat"` // 最大支持长度300(汉字占3,非汉字占1)
|
||||
IsCheckRcvpartyDepbnkId *tysk_constant.IsCheckRcvpartyDepbnkId `json:"isCheckRcvpartyDepbnkId" comment:"是否准确校验开户行行名" validate:"omitempty,oneof=00 01"` // 00:是 01:否 默认为是 当该字段为00是时:同时传入开户行行名和联行号,以联行号为准; 当该字段为01否时:同时传入开户行行名和联行号,以联行号为准;只传入开户行行名直接返显开户行,不再校验开户行行名在境内网点表是否存在,若用户上送的开户行行名匹配不上所属银行,则【收方银行】展示--,【是否跨行】字段,若用户上送,则以用户上送的为准,若用户未上送,收方银行为空,则无法按照收付方银行判断出是否跨行,则是否跨行默认为是;若用户上送的开户行行名匹配不出联行号时,则【收方联行号】、【收方地区】展示为--;只传入联行号,以联行号为准。
|
||||
RcvpartyDepbnkId *string `json:"rcvpartyDepbnkId" comment:"收方开户行" validate:"omitempty,max=80"` // 收方开户行
|
||||
RcvpartyBnkgId *string `json:"rcvpartyBnkgId" comment:"收方联行号" validate:"omitempty,max=40"` // 收方联行号
|
||||
TxnCntprTp *tysk_constant.TxnCntprTp `json:"txnCntprTp" comment:"交易对手类型" validate:"omitempty,oneof=01 02 03 04"` // 客户:01 供应商:02 经销商:03 其他:04
|
||||
PyAccTp tysk_constant.PyAccTp `json:"pyAccTp" comment:"付款种类" validate:"required,oneof=00 01"` // 00:对公 01:对私
|
||||
Amt float64 `json:"amt" comment:"付款金额" validate:"required,numeric,min=0.01,max=9999999999999.99"` // 整数最长13位,2位小数
|
||||
CurrencyID string `json:"currencyID" comment:"币种" validate:"required,oneof=CNY"` // 币种仅支持人民币(CNY)
|
||||
IsInterbnk *tysk_constant.IsInterbnk `json:"isInterbnk" comment:"是否跨行" validate:"omitempty,oneof=00 01"` // 00:不跨行 01:跨行
|
||||
UrgntAprvFlag *tysk_constant.CommonBool `json:"urgntAprvFlag" comment:"加急审批" validate:"omitempty,oneof=00 01"` // 00:否,01:是 默认为否
|
||||
PyTmlnsFlag *tysk_constant.CommonBool `json:"pyTmlnsFlag" comment:"预约付款" validate:"omitempty,oneof=00 01"` // 00:否 01:是 默认为否
|
||||
RsrvtnTms string `json:"rsrvtnTms" comment:"预约时间" validate:"omitempty,datetime=2006-01-02 15:04:05,timeRange"` // 预约时间格式 yyyy-MM-dd HH:mm:ss,时间范围06:00-22:00
|
||||
Pscpt string `json:"pscpt" comment:"附言" validate:"required,max=300,noteFormat"` // 银行附言,最大支持长度300(汉字占3,非汉字占1)
|
||||
Rmrk string `json:"rmrk" comment:"备注" validate:"omitempty,max=120"` // 最大长度为120
|
||||
Rmrk1 string `json:"rmrk1" comment:"备用字段1" validate:"omitempty,max=600"` // 最大长度为600
|
||||
Rmrk2 string `json:"rmrk2" comment:"备用字段2" validate:"omitempty,max=600"` // 最大长度为600
|
||||
Rmrk3 string `json:"rmrk3" comment:"备用字段3" validate:"omitempty,max=600"` // 最大长度为600
|
||||
Rmrk4 string `json:"rmrk4" comment:"备用字段4" validate:"omitempty,max=600"` // 最大长度为600
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package tysk_entity
|
||||
|
||||
import "gitea.cdlsxd.cn/self-tools/tysk/tysk_constant"
|
||||
import (
|
||||
"gitea.cdlsxd.cn/self-tools/tysk/tysk_constant"
|
||||
)
|
||||
|
||||
type (
|
||||
AccountBalance struct {
|
||||
|
@ -160,12 +162,12 @@ type (
|
|||
Message string `json:"message" comment:"未查询数据原因"` // 未查询数据原因
|
||||
}
|
||||
|
||||
// BankEnterpriseDownloadResponse 银企直联回单下载响应参数
|
||||
// ReceiptDownloadResp 电子回单文件下载
|
||||
ReceiptDownloadResp struct {
|
||||
TotalRecords string `json:"totalRecords" comment:"总记录条数"` // 成功时返回,用户具有查询权限的所有账户数量(int,选填)
|
||||
ReturnRecords string `json:"returnRecords" comment:"返回记录条数"` // 成功时返回,本次查询获取到的账户数量(int,选填)
|
||||
List []DownloadResRow `json:"list" comment:"回单文件列表"` // 回单文件明细列表(选填)
|
||||
FileContent string `json:"fileContent" comment:"回单汇总文件内容"` // Base64编码的压缩文件内容(varchar(2097152),选填)
|
||||
List []DownloadResRow `json:"resultList" comment:"回单文件列表"` // 回单文件明细列表(选填)
|
||||
FileContent string `json:"fileContent" comment:"回单汇总文件内容"` // Base64编码的压缩文件内容(varchar(2097152),选填),//交易成功时返回,返回所有回单文件汇总后压缩的文件内容,需使用base64解码后再进行zip解压缩 Base64使用commons-codec包的org.apache.commons.codec.binary.Base64 如查询到的文件压缩后超限,将返回文件超大的报错,需修改回单文件下载数量
|
||||
FileName string `json:"fileName" comment:"回单汇总文件名称"` // 汇总文件名(varchar(128),选填)
|
||||
Size string `json:"size" comment:"文件大小"` // 文件大小(单位:字节,int,选填)
|
||||
}
|
||||
|
@ -175,4 +177,158 @@ type (
|
|||
RcptNum string `json:"rcptNum" comment:"回单编号"` // 回单编号(varchar(200),选填)
|
||||
PdfName string `json:"pdfName" comment:"回单文件名称"` // 单个回单文件名(varchar(256),选填)
|
||||
}
|
||||
|
||||
// TransHisQueryApplyResp 历史明细查询申请
|
||||
TransHisQueryApplyResp struct {
|
||||
ClientId string `json:"clientId" comment:"记录申请编号"` //客户查询自定义的流水号,用于查询结果信息,流水号需唯一
|
||||
}
|
||||
|
||||
//TransHisQueryResp 历史明细结果查询 银企直联交易明细查询响应
|
||||
TransHisQueryResp struct {
|
||||
// 账户基本信息(交易成功时返回)
|
||||
AccountNo string `json:"accountNo" comment:"账号"` // 账号(varchar(40),选填)
|
||||
AccountName string `json:"accountName" comment:"账户名称"` // 账户名称(varchar(120),选填)
|
||||
OpenBankName string `json:"openBankName" comment:"开户行名称"` // 开户行名称(varchar(300),选填)
|
||||
BankName string `json:"bankName" comment:"本方所属银行"` // 本方所属银行(varchar(120),选填)
|
||||
// 记录统计信息(交易成功时返回)
|
||||
TotalRecords string `json:"totalRecords" comment:"总记录条数"` // 总记录条数(int,选填)
|
||||
ReturnRecords string `json:"returnRecords" comment:"返回记录条数"` // 返回记录条数(int,选填)
|
||||
// 交易明细列表
|
||||
List []TransHisQueryRespRow `json:"userDataList" comment:"交易明细记录"`
|
||||
}
|
||||
|
||||
TransHisQueryRespRow struct {
|
||||
SumTranNo string `json:"sumTranNo" comment:"系统交易流水号"` // 系统交易流水号(varchar(20),选填)
|
||||
TranDate string `json:"tranDate" comment:"交易日期"` // 交易日期(char(8),选填)
|
||||
TranTime string `json:"tranTime" comment:"交易时间"` // 交易时间(char(6),选填)
|
||||
AccountingDate string `json:"accountingDate" comment:"记账日期"` // 记账日期(char(8),选填)
|
||||
OppAccountNo string `json:"oppAccountNo" comment:"对方账号"` // 对方账号(varchar(40),选填)
|
||||
OppAccountName string `json:"oppAccountName" comment:"对方账户名称"` // 对方账户名称(varchar(120),选填)
|
||||
OppOpenBankName string `json:"oppOpenBankName" comment:"对方开户行名"` // 对方开户行名(varchar(120),选填)
|
||||
TranType string `json:"tranType" comment:"交易类型"` // 交易类型(char(2),选填) 02:账户支出;03:账户收入
|
||||
TranAmount string `json:"tranAmount" comment:"交易金额"` // 交易金额(decimal(15,2),选填)
|
||||
Balance string `json:"balance" comment:"账户余额"` // 账户余额(decimal(15,2),选填)
|
||||
CurrencyID string `json:"currencyID" comment:"币种"` // 币种(varchar(5),选填)
|
||||
BnkSrlnum string `json:"bnkSrlnum" comment:"银行流水号"` // 银行流水号(varchar(200),选填)
|
||||
OriginalSrlNum string `json:"originalSrlNum" comment:"原始银行流水号"` // 原始银行流水号(varchar(100),选填)
|
||||
DataSource string `json:"dataSource" comment:"数据来源"` // 数据来源(varchar(2),选填) 1:接口查询;2:用户导入
|
||||
Lvmsg string `json:"lvmsg" comment:"附言"` // 附言(varchar(512),选填)
|
||||
Smy string `json:"smy" comment:"摘要"` // 摘要(varchar(512),选填)
|
||||
Rmrk string `json:"rmrk" comment:"备注"` // 备注(varchar(512),选填)
|
||||
Purpose string `json:"purpose" comment:"用途"` // 用途(varchar(512),选填)
|
||||
ExternalNum string `json:"externalNum" comment:"外部请求流水号"` // 外部请求流水号(varchar(50),选填)
|
||||
ExternalBatNum string `json:"externalBatNum" comment:"外部请求批次号"` // 外部请求批次号(varchar(30),选填)
|
||||
AccDtlId string `json:"accDtlId" comment:"系统交易流水号"` // 系统交易流水号(varchar(20),选填)
|
||||
ExtendRemark string `json:"extendRemark" comment:"扩展字段1"` // 扩展字段1(varchar(20),选填)
|
||||
|
||||
// 机构信息
|
||||
InstName string `json:"instName" comment:"机构名称"` // 机构名称(varchar(360),选填)
|
||||
InstCode string `json:"instCode" comment:"机构编码"` // 机构编码(varchar(20),选填)
|
||||
|
||||
}
|
||||
|
||||
// BalanceHisQueryApplyResp 历史明细查询申请
|
||||
BalanceHisQueryApplyResp struct {
|
||||
ClientId string `json:"clientId" comment:"记录申请编号"` //客户查询自定义的流水号,用于查询结果信息,流水号需唯一
|
||||
}
|
||||
|
||||
// BalanceHisQueryResp 银企直联交易明细查询响应
|
||||
BalanceHisQueryResp struct {
|
||||
ClientID string `json:"clientID" comment:"记录申请编号"` // 客户查询自定义的流水号,用于查询结果信息,流水号需唯一(char(20),必填)
|
||||
|
||||
// 账户交易明细列表(交易成功时返回)
|
||||
List []BalanceHisQueryRespRow `json:"userDataList" comment:"交易明细记录"`
|
||||
}
|
||||
|
||||
BalanceHisQueryRespRow struct {
|
||||
AccountNo string `json:"accountNo" comment:"账号"` // 账号(varchar(40),必填)
|
||||
AccountName string `json:"accountName" comment:"账户名称"` // 账户名称(varchar(120),必填)
|
||||
Balance float64 `json:"balance" comment:"历史余额"` // 余额(decimal(15,2),选填)
|
||||
CurrencyID string `json:"currencyID" comment:"币种"` // 币种(varchar(5),选填)
|
||||
Date string `json:"date" comment:"日期"` // 余额日期(char(8),选填,格式yyyyMMdd)
|
||||
DataSource string `json:"dataSource" comment:"数据来源"` // 数据来源(char(2),选填)
|
||||
DataStatus string `json:"dataStatus" comment:"数据状态"` // 数据状态(char(2),必填)
|
||||
LastUdtTms string `json:"lastUdtTms" comment:"更新时间"` // 更新时间(char(15),选填,格式yyyyMMddHHmmssSSS)
|
||||
}
|
||||
|
||||
// AccountsTransHisQueryResp 多账户历史明细查询
|
||||
AccountsTransHisQueryResp struct {
|
||||
TotalRecords string `json:"totalRecords" comment:"总记录条数(int,选填)"`
|
||||
ReturnRecords string `json:"returnRecords" comment:"返回记录条数(int,选填)"`
|
||||
|
||||
// 交易明细列表
|
||||
List []AccountsTransHisQueryRow `json:"userDataList" comment:"交易明细列表"`
|
||||
}
|
||||
|
||||
AccountsTransHisQueryRow struct {
|
||||
// 基础交易信息
|
||||
SumTranNo string `json:"sumTranNo" comment:"系统交易流水号(varchar(20),选填)"`
|
||||
TranDate string `json:"tranDate" comment:"交易日期(char(8),格式yyyyMMdd,选填)"`
|
||||
TranTime string `json:"tranTime" comment:"交易时间(char(6),格式hhmmss,选填)"`
|
||||
AccountingDate string `json:"accountingDate" comment:"记账日期(char(8),格式yyyyMMdd,选填)"`
|
||||
|
||||
// 本方账户信息
|
||||
AccountNo string `json:"accountNo" comment:"本方账号(varchar(40),选填)"`
|
||||
AccountName string `json:"accountName" comment:"账户名称(varchar(120),选填)"`
|
||||
OpenBankName string `json:"openBankName" comment:"开户行名称(varchar(300),选填)"`
|
||||
BankName string `json:"bankName" comment:"本方所属银行(varchar(120),选填)"`
|
||||
InstName string `json:"instName" comment:"机构名称(varchar(360),选填)"`
|
||||
InstCode string `json:"instCode" comment:"机构编码(varchar(20),选填)"`
|
||||
|
||||
// 对方账户信息
|
||||
OppAccountNo string `json:"oppAccountNo" comment:"对方账号(varchar(40),选填)"`
|
||||
OppAccountName string `json:"oppAccountName" comment:"对方账户名称(varchar(120),选填)"`
|
||||
OppOpenBankName string `json:"oppOpenBankName" comment:"对方开户行名(varchar(120),选填)"`
|
||||
OppOpenBankNo string `json:"oppOpenBankNo" comment:"对方开户行联行号(varchar(32),选填)"`
|
||||
|
||||
// 交易属性
|
||||
TranType string `json:"tranType" comment:"借贷方向(char(2),02:借;03:贷,选填)"`
|
||||
TranAmount string `json:"tranAmount" comment:"交易金额(decimal(15,2),选填)"`
|
||||
Rrtanid string `json:"rrtanid" comment:"退汇标识(char(1),0已退汇;1非退汇;2手工退汇,选填)"`
|
||||
|
||||
// 余额信息
|
||||
Balance string `json:"balance" comment:"账户余额(decimal(15,2),选填)"`
|
||||
CurrencyID string `json:"currencyID" comment:"币种(varchar(5),选填)"`
|
||||
|
||||
// 流水号信息
|
||||
TxnSrlnum string `json:"txnSrlnum" comment:"交易流水号(varchar(200),选填)"`
|
||||
BnkSrlnum string `json:"bnkSrlnum" comment:"银行流水号(varchar(200),选填)"`
|
||||
OriginalSrlnum string `json:"originalSrlnum" comment:"原始银行流水号(varchar(100),选填,仅平安银行支持)"`
|
||||
AccDtlId string `json:"accDtlId" comment:"系统交易流水号(varchar(20),选填,与sumTranNo一致)"`
|
||||
|
||||
// 数据来源信息
|
||||
DataSource string `json:"dataSource" comment:"数据来源(varchar(2),1直联;2非直联-人工;3非直联-智能,选填)"`
|
||||
|
||||
// 交易描述信息
|
||||
Lvmsg string `json:"lvmsg" comment:"附言(varchar(512),选填)"`
|
||||
Smy string `json:"smy" comment:"摘要(varchar(512),选填)"`
|
||||
Rmrk string `json:"rmrk" comment:"备注(varchar(512),选填)"`
|
||||
Purpose string `json:"purpose" comment:"用途(varchar(512),选填)"`
|
||||
|
||||
// 交易类型标识
|
||||
CashTfrId string `json:"cashTfrId" comment:"现转标识(char(1),0现金;1转账,选填)"`
|
||||
|
||||
// 系统时间信息
|
||||
HdlTms string `json:"hdlTms" comment:"直联获取时间(TIMESTAMP,格式yyyy-MM-dd HH:mm:ss,选填)"`
|
||||
|
||||
// 外部对账信息
|
||||
ExternalNum string `json:"externalNum" comment:"外部请求流水号(varchar(50),选填)"`
|
||||
ExternalBatNum string `json:"externalBatNum" comment:"外部请求批次号(varchar(30),选填)"`
|
||||
|
||||
// 扩展字段
|
||||
ExtendRemark string `json:"extendRemark" comment:"扩展字段1(varchar(20),仅兴业银行支持,选填)"`
|
||||
|
||||
// 账户属性信息
|
||||
IsOpnDirconId string `json:"isOpnDirconId" comment:"联网方式(char(1),0非直联;1直联,选填)"`
|
||||
AccCgyId string `json:"accCgyId" comment:"账户性质(char(20),1一般账户;2基本账户;3专用账户;4临时账户;5其他,选填)"`
|
||||
AccTpId string `json:"accTpId" comment:"存款类型(char(20),1活期;2定期;3通知;4活期保证金;5定期保证金;6其他,选填)"`
|
||||
IsFrgnAccId string `json:"isFrgnAccId" comment:"境内/境外账户(char(1),0境内;1境外,选填)"`
|
||||
AccCharId string `json:"accCharId" comment:"账户属性(char(20),1实账户;2登记簿,选填)"`
|
||||
}
|
||||
|
||||
// SinglePayResp 单笔付款
|
||||
SinglePayResp struct {
|
||||
ExternalNum string `json:"externalNum" comment:"外部请求流水号"` // 入参流水号返回
|
||||
DealMode string `json:"dealMode" comment:"处理模式"` // 1.审批处理 2.直接出账 3.经办处理
|
||||
}
|
||||
)
|
||||
|
|
69
tysk_test.go
69
tysk_test.go
|
@ -67,3 +67,72 @@ func Test_ReceiptDownload(t *testing.T) {
|
|||
res, err := g.ReceiptDownload(req)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
||||
func Test_TransHisQueryApply(t *testing.T) {
|
||||
req := tysk_entity.TransHisQueryApplyReq{
|
||||
ClientID: "123456",
|
||||
AccountNo: "8110701013301269598",
|
||||
StartDate: "20250729",
|
||||
EndDate: "20250803",
|
||||
}
|
||||
res, err := g.TransHisQueryApply(req)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
||||
func Test_TransHisQuery(t *testing.T) {
|
||||
req := tysk_entity.TransHisQueryReq{
|
||||
ClientID: "123456",
|
||||
TranType: tysk_constant.TranTypeAll,
|
||||
StartRecord: 1,
|
||||
PageNumber: 10,
|
||||
}
|
||||
res, err := g.TransHisQuery(req)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
||||
func Test_BalanceHisQueryApply(t *testing.T) {
|
||||
req := tysk_entity.BalanceHisQueryApplyReq{
|
||||
ClientID: "123456",
|
||||
AccountNo: []tysk_constant.AccountNo{"8110701013301269598", "8110701012401269599", "8110701013801269600"},
|
||||
StartDate: "20250728",
|
||||
EndDate: "20250803",
|
||||
}
|
||||
res, err := g.BalanceHisQueryApply(req)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
||||
func Test_BalanceHisQuery(t *testing.T) {
|
||||
req := tysk_entity.BalanceHisQueryReq{
|
||||
ClientID: "123456",
|
||||
StartRecord: 1,
|
||||
PageNumber: 10,
|
||||
}
|
||||
res, err := g.BalanceHisQuery(req)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
||||
func Test_AccountsTransHisQuery(t *testing.T) {
|
||||
req := tysk_entity.AccountsTransHisQueryReq{
|
||||
TranType: tysk_constant.TranTypeAll,
|
||||
StartDate: "20250728",
|
||||
EndDate: "20250803",
|
||||
StartRecord: 1,
|
||||
PageNumber: 10,
|
||||
AccountNo: []tysk_constant.AccountNo{"8110701013301269598", "8110701012401269599", "8110701013801269600"},
|
||||
}
|
||||
res, err := g.AccountsTransHisQuery(req)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
||||
func Test_SinglePay(t *testing.T) {
|
||||
req := tysk_entity.AccountsTransHisQueryReq{
|
||||
TranType: tysk_constant.TranTypeAll,
|
||||
StartDate: "20250728",
|
||||
EndDate: "20250803",
|
||||
StartRecord: 1,
|
||||
PageNumber: 10,
|
||||
AccountNo: []tysk_constant.AccountNo{"8110701013301269598", "8110701012401269599", "8110701013801269600"},
|
||||
}
|
||||
res, err := g.SinglePay(req)
|
||||
t.Log(res, err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue