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

finance
黄伟 2 years ago
commit 46b185d67a

@ -3,7 +3,8 @@ package customer
type serviceId uint
const (
ServiceSupply serviceId = 1 // 供应链
ServiceSupply serviceId = 1 // 供应链
ServiceWholesale serviceId = 2 // 批发
UserServiceStatusNone = 0 // 无
UserServiceStatusWait = 1 // 待审核

@ -3,12 +3,17 @@ package service
import (
"context"
"git.oa00.com/supply-chain/service/client"
audit2 "git.oa00.com/supply-chain/service/customer/service/audit"
"git.oa00.com/supply-chain/service/lib/bean"
"time"
)
const (
AuditHistoryAuditStatusNone = 1 // 待审核
AuditHistoryAuditStatusAdopt = 2 // 审核通过
AuditHistoryAuditStatusReject = 3 // 审核驳回
)
type audit struct {
audit2.Audit
}
type AuditSearch struct {
ApplyUserId uint // 申请人
@ -44,3 +49,124 @@ func (a *audit) Lists(ctx context.Context, args ArgsAuditLists) (reply ReplyAudi
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsHistory struct {
Page bean.Page
CustomerId uint
AuditStatus uint
}
type ReplyHistoryLists struct {
Lists []HistoryItem `json:"lists"`
Total int64 `json:"total"`
AuditStatus uint `json:"auditStatus"` // 审核状态
}
type HistoryItem struct {
ServiceId uint `json:"serviceId"`
Remark string `json:"remark"`
ExpirationAt int64 `json:"expirationAt"`
ApplyAt int64 `json:"applyAt"`
AuditStatus uint `json:"auditStatus"`
}
// History @Title 服务申请记录
func (a *audit) History(ctx context.Context, args ArgsHistory) (reply ReplyHistoryLists, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "History", args, &reply)
return
}
type ArgsAuditApply struct {
ServiceId uint `json:"serviceId"` // 服务id
ApplyUserId uint `json:"applyUserId"` // 申请人id
CustomerId uint `json:"customerId"` // 客户id
ExpirationAt time.Time `json:"expirationAt"` // 到期时间
Expand any `json:"expand"` // 拓展参数
}
// Apply @Title 申请
func (a *audit) Apply(ctx context.Context, args ArgsAuditApply) error {
reply := 0
xClient, err := client.GetClient(a)
if err != nil {
return err
}
return xClient.Call(ctx, "Apply", args, &reply)
}
type ArgsAuditAdopt struct {
AuditUserId uint // 审核人id
UserServiceId uint // 客户服务id
}
// Adopt @Title 审核通过
func (a *audit) Adopt(ctx context.Context, args ArgsAuditAdopt) error {
reply := 0
xClient, err := client.GetClient(a)
if err != nil {
return err
}
return xClient.Call(ctx, "Adopt", args, &reply)
}
type ArgsAuditReject struct {
AuditUserId uint // 审核人id
UserServiceId uint // 客户服务id
Reason string // 驳回原因
}
// Reject @Title 驳回
func (a *audit) Reject(ctx context.Context, args ArgsAuditReject) error {
reply := 0
xClient, err := client.GetClient(a)
if err != nil {
return err
}
return xClient.Call(ctx, "Reject", args, &reply)
}
type ReplyAuditInfo struct {
Id uint `json:"id"`
UserName string `json:"userName"`
ApplyUserId uint `json:"applyUserId"`
ApplyAt int64 `json:"applyAt"`
ServiceId uint `json:"serviceId"`
ServiceName string `json:"serviceName"`
ExpirationAt int64 `json:"expirationAt"`
AuditStatus uint `json:"auditStatus"`
AuditAt int64 `json:"auditAt"`
Reason string `json:"reason"`
AuditUserId uint `json:"auditUserId"`
Expand any `json:"expand"`
}
// Info @Title 详情
func (a *audit) Info(ctx context.Context, userServiceId uint) (reply ReplyAuditInfo, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", userServiceId, &reply)
return
}
type ReplyProof struct {
Name string `json:"name"`
ChannelId uint `json:"channelId"` // 用户Id
AppKey string `json:"appKey"`
AppSecret string `json:"appSecret"`
}
// GetProof @Title 获取凭证
func (a *audit) GetProof(ctx context.Context, userServiceId uint) (reply ReplyProof, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "GetProof", userServiceId, &reply)
return
}

@ -1,5 +0,0 @@
package audit
type Audit struct {
Supply supply
}

@ -1,101 +0,0 @@
package audit
import (
"context"
"git.oa00.com/supply-chain/service/client"
)
type supply struct {
}
type ArgsSupplyApply struct {
ApplyUserId uint // 申请人id
CustomerId uint // 客户id
RateId uint // 费率id
ExpirationAt int64 // 到期时间
Enclosure string // 附件
}
// Apply @Title 申请
func (s *supply) Apply(ctx context.Context, args ArgsSupplyApply) error {
reply := 0
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Apply", args, &reply)
}
type ArgsSupplyAdopt struct {
AuditUserId uint // 审核人id
UserServiceId uint // 客户服务id
}
// Adopt @Title 审核通过
func (s *supply) Adopt(ctx context.Context, args ArgsSupplyAdopt) error {
reply := 0
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Adopt", args, &reply)
}
type ArgsSupplyReject struct {
AuditUserId uint // 审核人id
UserServiceId uint // 客户服务id
Reason string // 驳回原因
}
// Reject @Title 驳回
func (s *supply) Reject(ctx context.Context, args ArgsSupplyReject) error {
reply := 0
xClient, err := client.GetClient(s)
if err != nil {
return err
}
return xClient.Call(ctx, "Reject", args, &reply)
}
type ReplySupplyInfo struct {
Id uint `json:"id"`
UserName string `json:"userName"`
ApplyUserId uint `json:"applyUserId"`
ApplyAt int64 `json:"applyAt"`
ServiceId uint `json:"serviceId"`
ServiceName string `json:"serviceName"`
ExpirationAt int64 `json:"expirationAt"`
RateId uint `json:"rateId"`
Enclosure string `json:"enclosure"`
AuditStatus uint `json:"auditStatus"`
AuditAt int64 `json:"auditAt"`
Reason string `json:"reason"`
AuditUserId uint `json:"auditUserId"`
}
// Info @Title 详情
func (s *supply) Info(ctx context.Context, userServiceId uint) (reply ReplySupplyInfo, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", userServiceId, &reply)
return
}
type ReplyProof struct {
Name string `json:"name"`
ChannelId uint `json:"channelId"` // 用户Id
AppKey string `json:"appKey"`
AppSecret string `json:"appSecret"`
}
// GetProof @Title 获取凭证
func (s *supply) GetProof(ctx context.Context, userServiceId uint) (reply ReplyProof, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "GetProof", userServiceId, &reply)
return
}

