Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop

This commit is contained in:
richboo111
2024-02-18 10:28:12 +08:00
20 changed files with 143 additions and 73 deletions

View File

@@ -309,6 +309,7 @@ func (c *DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInf
}
deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(result.DeliverFee) // jxutils.StandardPrice2Int(result.Fee)
deliveryFeeInfo.RefDeliveryFee = deliveryFeeInfo.DeliveryFee
deliveryFeeInfo.RefAddFee = deliveryFeeInfo.DeliveryFee
}
return deliveryFeeInfo, err
}

View File

@@ -293,7 +293,7 @@ func (d DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo
deliveryFeeInfo = &partner.WaybillFeeInfo{}
price, err := api.SfPsAPI.PreCreateOrder(param)
deliveryFeeInfo.DeliveryFee = utils.Float64TwoInt64(price)
globals.SugarLogger.Debugf("GetWaybillFee deliveryFeeInfo.DeliveryFee=%d", deliveryFeeInfo.DeliveryFee)
deliveryFeeInfo.RefAddFee = utils.Float64TwoInt64(price)
return deliveryFeeInfo, err
}

View File

@@ -203,7 +203,7 @@ func (d DeliveryHandler) GetWaybillFee(order *model.GoodsOrder) (deliveryFeeInfo
return nil, err
} else {
deliveryFeeInfo = &partner.WaybillFeeInfo{}
// deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.NeedPayMoney)) 优惠后金额
deliveryFeeInfo.RefAddFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.NeedPayMoney)) // 优惠后金额
deliveryFeeInfo.DeliveryFee = jxutils.StandardPrice2Int(utils.Str2Float64(orderPrice.TotalMoney)) // 原始金额
}
return deliveryFeeInfo, err

View File

@@ -477,9 +477,9 @@ func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder,
title,
)
orderFmt += `<LEFT><font# bolder=1 height=2 width=1>共%d种%d件商品</font#></LEFT>
<LEFT><font# bolder=1 height=2 width=1>实付金额: %s</font#></LEFT>
<font# bolder=0 height=1 width=1>--------------#%d完-------------</font#>`
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq)
/*<LEFT><font# bolder=1 height=2 width=1>实付金额: %s</font#></LEFT>*/
orderParams = append(orderParams, order.SkuCount, order.GoodsCount /* jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),*/, order.OrderSeq)
return fmt.Sprintf(orderFmt, orderParams...)
}
@@ -518,8 +518,8 @@ func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrde
)
orderFmt += xpyunapi.StrRepeat("-", 32)
orderFmt += `<LEFT><font# bolder=1 height=2 width=1>共%d种%d件商品</font#></LEFT>
<LEFT><font# bolder=1 height=2 width=1>实付金额: %s</font#></LEFT>
<font# bolder=0 height=1 width=1>--------------#%d完-------------</font#>`
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq)
/*<LEFT><font# bolder=1 height=2 width=1>实付金额: %s</font#></LEFT>*/
orderParams = append(orderParams, order.SkuCount, order.GoodsCount /*jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),*/, order.OrderSeq)
return fmt.Sprintf(orderFmt, orderParams...)
}

View File

@@ -471,10 +471,10 @@ func (c *PrinterHandler) getCancelOrRefundOrderContent(order *model.GoodsOrder,
order.OrderSeq,
)
orderFmt += xpyunapi.StrRepeat("-", 32)
orderFmt += `<L>共%d种%d件商品</L>
实际支付:%s<BR>`
orderFmt += `<L>共%d种%d件商品</L>`
/*实际支付:%s<BR>`*/
orderFmt += xpyunapi.StrRepeat("-", 14) + "#%d完</HB>" + xpyunapi.StrRepeat("-", 14) + `<BR>`
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq)
orderParams = append(orderParams, order.SkuCount, order.GoodsCount /*jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),*/, order.OrderSeq)
return fmt.Sprintf(orderFmt, orderParams...)
}
@@ -516,9 +516,9 @@ func (c *PrinterHandler) getCancelOrRefundOrderContentBig(order *model.GoodsOrde
order.OrderSeq,
)
orderFmt += xpyunapi.StrRepeat("-", 32)
orderFmt += `<L><HB>共%d种%d件商品</L>
实际支付:%s</HB><BR>`
orderFmt += `<L><HB>共%d种%d件商品</L>`
/*实际支付:%s</HB><BR>`*/
orderFmt += xpyunapi.StrRepeat("-", 14) + "#%d完</HB>" + xpyunapi.StrRepeat("-", 14) + `<BR>`
orderParams = append(orderParams, order.SkuCount, order.GoodsCount, jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice), order.OrderSeq)
orderParams = append(orderParams, order.SkuCount, order.GoodsCount /*jxutils.IntPrice2StandardCurrencyString(order.ActualPayPrice),*/, order.OrderSeq)
return fmt.Sprintf(orderFmt, orderParams...)
}

