冲突
This commit is contained in:
@@ -228,14 +228,14 @@ func (c *DeliveryHandler) getBillParams(db *dao.DaoDB, order *model.GoodsOrder)
|
||||
}
|
||||
if billParams.ShopNo, err = c.getDadaShopID(order, db); err == nil {
|
||||
if billParams.CityCode, err = c.getDataCityCodeFromOrder(order, db); err == nil {
|
||||
storeTel := ""
|
||||
storeID := jxutils.GetSaleStoreIDFromOrder(order)
|
||||
storeDeatail, _ := dao.GetStoreDetail(db, storeID, order.VendorID)
|
||||
if storeDeatail.Tel2 != "" {
|
||||
storeTel = ",门店电话:" + storeDeatail.Tel2
|
||||
}
|
||||
// storeTel := ""
|
||||
// storeID := jxutils.GetSaleStoreIDFromOrder(order)
|
||||
// storeDeatail, _ := dao.GetStoreDetail(db, storeID, order.VendorID)
|
||||
// if storeDeatail.Tel2 != "" {
|
||||
// storeTel = ",门店电话:" + storeDeatail.Tel2
|
||||
// }
|
||||
billParams.ReceiverLng, billParams.ReceiverLat, _ = jxutils.IntCoordinate2MarsStandard(order.ConsigneeLng, order.ConsigneeLat, order.CoordinateType)
|
||||
billParams.Info = fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, utils.FilterMb4(order.BuyerComment+"取货失败请联系平台电话:18048531223"+storeTel))
|
||||
billParams.Info = fmt.Sprintf("%s第%d号订单, %s", model.VendorChineseNames[order.VendorID], order.OrderSeq, utils.FilterMb4(order.BuyerComment+"取货失败或配送遇到问题请联系18048531223,禁止未配送直接完成定单!"))
|
||||
billParams.CargoType = dadaapi.CargoTypeFresh
|
||||
billParams.CargoWeight = float64(jxutils.IntWeight2Float(limitOrderWeight(order.Weight)))
|
||||
billParams.CargoNum = order.GoodsCount
|
||||
|
||||
@@ -238,13 +238,13 @@ func (c *DeliveryHandler) CreateWaybill(order *model.GoodsOrder, maxDeliveryFee
|
||||
// "goods_pickup_info": fmt.Sprintf("%s第%d号单", model.VendorChineseNames[order.VendorID], order.OrderSeq),
|
||||
// "poi_seq": fmt.Sprintf("#%d", order.OrderSeq),
|
||||
// }
|
||||
storeTel := ""
|
||||
storeID := jxutils.GetSaleStoreIDFromOrder(order)
|
||||
storeDeatail, _ := dao.GetStoreDetail(db, storeID, order.VendorID)
|
||||
if storeDeatail.Tel2 != "" {
|
||||
storeTel = ",门店电话:" + storeDeatail.Tel2
|
||||
}
|
||||
billParams.Note = utils.FilterMb4(order.BuyerComment + ",取货失败请联系平台电话:18048531223" + storeTel)
|
||||
// storeTel := ""
|
||||
// storeID := jxutils.GetSaleStoreIDFromOrder(order)
|
||||
// storeDeatail, _ := dao.GetStoreDetail(db, storeID, order.VendorID)
|
||||
// if storeDeatail.Tel2 != "" {
|
||||
// storeTel = ",门店电话:" + storeDeatail.Tel2
|
||||
// }
|
||||
billParams.Note = utils.FilterMb4(order.BuyerComment + ",取货失败或配送遇到问题请联系18048531223,禁止未配送直接完成定单!")
|
||||
billParams.GoodsDetail = string(utils.MustMarshal(goods))
|
||||
billParams.GoodsPickupInfo = fmt.Sprintf("%s第%d号单", model.VendorChineseNames[order.VendorID], order.OrderSeq)
|
||||
billParams.PoiSeq = fmt.Sprintf("#%d", order.OrderSeq)
|
||||
|
||||
@@ -390,6 +390,7 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
||||
phone = model.VendorStoreTel
|
||||
}
|
||||
params["ivr_phone"] = phone //统一改为这个电话
|
||||
|
||||
if store.VendorStoreID != "" {
|
||||
params["baidu_shop_id"] = store.VendorStoreID
|
||||
}
|
||||
@@ -402,7 +403,7 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
||||
}
|
||||
boxFee, _ := dao.GetSysConfigAsInt64(dao.GetDB(), model.ConfigSysEbaiBoxFee)
|
||||
params["package_box_price"] = boxFee
|
||||
|
||||
params["service_phone"] = store.Tel1
|
||||
params["address"] = store.Address
|
||||
// todo 饿百 开店审核通过后不允许修改商户信息
|
||||
if store.SyncStatus&(model.SyncFlagNewMask /*|model.SyncFlagStoreAddress*/) != 0 {
|
||||
|
||||
@@ -109,6 +109,16 @@ func (c *PurchaseHandler) onOrderMsg(vendorOrgCode string, msg *jdapi.CallbackOr
|
||||
c.onOrderComment2(a, msg)
|
||||
})
|
||||
}
|
||||
// if msg.StatusID == jdapi.OrderStatusVenderAgreeCancel {
|
||||
// order := &model.GoodsOrder{
|
||||
// VendorOrgCode: vendorOrgCode,
|
||||
// VendorOrderID: msg.BillID,
|
||||
// }
|
||||
// err2 := c.PickupGoods(order, false, jxcontext.AdminCtx.GetUserName())
|
||||
// if err2 != nil {
|
||||
// globals.SugarLogger.Warnf("京东取消拣货:%v", err2)
|
||||
// }
|
||||
// }
|
||||
err := partner.CurOrderManager.OnOrderStatusChanged(vendorOrgCode, status)
|
||||
retVal = jdapi.Err2CallbackResponse(err, status.VendorStatus)
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ func (c *PurchaseHandler) RefundOrder(ctx *jxcontext.Context, order *model.Goods
|
||||
// 发起部分退款
|
||||
func (c *PurchaseHandler) PartRefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, refundSkuList []*model.OrderSku, reason string) (err error) {
|
||||
if globals.EnableJdStoreWrite {
|
||||
_, err = getAPI(order.VendorOrgCode).AfsSubmit(order.VendorOrderID, ctx.GetUserName(), utils.Int2Str(jdapi.AfsReasonWrongPurchase), reason, "", order.ConsigneeName, order.ConsigneeMobile, order.ConsigneeAddress, orderSkus2AfsSkus(refundSkuList))
|
||||
_, err = getAPI(order.VendorOrgCode).AfsSubmit(order.VendorOrderID, ctx.GetUserName(), utils.Int2Str(jdapi.AfsReasonTypeWrongGoods), reason, "", order.ConsigneeName, order.ConsigneeMobile, order.ConsigneeAddress, orderSkus2AfsSkus(refundSkuList))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -34,7 +34,12 @@ func OnCallbackMsg(msg *jdshopapi.CallBackResult) (err error) {
|
||||
})
|
||||
case jcqapi.TopicOrderCancel:
|
||||
utils.CallFuncAsync(func() {
|
||||
CurPurchaseHandler.CancelOrder(jxcontext.AdminCtx, getRealOrderID(msg.OrderID), "系统取消")
|
||||
order := getRealOrderID(msg.OrderID)
|
||||
if order != nil {
|
||||
if order.Status != model.OrderStatusCanceled {
|
||||
CurPurchaseHandler.CancelOrder(jxcontext.AdminCtx, order, "系统取消")
|
||||
}
|
||||
}
|
||||
})
|
||||
default:
|
||||
return fmt.Errorf("暂不支持的topic类型!topic: %v", msgType)
|
||||
@@ -44,6 +49,9 @@ func OnCallbackMsg(msg *jdshopapi.CallBackResult) (err error) {
|
||||
|
||||
func SaveJdsOrders(msg *jdshopapi.CallBackResult) (err error) {
|
||||
order, err := result2Orders(msg)
|
||||
if err != nil || order == nil {
|
||||
return err
|
||||
}
|
||||
order.StoreID = 102919
|
||||
order.JxStoreID = 102919
|
||||
order.StoreName = "商城模板(成都发货)"
|
||||
@@ -74,8 +82,8 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
|
||||
OrderCreatedAt: utils.Str2Time(msg.OrderStartTime),
|
||||
ConsigneeAddress: Decrypt(msg.ConsigneeInfo.FullAddress),
|
||||
ConsigneeName: Decrypt(msg.ConsigneeInfo.Fullname),
|
||||
ConsigneeMobile: Decrypt(msg.ConsigneeInfo.Telephone),
|
||||
ConsigneeMobile2: Decrypt(msg.ConsigneeInfo.Mobile),
|
||||
ConsigneeMobile: Decrypt(msg.ConsigneeInfo.Mobile),
|
||||
ConsigneeMobile2: Decrypt(msg.ConsigneeInfo.Telephone),
|
||||
ActualPayPrice: jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment)),
|
||||
Status: model.OrderStatusNew,
|
||||
TotalShopMoney: utils.Float64TwoInt64(math.Round(float64(jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment))) * jdshopapi.JdsPayPercentage)),
|
||||
@@ -99,6 +107,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
|
||||
}
|
||||
order.StoreID = storeList[0].ID
|
||||
order.StoreName = storeList[0].Name
|
||||
globals.SugarLogger.Debugf("jds GetStoreListByLocation, orderID: %v storeID :%v", order.VendorOrderID, order.StoreID)
|
||||
storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJDShop}, []int{order.StoreID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "")
|
||||
if len(storeMaps) > 0 {
|
||||
order.VendorStoreID = storeMaps[0].VendorStoreID
|
||||
@@ -115,6 +124,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
|
||||
order.BusinessType = model.BusinessTypeImmediate
|
||||
} else {
|
||||
globals.SugarLogger.Warnf("暂不支持的京东商城订单类型!type: %v", msg.OrderState)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//结算类型
|
||||
@@ -162,6 +172,9 @@ func setJdsOrderSeq(order *model.GoodsOrder) (err error) {
|
||||
}
|
||||
|
||||
func Decrypt(p string) (result string) {
|
||||
if p == "" {
|
||||
return ""
|
||||
}
|
||||
data, _ := base64.StdEncoding.DecodeString(strings.ReplaceAll(p, " ", "+"))
|
||||
key := GetKey(hex.EncodeToString(data)[4:36])
|
||||
data2, _ := base64.StdEncoding.DecodeString(key)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package jdshop
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -50,7 +51,9 @@ func (p *PurchaseHandler) GetOrderStatus(vendorOrgCode, vendorOrderID string) (s
|
||||
params["orderID"] = vendorOrderID
|
||||
params["token"] = "JxCaIsHiGetJsdOrderTmpToken_20200731"
|
||||
result, err := apiToYd("order/GetJdsOrder", params)
|
||||
return status2Jxstatus(result["orderState"].(string)), err
|
||||
jdsOrder := &jdshopapi.GetOrderResult{}
|
||||
json.Unmarshal([]byte(strings.ReplaceAll(result["data"].(string), "\\", "")), &jdsOrder)
|
||||
return status2Jxstatus(jdsOrder.OrderState), err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) AcceptOrRefuseOrder(order *model.GoodsOrder, isAcceptIt bool, userName string) (err error) {
|
||||
@@ -193,9 +196,11 @@ func apiToYd(url string, params map[string]interface{}) (retVal map[string]inter
|
||||
}
|
||||
if err == nil {
|
||||
if jsonResult1["code"] != nil {
|
||||
errLevel = platformapi.ErrLevelGeneralFail
|
||||
err = utils.NewErrorCode(jsonResult1["desc"].(string), jsonResult1["code"].(string))
|
||||
baseapi.SugarLogger.Debugf("yd AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||
if utils.Interface2Int64WithDefault(jsonResult1["code"], 0) != 0 {
|
||||
errLevel = platformapi.ErrLevelGeneralFail
|
||||
err = utils.NewErrorCode(jsonResult1["desc"].(string), jsonResult1["code"].(string))
|
||||
baseapi.SugarLogger.Debugf("yd AccessAPI failed, jsonResult1:%s", utils.Format4Output(jsonResult1, true))
|
||||
}
|
||||
}
|
||||
retVal = jsonResult1
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdshopapi"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/event"
|
||||
@@ -847,6 +849,7 @@ func jxOrder2GoodsOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, deliveryAd
|
||||
}
|
||||
order.TotalShopMoney += jxOrder.FreightPrice
|
||||
order.ActualPayPrice = order.TotalShopMoney
|
||||
order.TotalShopMoney = utils.Float64TwoInt64(float64(order.TotalShopMoney) * jdshopapi.JdsPayPercentage)
|
||||
if jxOrder.FromStoreID != 0 {
|
||||
order.FromStoreID = jxOrder.FromStoreID
|
||||
order.DeliveryFlag = model.OrderDeliveryFlagMaskScheduleDisabled
|
||||
@@ -1709,44 +1712,44 @@ func SendFailedMatterOrder(ctx *jxcontext.Context, vendorOrderID string) (err er
|
||||
if order == nil || order.StoreID != model.MatterStoreID || order.FromStoreID == 0 {
|
||||
return fmt.Errorf("只允许物料店重发物料订单调用此接口!")
|
||||
}
|
||||
queryOrderStatus, err := api.JdEclpAPI.QueryOrderStatus(order.EclpOutID)
|
||||
if len(queryOrderStatus.OrderStatusList) > 0 {
|
||||
code := queryOrderStatus.OrderStatusList[len(queryOrderStatus.OrderStatusList)-1].SoStatusCode
|
||||
if code == jdeclpapi.SoStatusCode10022 || code == jdeclpapi.SoStatusCode10038 { //表示该订单在京东物流为暂停或已经逆向发货完成
|
||||
if len(order.VendorOrderID) == 14 && order.EclpOutID != "" { //这是不分包的订单
|
||||
_, err = createMatterOrder(buildJxOrderInfo(order, order.Skus), order, int64(00))
|
||||
err = CancelMatterOrder(db, order, cancelMatterOrderReason)
|
||||
changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason)
|
||||
for _, v := range order.Skus {
|
||||
cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID)
|
||||
}
|
||||
} else if len(order.VendorOrderID) == 14 && order.EclpOutID == "" { //这是分包的主订单
|
||||
goodsList, err := dao.GetMatterChildOrders(db, order.VendorOrderID)
|
||||
// queryOrderStatus, err := api.JdEclpAPI.QueryOrderStatus(order.EclpOutID)
|
||||
// if len(queryOrderStatus.OrderStatusList) > 0 {
|
||||
// code := queryOrderStatus.OrderStatusList[len(queryOrderStatus.OrderStatusList)-1].SoStatusCode
|
||||
// if code == jdeclpapi.SoStatusCode10022 || code == jdeclpapi.SoStatusCode10038 { //表示该订单在京东物流为暂停或已经逆向发货完成
|
||||
if len(order.VendorOrderID) == 14 && order.EclpOutID != "" { //这是不分包的订单
|
||||
_, err = createMatterOrder(buildJxOrderInfo(order, order.Skus), order, int64(01))
|
||||
err = CancelMatterOrder(db, order, cancelMatterOrderReason)
|
||||
changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason)
|
||||
for _, v := range order.Skus {
|
||||
cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID)
|
||||
}
|
||||
} else if len(order.VendorOrderID) == 14 && order.EclpOutID == "" { //这是分包的主订单
|
||||
goodsList, err := dao.GetMatterChildOrders(db, order.VendorOrderID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(goodsList) > 0 {
|
||||
for _, v := range goodsList {
|
||||
cOrder, err := partner.CurOrderManager.LoadOrder(v.VendorOrderID, model.VendorIDJX)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(goodsList) > 0 {
|
||||
for _, v := range goodsList {
|
||||
cOrder, err := partner.CurOrderManager.LoadOrder(v.VendorOrderID, model.VendorIDJX)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
suffix := utils.Str2Int64(cOrder.VendorOrderID[len(cOrder.VendorOrderID)-2:]) + int64(len(goodsList))
|
||||
_, err = createMatterOrder(buildJxOrderInfo(cOrder, cOrder.Skus), cOrder, suffix)
|
||||
for _, v := range cOrder.Skus {
|
||||
cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID)
|
||||
}
|
||||
}
|
||||
suffix := utils.Str2Int64(cOrder.VendorOrderID[len(cOrder.VendorOrderID)-2:]) + int64(len(goodsList))
|
||||
_, err = createMatterOrder(buildJxOrderInfo(cOrder, cOrder.Skus), cOrder, suffix)
|
||||
for _, v := range cOrder.Skus {
|
||||
cms.RefreshMatterStock(jxcontext.AdminCtx, v.SkuID)
|
||||
}
|
||||
err = CancelMatterOrder(db, order, cancelMatterOrderReason)
|
||||
changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason)
|
||||
} else if len(order.VendorOrderID) == 16 && order.EclpOutID != "" { // 这是分包的子订单
|
||||
return fmt.Errorf("请重发主订单!主订单号:[%v]", order.VendorOrderID[len(order.VendorOrderID)-2:])
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("只允许物流订单为暂停或逆向完成才能调用此接口!")
|
||||
}
|
||||
err = CancelMatterOrder(db, order, cancelMatterOrderReason)
|
||||
changeOrderStatus(order.VendorOrderID, model.OrderStatusCanceled, cancelMatterOrderReason)
|
||||
} else if len(order.VendorOrderID) == 16 && order.EclpOutID != "" { // 这是分包的子订单
|
||||
return fmt.Errorf("请重发主订单!主订单号:[%v]", order.VendorOrderID[len(order.VendorOrderID)-2:])
|
||||
}
|
||||
// } else {
|
||||
// return fmt.Errorf("只允许物流订单为暂停或逆向完成才能调用此接口!")
|
||||
// }
|
||||
// }
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
||||
if isNeedUpdatePrice {
|
||||
foodData["price"] = jxutils.IntPrice2Standard(storeSku.VendorPrice)
|
||||
}
|
||||
foodData["min_order_count"] = 1
|
||||
if storeSku.MinOrderCount != 0 {
|
||||
foodData["min_order_count"] = storeSku.MinOrderCount
|
||||
} else {
|
||||
foodData["min_order_count"] = 1
|
||||
}
|
||||
foodData["unit"] = storeSku.Unit
|
||||
foodData["box_num"] = 1
|
||||
foodData["box_price"] = jxutils.IntPrice2Standard(storeSku.BoxFee)
|
||||
|
||||
Reference in New Issue
Block a user