将美团和饿百取消订单申请索赔整合到interface中

This commit is contained in:
邹宗楠
2025-02-28 09:54:01 +08:00
parent a4573224a6
commit 054aac4e3c
13 changed files with 125 additions and 14 deletions

View File

@@ -83,8 +83,6 @@ func (p *PurchaseHandler) getStatusFromVendorStatus(vendorStatus string) int {
func (p *PurchaseHandler) GetOrder(vendorOrgCode, vendorOrderID, vendorStoreID string) (order *model.GoodsOrder, err error) {
order, _, err = p.getOrder(vendorOrderID)
globals.SugarLogger.Debugf("---------order GetOrder := %s", utils.Format4Output(order, false))
globals.SugarLogger.Debugf("---------order err := %v", err)
return order, err
}
@@ -1012,3 +1010,36 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64
func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
afsOrderList, err := dao.GetAfsOrders(dao.GetDB(), order.VendorID, order.VendorOrderID, "")
if err != nil {
return "", err
}
refundList := make([]*ebaiapi.ApplyCompensationList, 0, 0)
for _, v := range afsOrderList {
if v.AfsOrderID != v.VendorOrderID {
refundList = append(refundList, &ebaiapi.ApplyCompensationList{
RefundId: v.AfsOrderID,
CompensationReason: ebaiapi.CompensationCodeE1,
Description: "分配骑手缓慢/骑手到店缓慢",
})
}
}
if len(refundList) > 0 {
result, err := api.EbaiAPI.ApplyCompensation(order.VendorOrderID, refundList)
if err != nil {
return "", err
}
compensationStation := make([]string, 0, 0)
for _, r := range result {
compensationStation = append(compensationStation, fmt.Sprintf("售后ID:%s,索赔状态:%s,失败:%s", r.RefundId, r.CompensationStatusDesc, r.CompensationFailDesc))
}
return strings.Join(compensationStation, ","), nil
}
return "", err
}

View File

@@ -349,3 +349,8 @@ func (c *PurchaseHandler) OrderLogisticsStatus(orderId string) (*utils.RiderInfo
func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
return "", nil
}

View File

@@ -697,3 +697,8 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(goods *model.GoodsOrder) (int64
func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
return "",nil
}

View File

@@ -338,3 +338,8 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64
func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
return "", nil
}

View File

@@ -166,3 +166,8 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64
func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
return "",nil
}

View File

@@ -7,6 +7,7 @@ import (
"git.rosy.net.cn/jx-callback/business/jxutils/weixinmsg"
"net/url"
"regexp"
"strconv"
"strings"
"time"
@@ -1030,3 +1031,14 @@ func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int6
return utils.Float64TwoInt64(fee * 100), nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
num, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", utils.Int64ToFloat64(order.TotalShopMoney)/float64(100)), 64)
return "", getAPI(order.VendorOrgCode, jxutils.GetSaleStoreIDFromOrder(order), "").ApplyCompensation(&mtwmapi.ApplyCompensationRes{
OrderId: utils.Str2Int64(order.VendorOrderID),
Reason: "商户申请",
ApplyStatus: mtwmapi.ApplyCompensationStatusOne,
Amount: num,
})
}

View File

@@ -986,3 +986,8 @@ func GetOrderTotalShopMoney(appOrgCode string, vendorStoreID string, start, end
func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
return "",nil
}

View File

@@ -1111,3 +1111,8 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64
func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
return "", nil
}

View File

@@ -317,3 +317,8 @@ func (c *PurchaseHandler) OrderLogisticsStatus(orderId string) (*utils.RiderInfo
func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
return "", nil
}

View File

@@ -117,3 +117,8 @@ func (c *PurchaseHandler) GetOrderSettleAccounts(order *model.GoodsOrder) (int64
func (c *PurchaseHandler) GetPlatformLogisticsFee(order *model.GoodsOrder) (int64, error) {
return 0, nil
}
// ApplyCompensationOrder 订单索赔
func (c *PurchaseHandler) ApplyCompensationOrder(order *model.GoodsOrder) (string, error) {
return "", nil
}