View File

@@ -1,6 +1,8 @@
package ebai
import (
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/globals"
"time"
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
@@ -65,6 +67,17 @@ func (c *PurchaseHandler) onWaybillMsg(msg *ebaiapi.CallbackMsg) (retVal *ebaiap
}
}
})
} else if order.VendorStatus == ebaiapi.WaybillStatusSelfDelivery {
result1, err1 := api.EbaiAPI.OrderGet(order.VendorOrderID)
if err1 == nil {
address := utils.Interface2String(result1["user"].(map[string]interface{})["address"])
localOrder, _ := partner.CurOrderManager.LoadOrder(order.VendorOrderID, model.VendorIDEBAI)
localOrder.ConsigneeAddress = address
dao.UpdateEntity(dao.GetDB(), localOrder, "ConsigneeAddress")
} else {
globals.SugarLogger.Debugf("饿了么转自送解密用户配送地址,查询平台订单时错误:%v", err1)
}
}
return api.EbaiAPI.Err2CallbackResponse(msg.Cmd, partner.CurOrderManager.OnWaybillStatusChanged(order), order.VendorStatus)
}

View File

@@ -182,7 +182,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(msg *mtwmapi.CallbackMsg) (retVal *mtwma
for _, v := range wayBill {
handlerInfo := partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID)
if handlerInfo != nil {
handlerInfo.Handler.CancelWaybill(v, 0, "订单转移被取消")
handlerInfo.Handler.CancelWaybill(v, 0, "订单转移被取消10")
}
}
}

View File