@ -35,3 +35,19 @@ func (s *service) All(ctx context.Context, customerId uint) (reply []ReplyServic
err = xClient.Call(ctx, "All", customerId, &reply)
return
}
type ReplyServiceSelect struct {
Id uint `json:"id"`
Name string `json:"name"`
}
// Select @Title 服务筛选
func (s *service) Select(ctx context.Context) (reply []ReplyServiceSelect, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
args := 0
err = xClient.Call(ctx, "Select", args, &reply)
return
}

@ -79,3 +79,18 @@ func (i *item) DelAll(ctx context.Context, skuTypeId uint) error {
reply := 0
return xClient.Call(ctx, "DelAll", skuTypeId, &reply)
}
type ArgsBySkuIds struct {
SkuIds []uint
SkuTypeId uint
}
// FindBySkuIds @Title 根据SkuId查询数据
func (i *item) FindBySkuIds(ctx context.Context, args ArgsBySkuIds) (reply []SkuItem, err error) {
xClient, err := client.GetClient(i)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "FindBySkuIds", args, &reply)
return
}

@ -90,3 +90,13 @@ func (s *sale) DelAll(ctx context.Context) error {
reply := 0
return xClient.Call(ctx, "DelAll", args, &reply)
}
// FindBySkuIds @Title 根据SkuId查询数据
func (s *sale) FindBySkuIds(ctx context.Context, skuIds []uint) (reply []SaleSkuItem, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "FindBySkuIds", skuIds, &reply)
return
}

@ -31,11 +31,11 @@ type UserItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Account string `json:"account"`
RateId uint `json:"rateId"`
Liaison string `json:"liaison"`
Phone string `json:"phone"`
Amount decimal.Decimal `json:"amount"`
Status uint `json:"status"`
ServiceNames []string `json:"serviceNames"`
CreatedType uint `json:"createdType"`
CreatedUserId uint `json:"createdUserId"`
CreatedAt int64 `json:"createdAt"`

