This commit is contained in:
邹宗楠
2024-01-17 10:11:47 +08:00
parent 1fe0ca13b0
commit 0c8c438f0e
8 changed files with 48 additions and 33 deletions

View File

@@ -3525,6 +3525,9 @@ func UpdateJdStoreNameAll(ctx *jxcontext.Context) (err error) {
` `
if err = dao.GetRows(db, &stores, sql, model.VendorIDJD, v); err == nil { if err = dao.GetRows(db, &stores, sql, model.VendorIDJD, v); err == nil {
for _, store := range stores { for _, store := range stores {
if store.Status == model.StoreStatusDisabled {
continue
}
a := jd.GetAPI(store.VendorOrgCode) a := jd.GetAPI(store.VendorOrgCode)
storeParams := &jdapi.OpStoreParams{ storeParams := &jdapi.OpStoreParams{
StationNo: store.VendorStoreID, StationNo: store.VendorStoreID,

View File

@@ -106,11 +106,13 @@ func InsertItemFreight(tem *model.FreightTemplate) error {
sqlParams = append(sqlParams, tem.TradeLimitID) sqlParams = append(sqlParams, tem.TradeLimitID)
sqlStr = append(sqlStr, tradeLimitIDSql) sqlStr = append(sqlStr, tradeLimitIDSql)
} }
if len(sqlStr) == model.NO {
return nil
}
tStr = "WHERE a.store_id = ? AND a.vendor_store_id = ?" tStr = "WHERE a.store_id = ? AND a.vendor_store_id = ?"
sqlParams = append(sqlParams, tem.StoreID, tem.VendorStoreID) sqlParams = append(sqlParams, tem.StoreID, tem.VendorStoreID)
tStr2 := sql + strings.Join(sqlStr, ",") + tStr tStr2 := sql + strings.Join(sqlStr, ",") + tStr
_, err := ExecuteSQL(GetDB(), tStr2, sqlParams...) _, err := ExecuteSQL(GetDB(), tStr2, sqlParams...)
fmt.Println(tStr2)
return err return err
} }

View File

@@ -100,6 +100,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
return nil, fmt.Errorf("此平台配送已被系统关闭,暂不发配送 [%v]", vendorOrgCode[0].Comment) return nil, fmt.Errorf("此平台配送已被系统关闭,暂不发配送 [%v]", vendorOrgCode[0].Comment)
} }
if maxDeliveryFee == model.NO {
// 获取配送费 // 获取配送费
fee, err := c.GetWaybillFee(order) fee, err := c.GetWaybillFee(order)
if err != nil { if err != nil {
@@ -108,6 +109,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
if fee.DeliveryFee >= model.DefMaxDeliveryFee { if fee.DeliveryFee >= model.DefMaxDeliveryFee {
return nil, fmt.Errorf("蜂鸟超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee)) return nil, fmt.Errorf("蜂鸟超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee))
} }
}
// 蜂鸟入参结构体 // 蜂鸟入参结构体
parameter := &fnpsapi.CreateOrderReqParam{ parameter := &fnpsapi.CreateOrderReqParam{

View File

@@ -331,6 +331,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
return nil, fmt.Errorf("此平台配送已被系统关闭,暂不发配送 [%v]", vendorOrgCode[0].Comment) return nil, fmt.Errorf("此平台配送已被系统关闭,暂不发配送 [%v]", vendorOrgCode[0].Comment)
} }
if maxDeliveryFee == model.NO {
fee, err := c.GetWaybillFee(order) fee, err := c.GetWaybillFee(order)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -338,6 +339,7 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
if fee.DeliveryFee >= model.DefMaxDeliveryFee { if fee.DeliveryFee >= model.DefMaxDeliveryFee {
return nil, fmt.Errorf("美团配送超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee)) return nil, fmt.Errorf("美团配送超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee))
} }
}
// 忽略坐标转换错误,即使是转换出错,也只能当成转换成功来处理,底层会有错误日志输出 // 忽略坐标转换错误,即使是转换出错,也只能当成转换成功来处理,底层会有错误日志输出
lngFloat, latFloat, _ := jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType) lngFloat, latFloat, _ := jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType)

View File

