超12小时自动审核售后单

This commit is contained in:
苏尹岚
2020-09-14 17:24:25 +08:00
parent 69c617e87a
commit e681e406a0
2 changed files with 53 additions and 36 deletions

View File

@@ -1804,6 +1804,9 @@ func GenOrderNo(ctx *jxcontext.Context) (orderNo int64) {
func RefreshJdsOrderConsigneeInfo(ctx *jxcontext.Context, vendorOrderID string) (err error) {
order, err := partner.CurOrderManager.LoadOrder(vendorOrderID, model.VendorIDJDShop)
if order == nil {
return fmt.Errorf("未查询到此京东商城订单!")
}
waybill, err := partner.CurOrderManager.LoadWaybill(order.VendorWaybillID, order.WaybillVendorID)
if waybill != nil {
return fmt.Errorf("已经创建了三方运单不允许修改联系人信息!")

View File

@@ -67,10 +67,6 @@ func SaveJdsOrders(msg *jdshopapi.CallBackResult) (err error) {
if err != nil || order == nil {
return err
}
order.StoreID = 102919
order.JxStoreID = 102919
order.StoreName = "商城模板(成都发货)"
order.VendorStoreID = model.JdShopMainVendorStoreID
partner.CurOrderManager.OnOrderNew(order, model.Order2Status(order))
noticeMsg := fmt.Sprintf("京东商城新订单,订单号:[%v] ,将要发到的门店id[%v] , 门店名:[%v]", order.VendorOrderID, order.StoreID, order.StoreName)
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, "DDC5657B43EE11E9A9FF525400E86DC0", "京东商城来新订单了!", noticeMsg)
@@ -102,7 +98,6 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
ActualPayPrice: jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment)),
Status: model.OrderStatusNew,
TotalShopMoney: utils.Float64TwoInt64(math.Round(float64(jxutils.StandardPrice2Int(utils.Str2Float64(msg.OrderPayment))) * jdshopapi.JdsPayPercentage)),
DeliveryFlag: model.OrderDeliveryFlagMaskScheduleDisabled,
DeliveryType: model.OrderDeliveryTypeStoreSelf,
StatusTime: utils.Str2Time(msg.OrderStartTime),
OrderSeq: 0,
@@ -114,15 +109,61 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
lng, lat, _ := api.AutonaviAPI.GetCoordinateFromAddress(order.ConsigneeAddress, "")
order.ConsigneeLng = jxutils.StandardCoordinate2Int(lng)
order.ConsigneeLat = jxutils.StandardCoordinate2Int(lat)
order.CoordinateType = model.CoordinateTypeMars
}
storeList, err := common.GetStoreListByLocation(jxcontext.AdminCtx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false, true)
var skuIDs []int
for _, v := range msg.ItemInfoList {
sku := &model.OrderSku{
VendorID: model.VendorIDJDShop,
VendorOrderID: order.VendorOrderID,
Count: utils.Str2Int(v.ItemTotal),
VendorSkuID: v.SkuID,
SkuName: v.SkuName,
VendorPrice: jxutils.StandardPrice2Int(utils.Str2Float64(v.JdPrice)),
SalePrice: jxutils.StandardPrice2Int(utils.Str2Float64(v.JdPrice)),
// SkuID: utils.Str2Int(v.OuterSkuID),
}
if v.OuterSkuID != "" {
sku.SkuID = utils.Str2Int(v.OuterSkuID)
}
_, _, _, specUnit, _, specQuality := jxutils.SplitSkuName(v.SkuName)
sku.Weight = jxutils.FormatSkuWeight(specQuality, specUnit)
order.Skus = append(order.Skus, sku)
skuIDs = append(skuIDs, sku.SkuID)
}
storeList, err := common.GetStoreListByLocation(jxcontext.AdminCtx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 3000, false, true)
if err != nil {
globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error())
return order, err
}
order.StoreID = storeList[0].ID
order.StoreName = storeList[0].Name
globals.SugarLogger.Debugf("jds GetStoreListByLocation, orderID: %v storeID :%v", order.VendorOrderID, order.StoreID)
if len(storeList) > 0 {
order.StoreID = storeList[0].ID
order.JxStoreID = storeList[0].ID
order.StoreName = storeList[0].Name
globals.SugarLogger.Debugf("jds GetStoreListByLocation, orderID: %v storeID :%v", order.VendorOrderID, order.StoreID)
//结算类型
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), order.StoreID, model.VendorIDJDShop)
if storeDetail != nil {
if storeDetail.PayPercentage < 50 {
order.EarningType = model.EarningTypePoints
} else {
order.EarningType = model.EarningTypeQuote
}
}
if order.EarningType == model.EarningTypeQuote {
var shopPriceSum int
storeSkuList, _ := dao.GetStoresSkusInfo(dao.GetDB(), []int{order.StoreID}, skuIDs)
for _, storeSku := range storeSkuList {
shopPriceSum += storeSku.Price
}
}
} else {
order.StoreID = 102919
order.JxStoreID = 102919
order.StoreName = "商城模板(成都发货)"
order.VendorStoreID = model.JdShopMainVendorStoreID
order.DeliveryFlag = model.OrderDeliveryFlagMaskScheduleDisabled
}
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
@@ -149,34 +190,7 @@ func result2Orders(msg *jdshopapi.CallBackResult) (order *model.GoodsOrder, err
}
}
//结算类型
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), order.StoreID, model.VendorIDJDShop)
if storeDetail != nil {
if storeDetail.PayPercentage < 50 {
order.EarningType = model.EarningTypePoints
} else {
order.EarningType = model.EarningTypeQuote
}
}
setJdsOrderSeq(order)
for _, v := range msg.ItemInfoList {
sku := &model.OrderSku{
VendorID: model.VendorIDJDShop,
VendorOrderID: order.VendorOrderID,
Count: utils.Str2Int(v.ItemTotal),
VendorSkuID: v.SkuID,
SkuName: v.SkuName,
VendorPrice: jxutils.StandardPrice2Int(utils.Str2Float64(v.JdPrice)),
SalePrice: jxutils.StandardPrice2Int(utils.Str2Float64(v.JdPrice)),
// SkuID: utils.Str2Int(v.OuterSkuID),
}
if v.OuterSkuID != "" {
sku.SkuID = utils.Str2Int(v.OuterSkuID)
}
_, _, _, specUnit, _, specQuality := jxutils.SplitSkuName(v.SkuName)
sku.Weight = jxutils.FormatSkuWeight(specQuality, specUnit)
order.Skus = append(order.Skus, sku)
}
return order, err
}