@@ -230,6 +230,7 @@ func (p *PurchaseHandler) DeleteStore(db *dao.DaoDB, storeID int, userName strin
}
func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName string) (err error) {
globals.SugarLogger.Debugf("===========data : %s",utils.Format4Output(storeID,false))
if db == nil {
db = dao.GetDB()
}
@@ -280,6 +281,7 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
}
if globals.EnableMtwmStoreWrite {
globals.SugarLogger.Debugf("===========data : %s",utils.Format4Output(params,false))
errList.AddErr(mtapi.PoiSave(storeDetail.VendorStoreID, params))
}
if storeDetail.SyncStatus&(model.SyncFlagNewMask|model.SyncFlagStoreStatus) != 0 {

View File

@@ -401,7 +401,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(status string, msg interface{}) (retVal
// 取消三方运单
waybill, _ := dao.GetWaybills(db, goodsOrder.VendorOrderID, []int64{model.VendorIDMTPS, model.VendorIDDada, model.VendorIDFengNiao, model.VendorIDUUPT, model.VendorIDSFPS})
for _, v := range waybill {
err = partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID).Handler.CancelWaybill(v, 0, "订单被取消了")
err = partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID).Handler.CancelWaybill(v, 0, "订单被取消了11")
if err != nil {
partner.CurOrderManager.OnOrderMsg(goodsOrder, fmt.Sprintf("订单[%s]被取消了,运单[%s]取消失败Err: %s", goodsOrder.VendorOrderID, v.VendorWaybillID, err.Error()), "")
} else {

View File

@@ -3,6 +3,7 @@ package tiktok_store
import (
"errors"
"fmt"
instantShopping_reportRiderLocation_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/instantShopping_reportRiderLocation/request"
"regexp"
"strings"
"time"
@@ -255,12 +256,42 @@ func (p *PurchaseHandler) GetOrderRider(vendorOrgCode, vendorStoreID string, par
param["longitude"] = utils.Float64ToStr(lng)
}
}
order, _ := partner.CurOrderManager.LoadOrder(param["order_id"].(string), model.VendorIDDD)
if vendorStoreID == "" {
order, _ := partner.CurOrderManager.LoadOrder(param["order_id"].(string), model.VendorIDDD)
vendorStoreID = order.VendorStoreID
}
return getAPI(vendorOrgCode, 0, vendorStoreID).OrderStatusAndPsInfoNew(param, vendorStoreID)
api := getAPI(vendorOrgCode, 0, vendorStoreID)
// 同步骑手状态
if err = api.OrderStatusAndPsInfoNew(param, vendorStoreID); err != nil {
partner.CurOrderManager.OnOrderMsg(order, param["opcode"].(string), "抖音订单三方配送状态信息回传记录异常:"+err.Error())
}
if err = SyncOrderRiderLine(vendorOrgCode, vendorStoreID, param); err != nil {
partner.CurOrderManager.OnOrderMsg(order, param["opcode"].(string), "抖音订单三方配送轨迹信息回传记录异常:"+err.Error())
}
return err
}
// SyncOrderRiderLine 同步骑手轨迹
func SyncOrderRiderLine(vendorOrgCode, vendorStoreID string, param map[string]interface{}) error {
// 同步骑手轨迹(其实状态和轨迹应该分开同步才对)
param2 := &instantShopping_reportRiderLocation_request.InstantShoppingReportRiderLocationParam{
ShopOrderId: param["order_id"].(string),
DistributionCode: tiktokShop.JxLogistics2Tiktok(param["logistics_provider_code"].(string)),
DistributionDeliveryId: param["order_id"].(string),
RiderName: param["courier_name"].(string),
RiderPhoneType: 0,
RiderPhone: param["courier_phone"].(string),
RiderLongitude: param["longitude"].(string),
RiderLatitude: param["latitude"].(string),
ReportTime: time.Now().Unix(),
}
if len(param["courier_phone"].(string)) > 11 {
param2.RiderPhoneType = 1
}
return getAPI(vendorOrgCode, 0, vendorStoreID).OrderStatusReportRiderLocation(param2)
}
func (p *PurchaseHandler) GetOrder(vendorOrgCode, vendorOrderID, vendorStoreID string) (order *model.GoodsOrder, err error) {
@@ -596,7 +627,7 @@ func (c *PurchaseHandler) Swtich2SelfDeliver(order *model.GoodsOrder, userName s
if remoteWaybill.Status >= tiktokShop.ShipmentStatusArrived && remoteWaybill.Status != tiktokShop.ShipmentStatusCanceled { //骑手取货后不可取消
return errors.New("抖音配送骑手已取货,不可转门店自配送/三方配送")
}
if remoteWaybill.Status < tiktokShop.ShipmentStatusArrived || remoteWaybill.Status == tiktokShop.ShipmentStatusCanceled { //存在运单
if remoteWaybill.Status < tiktokShop.ShipmentStatusArrived /*|| remoteWaybill.Status == tiktokShop.ShipmentStatusCanceled */ { //存在运单
if err := api.ShopOrderDispatcher(utils.Str2Int64(order.VendorStoreID), order.VendorOrderID, tiktokShop.DispatcherFeeTypeCancel); err != nil {
return err
}

View File

@@ -146,7 +146,7 @@ func (c *PurchaseHandler) onAfsOrderMsg(msgId string, msg interface{}) (retVal *
for _, v := range wayBill {
if v.Status != model.WaybillStatusCanceled {
if handlerInfo := partner.GetDeliveryPlatformFromVendorID(v.WaybillVendorID); handlerInfo != nil {
if err := handlerInfo.Handler.CancelWaybill(v, 0, "订单被取消了"); err != nil {
if err := handlerInfo.Handler.CancelWaybill(v, 0, "订单被取消了12"); err != nil {
partner.CurOrderManager.OnOrderMsg(goodsOrder, "", fmt.Sprintf("抖店订单取消时,取消运单异常:%s", err.Error()))
}
}