@@ -89,6 +89,7 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i
return nil, fmt.Errorf("此平台配送已被系统关闭,暂不发配送 [%v]", vendorOrgCode[0].Comment) return nil, fmt.Errorf("此平台配送已被系统关闭,暂不发配送 [%v]", vendorOrgCode[0].Comment)
} }
if maxDeliveryFee == model.NO {
fee, err := d.GetWaybillFee(order) fee, err := d.GetWaybillFee(order)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -96,6 +97,7 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i
if fee.DeliveryFee >= model.DefMaxDeliveryFee { if fee.DeliveryFee >= model.DefMaxDeliveryFee {
return nil, fmt.Errorf("顺丰超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee)) return nil, fmt.Errorf("顺丰超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee))
} }
}
store, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "") store, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "")
if err != nil { if err != nil {

View File

@@ -139,6 +139,7 @@ func (d DeliveryHandler) IsErrStoreExist(err error) bool {
} }
func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee int64) (bill *model.Waybill, err error) { func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee int64) (bill *model.Waybill, err error) {
if maxDeliveryFee == model.NO {
fee, err := d.GetWaybillFee(order) fee, err := d.GetWaybillFee(order)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -147,6 +148,7 @@ func (d DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee i
return nil, fmt.Errorf("顺丰超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee)) return nil, fmt.Errorf("顺丰超最高限价, 所需运费:%s, 最高限价:%s", jxutils.IntPrice2StandardCurrencyString(fee.DeliveryFee), jxutils.IntPrice2StandardCurrencyString(model.DefMaxDeliveryFee))
} }
}
//获取门店老板详情 //获取门店老板详情
storeOwner, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "") storeOwner, err := dao.GetStoreDetail(dao.GetDB(), getReallyStoreID(order.StoreID, order.JxStoreID), 0, "")
if err != nil { if err != nil {

View File

@@ -2,6 +2,8 @@ package jd
import ( import (
"git.rosy.net.cn/baseapi/platformapi/jdapi" "git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
) )
func OnOrderMsg(msg *jdapi.CallbackOrderMsg, a *jdapi.API) (retVal *jdapi.CallbackResponse) { func OnOrderMsg(msg *jdapi.CallbackOrderMsg, a *jdapi.API) (retVal *jdapi.CallbackResponse) {
@@ -21,6 +23,7 @@ func OnWaybillMsg(msg *jdapi.CallbackDeliveryStatusMsg) (retVal *jdapi.CallbackR
func OnStoreMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) { func OnStoreMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
if CurPurchaseHandler != nil { if CurPurchaseHandler != nil {
retVal = CurPurchaseHandler.OnStoreMsg(AppKey2OrgCode(msg.AppKey), msg) retVal = CurPurchaseHandler.OnStoreMsg(AppKey2OrgCode(msg.AppKey), msg)
globals.SugarLogger.Debugf("retVal========= %s", utils.Format4Output(retVal, false))
} }
return retVal return retVal
} }

View File

@@ -142,12 +142,10 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
if err = dao.GetRows(db, &stores, sql, model.VendorIDJD, utils.DefaultTimeValue, storeID); err == nil { if err = dao.GetRows(db, &stores, sql, model.VendorIDJD, utils.DefaultTimeValue, storeID); err == nil {
for _, store := range stores { for _, store := range stores {
a := getAPI(store.VendorOrgCode) a := getAPI(store.VendorOrgCode)
// phone := "" if store.Status == model.StoreStatusDisabled {
// if store.MarketManPhone != "" { continue
// phone = store.MarketManPhone }
// } else {
// phone = model.VendorStoreTel
// }
storeParams := &jdapi.OpStoreParams{ storeParams := &jdapi.OpStoreParams{
StationNo: store.VendorStoreID, StationNo: store.VendorStoreID,
Operator: userName, Operator: userName,
@@ -339,6 +337,7 @@ func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode s
// 当前京东的storeCrud消息不会在门店状态改变时发送所以意义不大先放在这里 // 当前京东的storeCrud消息不会在门店状态改变时发送所以意义不大先放在这里
func (c *PurchaseHandler) OnStoreMsg(vendorOrgCode string, msg *jdapi.CallbackOrderMsg) (response *jdapi.CallbackResponse) { func (c *PurchaseHandler) OnStoreMsg(vendorOrgCode string, msg *jdapi.CallbackOrderMsg) (response *jdapi.CallbackResponse) {
globals.SugarLogger.Debugf("OnStoreMsg========= %s", utils.Format4Output(msg, false))
var err error var err error
if msg.StatusID == jdapi.StatusIDUpdateStore { if msg.StatusID == jdapi.StatusIDUpdateStore {
var storeStatus int var storeStatus int