Merge branch 'master' of git.oa00.com:supply-chain/service

finance
杨赟 2 years ago
commit a4d30272e0

@ -5,13 +5,15 @@ import (
"git.oa00.com/supply-chain/service/jd" "git.oa00.com/supply-chain/service/jd"
"git.oa00.com/supply-chain/service/supplier" "git.oa00.com/supply-chain/service/supplier"
"git.oa00.com/supply-chain/service/supply" "git.oa00.com/supply-chain/service/supply"
"git.oa00.com/supply-chain/service/wholesale"
) )
var Rpc = &rpc{} var Rpc = &rpc{}
type rpc struct { type rpc struct {
Supply supply.Supply Supply supply.Supply
Jd jd.Jd Jd jd.Jd
Customer customer.Customer Customer customer.Customer
Supplier supplier.Supplier Supplier supplier.Supplier
Wholesale wholesale.Wholesale
} }

@ -0,0 +1,195 @@
package supplier
import (
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
"github.com/shopspring/decimal"
"golang.org/x/net/context"
)
type afs struct {
}
type ArgsAfsLists struct {
Search AfsSearch
Page bean.Page
}
type AfsSearch struct {
Status uint
AfsSn string
OrderSubSn string
CreatedStartDate string
CreatedEndDate string
}
type ReplyAfsLists struct {
Lists []AfsItem
Total int64
}
type AfsItem struct {
Id uint `json:"id"`
AfsSn string `json:"afsSn"`
OrderSubSn string `json:"orderSubSn"`
SkuName string `json:"skuName"`
Quantity uint `json:"quantity"`
Status uint `json:"status"`
Result string `json:"result"`
OrderFee decimal.Decimal `json:"orderFee"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
ReturnAddress []ReturnAddressItem `json:"returnAddress"`
}
// Lists @Title 售后列表
func (a *afs) Lists(ctx context.Context, args ArgsAfsLists) (reply ReplyAfsLists, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ReplyAfsDetail struct {
Id uint `json:"id"`
AfsSn string `json:"afsSn"`
Status uint `json:"status"`
ApproveNotes string `json:"approveNotes"`
Result string `json:"result"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
SkuName string `json:"skuName"`
ImgUrl string `json:"imgUrl"`
SkuId uint `json:"skuId"`
Price decimal.Decimal `json:"price"`
Quantity uint `json:"quantity"`
HopeTypeName string `json:"hopeTypeName"`
TypeReasonName string `json:"typeReasonName"`
Imgs []string `json:"imgs"`
LogisticsCompany string `json:"logisticsCompany"`
WaybillCode string `json:"waybillCode"`
SendAt int64 `json:"sendAt"`
NewOrderSn string `json:"newOrderSn"`
RefundFee decimal.Decimal `json:"refundFee"`
PackageSend uint `json:"packageSend"`
AfsPackageSend AfsPackageSend `json:"afsPackageSend"`
ReturnAddress []ReturnAddressItem `json:"returnAddress"`
}
type AfsPackageSend struct {
Name string `json:"name"`
Mobile string `json:"mobile"`
LogisticsCompany string `json:"logisticsCompany"`
WaybillCode string `json:"waybillCode"`
SendGoodsDate int64 `json:"sendGoodsDate"`
}
// Detail @Title 售后详情
func (a *afs) Detail(ctx context.Context, afsSn uint64) (reply ReplyAfsDetail, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "Detail", afsSn, &reply)
return
}
type ArgsAfsReject struct {
AfsSn string `json:"afsSn"`
Notes string `json:"notes"`
}
// Reject @Title 审核驳回
func (a *afs) Reject(ctx context.Context, args ArgsAfsReject) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Reject", args, &reply)
return
}
type ArgsAfsDeliver struct {
AfsSn string `json:"afsSn"`
ReturnAddressId uint `json:"returnAddressId"`
Notes string `json:"notes"`
}
// Deliver @Title 待客户发货
func (a *afs) Deliver(ctx context.Context, args ArgsAfsDeliver) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Deliver", args, &reply)
return
}
type ArgsAfsRefund struct {
AfsSn string `json:"afsSn"`
Notes string `json:"notes"`
}
// Refund @Title 退款
func (a *afs) Refund(ctx context.Context, args ArgsAfsRefund) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Refund", args, &reply)
return
}
type ArgsAfsCompensate struct {
AfsSn string `json:"afsSn"`
RefundFee decimal.Decimal `json:"refundFee"`
Notes string `json:"notes"`
}
// Compensate @Title 订单赔偿
func (a *afs) Compensate(ctx context.Context, args ArgsAfsCompensate) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Compensate", args, &reply)
return
}
type ArgsAfsCompensateSku struct {
AfsSn string `json:"afsSn"`
Notes string `json:"notes"`
}
// CompensateSku @Title 直赔商品
func (a *afs) CompensateSku(ctx context.Context, args ArgsAfsCompensateSku) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "CompensateSku", args, &reply)
return
}
type ArgsAfsReissue struct {
AfsSn string `json:"afsSn"`
Notes string `json:"notes"`
}
// Reissue @Title 补发商品
func (a *afs) Reissue(ctx context.Context, args ArgsAfsReissue) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Reissue", args, &reply)
return
}