@ -3,9 +3,11 @@ module git.oa00.com/supply-chain/service
go 1.18
require (
git.oa00.com/go/jdsdk v1.0.0
github.com/rpcxio/rpcx-consul v0.0.0-20220730062257-1ff0472e730f
github.com/shopspring/decimal v1.3.1
github.com/smallnest/rpcx v1.7.8
golang.org/x/net v0.0.0-20220708220712-1185a9018129
)
require (
@ -66,7 +68,6 @@ require (
github.com/xtaci/kcp-go v5.4.20+incompatible // indirect
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d // indirect
golang.org/x/tools v0.1.11 // indirect

@ -7,6 +7,8 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
git.oa00.com/go/jdsdk v1.0.0 h1:xsxZlcPrRoJ47PNU49Xtb+m8K/XaHu3pDljSSd9lYAo=
git.oa00.com/go/jdsdk v1.0.0/go.mod h1:ZLdq5OMaXWHO9wtXJflhysp3cSVLRJHbxHLE1DpKYdY=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/akutz/memconn v0.1.0 h1:NawI0TORU4hcOMsMr11g7vwlCdkYeLKXBcxWu2W/P8A=

@ -1,8 +1,11 @@
package jd
import "git.oa00.com/supply-chain/service/jd/jdsdk"
type Jd struct {
Task task
Brand brand
Category category
Sku sku
Jdsdk jdsdk.Jdsdk
}

@ -0,0 +1,20 @@
package jdsdk
import (
"context"
order2 "git.oa00.com/go/jdsdk/order"
"git.oa00.com/supply-chain/service/client"
)
type afterSale struct {
}
// Info @Title 售后详情
func (a *afterSale) Info(ctx context.Context, afsServiceId uint64) (reply order2.AfterSaleInfo, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", afsServiceId, &reply)
return
}

@ -0,0 +1,7 @@
package jdsdk
type Jdsdk struct {
Order order
Sku sku
AfterSale afterSale
}

@ -0,0 +1,20 @@
package jdsdk
import (
"context"
order2 "git.oa00.com/go/jdsdk/order"
"git.oa00.com/supply-chain/service/client"
)
type order struct {
}
// Cancel @Title 订单取消 京东订单id
func (o *order) Cancel(ctx context.Context, orderId string) (reply order2.OrderInfo, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(ctx, "Cancel", orderId, &reply)
return
}

@ -0,0 +1,30 @@
package jdsdk
import (
"context"
sku2 "git.oa00.com/go/jdsdk/sku"
"git.oa00.com/supply-chain/service/client"
)
type sku struct {
}
// GetDetail @Title 获取商品详情 sku最大20
func (s *sku) GetDetail(ctx context.Context, jdSkuIds []uint64) (reply []sku2.Detail, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "GetDetail", jdSkuIds, &reply)
return
}
// GetPriceList @Title 获取商品价格列表 最大100
func (s *sku) GetPriceList(ctx context.Context, jdSkuIds []uint64) (reply []sku2.PriceItem, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return
}
err = xClient.Call(ctx, "GetPriceList", jdSkuIds, &reply)
return
}

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

