From eeb91c0724b6c457dc9cd4b5a01d1671ccb05912 Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 8 May 2019 21:49:48 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=B7=BB=E5=8A=A0=E7=A9=BAJD=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/const.go | 27 +++++++++++++ business/model/order.go | 2 +- business/model/order_financial.go | 49 ++++++++++++++--------- business/partner/purchase/jd/callback.go | 2 +- controllers/jd_callback.go | 50 +++++++++++++++++------- 5 files changed, 95 insertions(+), 35 deletions(-) diff --git a/business/model/const.go b/business/model/const.go index 8c4a3d4d0..499908325 100644 --- a/business/model/const.go +++ b/business/model/const.go @@ -216,6 +216,13 @@ const ( OrderStatusEndBegin = 100 // 以下的状态就是结束状态 OrderStatusFinished = 110 // 订单已完成 OrderStatusCanceled = 115 // 订单已取消 + + AfsOrderStatusWait4Approve = 150 // 待审核售后单 + AfsOrderStatusNew = 155 // 已审核售后单,或不需要审核的新售后单 + AfsOrderStatusWait4ReceiveGoods = 160 // 退款退货的,需要商家确认收到货 + AfsOrderStatusReceivedGoods = 162 // 已确认收到货 + AfsOrderStatusFinished = 180 // 售后单成功完成 + AfsOrderStatusFailed = 190 // 售后单失败 ) const ( @@ -290,6 +297,26 @@ const ( OrderFlagMaskCallPMCourier = 64 // 取货失败后召唤平台配送 ) +const ( + AfsAppealTypeRefund = 1 // 仅退款 + AfsAppealTypeReturnAndRefund = 2 // 退货退款 + AfsAppealTypeNewGoods = 3 // 重发新商品(即京东到家的直赔) +) + +const ( + AfsReasonTypeGoodsQuality = 1 // 商品质量 + AfsReasonTypeWrongGoods = 2 // 错误的商品 + AfsReasonTypeMissingGoods = 3 // 缺少部分商品 + AfsReasonTypeNoGoods = 4 // 全部商品未收到 + AfsReasonTypeDamagedGoods = 5 // 商品有损伤 + AfsReasonTypeGoodsQuantity = 6 // 缺斤少两 + AfsReasonTypeAgreedByMerchant = 7 // 与商家协商一致 + AfsReasonTypeGoodsNoSame = 8 // 商品与描述不符 + AfsReasonWrongPurchase = 9 // 误购 + AfsReasonNotReceivedIntime = 10 // 未在时效内送达 + AfsReasonNotOthers = 20 // 其它 +) + func IsPurchaseVendorExist(vendorID int) bool { _, ok := VendorNames[vendorID] return ok && vendorID >= VendorIDPurchaseBegin && vendorID <= VendorIDPurchaseEnd diff --git a/business/model/order.go b/business/model/order.go index a85fbfa45..3857174c1 100644 --- a/business/model/order.go +++ b/business/model/order.go @@ -30,7 +30,7 @@ type GoodsOrder struct { SkuCount int `json:"skuCount"` // 商品类别数量,即有多少种商品(注意在某些情况下,相同SKU的商品由于售价不同,也会当成不同商品在这个值里) GoodsCount int `json:"goodsCount"` // 商品个数 Status int `json:"status"` // 参见OrderStatus*相关的常量定义 - VendorStatus string `orm:"size(255)" json:"-"` + VendorStatus string `orm:"size(255)" json:"vendorStatus"` LockStatus int `json:"lockStatus"` LockStatusTime time.Time `orm:"type(datetime);null" json:"lockStatusTime"` // last lock status time OrderSeq int `json:"orderSeq"` // 门店订单序号 diff --git a/business/model/order_financial.go b/business/model/order_financial.go index 2cd40dec3..ebfbaf86f 100644 --- a/business/model/order_financial.go +++ b/business/model/order_financial.go @@ -70,25 +70,36 @@ func (o *OrderDiscountFinancial) TableUnique() [][]string { type AfsOrder struct { ModelIDCUL - VendorID int `orm:"column(vendor_id)" json:"vendorID"` - VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 关联原始订单ID - VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 关联原始订单ID2,饿百独有 - AfsOrderID string `orm:"column(afs_order_id);size(48)" json:"afsOrderID"` // 售后订单ID - AfsCreateAt time.Time `orm:"type(datetime);index" json:"afsCreateAt"` // 订单生成时间 - VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` // 外部系统里记录的storeid - StoreID int `orm:"column(store_id)" json:"storeID"` // 接口返回的京西门店ID - JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid - SkuUserMoney int64 `json:"skuUserMoney"` // 用户支付菜品金额 - FreightUserMoney int64 `json:"freightUserMoney"` // 用户支付运费金额 - AfsFreightMoney int64 `json:"afsFreightMoney"` // 退货取件费 - BoxMoney int64 `json:"boxMoney"` // 应退包装费金额 - TongchengFreightMoney int64 `json:"tongchengFreightMoney"` // 退货单产生的同城送费用 - SkuBoxMoney int64 `json:"skuBoxMoney"` // 应退订单餐盒费 - PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台总补贴金额 - PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台sku补贴金额 - PmRefundMoney int64 `json:"pmRefundMoney"` // 订单取消后可能存在佣金减少,平台退回部分金额的情况 - RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 1 - RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M + VendorID int `orm:"column(vendor_id)" json:"vendorID"` + VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 关联原始订单ID + VendorOrderID2 string `orm:"column(vendor_order_id2);size(48);index" json:"vendorOrderID2"` // 关联原始订单ID2,饿百独有 + AfsOrderID string `orm:"column(afs_order_id);size(48)" json:"afsOrderID"` // 售后订单ID + AfsCreateAt time.Time `orm:"type(datetime);index" json:"afsCreateAt"` // 订单生成时间 + VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"` // 外部系统里记录的storeid + StoreID int `orm:"column(store_id)" json:"storeID"` // 接口返回的京西门店ID + JxStoreID int `orm:"column(jx_store_id)" json:"jxStoreID"` // 根据VendorStoreID在本地系统里查询出来的 jxstoreid + + // Status int `json:"status"` + // VendorStatus string `orm:"size(255)" json:"vendorStatus"` + // ReasonType int8 `json:"reasonType"` // 售后原因 + // VendorReasonType string `orm:"size(255)" json:"vendorReasonType"` + // ReasonDesc string `orm:"size(1024)" json:"reasonDesc"` // 售后原因描述 + // ReasonImgList string `orm:"size(1024)" json:"reasonImgList"` // 售后描述图片 + // AppealType int8 `json:"appealType"` // 售后方式 + // VendorAppealType string `orm:"size(255)" json:"vendorAppealType"` + // Flag int `json:"flag"` + + SkuUserMoney int64 `json:"skuUserMoney"` // 用户支付菜品金额 + FreightUserMoney int64 `json:"freightUserMoney"` // 用户支付运费金额 + AfsFreightMoney int64 `json:"afsFreightMoney"` // 退货取件费 + BoxMoney int64 `json:"boxMoney"` // 应退包装费金额 + TongchengFreightMoney int64 `json:"tongchengFreightMoney"` // 退货单产生的同城送费用 + SkuBoxMoney int64 `json:"skuBoxMoney"` // 应退订单餐盒费 + PmSubsidyMoney int64 `json:"pmSubsidyMoney"` // 平台总补贴金额 + PmSkuSubsidyMoney int64 `json:"pmSkuSubsidyMoney"` // 平台sku补贴金额 + PmRefundMoney int64 `json:"pmRefundMoney"` // 订单取消后可能存在佣金减少,平台退回部分金额的情况 + RefundMoney int64 `json:"refundMoney"` // 平台扣款总额 1 + RefundMoneyByCal int64 `json:"refundMoneyByCal"` // 平台扣款总额-通过公式计算平台扣除京西的金额M // JxSkuMoney int64 `json:"jxSkuMoney"` // 京西补贴金额,现阶段是平台扣京西多少钱,京西扣商家多少钱,暂不考虑撤回京西补贴 Skus []*OrderSkuFinancial `orm:"-" json:"skus"` } diff --git a/business/partner/purchase/jd/callback.go b/business/partner/purchase/jd/callback.go index cf1d8c55f..ae619ad57 100644 --- a/business/partner/purchase/jd/callback.go +++ b/business/partner/purchase/jd/callback.go @@ -32,7 +32,7 @@ func OnStoreMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) { return retVal } -func OnAfterSaleMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) { +func OnFinancialMsg2(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) { if curPurchaseHandler != nil { utils.CallFuncAsync(func() { OnFinancialMsg(msg) diff --git a/controllers/jd_callback.go b/controllers/jd_callback.go index 242e823ce..4050d1f7b 100644 --- a/controllers/jd_callback.go +++ b/controllers/jd_callback.go @@ -158,30 +158,52 @@ func (c *DjswController) transferResponse(inCallbackResponse *jdapi.CallbackResp return inCallbackResponse } -func (c *DjswController) afterSaleBillStatus() { +func (c *DjswController) EndOrderFinance() { + c.nullOperation() +} + +func (c *DjswController) FinanceAdjustment() { + c.nullOperation() +} + +func (c *DjswController) DeliveryCarrierModify() { + c.nullOperation() +} + +func (c *DjswController) NewApplyAfterSaleBill() { + c.nullOperation() +} + +func (c *DjswController) UpdateApplyAfterSaleBill() { + c.nullOperation() +} + +func (c *DjswController) NewAfterSaleBill() { + c.nullOperation() +} + +func (c *DjswController) AfterSaleBillStatus() { + // c.orderStatus(false) + c.OrderAccounting() +} + +func (c *DjswController) OrderAccounting() { var obj *jdapi.CallbackOrderMsg var callbackResponse *jdapi.CallbackResponse obj, callbackResponse = api.JdAPI.GetOrderCallbackMsg(getUsefulRequest(c.Ctx)) if callbackResponse == nil { - callbackResponse = jd.OnAfterSaleMsg(obj) + callbackResponse = jd.OnFinancialMsg2(obj) } c.Data["json"] = c.transferResponse(callbackResponse) c.ServeJSON() } -// func (c *DjswController) NewAfterSaleBill() { -// c.afterSaleBillStatus() -// } - -func (c *DjswController) AfterSaleBillStatus() { - c.afterSaleBillStatus() -} - -func (c *DjswController) OrderAccounting() { - c.afterSaleBillStatus() -} - func getUsefulRequest(ctx *context.Context) *http.Request { ctx.Request.Body = ioutil.NopCloser(bytes.NewReader(ctx.Input.RequestBody)) return ctx.Request } + +func (c *DjswController) nullOperation() { + c.Data["json"] = c.transferResponse(nil) + c.ServeJSON() +}