feat(erp): 新增收汇管理模块及相关功能
- 新增收汇单据管理,支持列表、详情、新增、编辑功能 - 新增收汇认领管理,支持认领列表、新增、编辑、删除、确认及取消确认功能 - 新增国内扣费类型常量定义(外币、人民币) - 优化服务发现逻辑,针对特定 basePath 使用本地调试地址 - 修复应收模块方法接收者命名问题,统一为 r *receivable
This commit is contained in:
@@ -61,9 +61,18 @@ func GetClient(s interface{}) (*RpcClient, error) {
|
|||||||
mutex.Lock()
|
mutex.Lock()
|
||||||
xClient, ok = mClient.Load(key)
|
xClient, ok = mClient.Load(key)
|
||||||
if !ok {
|
if !ok {
|
||||||
d, err := consulClient.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil)
|
var d client.ServiceDiscovery
|
||||||
if err != nil {
|
var err error
|
||||||
return nil, errors.New("系统异常")
|
if basePath == "ik3cloud" {
|
||||||
|
d, err = client.NewPeer2PeerDiscovery("tcp@localhost:8081", "")
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("系统异常")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
d, err = consulClient.NewConsulDiscovery(basePath, servicePath, config.RpcConfig.RegistryServer, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.New("系统异常")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
option := client.DefaultOption
|
option := client.DefaultOption
|
||||||
option.Retries = 3
|
option.Retries = 3
|
||||||
|
|||||||
@@ -81,3 +81,9 @@ const (
|
|||||||
FlagTrue Flag = 1 // 是
|
FlagTrue Flag = 1 // 是
|
||||||
FlagFalse Flag = 2 // 否
|
FlagFalse Flag = 2 // 否
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type DomesticFeeType = int64 // 国内扣费类型 1=外币 2=人民币
|
||||||
|
const (
|
||||||
|
DomesticFeeTypeForeign DomesticFeeType = 1 // 外币
|
||||||
|
DomesticFeeTypeRMB DomesticFeeType = 2 // 人民币
|
||||||
|
)
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ type Erp struct {
|
|||||||
Accounting accounting
|
Accounting accounting
|
||||||
Payable payable
|
Payable payable
|
||||||
Receivable receivable
|
Receivable receivable
|
||||||
|
Receipt receipt
|
||||||
}
|
}
|
||||||
|
|||||||
129
erp/receipt.go
Normal file
129
erp/receipt.go
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
package erp
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.kumo.work/shama/service/client"
|
||||||
|
receipt2 "git.kumo.work/shama/service/erp/receipt"
|
||||||
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type receipt struct {
|
||||||
|
receipt2.Receipt
|
||||||
|
}
|
||||||
|
type ArgsReceiptList struct {
|
||||||
|
Page bean.Page
|
||||||
|
Search ReceiptSearch
|
||||||
|
}
|
||||||
|
type ReceiptSearch struct {
|
||||||
|
ReceiptSerial string // 收汇单号
|
||||||
|
PayName string // 付款单位
|
||||||
|
BankName string // 结汇银行
|
||||||
|
ReceiptDateStart *time.Time // 创建开始时间
|
||||||
|
ReceiptDateEnd *time.Time // 创建结束时间
|
||||||
|
}
|
||||||
|
type ReplyReceiptList struct {
|
||||||
|
List []ReceiptItem `json:"list"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
type ReceiptItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
ReceiptSerial string `json:"receiptSerial"`
|
||||||
|
PayName string `json:"payName"`
|
||||||
|
ReceiptDate time.Time `json:"receiptDate"`
|
||||||
|
Currency string `json:"currency"`
|
||||||
|
CurrencyName string `json:"currencyName"`
|
||||||
|
CurrencySymbol string `json:"currencySymbol"`
|
||||||
|
CurrencyRate decimal.Decimal `json:"currencyRate"`
|
||||||
|
BankName string `json:"bankName"`
|
||||||
|
EntryAmount decimal.Decimal `json:"entryAmount"`
|
||||||
|
ReceivableFxAmount decimal.Decimal `json:"receivableFxAmount"`
|
||||||
|
CreatedStaffId int64 `json:"createdStaffId"`
|
||||||
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @TITLE 列表
|
||||||
|
func (r *receipt) List(ctx context.Context, args ArgsReceiptList) (reply ReplyReceiptList, err error) {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsReceiptAdd struct {
|
||||||
|
StaffId int64
|
||||||
|
ReceiptAdd
|
||||||
|
}
|
||||||
|
type ReceiptAdd struct {
|
||||||
|
ReceiptDate time.Time // 收汇日期
|
||||||
|
Currency string // 币种
|
||||||
|
CurrencyName string // 币种名称
|
||||||
|
CurrencySymbol string // 币种符号
|
||||||
|
CurrencyRate decimal.Decimal // 币种汇率
|
||||||
|
PayName string // 付款单位
|
||||||
|
BankName string // 结汇银行
|
||||||
|
EntryAmount decimal.Decimal // 外币入账金额
|
||||||
|
ForeignFee decimal.Decimal // 国外扣费
|
||||||
|
DomesticFee decimal.Decimal // 国内扣费
|
||||||
|
DomesticFeeType DomesticFeeType // 国内扣费类型 1=外币 2=人民币
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @TITLE 添加
|
||||||
|
func (r *receipt) Add(ctx context.Context, args ArgsReceiptAdd) (receiptId int64, err error) {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Add", args, &receiptId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReplyReceiptInfo struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
ReceiptSerial string `json:"receiptSerial"`
|
||||||
|
ReceiptDate time.Time `json:"receiptDate"`
|
||||||
|
Currency string `json:"currency"`
|
||||||
|
CurrencyName string `json:"currencyName"`
|
||||||
|
CurrencySymbol string `json:"currencySymbol"`
|
||||||
|
CurrencyRate decimal.Decimal `json:"currencyRate"`
|
||||||
|
PayName string `json:"payName"`
|
||||||
|
BankName string `json:"bankName"`
|
||||||
|
EntryAmount decimal.Decimal `json:"entryAmount"`
|
||||||
|
ForeignFee decimal.Decimal `json:"foreignFee"`
|
||||||
|
DomesticFee decimal.Decimal `json:"domesticFee"`
|
||||||
|
DomesticFeeType int64 `json:"domesticFeeType"`
|
||||||
|
ReceivableFxAmount decimal.Decimal `json:"receivableFxAmount"`
|
||||||
|
CreatedStaffId int64 `json:"createdStaffId"`
|
||||||
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Info @TITLE 详情
|
||||||
|
func (r *receipt) Info(ctx context.Context, receiptId int64) (reply ReplyReceiptInfo, err error) {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "Info", receiptId, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsReceiptEdit struct {
|
||||||
|
ReceiptId int64
|
||||||
|
ReceiptAdd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit @TITLE 编辑
|
||||||
|
func (r *receipt) Edit(ctx context.Context, args ArgsReceiptEdit) (err error) {
|
||||||
|
xClient, err := client.GetClient(r)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||||||
|
}
|
||||||
127
erp/receipt/claim.go
Normal file
127
erp/receipt/claim.go
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
package receipt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.kumo.work/shama/service/client"
|
||||||
|
"git.kumo.work/shama/service/lib/bean"
|
||||||
|
"github.com/shopspring/decimal"
|
||||||
|
)
|
||||||
|
|
||||||
|
type claim struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsClaimList struct {
|
||||||
|
Page bean.Page
|
||||||
|
Search ClaimSearch
|
||||||
|
}
|
||||||
|
type ClaimSearch struct {
|
||||||
|
ReceiptId int64 // 收汇单ID
|
||||||
|
}
|
||||||
|
type ReplyClaimList struct {
|
||||||
|
List []ClaimItem `json:"list"`
|
||||||
|
Total int64 `json:"total"`
|
||||||
|
}
|
||||||
|
type ClaimItem struct {
|
||||||
|
Id int64 `json:"id"`
|
||||||
|
ReceivableId int64 `json:"receivableId"`
|
||||||
|
InvoiceSerial string `json:"invoiceSerial"`
|
||||||
|
Amount decimal.Decimal `json:"amount"`
|
||||||
|
CustomName string `json:"customName"`
|
||||||
|
IsConfirm int64 `json:"isConfirm"`
|
||||||
|
CreatedStaffId int64 `json:"createdStaffId"`
|
||||||
|
CreatedAt *time.Time `json:"createdAt"`
|
||||||
|
UpdatedAt *time.Time `json:"updatedAt"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// List @TITLE 列表
|
||||||
|
func (c *claim) List(ctx context.Context, args ArgsClaimList) (reply ReplyClaimList, err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
err = xClient.Call(ctx, "List", args, &reply)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsClaimAdd struct {
|
||||||
|
StaffId int64
|
||||||
|
ClaimAdd
|
||||||
|
}
|
||||||
|
type ClaimAdd struct {
|
||||||
|
ReceiptId int64 // 收汇单ID
|
||||||
|
ReceivableId int64 // 应收单ID
|
||||||
|
Amount decimal.Decimal // 应收金额
|
||||||
|
Remarks string // 备注
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add @TITLE 添加
|
||||||
|
func (c *claim) Add(ctx context.Context, args ArgsClaimAdd) (err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Add", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsClaimEdit struct {
|
||||||
|
ClaimId int64
|
||||||
|
ClaimAdd
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit @TITLE 编辑
|
||||||
|
func (c *claim) Edit(ctx context.Context, args ArgsClaimEdit) (err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Edit", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsClaimDelete struct {
|
||||||
|
ReceiptId int64 // 收汇单ID
|
||||||
|
ClaimIds []int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete @TITLE 删除
|
||||||
|
func (c *claim) Delete(ctx context.Context, args ArgsClaimDelete) (err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Delete", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsClaimConfirm struct {
|
||||||
|
ReceiptId int64 // 收汇单ID
|
||||||
|
ClaimIds []int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// Confirm @TITLE 确认
|
||||||
|
func (c *claim) Confirm(ctx context.Context, args ArgsClaimConfirm) (err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "Confirm", args, &reply)
|
||||||
|
}
|
||||||
|
|
||||||
|
type ArgsClaimCancelConfirm struct {
|
||||||
|
ReceiptId int64 // 收汇单ID
|
||||||
|
ClaimIds []int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// CancelConfirm @TITLE 取消确认
|
||||||
|
func (c *claim) CancelConfirm(ctx context.Context, args ArgsClaimCancelConfirm) (err error) {
|
||||||
|
xClient, err := client.GetClient(c)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
reply := 0
|
||||||
|
return xClient.Call(ctx, "CancelConfirm", args, &reply)
|
||||||
|
}
|
||||||
5
erp/receipt/receipt.go
Normal file
5
erp/receipt/receipt.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package receipt
|
||||||
|
|
||||||
|
type Receipt struct {
|
||||||
|
Claim claim
|
||||||
|
}
|
||||||
@@ -44,8 +44,8 @@ type ReceivableItem struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// List @TITLE 列表
|
// List @TITLE 列表
|
||||||
func (p *receivable) List(ctx context.Context, args ArgsReceivableList) (reply ReplyReceivableList, err error) {
|
func (r *receivable) List(ctx context.Context, args ArgsReceivableList) (reply ReplyReceivableList, err error) {
|
||||||
xClient, err := client.GetClient(p)
|
xClient, err := client.GetClient(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -86,8 +86,8 @@ type ReceivableProductItem struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Info @TITLE 详情
|
// Info @TITLE 详情
|
||||||
func (p *receivable) Info(ctx context.Context, receivableId int64) (reply ReplyReceivableInfo, err error) {
|
func (r *receivable) Info(ctx context.Context, receivableId int64) (reply ReplyReceivableInfo, err error) {
|
||||||
xClient, err := client.GetClient(p)
|
xClient, err := client.GetClient(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user