将菜市蜂鸟信息通知到果园去
This commit is contained in:
@@ -147,7 +147,14 @@ func (c *DeliveryHandler) UpdateStore(ctx *jxcontext.Context, storeDetail *dao.S
|
||||
}
|
||||
|
||||
// 蜂鸟门店状态改变
|
||||
func OnStoreStatus(msg *fnpsapi.ChainstoreStatusNotify) (retVal *fnpsapi.CallbackResponse) {
|
||||
func OnStoreStatus(msg *fnpsapi.ChainstoreStatusNotify, reallyData *fnpsapi.ShortStatus) (retVal *fnpsapi.CallbackResponse) {
|
||||
store, err := dao.GetStoreDetail2(dao.GetDB(), 0, msg.Param.OutShopCode, model.VendorIDFengNiao)
|
||||
if store == nil || store.ID == model.NO || err != nil {
|
||||
if _, err = fnpsapi.HttpToGuoYuanFN(utils.Struct2MapByJson(reallyData), fnpsapi.FengNiaoCallbackTypeStore); err != nil {
|
||||
return fnpsapi.Err2CallbackResponse(err, "")
|
||||
}
|
||||
return fnpsapi.Err2CallbackResponse(nil, "")
|
||||
}
|
||||
return CurDeliveryHandler.OnStoreStatus(msg)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/tao_vegetable"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -247,6 +248,15 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify, resultParam *fnpsapi.ShortSta
|
||||
if err := utils.Map2StructByJson(msg.Param, cc, true); err != nil {
|
||||
return fnpsapi.Err2CallbackResponse(err, "")
|
||||
}
|
||||
|
||||
good, err := dao.GetSimpleOrder(dao.GetDB(), cc.PartnerOrderCode)
|
||||
if good == nil || good.VendorOrderID == "" || err != nil {
|
||||
if _, err = fnpsapi.HttpToGuoYuanFN(utils.Struct2MapByJson(resultParam), fnpsapi.FengNiaoCallbackTypeOrder); err != nil {
|
||||
return fnpsapi.Err2CallbackResponse(err, "")
|
||||
}
|
||||
return fnpsapi.Err2CallbackResponse(nil, "")
|
||||
}
|
||||
|
||||
// 多次取消,只处理第一次
|
||||
if cc.OrderStatus == fnpsapi.OrderStatusAcceptCacle {
|
||||
bill, err := partner.CurOrderManager.LoadWaybill(utils.Int64ToStr(cc.OrderId), model.VendorIDFengNiao)
|
||||
@@ -258,18 +268,6 @@ func OnWaybillMsg(msg *fnpsapi.OrderStatusNottify, resultParam *fnpsapi.ShortSta
|
||||
}
|
||||
}
|
||||
|
||||
var good *model.GoodsOrder
|
||||
sql := `SELECT * FROM goods_order WHERE vendor_order_id = ? ORDER BY order_created_at DESC LIMIT 1 OFFSET 0`
|
||||
sqlParams := []interface{}{cc.PartnerOrderCode}
|
||||
dao.GetRow(dao.GetDB(), &good, sql, sqlParams)
|
||||
if good == nil || good.VendorOrderID == "" {
|
||||
_, err := fnpsapi.HttpToGuoYuanFN(utils.Struct2MapByJson(resultParam), "order")
|
||||
if err != nil {
|
||||
return fnpsapi.Err2CallbackResponse(err, "")
|
||||
}
|
||||
return fnpsapi.Err2CallbackResponse(nil, "")
|
||||
}
|
||||
|
||||
order := &model.Waybill{
|
||||
VendorWaybillID: utils.Int64ToStr(cc.OrderId),
|
||||
VendorWaybillID2: cc.PartnerOrderCode,
|
||||
@@ -375,7 +373,14 @@ func tiktokStatusPush(order *model.Waybill, orderStatus int64, lng, lat, vendorO
|
||||
}
|
||||
|
||||
// 异常报备
|
||||
func OnWaybillExceptFn(msg *fnpsapi.AbnormalReportNotify) (retVal *fnpsapi.CallbackResponse) {
|
||||
func OnWaybillExceptFn(msg *fnpsapi.AbnormalReportNotify, reallyData *fnpsapi.ShortStatus) (retVal *fnpsapi.CallbackResponse) {
|
||||
order, err := dao.GetSimpleOrder(dao.GetDB(), msg.PartnerOrderCode)
|
||||
if order == nil || order.VendorOrderID == "" || err != nil {
|
||||
if _, err = fnpsapi.HttpToGuoYuanFN(utils.Struct2MapByJson(reallyData), fnpsapi.FengNiaoCallbackTypeAbnormal); err != nil {
|
||||
return fnpsapi.Err2CallbackResponse(err, "")
|
||||
}
|
||||
return fnpsapi.Err2CallbackResponse(nil, "")
|
||||
}
|
||||
return CurDeliveryHandler.OnWaybillExcept(msg)
|
||||
}
|
||||
|
||||
@@ -385,7 +390,7 @@ func (c *DeliveryHandler) OnWaybillExcept(msg *fnpsapi.AbnormalReportNotify) (re
|
||||
VendorWaybillID: msg.PartnerOrderCode,
|
||||
VendorWaybillID2: utils.Int64ToStr(msg.OrderId),
|
||||
WaybillVendorID: model.VendorIDFengNiao,
|
||||
CourierName: string(msg.CarrierDriverId),
|
||||
CourierName: strconv.FormatInt(msg.CarrierDriverId, 10),
|
||||
CourierMobile: "",
|
||||
Status: model.WaybillStatusUnknown, // todo 这里要再确定一下是否只要收到订单异常消息就只简单当成一个消息
|
||||
VendorStatus: msg.AbnormalCode,
|
||||
|
||||
Reference in New Issue
Block a user