@ -5,48 +5,52 @@ type Error uint
const (
ErrorSystem Error = 11001 // 系统错误
ErrorOrderRepeat Error = 11002 // 重复下单
ErrorOrderFreightFee Error = 11003 // 运费错误
ErrorOrderSubmit Error = 11004 // 下单失败
ErrorOrderShipment Error = 11005 // 无法配送
ErrorOrderSkuPrice Error = 11006 // 商品价格错误
ErrorOrderAmount Error = 11007 // 订单金额错误
ErrorOrderLadingBill Error = 11008 // 订单已提单
ErrorOrderClose Error = 11009 // 订单已关闭
ErrorOrderTimeOut Error = 11010 // 订单超时
ErrorOrderError Error = 11011 // 订单错误
ErrorOrderUnPay Error = 11012 // 订单未支付
ErrorOrderInvalid Error = 11013 // 订单失效
ErrorOrderSkuInvalid Error = 11014 // 订单商品错误
ErrorAfterServiceTypeError Error = 11015 // 售后类型错误
ErrorAfterServiceReasonError Error = 11016 // 售后原因错误
ErrorAfterServiceError Error = 11017 // 售后单错误
ErrorAfterServiceCloseError Error = 11018 // 售后已关闭
ErrorAfterServiceFinishError Error = 11019 // 售后已完成
ErrorOrderCancelError Error = 11020 // 订单取消失败
ErrorOrderRepeat Error = 11002 // 重复下单
ErrorOrderFreightFee Error = 11003 // 运费错误
ErrorOrderSubmit Error = 11004 // 下单失败
ErrorOrderShipment Error = 11005 // 无法配送
ErrorOrderSkuPrice Error = 11006 // 商品价格错误
ErrorOrderAmount Error = 11007 // 订单金额错误
ErrorOrderLadingBill Error = 11008 // 订单已提单
ErrorOrderClose Error = 11009 // 订单已关闭
ErrorOrderTimeOut Error = 11010 // 订单超时
ErrorOrderError Error = 11011 // 订单错误
ErrorOrderUnPay Error = 11012 // 订单未支付
ErrorOrderInvalid Error = 11013 // 订单失效
ErrorOrderSkuInvalid Error = 11014 // 订单商品错误
ErrorAfterServiceTypeError Error = 11015 // 售后类型错误
ErrorAfterServiceReasonError Error = 11016 // 售后原因错误
ErrorAfterServiceError Error = 11017 // 售后单错误
ErrorAfterServiceCloseError Error = 11018 // 售后已关闭
ErrorAfterServiceFinishError Error = 11019 // 售后已完成
ErrorOrderCancelError Error = 11020 // 订单取消失败
ErrorAfterServiceLogisticsAddressError Error = 11021 // 售后寄回地址获取失败
ErrorAfterServiceLogisticsAddressReturnError Error = 11022 // 售后寄回地址已回传
)
var ErrorCodes = map[Error]string{
ErrorSystem: "系统错误",
ErrorOrderRepeat: "重复下单",
ErrorOrderFreightFee: "运费错误",
ErrorOrderSubmit: "下单失败",
ErrorOrderShipment: "无法配送",
ErrorOrderSkuPrice: "商品价格错误",
ErrorOrderAmount: "订单金额错误",
ErrorOrderLadingBill: "订单已提单",
ErrorOrderClose: "订单已关闭",
ErrorOrderTimeOut: "订单超时",
ErrorOrderError: "订单错误",
ErrorOrderUnPay: "订单未支付",
ErrorOrderInvalid: "订单失效",
ErrorOrderSkuInvalid: "订单商品错误",
ErrorAfterServiceTypeError: "售后类型错误",
ErrorAfterServiceReasonError: "售后原因错误",
ErrorAfterServiceError: "售后单错误",
ErrorAfterServiceCloseError: "售后已关闭",
ErrorAfterServiceFinishError: "售后已完成",
ErrorOrderCancelError: "订单取消失败",
ErrorSystem: "系统错误",
ErrorOrderRepeat: "重复下单",
ErrorOrderFreightFee: "运费错误",
ErrorOrderSubmit: "下单失败",
ErrorOrderShipment: "无法配送",
ErrorOrderSkuPrice: "商品价格错误",
ErrorOrderAmount: "订单金额错误",
ErrorOrderLadingBill: "订单已提单",
ErrorOrderClose: "订单已关闭",
ErrorOrderTimeOut: "订单超时",
ErrorOrderError: "订单错误",
ErrorOrderUnPay: "订单未支付",
ErrorOrderInvalid: "订单失效",
ErrorOrderSkuInvalid: "订单商品错误",
ErrorAfterServiceTypeError: "售后类型错误",
ErrorAfterServiceReasonError: "售后原因错误",
ErrorAfterServiceError: "售后单错误",
ErrorAfterServiceCloseError: "售后已关闭",
ErrorAfterServiceFinishError: "售后已完成",
ErrorOrderCancelError: "订单取消失败",
ErrorAfterServiceLogisticsAddressError: "售后寄回地址获取失败",
ErrorAfterServiceLogisticsAddressReturnError: "售后寄回地址已回传",
}
func (e Error) Error() string {

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

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

@ -37,6 +37,7 @@ type GoodsItem struct {
StockCount uint `json:"stockCount"`
GuidePrices []decimal.Decimal `json:"guidePrices"`
SupplyPrices []decimal.Decimal `json:"supplyPrices"`
Status uint `json:"status"`
CreatedAt int64 `json:"createdAt"`
}

@ -0,0 +1,25 @@
package supplier
import (
"git.oa00.com/supply-chain/service/client"
"golang.org/x/net/context"
)
type logisticsCompany struct {
}
type CompanyItem struct {
Id uint `json:"id"`
Name string `json:"name"`
}
// Select @Title 物流公司筛选
func (l *logisticsCompany) Select(ctx context.Context) (reply []CompanyItem, err error) {
xClient, err := client.GetClient(l)
if err != nil {
return nil, err
}
args := 0
err = xClient.Call(ctx, "Select", args, &reply)
return
}

@ -0,0 +1,30 @@
package supplier
import (
"git.oa00.com/supply-chain/service/client"
"golang.org/x/net/context"
)
type returnAddress struct {
}
type ReplyReturnAddressAll struct {
SupplierId uint `json:"supplierId"`
Item []ReturnAddressItem `json:"item"`
}
type ReturnAddressItem struct {
Id uint `json:"id"`
Address string `json:"name"`
}
// All @Title 全部退货地址
func (r *returnAddress) All(ctx context.Context) (reply []ReplyReturnAddressAll, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return nil, err
}
args := 0
err = xClient.Call(ctx, "All", args, &reply)
return
}

