- 京东售后单填充所有信息
This commit is contained in:
@@ -67,7 +67,7 @@ func (c *OrderManager) SaveAfsOrder(db *dao.DaoDB, afsOrder *model.AfsOrder, isD
|
|||||||
if db == nil {
|
if db == nil {
|
||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
}
|
}
|
||||||
if err = c.updateAfsOrderSkuOtherInfo(db, afsOrder); err != nil {
|
if err = c.updateAfsOrderOtherInfo(db, afsOrder); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
dao.Begin(db)
|
dao.Begin(db)
|
||||||
@@ -234,6 +234,7 @@ func (c *OrderManager) updateAfsOrderSkuOtherInfo(db *dao.DaoDB, order *model.Af
|
|||||||
skumapper[v.VendorSkuID] = v
|
skumapper[v.VendorSkuID] = v
|
||||||
}
|
}
|
||||||
for _, v := range orderSkus {
|
for _, v := range orderSkus {
|
||||||
|
v.JxStoreID = jxStoreID
|
||||||
intVendorSkuID := utils.Str2Int64WithDefault(v.VendorSkuID, 0)
|
intVendorSkuID := utils.Str2Int64WithDefault(v.VendorSkuID, 0)
|
||||||
if intVendorSkuID != 0 && v.VendorSkuID != "-70000" { // todo hard code
|
if intVendorSkuID != 0 && v.VendorSkuID != "-70000" { // todo hard code
|
||||||
skuBindInfo := skumapper[intVendorSkuID]
|
skuBindInfo := skumapper[intVendorSkuID]
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ func InitServiceInfo(version string, buildTime time.Time, gitCommit string) {
|
|||||||
"shopChineseNames": model.ShopChineseNames,
|
"shopChineseNames": model.ShopChineseNames,
|
||||||
"printerVendorInfo": model.PrinterVendorInfo,
|
"printerVendorInfo": model.PrinterVendorInfo,
|
||||||
"purchaseVendorInfo": model.PurchaseVendorInfo,
|
"purchaseVendorInfo": model.PurchaseVendorInfo,
|
||||||
|
"afsReasonTypeName": model.AfsReasonTypeName,
|
||||||
|
"afsAppealTypeName": model.AfsAppealTypeName,
|
||||||
|
"afsOrderStatusName": model.AfsOrderStatusName,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Init()
|
Init()
|
||||||
|
|||||||
@@ -163,6 +163,32 @@ var (
|
|||||||
"打印机密钥",
|
"打印机密钥",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
AfsReasonTypeName = map[int]string{
|
||||||
|
AfsReasonTypeGoodsQuality: "商品质量",
|
||||||
|
AfsReasonTypeWrongGoods: "错误的商品",
|
||||||
|
AfsReasonTypeMissingGoods: "缺少部分商品",
|
||||||
|
AfsReasonTypeNoGoods: "全部商品未收到",
|
||||||
|
AfsReasonTypeDamagedGoods: "商品有损伤",
|
||||||
|
AfsReasonTypeGoodsQuantity: "缺斤少两",
|
||||||
|
AfsReasonTypeAgreedByMerchant: "与商家协商一致",
|
||||||
|
AfsReasonTypeGoodsNoSame: "商品与描述不符",
|
||||||
|
AfsReasonWrongPurchase: "误购",
|
||||||
|
AfsReasonNotReceivedIntime: "未在时效内送达",
|
||||||
|
AfsReasonNotOthers: "其它",
|
||||||
|
}
|
||||||
|
AfsAppealTypeName = map[int]string{
|
||||||
|
AfsAppealTypeRefund: "仅退款",
|
||||||
|
AfsAppealTypeReturnAndRefund: "退货退款",
|
||||||
|
AfsAppealTypeNewGoods: "重发商品",
|
||||||
|
}
|
||||||
|
AfsOrderStatusName = map[int]string{
|
||||||
|
AfsOrderStatusWait4Approve: "售后待审",
|
||||||
|
AfsOrderStatusNew: "新售后单",
|
||||||
|
AfsOrderStatusWait4ReceiveGoods: "售后待确认收货",
|
||||||
|
AfsOrderStatusReceivedGoods: "售后已收货",
|
||||||
|
AfsOrderStatusFinished: "售后成功",
|
||||||
|
AfsOrderStatusFailed: "售后失败",
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -315,7 +341,7 @@ const (
|
|||||||
AfsReasonTypeGoodsNoSame = 8 // 商品与描述不符
|
AfsReasonTypeGoodsNoSame = 8 // 商品与描述不符
|
||||||
AfsReasonWrongPurchase = 9 // 误购
|
AfsReasonWrongPurchase = 9 // 误购
|
||||||
AfsReasonNotReceivedIntime = 10 // 未在时效内送达
|
AfsReasonNotReceivedIntime = 10 // 未在时效内送达
|
||||||
AfsReasonNotOthers = 20 // 其它
|
AfsReasonNotOthers = 0 // 其它
|
||||||
)
|
)
|
||||||
|
|
||||||
func IsPurchaseVendorExist(vendorID int) bool {
|
func IsPurchaseVendorExist(vendorID int) bool {
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ const (
|
|||||||
PrinterStatusOnlineAbnormal = 3
|
PrinterStatusOnlineAbnormal = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
AfsApproveTypeRefund = 1 // 退款
|
||||||
|
AfsApproveTypeReturnGoods = 2 // 退货
|
||||||
|
AfsApproveTypeRefused = 3 // 驳回
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PrintResultSuccess = 0
|
PrintResultSuccess = 0
|
||||||
PrintResultNoPrinter = 1
|
PrintResultNoPrinter = 1
|
||||||
@@ -194,7 +200,7 @@ type IPurchasePlatformHandler interface {
|
|||||||
|
|
||||||
// 售后
|
// 售后
|
||||||
// 同意用户退款申请
|
// 同意用户退款申请
|
||||||
// AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error)
|
// AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.GoodsOrder, approveType int, reason string) (err error)
|
||||||
// // 发起全款退款
|
// // 发起全款退款
|
||||||
// RefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error)
|
// RefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error)
|
||||||
// // 发起部分退款
|
// // 发起部分退款
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -31,6 +32,25 @@ var (
|
|||||||
jdapi.AfsServiceStateDirectCompensateFailed: model.AfsOrderStatusFailed,
|
jdapi.AfsServiceStateDirectCompensateFailed: model.AfsOrderStatusFailed,
|
||||||
jdapi.AfsServiceStateReturnGoodsFailed: model.AfsOrderStatusFailed,
|
jdapi.AfsServiceStateReturnGoodsFailed: model.AfsOrderStatusFailed,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
afsReasonTypeMap = map[int]int8{
|
||||||
|
jdapi.AfsReasonTypeGoodsQuality: model.AfsReasonTypeGoodsQuality,
|
||||||
|
jdapi.AfsReasonTypeWrongGoods: model.AfsReasonTypeWrongGoods,
|
||||||
|
jdapi.AfsReasonTypeMissingGoods: model.AfsReasonTypeMissingGoods,
|
||||||
|
jdapi.AfsReasonTypeNoGoods: model.AfsReasonTypeNoGoods,
|
||||||
|
jdapi.AfsReasonTypeDamagedGoods: model.AfsReasonTypeDamagedGoods,
|
||||||
|
jdapi.AfsReasonTypeGoodsQuantity: model.AfsReasonTypeGoodsQuantity,
|
||||||
|
jdapi.AfsReasonTypeAgreedByMerchant: model.AfsReasonTypeAgreedByMerchant,
|
||||||
|
jdapi.AfsReasonTypeGoodsSizeNoSame: model.AfsReasonTypeGoodsNoSame,
|
||||||
|
jdapi.AfsReasonTypeGoodsColorNoSame: model.AfsReasonTypeGoodsNoSame,
|
||||||
|
jdapi.AfsReasonWrongPurchase: model.AfsReasonWrongPurchase,
|
||||||
|
jdapi.AfsReasonNotReceivedIntime: model.AfsReasonNotReceivedIntime,
|
||||||
|
}
|
||||||
|
afsAppealTypeMap = map[string]int8{
|
||||||
|
jdapi.AfsDealTypeRefund: model.AfsAppealTypeRefund,
|
||||||
|
jdapi.AfsDealTypeReturnGoodsRefund: model.AfsAppealTypeReturnAndRefund,
|
||||||
|
jdapi.AfsDealTypeDirectCompensate: model.AfsAppealTypeNewGoods,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *PurchaseHandler) OnAfsOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
|
func (c *PurchaseHandler) OnAfsOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
|
||||||
@@ -78,6 +98,20 @@ func (c *PurchaseHandler) GetAfsStatusFromVendorStatus(vendorStatus string) int
|
|||||||
return model.OrderStatusUnknown
|
return model.OrderStatusUnknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *PurchaseHandler) convertAfsReasonType(vendorReasonType int) int8 {
|
||||||
|
if status, ok := afsReasonTypeMap[vendorReasonType]; ok {
|
||||||
|
return status
|
||||||
|
}
|
||||||
|
return model.AfsReasonNotOthers
|
||||||
|
}
|
||||||
|
func (c *PurchaseHandler) convertAfsAppealType(vendorAppealType string) int8 {
|
||||||
|
if status, ok := afsAppealTypeMap[vendorAppealType]; ok {
|
||||||
|
return status
|
||||||
|
}
|
||||||
|
globals.SugarLogger.Warnf("jd convertAfsAppealType unknown vendorAppealType:%d", vendorAppealType)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsOrder *model.AfsOrder) {
|
func (p *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsOrder *model.AfsOrder) {
|
||||||
afsOrder = &model.AfsOrder{
|
afsOrder = &model.AfsOrder{
|
||||||
VendorID: model.VendorIDJD,
|
VendorID: model.VendorIDJD,
|
||||||
@@ -91,6 +125,13 @@ func (p *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsO
|
|||||||
BoxMoney: afsInfo.PackagingMoney,
|
BoxMoney: afsInfo.PackagingMoney,
|
||||||
TongchengFreightMoney: afsInfo.TongchengFreightMoney,
|
TongchengFreightMoney: afsInfo.TongchengFreightMoney,
|
||||||
SkuBoxMoney: afsInfo.MealBoxMoney,
|
SkuBoxMoney: afsInfo.MealBoxMoney,
|
||||||
|
|
||||||
|
VendorReasonType: utils.Int2Str(afsInfo.QuestionTypeCid),
|
||||||
|
ReasonType: p.convertAfsReasonType(afsInfo.QuestionTypeCid),
|
||||||
|
ReasonDesc: utils.LimitUTF8StringLen(afsInfo.QuestionDesc, 1024),
|
||||||
|
ReasonImgList: utils.LimitUTF8StringLen(afsInfo.QuestionPic, 1024),
|
||||||
|
VendorAppealType: afsInfo.ApplyDeal,
|
||||||
|
AppealType: p.convertAfsAppealType(afsInfo.ApplyDeal),
|
||||||
}
|
}
|
||||||
for _, x := range afsInfo.AfsDetailList {
|
for _, x := range afsInfo.AfsDetailList {
|
||||||
orderSku := &model.OrderSkuFinancial{
|
orderSku := &model.OrderSkuFinancial{
|
||||||
|
|||||||
Reference in New Issue
Block a user