diff --git a/rpc.go b/rpc.go index f53982f..3046df6 100644 --- a/rpc.go +++ b/rpc.go @@ -5,13 +5,15 @@ import ( "git.oa00.com/supply-chain/service/jd" "git.oa00.com/supply-chain/service/supplier" "git.oa00.com/supply-chain/service/supply" + "git.oa00.com/supply-chain/service/wholesale" ) var Rpc = &rpc{} type rpc struct { - Supply supply.Supply - Jd jd.Jd - Customer customer.Customer - Supplier supplier.Supplier + Supply supply.Supply + Jd jd.Jd + Customer customer.Customer + Supplier supplier.Supplier + Wholesale wholesale.Wholesale } diff --git a/wholesale/brand.go b/wholesale/brand.go new file mode 100644 index 0000000..231096b --- /dev/null +++ b/wholesale/brand.go @@ -0,0 +1,103 @@ +package wholesale + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" +) + +type brand struct { +} + +type ArgsBrandList struct { + Search BrandSearch + Page bean.Page +} + +type BrandItem struct { + Id uint `json:"id"` + Name string `json:"name"` + CreatedAt int64 `json:"createdAt"` + UpdatedAt int64 `json:"updatedAt"` +} +type ReplyBrandList struct { + Lists []BrandItem `json:"lists"` + Total int64 `json:"total"` +} + +type BrandSearch struct { + Name string // 品牌名称 +} + +// Lists @Title 品牌列表 +func (b *brand) Lists(ctx context.Context, args ArgsBrandList) (result ReplyBrandList, err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &result) + return +} + +// All @Title 全部品牌 +func (b *brand) All(ctx context.Context) (result []BrandItem, err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "All", 0, &result) + return +} + +// FindByNameAll @Title 品牌名称筛选品牌 +func (b *brand) FindByNameAll(ctx context.Context, name string) (result []BrandItem, err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "FindByNameAll", name, &result) + return +} + +type ArgsBrandAdd struct { + Name string // 品牌名称 +} + +// Add @Title 添加品牌 +func (b *brand) Add(ctx context.Context, args ArgsBrandAdd) (err error) { + reply := 0 + xClient, err := client.GetClient(b) + if err != nil { + return err + } + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsBrandEdit struct { + BrandId uint // 品牌id + Name string // 品牌名称 +} + +// Edit @Title 编辑品牌 +func (b *brand) Edit(ctx context.Context, args ArgsBrandEdit) (err error) { + reply := 0 + xClient, err := client.GetClient(b) + if err != nil { + return err + } + return xClient.Call(ctx, "Edit", args, &reply) +} + +type ArgsBrandFindByIds struct { + BrandIds []uint // 品牌id数组 +} + +// FindByIds @Title 品牌获取 +func (b *brand) FindByIds(ctx context.Context, args ArgsBrandFindByIds) (result []BrandItem, err error) { + xClient, err := client.GetClient(b) + if err != nil { + return + } + err = xClient.Call(ctx, "FindByIds", args, &result) + return +} diff --git a/wholesale/category.go b/wholesale/category.go new file mode 100644 index 0000000..6d6295d --- /dev/null +++ b/wholesale/category.go @@ -0,0 +1,77 @@ +package wholesale + +import ( + "context" + "git.oa00.com/supply-chain/service/client" +) + +type category struct { +} + +type CategoryItem struct { + Id uint `json:"id"` + Name string `json:"name"` + ParentId uint `json:"parentId"` + Children []CategoryItem `json:"children"` +} + +// All @Title 获取分类 +func (c *category) All(ctx context.Context) (result []CategoryItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", 0, &result) + return +} + +type ArgsCategoryAdd struct { + Name string // 分类名称 + ParentId uint // 上级id +} + +// Add @Title 添加分类 +func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) { + reply := 0 + xClient, err := client.GetClient(c) + if err != nil { + return + } + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsCategoryEdit struct { + CategoryId uint // 分类id + Name string // 分类名称 + ParentId uint // 上级id +} + +// Edit @Title 编辑分类 +func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) { + reply := 0 + xClient, err := client.GetClient(c) + if err != nil { + return + } + return xClient.Call(ctx, "Edit", args, &reply) +} + +type ArgsCategoryFindByIds struct { + ThirdCategoryIds []uint // 三级分类id数组 +} +type ThirdCategoryItem struct { + Id uint `json:"id"` + Name string `json:"name"` + ParentId uint `json:"parentId"` + Parent *ThirdCategoryItem `json:"parent"` +} + +// FindByIds @Title 三级分类获取 +func (c *category) FindByIds(ctx context.Context, args ArgsCategoryFindByIds) (result []ThirdCategoryItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "FindByIds", args, &result) + return +} diff --git a/wholesale/setting/rate.go b/wholesale/setting/rate.go new file mode 100644 index 0000000..8ffb1fa --- /dev/null +++ b/wholesale/setting/rate.go @@ -0,0 +1,41 @@ +package setting + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "github.com/shopspring/decimal" +) + +type rate struct { +} + +type RateItem struct { + Id uint `json:"id"` + Name string `json:"name"` + Rate decimal.Decimal `json:"rate"` +} + +// All @Title 全部利率 +func (r *rate) All(ctx context.Context) (result []RateItem, err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + err = xClient.Call(ctx, "All", 0, &result) + return +} + +type ArgsRateChannel struct { + ChannelId uint // 渠道id + RateId uint // 费率id +} + +// Channel @Title 设置渠道利率 +func (r *rate) Channel(ctx context.Context, args ArgsRateChannel) error { + reply := 0 + xClient, err := client.GetClient(r) + if err != nil { + return err + } + return xClient.Call(ctx, "Channel", args, &reply) +} diff --git a/wholesale/setting/setting.go b/wholesale/setting/setting.go new file mode 100644 index 0000000..50e35c9 --- /dev/null +++ b/wholesale/setting/setting.go @@ -0,0 +1,5 @@ +package setting + +type Setting struct { + Rate rate +} diff --git a/wholesale/sku.go b/wholesale/sku.go new file mode 100644 index 0000000..0b7b8dc --- /dev/null +++ b/wholesale/sku.go @@ -0,0 +1,479 @@ +package wholesale + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" + "github.com/shopspring/decimal" +) + +type sku struct { +} + +type source uint + +const ( + SkuSourceSupplier source = 2 // 供应链供应商渠道 +) + +const ( + SkuAdjustTypeRate = 1 // 加价比例 + SkuAdjustTypeAmount = 2 // 加价金额 + + SkuPlatformStatusUp = 1 // 平台上架 + SkuPlatformStatusDown = 2 // 平台下架 + + SkuSourceStatusUp = 1 // 供应商上架 + SkuSourceStatusDown = 2 // 供应商下架 + + SkuHandleNone = 1 // 未处理 + SkuHandleFinal = 2 // 已处理 + + SkuAuditStatusNone = 0 // 无 + SkuAuditStatusWait = 1 // 待审核 + SkuAuditStatusAdopt = 2 // 审核通过 + SkuAuditStatusReject = 3 // 审核驳回 + + ProfitGtZero = 1 // 利润比大于0 + ProfitEqZero = 2 // 利润比等于0 + ProfitLtZero = 3 // 利润比小于0 +) + +type ArgsSkuAdd struct { + SourceSkuId string // 源skuId + SourceGroupSkuIds []string // 源skuId关系数组 + SourceStatus uint // 源状态 + Name string // 商品名称 + BrandId uint // 品牌id + ThirdCategoryId uint // 三级分类id + SupplyPrice decimal.Decimal // 采购价 + GuidePrice decimal.Decimal // 指导价-建议售价 + Size string // 尺码 + Color string // 颜色 + Tax string // 税率 + TaxName string // 税收名称 + TaxCode string // 税收编码 + Unit string // 销售单位 + UpcCode string // 商品条码 + Source source // 商品来源 + Content string // 商品详情 + Length decimal.Decimal // 长 + Width decimal.Decimal // 宽 + Height decimal.Decimal // 高 + Weight decimal.Decimal // 重 + PackingRate uint // 装箱率 + StartingBatch uint // 起批量 + InitialFreight decimal.Decimal // 起批运费 + Imgs []SkuImg // 商品图片 第一张主图 + Specifications []SkuSpecification // 商品参数信息 +} + +type SkuImg struct { + Path string `json:"path"` +} + +type SkuSpecification struct { + Name string `json:"name"` + Attributes []SkuAttribute `json:"attributes"` +} + +type SkuAttribute struct { + Name string `json:"name"` + Value []string `json:"value"` +} + +// Add @Title 添加商品 +func (s *sku) Add(ctx context.Context, args ArgsSkuAdd) error { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsSkuAdjust struct { + ApplyUserId uint // 修改人 + SkuIds []uint // 商品id + AdjustType uint // 加价类型 + AdjustPrice decimal.Decimal // 加价金额 +} + +// Adjust @Title 加价 +func (s *sku) Adjust(ctx context.Context, args ArgsSkuAdjust) error { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Adjust", args, &reply) +} + +type ArgsSkuLists struct { + Search SkuListsSearch + Page bean.Page +} + +type SkuListsSearch struct { + Id uint // 瑞库客id + Name string // 商品名称 + SourceId uint // 所属供应商 1=京东 + SourceSkuId uint // 供应商skuId + BrandId uint // 品牌Id + BrandIds []uint // 品牌Ids + FirstCategoryId uint // 一级分类Id + FirstCategoryIds []uint // 一级分类ids + SecondCategoryId uint // 二级分类Id + SecondCategoryIds []uint // 二级分类Ids + ThirdCategoryId uint // 三级分类Id + ThirdCategoryIds []uint // 三级分类Ids + AdjustType uint // 加价规则 + MaxSupplyPrice decimal.Decimal // 最大采购价格 + MinSupplyPrice decimal.Decimal // 最小采购价格 + CustomerProfitRate uint // 客户利润比 1=大于0 2=等于0 3=小于0 + Handle uint // 处理状态 + AuditStatus uint // 审核状态 + SourceStatus uint // 供应商下架状态 + PlatformStatus uint // 平台下架状态 + UpcCode string // 商品条码 + Length decimal.Decimal // 长 + Width decimal.Decimal // 宽 + Height decimal.Decimal // 高 + Weight decimal.Decimal // 重 + PackingRate uint // 装箱率 + StartingBatch uint // 起批量 + InitialFreight decimal.Decimal // 起批运费 +} + +type ReplySkuList struct { + Lists []SkuItem `json:"lists"` + Total int64 `json:"total"` +} + +type SkuItem struct { + Id uint `json:"id"` + Name string `json:"name"` // 名称 + BrandName string `json:"brandName"` // 品牌名称 + FirstCategoryId uint `json:"firstCategoryId"` // 一级分类id + SecondCategoryId uint `json:"secondCategoryId"` // 二级分类id + ThirdCategoryId uint `json:"thirdCategoryId"` // 三级分类id + SupplyPrice decimal.Decimal `json:"supplyPrice"` // 采购价 + GuidePrice decimal.Decimal `json:"guidePrice"` // 指导价 + ImgUrl string `json:"imgUrl"` // 商品主图 + PlatformStatus uint `json:"platformStatus"` // 平台状态 1=上架 2=下架 + SourceId uint `json:"sourceId"` // 所属供应商 + SourceName string `json:"sourceName"` // 供应商名称 + SourceSkuId string `json:"sourceSkuId"` // 源skuId + SourceStatus uint `json:"sourceStatus"` // 供应商状态 1=上架 2=下架 + CustomerPrice decimal.Decimal `json:"customerPrice"` // 供货最高价 + CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` // 供货利润率 供货利润/供货最高价% + CustomerDiscount decimal.Decimal `json:"customerDiscount"` // 折扣 + AdjustType uint `json:"adjustType"` // 加价类型 + AdjustPrice decimal.Decimal `json:"adjustPrice"` // 加价金额 + AfterAdjustType uint `json:"afterAdjustType"` // 改价后加价类型 + AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` // 改价后加价金额 + AfterPrice decimal.Decimal `json:"afterPrice"` // 改价后金额 + AfterDiscount decimal.Decimal `json:"afterDiscount"` // 改价后折扣 + AdjustAuditStatus uint `json:"adjustAuditStatus"` // 改价审核状态 + Reason string `json:"reason"` // 改价驳回原因 + UpcCode string `json:"upcCode"` // 商品条码 + Color string `json:"color"` // 颜色 + Size string `json:"size"` // 尺寸 + Attributes []AttributeItem `json:"attributes"` // 商品属性 + Length decimal.Decimal `json:"length"` // 长 + Width decimal.Decimal `json:"width"` // 宽 + Height decimal.Decimal `json:"height"` // 高 + Weight decimal.Decimal `json:"weight"` // 重 + PackingRate uint `json:"packingRate"` // 装箱率 + StartingBatch uint `json:"startingBatch"` // 起批量 + InitialFreight decimal.Decimal `json:"initialFreight"` // 起批运费 +} + +type AttributeItem struct { + GroupName string `json:"groupName"` + Name string `json:"name"` + Value string `json:"value"` +} + +// Lists @Title 商品列表 +func (s *sku) Lists(ctx context.Context, args ArgsSkuLists) (reply ReplySkuList, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) + return +} + +type SkuEsSearch struct { + SourceId uint // 所属供应商 + SourceSonId uint // 沙马供应商的供应商Id + SourceSkuId uint // 供应商SkuId + SourceStatus uint // 供应商上下架状态 1=上架 2=下架 + PlatformStatus uint // 平台上下架状态 1=上架 2=下架 + AuditStatus uint // 改价审核状态 1=待审核 2=通过 3=驳回 + SkuId uint // Sku编码 + SupplySkuId uint // 供应商Sku编码 + SkuName string // 商品名称 + UpcCode string // 商品条码 + BrandId uint // 品牌id + BrandName string // 品牌名称 全词匹配 + FirstCategoryId uint // 一级分类id + FirstCategoryName string // 一级分类名称 全词匹配 + SecondCategoryId uint // 二级分类id + SecondCategoryName string // 二级分类名称 全词匹配 + ThirdCategoryId uint // 三级分类id + ThirdCategoryName string // 三级分类名称 全词匹配 + AdjustType uint // 加价规则 1=比例 2=金额 + Handel uint // 处理状态 + MaxSupplyPrice decimal.Decimal // 最高金额 + MinSupplyPrice decimal.Decimal // 最低金额 + MinDiscount decimal.Decimal // 最低折扣 + MaxDiscount decimal.Decimal // 最高折扣 + AdjustMinDiscount decimal.Decimal // 改价后最小折扣 + AdjustMaxDiscount decimal.Decimal // 改价后最大折扣 + Length decimal.Decimal // 长 + Width decimal.Decimal // 宽 + Height decimal.Decimal // 高 + Weight decimal.Decimal // 重 + PackingRate uint // 装箱率 + StartingBatch uint // 起批量 + InitialFreight decimal.Decimal // 起批运费 +} +type ArgsSkuListsEs struct { + Search SkuEsSearch + Page bean.Page +} + +// ListsEs @Title es商品列表 目前最大10000条数据,超出不显示 +func (s *sku) ListsEs(ctx context.Context, args ArgsSkuListsEs) (reply ReplySkuList, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "ListsEs", args, &reply) + return +} + +type SkuInfo struct { + Id uint `json:"id"` + Name string `json:"name"` + SourceSkuId string `json:"jdSkuId"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + CustomerPrice decimal.Decimal `json:"customerPrice"` + GuidePrice decimal.Decimal `json:"guidePrice"` + Profit decimal.Decimal `json:"profit"` + CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` + UpcCode string `json:"upcCode"` + Color string `json:"color"` + Size string `json:"size"` + FirstCategoryName string `json:"firstCategoryName"` + SecondCategoryName string `json:"secondCategoryName"` + ThirdCategoryName string `json:"thirdCategoryName"` + BrandName string `json:"brandName"` + Content string `json:"content"` + Tax string `json:"tax"` + TaxName string `json:"taxName"` + TaxCode string `json:"taxCode"` + Unit string `json:"unit"` + Imgs []SkuImgItem `json:"imgs"` + Reason string `json:"reason"` + Specifications []SkuSpecification `json:"specification"` + PlatformStatus uint `json:"platformStatus"` + SourceStatus uint `json:"sourceStatus"` + SourceName string `json:"sourceName"` + AdjustType uint `json:"adjustType"` + AdjustPrice decimal.Decimal `json:"adjustPrice"` + Length decimal.Decimal `json:"length"` // 长 + Width decimal.Decimal `json:"width"` // 宽 + Height decimal.Decimal `json:"height"` // 高 + Weight decimal.Decimal `json:"weight"` // 重 + PackingRate uint `json:"packingRate"` // 装箱率 + StartingBatch uint `json:"startingBatch"` // 起批量 + InitialFreight decimal.Decimal `json:"initialFreight"` // 起批运费 +} + +type SkuImgItem struct { + Id uint `json:"id"` + Path string `json:"path"` +} + +// Info @Title 商品信息 +func (s *sku) Info(ctx context.Context, skuId uint) (reply SkuInfo, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", skuId, &reply) + return +} + +type ArgsSkuOnShelves struct { + SkuIds []uint +} + +type ArgsSkuDownShelves struct { + SkuIds []uint +} + +// OnShelves @Title 上架 +func (s *sku) OnShelves(ctx context.Context, args ArgsSkuOnShelves) error { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "OnShelves", args, &reply) +} + +// DownShelves @Title 下架 +func (s *sku) DownShelves(ctx context.Context, args ArgsSkuDownShelves) error { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "DownShelves", args, &reply) +} + +// GetImgs @Title 获取预览图 +func (s *sku) GetImgs(ctx context.Context, skuId uint) (reply []SkuImgItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "GetImgs", skuId, &reply) + return +} + +type ArgsReplaceImg struct { + SkuId uint + Id uint + Path string +} + +// ReplaceImg @Title 替换图片 +func (s *sku) ReplaceImg(ctx context.Context, args ArgsReplaceImg) (err error) { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + err = xClient.Call(ctx, "ReplaceImg", args, &reply) + return +} + +type ArgsSkuChangePrice struct { + SourceSkuId string // 源skuId + SupplyPrice decimal.Decimal // 采购价 + GuidePrice decimal.Decimal // 指导价-建议售价 + Source source // 商品来源 +} + +// ChangePrice @Title 更新价格 +func (s *sku) ChangePrice(ctx context.Context, args ArgsSkuChangePrice) (err error) { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + err = xClient.Call(ctx, "ChangePrice", args, &reply) + return +} + +type ArgsSkuChangeData struct { + SourceSkuId string // 源skuId + SourceStatus uint // 源状态 + Name string // 商品名称 + BrandId uint // 品牌id + ThirdCategoryId uint // 三级分类id + SupplyPrice decimal.Decimal // 采购价 + GuidePrice decimal.Decimal // 指导价-建议售价 + Size string // 尺码 + Color string // 颜色 + Tax string // 税率 + Unit string // 销售单位 + UpcCode string // 商品条码 + Source source // 商品来源 + Specifications []SkuSpecification // 商品参数信息 + Length decimal.Decimal // 长 + Width decimal.Decimal // 宽 + Height decimal.Decimal // 高 + Weight decimal.Decimal // 重 + PackingRate uint // 装箱率 + StartingBatch uint // 起批量 + InitialFreight decimal.Decimal // 起批运费 +} + +// ChangeData @Title 更新商品信息 +func (s *sku) ChangeData(ctx context.Context, args ArgsSkuChangeData) (err error) { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + err = xClient.Call(ctx, "ChangeData", args, &reply) + return +} + +type ByIdsSkuItem struct { + Id uint `json:"id"` + Name string `json:"name"` // 名称 + BrandName string `json:"brandName"` // 品牌名称 + FirstCategoryId uint `json:"firstCategoryId"` // 一级分类id + SecondCategoryId uint `json:"secondCategoryId"` // 二级分类id + ThirdCategoryId uint `json:"thirdCategoryId"` // 三级分类id + SupplyPrice decimal.Decimal `json:"supplyPrice"` // 采购价 + GuidePrice decimal.Decimal `json:"guidePrice"` // 指导价 + ImgUrl string `json:"imgUrl"` // 商品主图 + PlatformStatus uint `json:"platformStatus"` // 平台状态 1=上架 2=下架 + SourceName string `json:"sourceName"` // 供应商名称 + SourceSkuId string `json:"sourceSkuId"` // 源skuId + SourceStatus uint `json:"sourceStatus"` // 供应商状态 1=上架 2=下架 + CustomerPrice decimal.Decimal `json:"customerPrice"` // 供货最高价 + CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` // 供货利润率 供货利润/供货最高价% + AdjustType uint `json:"adjustType"` // 加价类型 + AdjustPrice decimal.Decimal `json:"adjustPrice"` // 加价金额 + AfterAdjustType uint `json:"afterAdjustType"` // 改价后加价类型 + AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` // 改价后加价金额 + Handle uint `json:"handle"` // 1=未处理 2=已处理 + Reason string `json:"reason"` // 驳回原因 + Size string `json:"size"` + Color string `json:"color"` + Specifications []SpecItem `json:"specifications"` + Length decimal.Decimal `json:"length"` // 长 + Width decimal.Decimal `json:"width"` // 宽 + Height decimal.Decimal `json:"height"` // 高 + Weight decimal.Decimal `json:"weight"` // 重 + PackingRate uint `json:"packingRate"` // 装箱率 + StartingBatch uint `json:"startingBatch"` // 起批量 + InitialFreight decimal.Decimal `json:"initialFreight"` // 起批运费 +} + +type SpecItem struct { + Id uint `json:"id"` + SkuId uint `json:"skuId"` + Name string `json:"name"` + Value string `json:"value"` + GroupName string `json:"groupName"` +} + +// FindByIds @Title 根据Ids查询sku信息 +func (s *sku) FindByIds(ctx context.Context, ids []uint) (reply []ByIdsSkuItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "FindByIds", ids, &reply) + return +} + +// AuthPut @Title 根据sourceSkuId查询供应链是否入库 true=入库 false=没有入库 +func (s *sku) AuthPut(ctx context.Context, sourceSkuIds []uint) (reply bool) { + xClient, err := client.GetClient(s) + if err != nil { + return false + } + err = xClient.Call(ctx, "AuthPut", sourceSkuIds, &reply) + return +} diff --git a/wholesale/skuAudit.go b/wholesale/skuAudit.go new file mode 100644 index 0000000..20a21f6 --- /dev/null +++ b/wholesale/skuAudit.go @@ -0,0 +1,191 @@ +package wholesale + +import ( + "context" + "git.oa00.com/supply-chain/service/client" + "git.oa00.com/supply-chain/service/lib/bean" + "github.com/shopspring/decimal" +) + +type skuAudit struct { +} + +type ArgsSkuAuditLists struct { + Search SkuAuditSearch + Page bean.Page +} + +type SkuAuditSearch struct { + SourceId uint // 供应商id + AdjustType uint // 加价类型 + Status uint // 状态 1=未审核 2=通过 3=驳回 +} + +type ArgsSkuAuditEsLists struct { + Search SkuAuditEsSearch + Page bean.Page +} + +type SkuAuditEsSearch struct { + SourceId uint // 供应商id + SourceSonId uint // 沙马供应商的供应商 + AdjustType uint // 加价类型 + Status uint // 状态 1=未审核 2=通过 3=驳回 + AfterMinDiscount decimal.Decimal // 加价后最低折扣 + AfterMaxDiscount decimal.Decimal // 加价后最高折扣 +} + +type SkuAndAuditItem struct { + Id uint `json:"id"` + SkuId uint `json:"skuId"` + Name string `json:"name"` + SupplyPrice decimal.Decimal `json:"supplyPrice"` + GuidePrice decimal.Decimal `json:"guidePrice"` + AdjustType uint `json:"adjustType"` + AdjustPrice decimal.Decimal `json:"adjustPrice"` + AfterPrice decimal.Decimal `json:"afterPrice"` + AfterDiscount decimal.Decimal `json:"afterDiscount"` + BrandName string `json:"brandName"` + SourceName string `json:"sourceName"` + AuditUserId uint `json:"auditUserId"` + AuditAt int64 `json:"auditAt"` + ImgUrl string `json:"imgUrl"` + Reason string `json:"reason"` + FirstCategoryName string `json:"firstCategoryName"` + SecondCategoryName string `json:"secondCategoryName"` + ThirdCategoryName string `json:"thirdCategoryName"` + CreatedAt int64 `json:"createdAt"` + Length decimal.Decimal `json:"length"` // 长 + Width decimal.Decimal `json:"width"` // 宽 + Height decimal.Decimal `json:"height"` // 高 + Weight decimal.Decimal `json:"weight"` // 重 + PackingRate uint `json:"packingRate"` // 装箱率 + StartingBatch uint `json:"startingBatch"` // 起批量 + InitialFreight decimal.Decimal `json:"initialFreight"` // 起批运费 +} + +type ReplySkuAuditLists struct { + Lists []SkuAndAuditItem `json:"lists"` + Total int64 `json:"total"` +} + +// Lists @Title 审核列表 +func (s *skuAudit) Lists(ctx context.Context, args ArgsSkuAuditLists) (reply ReplySkuAuditLists, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "Lists", args, &reply) + return +} + +// ListsEs @Title 审核列表 +func (s *skuAudit) ListsEs(ctx context.Context, args ArgsSkuAuditEsLists) (reply ReplySkuAuditLists, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + err = xClient.Call(ctx, "ListsEs", args, &reply) + return +} + +type ArgsSkuAuditAdopt struct { + AuditUserId uint // 审核人 + AuditIds []uint // 审核单id +} + +// Adopt @Title 通过 +func (s *skuAudit) Adopt(ctx context.Context, args ArgsSkuAuditAdopt) error { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Adopt", args, &reply) +} + +type ArgsSkuAuditReject struct { + AuditUserId uint // 审核人 + AuditIds []uint // 审核单id + Reason string // 驳回原因 +} + +// Reject @Title 驳回 +func (s *skuAudit) Reject(ctx context.Context, args ArgsSkuAuditReject) error { + reply := 0 + xClient, err := client.GetClient(s) + if err != nil { + return err + } + return xClient.Call(ctx, "Reject", args, &reply) +} + +type ArgsApplyHistory struct { + Search ApplyHistorySearch + Page bean.Page +} + +type ApplyHistorySearch struct { + Id uint // 瑞库客id + Name string // 商品名称 + SourceId uint // 所属供应商 1=京东 + SourceSonId uint // 沙马供应商的供应商 + SourceSkuId uint // 供应商skuId + BrandId uint // 品牌Id + ThirdCategoryId uint // 三级分类Id + AdjustType uint // 加价规则 + MaxSupplyPrice decimal.Decimal // 最大采购价格 + MinSupplyPrice decimal.Decimal // 最小采购价格 + CustomerProfitRate uint // 折扣 0=全部 1=5折以下 2=6 3=7 4=8 5=9折以下 + Handle uint // 处理状态 + AuditStatus uint // 审核状态 + SourceStatus uint // 供应商下架状态 + PlatformStatus uint // 平台下架状态 +} + +type ApplyHistoryItem struct { + Id uint `json:"id"` + Name string `json:"name"` // 名称 + BrandName string `json:"brandName"` // 品牌名称 + FirstCategoryId uint `json:"firstCategoryId"` // 一级分类id + SecondCategoryId uint `json:"secondCategoryId"` // 二级分类id + ThirdCategoryId uint `json:"thirdCategoryId"` // 三级分类id + SupplyPrice decimal.Decimal `json:"supplyPrice"` // 采购价 + GuidePrice decimal.Decimal `json:"guidePrice"` // 指导价 + ImgUrl string `json:"imgUrl"` // 商品主图 + PlatformStatus uint `json:"platformStatus"` // 平台状态 1=上架 2=下架 + SourceName string `json:"sourceName"` // 供应商名称 + SourceSkuId string `json:"sourceSkuId"` // 源skuId + SourceStatus uint `json:"sourceStatus"` // 供应商状态 1=上架 2=下架 + CustomerPrice decimal.Decimal `json:"customerPrice"` // 供货最高价 + CustomerProfitRate decimal.Decimal `json:"customerProfitRate"` // 供货利润率 供货利润/供货最高价% + CustomerDiscount decimal.Decimal `json:"customerDiscount"` // 折扣 + AdjustType uint `json:"adjustType"` // 加价类型 + AdjustPrice decimal.Decimal `json:"adjustPrice"` // 加价金额 + AfterAdjustType uint `json:"afterAdjustType"` // 改价后加价类型 + AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"` // 改价后加价金额 + AfterPrice decimal.Decimal `json:"afterPrice"` // 改价记录 + Length decimal.Decimal `json:"length"` // 长 + Width decimal.Decimal `json:"width"` // 宽 + Height decimal.Decimal `json:"height"` // 高 + Weight decimal.Decimal `json:"weight"` // 重 + PackingRate uint `json:"packingRate"` // 装箱率 + StartingBatch uint `json:"startingBatch"` // 起批量 + InitialFreight decimal.Decimal `json:"initialFreight"` // 起批运费 + Reason string // 改价驳回原因 +} + +type ReplyApplyHistoryLists struct { + Lists []ApplyHistoryItem `json:"lists"` + Total int64 `json:"total"` +} + +// ApplyHistory @Title 改价申请记录 +func (s *skuAudit) ApplyHistory(ctx context.Context, args ArgsApplyHistory) (reply []ReplyApplyHistoryLists, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return nil, err + } + err = xClient.Call(ctx, "ApplyHistory", args, &reply) + return +} diff --git a/wholesale/source.go b/wholesale/source.go new file mode 100644 index 0000000..99f531d --- /dev/null +++ b/wholesale/source.go @@ -0,0 +1,30 @@ +package wholesale + +import ( + "context" + "git.oa00.com/supply-chain/service/client" +) + +type sourceRpc struct { + Id uint `gorm:"primaryKey"` + Name string // 供货商名称 + Base string // rpc服务基础名称 + SkuName string // sku名称 + OrderName string // order名称 +} + +type SourceItem struct { + Id uint `json:"id"` + Name string `json:"name"` +} + +// Select @Title 供应商列表 +func (s *sourceRpc) Select(ctx context.Context) (reply []SourceItem, err error) { + xClient, err := client.GetClient(s) + if err != nil { + return + } + args := 0 + err = xClient.Call(ctx, "Select", args, &reply) + return +} diff --git a/wholesale/wholesale.go b/wholesale/wholesale.go new file mode 100644 index 0000000..b30ccc0 --- /dev/null +++ b/wholesale/wholesale.go @@ -0,0 +1,12 @@ +package wholesale + +import "git.oa00.com/supply-chain/service/wholesale/setting" + +type Wholesale struct { + Brand brand + Category category + Source sourceRpc + Sku sku + SkuAudit skuAudit + Setting setting.Setting +}