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

finance
杨赟 2 years ago
commit a7ab21065f

@ -0,0 +1,62 @@
package otosaas
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
)
type category struct {
}
type ArgsCategoryList struct {
ThirdCategoryId uint
Page bean.Page
}
type CategoryItem struct {
Id uint `json:"id"`
FirstCategoryName string `json:"firstCategoryName"`
SecondCategoryName string `json:"secondCategoryName"`
ThirdCategoryName string `json:"thirdCategoryName"`
SupplyCategoryId uint `json:"supplyCategoryId"`
}
type ReplyCategoryList struct {
Lists []CategoryItem `json:"lists"`
Total int64 `json:"total"`
}
// Lists @Title 获取品牌匹配列表
func (c *category) Lists(ctx context.Context, args ArgsCategoryList) (reply ReplyCategoryList, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsCategoryEdit struct {
CategoryId uint // 分类id
SupplyCategoryId uint // 匹配分类id
}
// Edit @Title 编辑品牌匹配
func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) error {
reply := 0
xClient, err := client.GetClient(c)
if err != nil {
return err
}
return xClient.Call(ctx, "Edit", args, &reply)
}
// Select @Title 类目筛选
func (c *category) Select(ctx context.Context) (reply []CategoryItem, err error) {
args := 0
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "Select", args, &reply)
return
}

@ -0,0 +1,185 @@
package otosaas
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
"github.com/shopspring/decimal"
)
const (
CommodityStatusNone = 1 // 待处理
CommodityStatusAdopt = 2 // 同步入库
CommodityStatusReject = 3 // 废弃商品
CommodityHandleNone = 1 // 未处理
CommodityHandleStart = 2 // 开始处理
CommoditySaasSkuStatusUp = 1 // 商品上架
CommoditySaasSkuStatusDown = 2 // 商品下架
)
type commodity struct {
}
type CommoditySearch struct {
Name string // 商品名称
CategoryIds []uint // 类目id
SkuCode string // 商品条码
Handle uint // 处理状态 1=待处理 2=入库 3=废弃
CommodityCode string // 商品编码
MinSupplyPrice decimal.Decimal // 最小采购价
MaxSupplyPrice decimal.Decimal // 最大采购价
}
type ArgsCommodityList struct {
Search CommoditySearch
Page bean.Page
}
type CommodityItem struct {
Id uint `json:"id"`
Name string `json:"name"`
CommodityCode string `json:"commodityCode"`
Img string `json:"img"`
CategoryId uint `json:"categoryId"`
CategoryNames string `json:"categoryNames"`
Skus []CommoditySkuItem `json:"skus"`
GuidePrices []decimal.Decimal `json:"guidePrices"`
SupplyPrices []decimal.Decimal `json:"supplyPrices"`
Status uint `json:"status"`
CreatedAt int64 `json:"createdAt"`
}
type CommoditySkuItem struct {
Id uint `json:"id"`
Img string `json:"img"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
SpecValue string `json:"specValue"`
SkuCode string `json:"skuCode"`
}
type ReplyCommodityLists struct {
List []CommodityItem `json:"list"`
Total int64 `json:"total"`
}
// Lists @Title 获取商品列表
func (g *commodity) Lists(ctx context.Context, args ArgsCommodityList) (reply ReplyCommodityLists, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ReplyCommodityInfo struct {
Id uint `json:"id"`
CommodityCode string `json:"commodityCode"`
Name string `json:"name"`
ImgUrl string `json:"imgUrl"`
FirstCategoryId uint `json:"firstCategoryId"`
FirstCategoryName string `json:"firstCategoryName"`
SecondCategoryId uint `json:"secondCategoryId"`
SecondCategoryName string `json:"secondCategoryName"`
ThirdCategoryId uint `json:"thirdCategoryId"`
ThirdCategoryName string `json:"thirdCategoryName"`
SupplyCategoryId uint `json:"supplyCategoryId"`
Handle uint `json:"handle"`
Status uint `json:"status"`
Skus []SkuItem `json:"skus"`
Imgs []CommodityImgItem `json:"imgs"`
}
type CommodityImgItem struct {
Id uint `json:"id"`
Path string `json:"path"`
ReplacePath string `json:"replacePath"`
}
type SkuItem struct {
Id uint `json:"id"`
SkuCode string `json:"skuCode"`
SpecName string `json:"specName"`
SpecValue string `json:"specValue"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
GuidePrice decimal.Decimal `json:"guidePrice"`
ImgUrl string `json:"imgUrl"`
}
// Info @Title 商品详情
func (g *commodity) Info(ctx context.Context, goodsId uint) (reply ReplyCommodityInfo, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", goodsId, &reply)
return
}
type ReplyImgs struct {
GoodsId uint `json:"goodsId"`
Imgs []string `json:"imgs"`
}
// GetImgs @Title 获取商品主图
func (g *commodity) GetImgs(ctx context.Context, goodsIds []uint) (reply []ReplyImgs, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "GetImgs", goodsIds, &reply)
return
}
type AdoptItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Error string `json:"error"`
}
// Adopt @Title 批量入库
func (g *commodity) Adopt(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Adopt", goodsIds, &reply)
return
}
// Discard @Title 批量废弃
func (g *commodity) Discard(ctx context.Context, goodsIds []uint) (err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Discard", goodsIds, &reply)
return
}
// ReHandle @Title 重新处理商品
func (g *commodity) ReHandle(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "ReHandle", goodsIds, &reply)
return
}
type ReplyByIdItem struct {
SkuId uint `json:"skuId"`
SupplierId uint `json:"supplierIds"`
SupplierName string `json:"supplierName"`
}
// FindBySkuIds @Title 根据商品Ids获取商品信息
func (g *commodity) FindBySkuIds(ctx context.Context, skuIds []uint) (reply []ReplyByIdItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "FindBySkuIds", skuIds, &reply)
return
}

