From 885d3cf055cd687a1704d9d45e7bdac842227153 Mon Sep 17 00:00:00 2001 From: sian Date: Thu, 13 Apr 2023 15:40:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E4=BD=99=E9=A2=9D=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customer/customer.go | 2 ++ customer/finance/finance.go | 5 ++++ customer/finance/wallet.go | 60 +++++++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 customer/finance/finance.go create mode 100644 customer/finance/wallet.go diff --git a/customer/customer.go b/customer/customer.go index ad1f7b7..5b5c0fa 100644 --- a/customer/customer.go +++ b/customer/customer.go @@ -2,6 +2,7 @@ package customer import ( "git.oa00.com/supply-chain/service/customer/batchSku" + "git.oa00.com/supply-chain/service/customer/finance" "git.oa00.com/supply-chain/service/customer/service" "git.oa00.com/supply-chain/service/customer/sku" ) @@ -11,4 +12,5 @@ type Customer struct { Service service.Service Sku sku.Sku BatchSku batchSku.BatchSku + Finance finance.Finance } diff --git a/customer/finance/finance.go b/customer/finance/finance.go new file mode 100644 index 0000000..3f929a7 --- /dev/null +++ b/customer/finance/finance.go @@ -0,0 +1,5 @@ +package finance + +type Finance struct { + Wallet wallet +} diff --git a/customer/finance/wallet.go b/customer/finance/wallet.go new file mode 100644 index 0000000..92bc1be --- /dev/null +++ b/customer/finance/wallet.go @@ -0,0 +1,60 @@ +package finance + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "github.com/shopspring/decimal" +) + +type wallet struct { +} + +type ArgsWalletDetail struct { + Year uint // 年份 + Month uint // 月份 +} + +type WalletItem struct { + CustomerName string `json:"customerName"` // 客户名称 + CreatedAt int64 `json:"createdAt"` // 交易时间 + Type uint `json:"type"` // 交易类型 + Amount decimal.Decimal `json:"amount"` // 交易金额 + AfterAmount decimal.Decimal `json:"afterAmount"` // 交易后余额 + TradeChannel string `json:"tradeChannel"` // 交易渠道 + TradeSerialSn string `json:"tradeSerialSn"` // 交易流水号 + Remark string `json:"remark"` // 交易备注 +} + +// WalletDetail @Title 余额统计 +func (w *wallet) WalletDetail(ctx context.Context, args ArgsWalletDetail) (reply []WalletItem, err error) { + xClient, err := client.GetClient(w) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "WalletDetail", args, &reply) + return +} + +type ArgsUserWallet struct { + Year uint // 年份 + Month uint // 月份 +} + +type UserWalletItem struct { + CustomerName string `json:"customerName"` + BeforeAmount decimal.Decimal `json:"beforeAmount"` // 期初余额 + AfterAmount decimal.Decimal `json:"afterAmount"` // 期末余额 + ConsumeAmount decimal.Decimal `json:"consumeAmount"` // 消费金额 + ReturnAmount decimal.Decimal `json:"returnAmount"` // 退款金额 + RechargeAmount decimal.Decimal `json:"rechargeAmount"` // 充值金额 +} + +// UserWallet @Title 客户余额 +func (w *wallet) UserWallet(ctx context.Context, args ArgsWalletDetail) (reply []UserWalletItem, err error) { + xClient, err := client.GetClient(w) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "UserWallet", args, &reply) + return +}