@ -15,6 +15,7 @@ type Supplier struct {
WalletApply supplierWalletApply WalletApply supplierWalletApply
LogisticsCompany logisticsCompany LogisticsCompany logisticsCompany
ReturnAddress returnAddress ReturnAddress returnAddress
Afs afs
} }
type supplier struct { type supplier struct {

@ -185,6 +185,7 @@ func (a *afterService) Lists(ctx context.Context, channelId string, args ArgsAft
type ReplyAfterServiceDetail struct { type ReplyAfterServiceDetail struct {
Id uint `json:"id"` Id uint `json:"id"`
AfsSn string `json:"afsSn"` AfsSn string `json:"afsSn"`
OrderSubSn string `json:"orderSubSn"`
Status uint `json:"status"` Status uint `json:"status"`
ApproveNotes string `json:"approveNotes"` ApproveNotes string `json:"approveNotes"`
Result string `json:"result"` Result string `json:"result"`

@ -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
}

@ -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
}

@ -0,0 +1,6 @@
package channel
type Channel struct {
Sku sku
Mq mq
}

@ -0,0 +1,56 @@
package channel
import (
"context"
"git.oa00.com/supply-chain/service/client"
"github.com/smallnest/rpcx/share"
)
const (
MqSubscribeNameSkuPriceChange = "sku_price_change" // sku价格变动
MqSubscribeNameSkuChange = "sku_change" // sku信息变动
)
type mq struct {
}
type ArgsMqSubscribe struct {
Name string // 队列名称
AppKey string // 队列名称
}
// Subscribe @Title 订阅mq
func (m *mq) Subscribe(ctx context.Context, channelId string, args ArgsMqSubscribe) (key string, err error) {
xClient, err := client.GetClient(m)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Subscribe", args, &key)
return
}
// SubscribeCancel @Title 订阅取消
func (m *mq) SubscribeCancel(ctx context.Context, channelId string, args ArgsMqSubscribe) (err error) {
reply := 0
xClient, err := client.GetClient(m)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "SubscribeCancel", args, &reply)
return
}
type ArgsMqUser struct {
AppKey string
AppSecret string
}
// User @Title Mq用户
func (m *mq) User(ctx context.Context, channelId string, args ArgsMqUser) (err error) {
reply := 0
xClient, err := client.GetClient(m)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "User", args, &reply)
return
}

@ -0,0 +1,237 @@
package channel
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
"github.com/shopspring/decimal"
"github.com/smallnest/rpcx/share"
)
type sku struct {
}
type SkuSearch struct {
Status uint // 1=上架 2=下架
SkuName string // 商品名称
}
type ArgsSkuList struct {
Search SkuSearch
Page bean.Page
}
type SkuItem struct {
Id uint `json:"id"`
Name string `json:"name"`
BrandId uint `json:"brandId"`
BrandName string `json:"brandName"`
FirstCategoryId uint `json:"firstCategoryId"`
FirstCategoryName string `json:"firstCategoryName"`
SecondCategoryId uint `json:"secondCategoryId"`
SecondCategoryName string `json:"secondCategoryName"`
ThirdCategoryId uint `json:"thirdCategoryId"`
ThirdCategoryName string `json:"thirdCategoryName"`
Price decimal.Decimal `json:"price"`
Discount decimal.Decimal `json:"discount"`
GuidePrice decimal.Decimal `json:"guidePrice"`
ImgUrl string `json:"imgUrl"`
Profit decimal.Decimal `json:"profit"`
Size string `json:"size"`
Color string `json:"color"`
Tax string `json:"tax"`
Unit string `json:"unit"`
UpcCode string `json:"upcCode"`
TaxName string `json:"taxName"`
TaxCode string `json:"taxCode"`
Status uint `json:"status"`
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"` // 起批运费
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
type ReplySkuList struct {
Lists []SkuItem `json:"lists"`
Total int64 `json:"total"`
}
// Lists @Title 商品列表
func (s *sku) Lists(ctx context.Context, channelId string, args ArgsSkuList) (reply ReplySkuList, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Lists", args, &reply)
return
}
type SkuEsSearch struct {
SkuIds []uint // 商品SkuIds
Status uint // 1=上架 2=下架
SkuName string // 商品名称
BrandId uint // 品牌id
BrandName string // 品牌名称 全词匹配
FirstCategoryId uint // 一级分类id
FirstCategoryName string // 一级分类名称 全词匹配
SecondCategoryId uint // 二级分类id
SecondCategoryName string // 二级分类名称 全词匹配
ThirdCategoryId uint // 三级分类id
ThirdCategoryName string // 三级分类名称 全词匹配
MaxPrice decimal.Decimal // 最高金额
MinPrice decimal.Decimal // 最低金额
MinDiscount decimal.Decimal // 最低折扣
MaxDiscount decimal.Decimal // 最高折扣
Expand []map[string]interface{} // 拓展查询
}
type ArgsSkuListsEs struct {
Search SkuEsSearch
Page bean.Page
}
// ListsEs @Title es商品列表 目前最大10000条数据超出不显示
func (s *sku) ListsEs(ctx context.Context, channelId string, args ArgsSkuListsEs) (reply ReplySkuList, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "ListsEs", args, &reply)
return
}
type ArgsSkuDetails struct {
SkuIds []uint // sku数组
}
type SkuDetailItem struct {
Id uint `json:"id"`
Name string `json:"name"`
BrandId uint `json:"brandId"`
BrandName string `json:"brandName"`
FirstCategoryId uint `json:"firstCategoryId"`
FirstCategoryName string `json:"firstCategoryName"`
SecondCategoryId uint `json:"secondCategoryId"`
SecondCategoryName string `json:"secondCategoryName"`
ThirdCategoryId uint `json:"thirdCategoryId"`
ThirdCategoryName string `json:"thirdCategoryName"`
Price decimal.Decimal `json:"price"`
GuidePrice decimal.Decimal `json:"guidePrice"`
ImgUrl string `json:"imgUrl"`
Profit decimal.Decimal `json:"profit"`
Size string `json:"size"`
Color string `json:"color"`
Tax string `json:"tax"`
Unit string `json:"unit"`
UpcCode string `json:"upcCode"`
TaxName string `json:"taxName"`
TaxCode string `json:"taxCode"`
Status uint `json:"status"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
Content string `json:"content"`
Imgs []SkuImg `json:"imgs"`
Specifications []SkuSpecification `json:"specifications"`
GroupSkuIds []uint `json:"groupSkuIds"`
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 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"`
}
// Details @Title 获取sku详情
func (s *sku) Details(ctx context.Context, channelId string, args ArgsSkuDetails) (reply []SkuDetailItem, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Details", args, &reply)
return
}
type ArgsSkuPrices struct {
SkuIds []uint // sku数组
}
type SkuPrice struct {
Id uint `json:"id"`
Name string `json:"name"`
Price decimal.Decimal `json:"price"`
GuidePrice decimal.Decimal `json:"guidePrice"`
Profit decimal.Decimal `json:"profit"`
Status uint `json:"status"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// Prices @Title 获取sku价格
func (s *sku) Prices(ctx context.Context, channelId string, args ArgsSkuPrices) (reply []SkuPrice, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Prices", args, &reply)
return
}
type ArgsSkuGroups struct {
SkuIds []uint // sku数组
}
type SkuGroup struct {
SkuId uint `json:"skuId"`
GroupSkuIds []uint `json:"groupSkuIds"`
}
// Groups @Title 获取sku分组信息
func (s *sku) Groups(ctx context.Context, channelId string, args ArgsSkuGroups) (reply []SkuGroup, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Groups", args, &reply)
return
}
type ArgsSkuStock struct {
Address string // 地址
Skus []SkuStockItem // sku信息
}
type SkuStockItem struct {
SkuId uint // skuId
Quantity uint // 数量
}
type ReplySkuStock struct {
SkuId uint `json:"skuId"` // skuId
State uint `json:"state"` // 库存状态
}
// Stock @Title 库存查询
func (s *sku) Stock(ctx context.Context, channelId string, args ArgsSkuStock) (reply []ReplySkuStock, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Stock", args, &reply)
return
}

@ -0,0 +1,32 @@
package _interface
import (
"context"
)
type skuState uint
const (
SkuStateIn = 1 // 有货
SkuStateOut = 2 // 无货
SkuStateDone = 3 // 下架商品
)
type Sku interface {
// Stock 库存查询
Stock(ctx context.Context, args ArgsSkuStock, reply *[]ReplySkuStock) error
}
type ArgsSkuStock struct {
Address string // 地址
Skus []SkuStockItem // sku信息
}
type SkuStockItem struct {
SourceSkuId string // 源skuId
Quantity uint // 数量
}
type ReplySkuStock struct {
SourceSkuId string `json:"sourceSkuId"` // 源skuId
State uint `json:"state"` // 库存状态
}

@ -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)
}

@ -0,0 +1,5 @@
package setting
type Setting struct {
Rate rate
}

@ -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
}

@ -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
}

@ -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
}

@ -0,0 +1,16 @@
package wholesale
import (
"git.oa00.com/supply-chain/service/wholesale/channel"
"git.oa00.com/supply-chain/service/wholesale/setting"
)
type Wholesale struct {
Brand brand
Category category
Source sourceRpc
Sku sku
SkuAudit skuAudit
Setting setting.Setting
Channel channel.Channel
}
Loading…
Cancel
Save