@ -4,6 +4,7 @@ import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
"git.oa00.com/supply-chain/service/supplier/batch"
"github.com/shopspring/decimal"
)
@ -11,8 +12,12 @@ type Supplier struct {
Goods goods
Apply supplierApply
supplier
WarnLiaison warnLiaison
WalletApply supplierWalletApply
WarnLiaison warnLiaison
WalletApply supplierWalletApply
LogisticsCompany logisticsCompany
ReturnAddress returnAddress
Afs afs
BatchGoods batch.Goods
}
type supplier struct {

@ -58,10 +58,54 @@ func (a *afterService) RetailAfsHistory(ctx context.Context, args ArgsRetailHist
return
}
type ArgsAfsLists struct {
Search AfsListSearch `json:"search"`
Page bean.Page `json:"page"`
}
type AfsListSearch struct {
Status uint `json:"status"`
AfsSn string `json:"afsSn"`
OrderSubSn string `json:"orderSubSn"`
CreatedStartDate string `json:"createdStartAt"`
CreatedEndDate string `json:"createdEndAt"`
}
type ReplyAfsLists struct {
Lists []AfsItem `json:"lists"`
Total int64 `json:"total"`
}
type AfsItem struct {
Id uint `json:"id"`
AfsSn string `json:"afsSn"`
OrderSubSn string `json:"orderSubSn"`
SourceId uint `json:"sourceId"`
SourceSkuId string `json:"sourceSkuId"`
SkuName string `json:"skuName"`
Quantity uint `json:"quantity"`
Status uint `json:"status"`
Result string `json:"result"`
Price decimal.Decimal `json:"price"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// Lists @Title 售后列表
func (a *afterService) Lists(ctx context.Context, args ArgsAfsLists) (reply ReplyAfsLists, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return ReplyAfsLists{}, err
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsAfterServiceDeliver struct {
SourceAfsSn string `json:"sourceAfsSn"`
SourceSkuId string `json:"sourceSkuId"`
SourceOrderSN string `json:"sourceOrderSN"`
SourceOrderSn string `json:"sourceOrderSn"`
ApproveNotes string `json:"approveNotes"`
}
// Deliver @Title 需要发货
@ -92,20 +136,73 @@ func (a *afterService) Receipt(ctx context.Context, args ArgsAfterServiceReceipt
return
}
type ArgsAfterServiceReject struct {
type ArgsAfterServiceClose struct {
Source source `json:"source"`
SourceAfsSn string `json:"sourceAfsSn"`
SourceSkuId string `json:"sourceSkuId"`
SourceOrderSN string `json:"sourceOrderSN"`
SourceOrderSn string `json:"sourceOrderSn"`
Result string `json:"result"`
ApproveNotes string `json:"approveNotes"`
}
// Close @Title 关闭售后单
func (a *afterService) Close(ctx context.Context, args ArgsAfterServiceClose) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return err
}
reply := 0
err = xClient.Call(ctx, "Close", args, &reply)
return
}
// Reject @Title 驳回
func (a *afterService) Reject(ctx context.Context, args ArgsAfterServiceReject) (err error) {
type ArgsAfterServiceRefund struct {
Source source `json:"source"`
SourceAfsSn string `json:"sourceAfsSn"`
SourceSkuId string `json:"sourceSkuId"`
SourceOrderSn string `json:"sourceOrderSn"`
Result string `json:"result"`
RefundFee decimal.Decimal `json:"refundFee"`
RefundOrderFee decimal.Decimal `json:"refundOrderFee"`
RefundFreightFee decimal.Decimal `json:"refundFreightFee"`
ApproveNotes string `json:"approveNotes"`
}
// Refund @Title 退款
func (a *afterService) Refund(ctx context.Context, args ArgsAfterServiceRefund) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return err
}
reply := 0
err = xClient.Call(ctx, "Refund", args, &reply)
return
}
type ArgsAfterServiceNewOrder struct {
Source source `json:"source"`
SourceAfsSn string `json:"sourceAfsSn"`
SourceSkuId string `json:"sourceSkuId"`
SourceOrderSn string `json:"sourceOrderSn"`
Result string `json:"result"`
NewSourceOrderSn string `json:"newSourceOrderSn"`
ApproveNotes string
Skus []NewOrderSku `json:"skus"`
}
type NewOrderSku struct {
SourceSkuId string `json:"sourceSkuId"`
Quantity uint `json:"quantity"`
Name string `json:"name"`
}
// NewOrder @Title 新订单
func (a *afterService) NewOrder(ctx context.Context, args ArgsAfterServiceNewOrder) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return err
}
reply := 0
err = xClient.Call(ctx, "Reject", args, &reply)
err = xClient.Call(ctx, "NewOrder", args, &reply)
return
}
@ -113,6 +210,7 @@ type ReplyAfterServiceDetail 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"`
@ -129,6 +227,17 @@ type ReplyAfterServiceDetail struct {
LogisticsCompany string `json:"logisticsCompany"`
WaybillCode string `json:"waybillCode"`
SendAt int64 `json:"sendAt"`
PackageSend uint `json:"packageSend"`
AfsPackageSend AfsPackageSend `json:"afsPackageSend"`
}
type AfsPackageSend struct {
Name string `json:"name"`
Mobile string `json:"mobile"`
ZipCode string `json:"zipCode"`
Address string `json:"address"`
LogisticsCompany string `json:"logisticsCompany"`
WaybillCode string `json:"waybillCode"`
SendGoodsDate int64 `json:"sendGoodsDate"`
}
// Detail @Title 售后详情
@ -157,3 +266,28 @@ func (a *afterService) LogisticsAddress(ctx context.Context, afsSn string) (repl
err = xClient.Call(ctx, "LogisticsAddress", afsSn, &reply)
return
}
type ReplyAfsInfoById struct {
Id uint `json:"id"`
AfsSn string `json:"afsSn"`
SourceAfsSn string `json:"sourceAfsSn"`
SkuId uint `json:"skuId"`
SourceSkuId string `json:"sourceSkuId"`
SourceId uint `json:"sourceId"`
OrderSubSn string `json:"orderSn"`
SourceOrderSn string `json:"SourceOrderSn"`
OrderFee decimal.Decimal `json:"orderFee"`
SourceOrderFee decimal.Decimal `json:"sourceOrderFee"`
FreightFee decimal.Decimal `json:"freightFee"`
ApproveNotes string `json:"approveNotes"`
}
// FindByAfsId @Title 获取售后信息
func (a *afterService) FindByAfsId(ctx context.Context, afsId uint) (reply ReplyAfsInfoById, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "FindByAfsId", afsId, &reply)
return
}

@ -14,6 +14,10 @@ const (
AfterServiceStatusHandle = 3 // 收货处理中
AfterServiceStatusFinal = 4 // 售后完成
AfterServiceStatusClose = 5 // 售后关闭
AfterServicePackageSendNone = 1 // 无
AfterServicePackageSendWait = 2 // 待客户发货
AfterServicePackageSendAlready = 3 // 客户已发货
)
type afterService struct {
@ -181,9 +185,9 @@ func (a *afterService) Lists(ctx context.Context, channelId string, args ArgsAft
type ReplyAfterServiceDetail struct {
Id uint `json:"id"`
AfsSn string `json:"afsSn"`
ReceiverName string `json:"receiverName"`
ReceiverMobile string `json:"receiverMobile"`
OrderSubSn string `json:"orderSubSn"`
Status uint `json:"status"`
ApproveNotes string `json:"approveNotes"`
Result string `json:"result"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
@ -198,6 +202,17 @@ type ReplyAfterServiceDetail struct {
LogisticsCompany string `json:"logisticsCompany"`
WaybillCode string `json:"waybillCode"`
SendAt int64 `json:"sendAt"`
PackageSend uint `json:"packageSend"`
AfsPackageSend AfsPackageSend `json:"afsPackageSend"`
}
type AfsPackageSend struct {
Name string `json:"name"`
Mobile string `json:"mobile"`
ZipCode string `json:"zipCode"`
Address string `json:"address"`
LogisticsCompany string `json:"logisticsCompany"`
WaybillCode string `json:"waybillCode"`
SendGoodsDate int64 `json:"sendGoodsDate"`
}
// Detail @Title 售后详情

@ -13,6 +13,10 @@ const (
MqSubscribeNameOrderStockOut = "order_stock_out" // 订单出库
MqSubscribeNameOrderFinish = "order_finish" // 订单完成
MqSubscribeNameOrderCancel = "order_cancel" // 订单取消
MqSubscribeNameAfsDeliver = "afs_deliver" // 需要客户发货
MqSubscribeNameAfsWait = "afs_wait" // 等待收货处理
MqSubscribeNameAfsClose = "afs_close" // 售后关闭
MqSubscribeNameAfsFinish = "afs_finish" // 售后完成
)
type mq struct {

@ -12,6 +12,7 @@ import (
const (
ReplyOrderFreightFeeErrCodeNone = 0 // 无错误
ReplyOrderFreightFeeErrCodeErr = 1 // 有错误
ReplyOrderFreightFeeErrCodeDone = 2 // 已下架
OrderStatusLock = 1 // 锁单待确认
OrderStatusLadingBill = 2 // 提单
@ -28,6 +29,10 @@ const (
OrderSubIsSplitFalse = 1 // 无
OrderSubIsSplitTrue = 2 // 被拆单
OrderSubTypeApi = 1 // api接口下单
OrderSubTypeCustomerWeb = 2 // 客户商城下单
)
type order struct {
@ -72,6 +77,7 @@ type ArgsOrderSubmit struct {
OrderFee decimal.Decimal // 订单金额-不含运费
FreightFees []OrderFreightFee // 运费
UserIp string // 下单用户ip
Type uint // 下单方式
}
type OrderFreightFee struct {
@ -87,8 +93,8 @@ type Receiver struct {
}
type ReplyOrderSubmit struct {
OrderSn string
ChannelOrderSn string
OrderSn string `json:"orderSn"`
ChannelOrderSn string `json:"channelOrderSn"`
}
// Submit @Title 下单
@ -136,7 +142,43 @@ func (o *order) Cancel(ctx context.Context, channelId string, args ArgsOrderChan
return xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Cancel", args, &reply)
}
type ArgsOrderSplit struct {
RootOrderSn string
ChannelOrderSn string
}
type ReplyOrderSplit struct {
OrderSn string `json:"orderSn"`
ChannelOrderSn string `json:"channelOrderSn"`
FreightFee decimal.Decimal `json:"freightFee"`
OrderFee decimal.Decimal `json:"orderFee"`
Skus []OrderSplitSkuItem `json:"skus"`
SubOrders []*OrderSubSplit `json:"subOrders"`
Type uint `json:"type"`
}
type OrderSubSplit struct {
OrderSn string `json:"orderSn"`
FreightFee decimal.Decimal `json:"freightFee"`
OrderFee decimal.Decimal `json:"orderFee"`
Skus []OrderSplitSkuItem `json:"skus"`
SubOrders []*OrderSubSplit `json:"subOrders"`
}
type OrderSplitSkuItem struct {
SkuId uint `json:"skuId"`
Quantity uint `json:"quantity"`
}
// Split @Title 获取拆单信息
func (o *order) Split(ctx context.Context, channelId string, args ArgsOrderSplit) (reply ReplyOrderSplit, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "Split", args, &reply)
return
}
type OrderListsSearch struct {
SkuIds []uint // 商品Ids
SkuName string // 商品名称
Status []uint // 订单状态
CancelStatus uint // 订单取消状态
@ -166,8 +208,10 @@ type OrderItem struct {
Status uint `json:"status"`
CancelStatus uint `json:"cancelStatus"`
CreatedAt int64 `json:"createdAt"`
CloseAt int64 `json:"closeAt"`
Skus []OrderSku `json:"skus"`
Packages []OrderPackage `json:"packages"`
StockOutAt int64 `json:"stockOutAt"`
}
type OrderSku struct {
@ -201,6 +245,30 @@ func (o *order) Lists(ctx context.Context, channelId string, args ArgsOrderLists
return
}
type ArgsOrderDetail struct {
RootOrderSn string
ChannelOrderSn string
}
type ReplyOrderDetail struct {
ChannelOrderSn string
OrderSn string
OrderFee decimal.Decimal
FreightFee decimal.Decimal
Receiver OrderReceiver
CreatedAt int64
LadingBillAt int64
CloseAt int64
}
type OrderReceiver struct {
ReceiverName string
ReceiverMobile string
ReceiverEmail string
ReceiverZipCode string
Address string
UserIp string
}
// Detail @Title 订单详情
func (o *order) Detail(ctx context.Context, channelId string, orderSn string) (reply OrderItem, err error) {
xClient, err := client.GetClient(o)
@ -211,6 +279,16 @@ func (o *order) Detail(ctx context.Context, channelId string, orderSn string) (r
return
}
// SubDetail @Title 子订单详情
func (o *order) SubDetail(ctx context.Context, channelId, orderSn string) (reply OrderItem, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(context.WithValue(ctx, share.ReqMetaDataKey, map[string]string{"channelId": channelId}), "SubDetail", orderSn, &reply)
return
}
// Trajectory @Title 获取订单物流信息
func (o *order) Trajectory(ctx context.Context, channelId string, orderSn string) (reply []_interface.ReplyTrajectory, err error) {
xClient, err := client.GetClient(o)

@ -80,12 +80,19 @@ type SkuEsSearch struct {
MinDiscount decimal.Decimal // 最低折扣
MaxDiscount decimal.Decimal // 最高折扣
Expand []map[string]interface{} // 拓展查询
CustomerSearch CustomerSearch // 客户系统的搜索条件
}
type ArgsSkuListsEs struct {
Search SkuEsSearch
Page bean.Page
}
type CustomerSearch struct {
SkuName string
SkuId uint
BrandName string
}
// ListsEs @Title es商品列表 目前最大10000条数据超出不显示
func (s *sku) ListsEs(ctx context.Context, channelId string, args ArgsSkuListsEs) (reply ReplySkuList, err error) {
xClient, err := client.GetClient(s)

@ -10,6 +10,8 @@ const (
AfterServiceNeedPictureTrue = 1 // 需要上传
AfterServiceNeedPictureFalse = 2 // 不需要上传
AfterServiceZipCodeNone = "000000"
)
type AfterServiceInterface interface {

@ -7,8 +7,9 @@ import (
type skuState uint
const (
SkuStateIn = 1 // 有货
SkuStateOut = 2 // 无货
SkuStateIn = 1 // 有货
SkuStateOut = 2 // 无货
SkuStateDone = 3 // 下架商品
)
type Sku interface {

@ -106,6 +106,7 @@ type ArgsRetailOrderLists struct {
type RetailOrderSearch struct {
OrderSubSn uint64 `label:"订单号"`
SourceSubSn uint64 `label:"供应商订单号"`
SupplierId uint `label:"供应商"`
CustomerId uint `label:"客户"`
WaybillCode string `label:"运单号"`
@ -119,6 +120,7 @@ type RetailOrderSearch struct {
type RetailOrderItem struct {
Id uint `json:"id"`
OrderSubSn string `json:"orderSubSn"`
SourceOrderSn string `json:"sourceOrderSn"`
SourceName string `json:"sourceName"`
CustomerName string `json:"customerName"`
OrderStatus uint `json:"orderStatus"`
@ -127,6 +129,8 @@ type RetailOrderItem struct {
SupplyOrderFee decimal.Decimal `json:"supplyOrderFee"`
PayTime int64 `json:"payTime"`
FinishAt int64 `json:"finishAt"`
CloseAt int64 `json:"closeAt"`
StockOutAt int64 `json:"stockOutAt"`
}
type ReplyRetailOrderLists struct {
@ -148,6 +152,9 @@ type OrderInfo struct {
OrderId uint `json:"orderId"`
CustomerId uint `json:"customerId"`
OrderSn uint64 `json:"orderSn"`
SourceOrderSn uint64 `json:"sourceOrderSn"`
SourceId uint `json:"sourceId"`
SourceName string `json:"sourceName"`
ReceiverName string `json:"receiverName"`
ReceiverMobile string `json:"receiverMobile"`
Address string `json:"address"`
@ -158,6 +165,7 @@ type OrderInfo struct {
Status uint `json:"status"`
Skus []OrderSku `json:"skus"`
Packages []OrderPackage `json:"packages"`
StockOutAt int64 `json:"stockOutAt"`
}
type OrderSku struct {

@ -25,6 +25,16 @@ func (r *rate) All(ctx context.Context) (result []RateItem, err error) {
return
}
// Get @Title 获取利率信息
func (r *rate) Get(ctx context.Context, rateId uint) (result RateItem, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "Get", rateId, &result)
return
}
type ArgsRateChannel struct {
ChannelId uint // 渠道id
RateId uint // 费率id

@ -114,9 +114,13 @@ type SkuListsSearch struct {
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 // 最小采购价格
@ -125,6 +129,7 @@ type SkuListsSearch struct {
AuditStatus uint // 审核状态
SourceStatus uint // 供应商下架状态
PlatformStatus uint // 平台下架状态
UpcCode string // 商品条码
}
type ReplySkuList struct {
@ -157,7 +162,17 @@ type SkuItem struct {
AfterPrice decimal.Decimal `json:"afterPrice"` // 改价后金额
AfterDiscount decimal.Decimal `json:"afterDiscount"` // 改价后折扣
AdjustAuditStatus uint `json:"adjustAuditStatus"` // 改价审核状态
Reason string // 改价驳回原因
Reason string `json:"reason"` // 改价驳回原因
UpcCode string `json:"upcCode"` // 商品条码
Color string `json:"color"` // 颜色
Size string `json:"size"` // 尺寸
Attributes []AttributeItem `json:"attributes"` // 商品属性
}
type AttributeItem struct {
GroupName string `json:"groupName"`
Name string `json:"name"`
Value string `json:"value"`
}
// Lists @Title 商品列表
@ -180,6 +195,7 @@ type SkuEsSearch struct {
SkuId uint // Sku编码
SupplySkuId uint // 供应商Sku编码
SkuName string // 商品名称
UpcCode string // 商品条码
BrandId uint // 品牌id
BrandName string // 品牌名称 全词匹配
FirstCategoryId uint // 一级分类id

@ -31,6 +31,7 @@ type SkuAuditEsSearch struct {
SourceSonId uint // 沙马供应商的供应商
AdjustType uint // 加价类型
Status uint // 状态 1=未审核 2=通过 3=驳回
BrandName string // 品牌名称
AfterMinDiscount decimal.Decimal // 加价后最低折扣
AfterMaxDiscount decimal.Decimal // 加价后最高折扣
}

@ -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,51 @@
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
}
// Get @Title 获取利率信息
func (r *rate) Get(ctx context.Context, rateId uint) (result RateItem, err error) {
xClient, err := client.GetClient(r)
if err != nil {
return
}
err = xClient.Call(ctx, "Get", rateId, &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