feat(erp): 新增货币汇率服务及收汇水单批量生成
- 新增 currencyRate 模块,支持按货币和日期查询汇率信息 - 定义汇率响应结构,包含中间价、现钞卖出价、买入价等字段 - 在 ERP 服务结构体中注册 CurrencyRate 客户端 - 新增收汇水单批量生成接口 Gen,支持按交易明细ID批量生成 - 定义 ArgsReceiptGen 参数结构,包含员工ID和交易明细ID列表
This commit is contained in:
34
erp/currencyRate.go
Normal file
34
erp/currencyRate.go
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package erp
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
client2 "git.kumo.work/shama/service/client"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type currencyRate struct {
|
||||||
|
}
|
||||||
|
type ArgsCurrencyRateDay struct {
|
||||||
|
Currency string `binding:"required" label:"货币"`
|
||||||
|
Day time.Time `binding:"required" label:"日期"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyCurrencyRateItem struct {
|
||||||
|
MiddleRate decimal.Decimal `json:"middleRate"`
|
||||||
|
CashSellingRate decimal.Decimal `json:"cashSellingRate"`
|
||||||
|
BuyingRate decimal.Decimal `json:"buyingRate"`
|
||||||
|
CashBuyingRate decimal.Decimal `json:"cashBuyingRate"`
|
||||||
|
SellingRate decimal.Decimal `json:"sellingRate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Day @TITLE 获取货币汇率
|
||||||
|
func (c *currencyRate) Day(ctx context.Context, args ArgsCurrencyRateDay) (reply ReplyCurrencyRateItem, err error) {
|
||||||
|
xClient, err := client2.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Day", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
@@ -22,4 +22,5 @@ type Erp struct {
|
|||||||
Dict dict
|
Dict dict
|
||||||
Ik3cloud ik3cloud
|
Ik3cloud ik3cloud
|
||||||
Transfer transfer
|
Transfer transfer
|
||||||
|
CurrencyRate currencyRate
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,3 +198,18 @@ func (r *receipt) Cancel(ctx context.Context, receiptId int64) (err error) {
|
|||||||
reply := 0
|
reply := 0
|
||||||
return xClient.Call(ctx, "Cancel", receiptId, &reply)
|
return xClient.Call(ctx, "Cancel", receiptId, &reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ArgsReceiptGen struct {
|
||||||
|
StaffId int64
|
||||||
|
BankStatementIds []int64 // 交易明细id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gen @TITLE 批量生成收汇水单
|
||||||
|
func (r *receipt) Gen(ctx context.Context, args ArgsReceiptGen) (receiptIds []int64, err error) {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Gen", args, &receiptIds)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ type StatementItem struct {
|
|||||||
FeeInfo string `json:"feeInfo"`
|
FeeInfo string `json:"feeInfo"`
|
||||||
CreatedAt *time.Time `json:"createdAt"`
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
UpdatedAt *time.Time `json:"updatedAt"`
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||||||
|
ReceiptId int64 `json:"receiptId"` // 生成的收汇水单id 0=未生成
|
||||||
}
|
}
|
||||||
|
|
||||||
// List @TITLE 列表
|
// List @TITLE 列表
|
||||||
|
|||||||
Reference in New Issue
Block a user