Files
service/erp/expense.go
kanade 93524fca2f feat(erp): 添加银行账户信息字段和批量修改功能
- 在报销单、付款单和申请单中添加银行账号和账号名称字段
- 为报销单、付款单和申请单实现批量修改银行账户信息功能
- 在ik3cloud常量中添加银行账户操作类型
- 新增字典查询相关结构体和过滤条件类型
- 更新金蝶同步相关服务以支持银行账户信息处理
2026-01-08 11:54:02 +08:00

179 lines
5.5 KiB
Go

package erp
import (
"context"
"time"
"git.kumo.work/shama/service/client"
expense2 "git.kumo.work/shama/service/erp/expense"
"git.kumo.work/shama/service/lib/bean"
"github.com/shopspring/decimal"
)
type expense struct {
expense2.Expense
}
type ArgsExpenseList struct {
Page bean.Page
Search ExpenseSearch
}
type ExpenseSearch struct {
ExpenseSerial string // 报销单号
CreatedAtStart *time.Time // 创建开始时间
CreatedAtEnd *time.Time // 创建结束时间
ExpenseIds []int64 // 报销单id
BanFlag int64 // 禁用标记 1=禁用 2=启用
BankAccount string // 银行账号
BankName string // 账号名称
}
type ReplyExpenseList struct {
List []ExpenseItem `json:"list"`
Total int64 `json:"total"`
}
type ExpenseItem struct {
Id int64 `json:"id"`
ExpenseSerial string `json:"expenseSerial"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencySymbol string `json:"currencySymbol"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
Remarks string `json:"remarks"`
BankAccount string `json:"bankAccount"`
BankName string `json:"bankName"`
Amount decimal.Decimal `json:"amount"`
WorkflowId int64 `json:"workflowId"`
WorkflowStatus int64 `json:"workflowStatus"`
WorkflowReason string `json:"workflowReason"`
ExpenseStaffId int64 `json:"expenseStaffId"`
CreatedStaffId int64 `json:"createdStaffId"`
BanFlag int64 `json:"banFlag"`
Ik3cloudStatus int64 `json:"ik3CloudStatus"`
Ik3cloudErrMsg string `json:"ik3CloudErrMsg"`
Ik3cloudUpdatedAt *time.Time `json:"ik3CloudUpdatedAt"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 列表
func (r *expense) List(ctx context.Context, args ArgsExpenseList) (reply ReplyExpenseList, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsExpenseAdd struct {
StaffId int64
ExpenseAdd
}
type ExpenseAdd struct {
Currency string // 币种
CurrencyName string // 币种名称
CurrencySymbol string // 币种符号
CurrencyRate decimal.Decimal // 币种汇率
Remarks string // 备注
ExpenseStaffId int64 // 报销人
BankAccount string // 银行账号
BankName string // 账号名称
}
// Add @TITLE 添加
func (r *expense) Add(ctx context.Context, args ArgsExpenseAdd) (expenseId int64, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "Add", args, &expenseId)
return
}
type ReplyExpenseInfo struct {
Id int64 `json:"id"`
ExpenseSerial string `json:"expenseSerial"`
Currency string `json:"currency"`
CurrencyName string `json:"currencyName"`
CurrencySymbol string `json:"currencySymbol"`
CurrencyRate decimal.Decimal `json:"currencyRate"`
Amount decimal.Decimal `json:"amount"`
Remarks string `json:"remarks"`
BankAccount string `json:"bankAccount"`
BankName string `json:"bankName"`
WorkflowId int64 `json:"workflowId"`
WorkflowStatus int64 `json:"workflowStatus"`
WorkflowReason string `json:"workflowReason"`
ExpenseStaffId int64 `json:"expenseStaffId"`
CreatedStaffId int64 `json:"createdStaffId"`
BanFlag int64 `json:"banFlag"`
Ik3cloudStatus int64 `json:"ik3CloudStatus"`
Ik3cloudErrMsg string `json:"ik3CloudErrMsg"`
Ik3cloudUpdatedAt *time.Time `json:"ik3CloudUpdatedAt"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// Info @TITLE 详情
func (r *expense) Info(ctx context.Context, expenseId int64) (reply ReplyExpenseInfo, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", expenseId, &reply)
return
}
type ArgsExpenseEdit struct {
ExpenseId int64
ExpenseAdd
}
// Edit @TITLE 编辑
func (r *expense) Edit(ctx context.Context, args ArgsExpenseEdit) (err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
type ArgsExpenseChange struct {
ExpenseIds []int64 // 报销单id
ExpenseChangeItem
}
type ExpenseChangeItem struct {
BankAccount string // 银行账号
BankName string // 账号名称
}
// BatchChange @TITLE 批量修改
func (r *expense) BatchChange(ctx context.Context, args ArgsExpenseChange) (err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "BatchChange", args, &reply)
}
// Ik3cloud @TITLE 同步
func (r *expense) Ik3cloud(ctx context.Context, expenseId int64) (err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Ik3cloud", expenseId, &reply)
}
// Cancel @TITLE 作废
func (r *expense) Cancel(ctx context.Context, expenseId int64) (err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Cancel", expenseId, &reply)
}