- 将 ChangeProductItem 中的 SaleCount 和 SalePrice 字段改为指针类型 - 将 ChangeProduct 中的 SaleCount 和 SalePrice 字段改为指针类型 - 保持其他字段类型不变以维持兼容性 - 通过指针类型支持空值处理场景
58 lines
1.5 KiB
Go
58 lines
1.5 KiB
Go
package sale
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.kumo.work/shama/service/client"
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
type change struct {
|
|
}
|
|
|
|
type ArgsChangeAllSearch struct {
|
|
SaleId int64 // 销售合同id
|
|
WorkflowId int64 // 审核id
|
|
}
|
|
type ChangeProduct struct {
|
|
Id int64 `json:"id"`
|
|
SaleProductID int64 `json:"saleProductID"`
|
|
BeforeSaleCount int64 `json:"beforeSaleCount"`
|
|
SaleCount *int64 `json:"saleCount"`
|
|
BeforeSalePrice decimal.Decimal `json:"beforeSalePrice"`
|
|
SalePrice *decimal.Decimal `json:"salePrice"`
|
|
CreatedAt *time.Time `json:"createdAt"`
|
|
UpdatedAt *time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// All @TITLE 获取产品
|
|
func (c *change) All(ctx context.Context, args ArgsChangeAllSearch) (reply []ChangeProduct, err error) {
|
|
xClient, err := client.GetClient(c)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "All", args, &reply)
|
|
return
|
|
}
|
|
|
|
// Benefit @TITLE 效益测算
|
|
func (c *change) Benefit(ctx context.Context, args ArgsAppendBenefit) (reply ReplyBenefitInfo, err error) {
|
|
xClient, err := client.GetClient(c)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Benefit", args, &reply)
|
|
return
|
|
}
|
|
|
|
// AuditBenefit @TITLE 审核效益测算
|
|
func (c *change) AuditBenefit(ctx context.Context, args ArgsAppendBenefit) (reply ReplyBenefitInfo, err error) {
|
|
xClient, err := client.GetClient(c)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "AuditBenefit", args, &reply)
|
|
return
|
|
}
|