@ -0,0 +1,6 @@
package otosaas
type OtoSaas struct {
Category category
Commodity commodity
}

@ -3,6 +3,7 @@ package service
import ( import (
"git.oa00.com/supply-chain/service/customer" "git.oa00.com/supply-chain/service/customer"
"git.oa00.com/supply-chain/service/jd" "git.oa00.com/supply-chain/service/jd"
"git.oa00.com/supply-chain/service/otosaas"
"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" "git.oa00.com/supply-chain/service/wholesale"
@ -16,4 +17,5 @@ type rpc struct {
Customer customer.Customer Customer customer.Customer
Supplier supplier.Supplier Supplier supplier.Supplier
Wholesale wholesale.Wholesale Wholesale wholesale.Wholesale
OtoSaas otosaas.OtoSaas
} }

@ -0,0 +1,200 @@
package batch
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 Goods struct {
goods
}
type goods struct {
}
type GoodsSearch struct {
Name string // 商品名称
CategoryIds []uint // 类目id
BrandName string // 品牌名
UpcCode string // 商品条码
Handle uint // 处理状态 1=待处理 2=入库 3=废弃
SkuId uint // 供应商skuId
MinSupplyPrice decimal.Decimal // 最小采购价
MaxSupplyPrice decimal.Decimal // 最大采购价
}
type ArgsGoodsList struct {
Search GoodsSearch
Page bean.Page
}
type GoodsItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Img string `json:"img"`
GoodsNum string `json:"goodsNum"`
CategoryId uint `json:"categoryId"`
BrandId uint `json:"brandId"`
BrandName string `json:"brandName"`
SkuItems []GoodsItemLists `json:"skuItems"`
UpcCodes []string `json:"upcCodes"`
StockCount uint `json:"stockCount"`
GuidePrices []decimal.Decimal `json:"guidePrices"`
SupplyPrices []decimal.Decimal `json:"supplyPrices"`
Status uint `json:"status"`
CreatedAt int64 `json:"createdAt"`
}
type GoodsItemLists struct {
Id uint `json:"id"`
Specifications []SkuSpecificationItem `json:"specifications"`
Stock uint `json:"stock"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
GoodsId uint `json:"goodsId"`
Img string `json:"img"`
UpcCode string `json:"upcCode"`
}
type GoodsSpecificationItem struct {
Name string `json:"name"`
Values []string `json:"values"`
}
type SkuSpecificationItem struct {
Name string `json:"name"`
Value string `json:"value"`
}
type ReplyGoodsLists struct {
List []GoodsItem `json:"list"`
Total int64 `json:"total"`
}
// Lists @Title 获取商品列表
func (g *goods) Lists(ctx context.Context, args ArgsGoodsList) (reply ReplyGoodsLists, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsGoodsInfo struct {
SkuId uint
}
type ReplyGoodsInfo struct {
Id uint `json:"id"`
Name string `json:"name"`
SupplierId uint `json:"supplierId"`
SupplierName string `json:"supplierName"`
CategoryId uint `json:"categoryId"`
BrandId uint `json:"brandId"`
Imgs []string `json:"imgs"`
Content string `json:"content"`
Attributes []GoodsAttributeItem `json:"attributes"`
Skus []SkuItem `json:"skus"`
Status uint `json:"status"`
}
type GoodsAttributeItem struct {
Name string `json:"name"`
Value string `json:"value"`
GroupName string `json:"groupName"`
}
type SkuSpecItem struct {
Name string `json:"name"`
Value string `json:"value"`
}
type SkuItem struct {
SkuId uint `json:"skuId"`
Color string `json:"color"`
Size string `json:"size"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
MarketPrice decimal.Decimal `json:"marketPrice"`
UpcCode string `json:"upcCode"`
UnitId uint `json:"uintId"`
TaxCategoryId uint `json:"taxCategoryId"`
TaxName string `json:"taxName"`
TaxCode string `json:"taxCode"`
Unit string `json:"uint"`
Tax decimal.Decimal `json:"tax"`
Img string `json:"img"`
}
// Info @Title 商品详情
func (g *goods) Info(ctx context.Context, goodsId uint) (reply ReplyGoodsInfo, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", goodsId, &reply)
return
}
// GetImgs @Title 获取商品主图
func (g *goods) GetImgs(ctx context.Context, goodsId uint) (reply []string, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "GetImgs", goodsId, &reply)
return
}
type AdoptItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Error string `json:"error"`
}
// Adopt @Title 批量入库
func (g *goods) Adopt(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Adopt", goodsIds, &reply)
return
}
// Discard @Title 批量废弃
func (g *goods) Discard(ctx context.Context, goodsIds []uint) (err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Discard", goodsIds, &reply)
return
}
// ReHandle @Title 重新处理商品
func (g *goods) ReHandle(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "ReHandle", goodsIds, &reply)
return
}
type ReplyByIdItem struct {
SkuId uint `json:"skuId"`
SupplierId uint `json:"supplierIds"`
SupplierName string `json:"supplierName"`
}
// FindBySkuIds @Title 根据商品Ids获取商品信息
func (g *goods) FindBySkuIds(ctx context.Context, skuIds []uint) (reply []ReplyByIdItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "FindBySkuIds", skuIds, &reply)
return
}

@ -4,6 +4,7 @@ import (
"context" "context"
"git.oa00.com/supply-chain/service/client" "git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean" "git.oa00.com/supply-chain/service/lib/bean"
"git.oa00.com/supply-chain/service/supplier/batch"
"github.com/shopspring/decimal" "github.com/shopspring/decimal"
) )
@ -16,6 +17,7 @@ type Supplier struct {
LogisticsCompany logisticsCompany LogisticsCompany logisticsCompany
ReturnAddress returnAddress ReturnAddress returnAddress
Afs afs Afs afs
BatchGoods batch.Goods
} }
type supplier struct { type supplier struct {

Loading…
Cancel
Save