aa
This commit is contained in:
@@ -586,6 +586,10 @@ func (s *DefScheduler) OnWaybillStatusChanged(bill *model.Waybill, isPending boo
|
||||
if order.VendorID == model.VendorIDJDShop {
|
||||
s.solutionJdsOrder(bill)
|
||||
}
|
||||
//订单已经是结束状态之后来的运单143945553920000001
|
||||
if order.Status > model.OrderStatusEndBegin {
|
||||
s.ProxyCancelWaybill(order, bill, partner.CancelWaybillReasonNotAcceptIntime, partner.CancelWaybillReasonStrNotAcceptIntime)
|
||||
}
|
||||
if model.IsWaybillPlatformOwn(bill) {
|
||||
if bill.Status == model.WaybillStatusDelivering && order.Status < model.OrderStatusEndBegin {
|
||||
// 强制将订单状态置为配送中?
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/authz"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin"
|
||||
"git.rosy.net.cn/jx-callback/business/partner/delivery"
|
||||
"github.com/360EntSecGroup-Skylar/excelize"
|
||||
@@ -1826,70 +1828,168 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// },
|
||||
// })
|
||||
// }
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
vendorThingIDs []int64
|
||||
)
|
||||
storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, []int{model.StoreStatusOpened, model.StoreStatusHaveRest, model.StoreStatusClosed}, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
||||
// for _, v := range storeMaps {
|
||||
// storesSkus, _ := dao.GetStoresSkusInfo(db, []int{v.StoreID}, nil)
|
||||
// for _, vv := range storesSkus {
|
||||
// if vv.Stock > 0 && vv.Status == model.StoreSkuBindStatusNormal {
|
||||
// thingIDs = append(thingIDs, vv.SkuID)
|
||||
// }
|
||||
// var (
|
||||
// db = dao.GetDB()
|
||||
// vendorThingIDs []int64
|
||||
// )
|
||||
// storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJD}, nil, []int{model.StoreStatusOpened, model.StoreStatusHaveRest, model.StoreStatusClosed}, model.StoreStatusAll, model.StoreIsSyncAll, "", "", "320406")
|
||||
// things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"})
|
||||
// thingIDmap := make(map[int64]string)
|
||||
|
||||
// for _, v := range things {
|
||||
// if v.VendorThingID != "" {
|
||||
// // lists = append(lists, &jdapi.SkuIdEntity{
|
||||
// // OutSkuId: utils.Int64ToStr(v.ThingID),
|
||||
// // })
|
||||
// vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(v.VendorThingID))
|
||||
// thingIDmap[utils.Str2Int64(v.VendorThingID)] = utils.Int64ToStr(v.ThingID)
|
||||
// }
|
||||
// }
|
||||
things, _ := dao.GetThingMapList(db, model.ThingTypeSku, []int{model.VendorIDJD}, nil, []string{"320406"})
|
||||
thingIDmap := make(map[int64]string)
|
||||
|
||||
for _, v := range things {
|
||||
if v.VendorThingID != "" {
|
||||
// lists = append(lists, &jdapi.SkuIdEntity{
|
||||
// OutSkuId: utils.Int64ToStr(v.ThingID),
|
||||
// })
|
||||
vendorThingIDs = append(vendorThingIDs, utils.Str2Int64(v.VendorThingID))
|
||||
thingIDmap[utils.Str2Int64(v.VendorThingID)] = utils.Int64ToStr(v.ThingID)
|
||||
// task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx,
|
||||
// func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// storeMap := batchItemList[0].(*model.StoreMap)
|
||||
// FreeBatchInfo("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) {
|
||||
// priceInfo, _ := api.JdAPI.GetStationInfoList(storeMap.VendorStoreID, batchedStoreSkuList)
|
||||
// var list []*jdapi.SkuIdEntity
|
||||
// for _, vv := range priceInfo {
|
||||
// if vv.VipPrice != 0 {
|
||||
// fmt.Println("vipPrice uuu", vv.SkuID)
|
||||
// list = append(list, &jdapi.SkuIdEntity{
|
||||
// OutSkuId: thingIDmap[vv.SkuID],
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), list)
|
||||
// return result, 0, err
|
||||
// }, ctx, task, vendorThingIDs, 50, true)
|
||||
// return retVal, err
|
||||
// }, storeMaps)
|
||||
// tasksch.HandleTask(task, nil, true).Run()
|
||||
// _, err = task.GetResult(0)
|
||||
var (
|
||||
storeIDs = []int{
|
||||
102997,
|
||||
103085,
|
||||
102481,
|
||||
103190,
|
||||
101755,
|
||||
100326,
|
||||
102807,
|
||||
101986,
|
||||
102752,
|
||||
100270,
|
||||
100267,
|
||||
102778,
|
||||
101111,
|
||||
103454,
|
||||
102160,
|
||||
102824,
|
||||
103425,
|
||||
100278,
|
||||
666742,
|
||||
103093,
|
||||
102606,
|
||||
100369,
|
||||
102519,
|
||||
101842,
|
||||
101722,
|
||||
100361,
|
||||
102637,
|
||||
666669,
|
||||
102991,
|
||||
666815,
|
||||
103060,
|
||||
102968,
|
||||
100517,
|
||||
102788,
|
||||
100234,
|
||||
100236,
|
||||
100463,
|
||||
666852,
|
||||
102990,
|
||||
100351,
|
||||
666743,
|
||||
100476,
|
||||
666898,
|
||||
102379,
|
||||
103069,
|
||||
100969,
|
||||
666760,
|
||||
666950,
|
||||
100477,
|
||||
100334,
|
||||
100274,
|
||||
100650,
|
||||
102022,
|
||||
101000,
|
||||
100328,
|
||||
102953,
|
||||
102433,
|
||||
103116,
|
||||
102962,
|
||||
103200,
|
||||
102782,
|
||||
100336,
|
||||
103089,
|
||||
100922,
|
||||
103013,
|
||||
102781,
|
||||
102709,
|
||||
667108,
|
||||
101088,
|
||||
100887,
|
||||
100335,
|
||||
103119,
|
||||
101775,
|
||||
101945,
|
||||
101997,
|
||||
103161,
|
||||
102300,
|
||||
100273,
|
||||
102253,
|
||||
103090,
|
||||
100767,
|
||||
667167,
|
||||
667184,
|
||||
100766,
|
||||
666736,
|
||||
667201,
|
||||
102046,
|
||||
667194,
|
||||
102136,
|
||||
102075,
|
||||
100350,
|
||||
102790,
|
||||
103084,
|
||||
667291,
|
||||
102303,
|
||||
667296,
|
||||
667212,
|
||||
103082,
|
||||
102014,
|
||||
667266,
|
||||
102882,
|
||||
102417,
|
||||
102320,
|
||||
100373,
|
||||
100366,
|
||||
667449,
|
||||
101107,
|
||||
100524,
|
||||
102444,
|
||||
667149,
|
||||
}
|
||||
)
|
||||
var roleList []*authz.RoleInfo
|
||||
for _, v := range storeIDs {
|
||||
role := &authz.RoleInfo{
|
||||
Name: "StoreBoss",
|
||||
StoreID: v,
|
||||
}
|
||||
roleList = append(roleList, role)
|
||||
}
|
||||
|
||||
task := tasksch.NewParallelTask("uuuuu", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
storeMap := batchItemList[0].(*model.StoreMap)
|
||||
FreeBatchInfo("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []int64) (result interface{}, successCount int, err error) {
|
||||
priceInfo, _ := api.JdAPI.GetStationInfoList(storeMap.VendorStoreID, batchedStoreSkuList)
|
||||
var list []*jdapi.SkuIdEntity
|
||||
for _, vv := range priceInfo {
|
||||
if vv.VipPrice != 0 {
|
||||
fmt.Println("vipPrice uuu", vv.SkuID)
|
||||
list = append(list, &jdapi.SkuIdEntity{
|
||||
OutSkuId: thingIDmap[vv.SkuID],
|
||||
})
|
||||
}
|
||||
}
|
||||
err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), list)
|
||||
return result, 0, err
|
||||
}, ctx, task, vendorThingIDs, 50, true)
|
||||
// for _, v := range resultList {
|
||||
// var thingmaps []*model.ThingMap
|
||||
// sql := `
|
||||
// SELECT * FROM thing_map WHERE vendor_thing_id = ? AND vendor_org_code = ? AND deleted_at = ?
|
||||
// `
|
||||
// sqlParams := []interface{}{v, 320406, utils.DefaultTimeValue}
|
||||
// err = dao.GetRows(db, &thingmaps, sql, sqlParams)
|
||||
// for _, vv := range thingmaps {
|
||||
// lists = append(lists, &jdapi.SkuIdEntity{
|
||||
// OutSkuId: thingIDmap[v.(int64)],
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// FreeBatchInfo2("uuuuu2", func(task tasksch.ITask, batchedStoreSkuList []*jdapi.SkuIdEntity) (result interface{}, successCount int, err error) {
|
||||
// err = api.JdAPI.DelVipPrice(utils.Int2Str(storeMap.StoreID), batchedStoreSkuList)
|
||||
// return result, 0, err
|
||||
// }, ctx, task, lists, 50, true)
|
||||
return retVal, err
|
||||
}, storeMaps)
|
||||
tasksch.HandleTask(task, nil, true).Run()
|
||||
_, err = task.GetResult(0)
|
||||
cms.AddRoles4User(ctx, "9DBC46AD71D211EBB5F7525400E86DC0", roleList)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -192,6 +192,7 @@ func OnWaybillMsg(msg *fnpsapi.WayBillInfo) {
|
||||
order.VendorOrderID, order.OrderVendorID = jxutils.SplitUniversalOrderID(msg.PartnerOrderCode)
|
||||
switch msg.OrderStatus {
|
||||
case fnpsapi.OrderStatusAccept:
|
||||
order.Status = model.WaybillStatusNew
|
||||
case fnpsapi.OrderStatusAssigned:
|
||||
order.DesiredFee = GetDesiredFee(order.VendorOrderID)
|
||||
order.Status = model.WaybillStatusAccepted
|
||||
|
||||
Reference in New Issue
Block a user