From 6c4d8472adc2569d4f5c6600cec1f0f55afdb6b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 09:10:20 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 8 ++++---- business/model/dao/store_sku.go | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 792ec6ef2..0b654b1ce 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1135,13 +1135,13 @@ func syncJdsStoreStock(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { storeSku := batchItemList[0].(*model.StoreSkuBind) stock := 0 - if storeSku.Status == model.StoreSkuBindStatusNormal { - stock = 9999 - } storeSku2, _ := dao.GetStoresSkusInfo(db, []int{storeMap.StoreID}, []int{storeSku.SkuID}) if storeSku.JdsID != 0 { if len(storeSku2) > 0 { - if storeSku.Status != storeSku2[0].Status && storeMap.VendorStoreID != "" { + if storeSku2[0].Status == model.StoreSkuBindStatusNormal { + stock = 9999 + } + if storeMap.VendorStoreID != "" { err = api.JdShopAPI.UpdateSkuSiteStock(storeSku.JdsID, stock, utils.Str2Int(storeMap.VendorStoreID)) } } else { diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 528284468..ebc1b5575 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -1669,3 +1669,30 @@ func GetStoreSkuAuditLight(db *DaoDB, storeIDs, nameIDs []int, status int) (stor err = GetRows(db, &storeSkuAudit, sql, sqlParams...) return storeSkuAudit, err } + +func GetStoreSkuHistory(db *DaoDB, storeIDs, skuIDs []int, status int, snapShot time.Time) (storeSkuHistory []*model.StoreSkuBindHistory, err error) { + sql := ` + SELECT a.* + FROM store_sku_bind_history a + WHERE a.deleted_at = ? + ` + sqlParams := []interface{}{utils.DefaultTimeValue} + if len(storeIDs) > 0 { + sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")" + sqlParams = append(sqlParams, storeIDs) + } + if len(skuIDs) > 0 { + sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")" + sqlParams = append(sqlParams, skuIDs) + } + if status != model.StoreAuditStatusAll { + sql += " AND a.status = ? " + sqlParams = append(sqlParams, status) + } + if !utils.IsTimeZero(snapShot) { + sql += " AND a.snapshot_at = ? " + sqlParams = append(sqlParams, snapShot) + } + err = GetRows(db, &storeSkuHistory, sql, sqlParams...) + return storeSkuHistory, err +} From 694f61c6cea201bb1bf884c556f736e6e45198cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 16:50:55 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E5=88=B7=E6=96=B0=E9=AB=98=E4=BB=B7?= =?UTF-8?q?=E5=93=81=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 25 +++++-------- business/jxstore/misc/misc.go | 2 +- business/jxstore/tempop/tempop.go | 61 +++++++++++++++++++------------ 3 files changed, 49 insertions(+), 39 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 9178cc301..ecf373753 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1096,6 +1096,11 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs return nil, fmt.Errorf("商品:%s价格:%s太夸张", allBinds[0].Name, jxutils.IntPrice2StandardCurrencyString(int64(skuBindInfo.UnitPrice))) } unitPrice = skuBindInfo.UnitPrice + if isRefreshHigh { + if allBinds[0].UnitPrice > unitPrice { + continue + } + } } else { unitPrice = allBinds[0].UnitPrice if unitPrice == 0 { @@ -1213,21 +1218,11 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs setStoreSkuBindStatus(skuBind, model.SyncFlagPriceMask) updateFieldMap["Price"] = 1 } - if isRefreshHigh { - if beforeMsg.UnitPrice > skuBindInfo.UnitPrice { - skuBind.UnitPrice = unitPrice - skuBind.Price = price - skuBind.JxPrice = jxPrice - updateFieldMap["UnitPrice"] = 1 - updateFieldMap["JxPrice"] = 1 - } - } else { - skuBind.UnitPrice = unitPrice - skuBind.Price = price - skuBind.JxPrice = jxPrice - updateFieldMap["UnitPrice"] = 1 - updateFieldMap["JxPrice"] = 1 - } + skuBind.UnitPrice = unitPrice + skuBind.Price = price + skuBind.JxPrice = jxPrice + updateFieldMap["UnitPrice"] = 1 + updateFieldMap["JxPrice"] = 1 } } if skuBindInfo.StatusSaleBegin != 0 && skuBindInfo.StatusSaleEnd != 0 { diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 0a9a75159..8d099886d 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -46,7 +46,7 @@ var ( "20:00:00", } dailyWorkTimeList2 = []string{ - "04:00:00", + "02:00:00", } priceReferTimeList = []string{ "03:00:00", diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 4f120b32a..744aed916 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1560,29 +1560,29 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } //京东商城街道name - var stores []*model.Store - var db = dao.GetDB() - sql := ` - SELECT b.* - FROM store_map a, store b - WHERE a.store_id = b.id - AND a.vendor_store_id = '' AND a.vendor_id = 5 AND a.deleted_at = ? - AND b.deleted_at = ? - ` - sqlParams := []interface{}{utils.DefaultTimeValue, utils.DefaultTimeValue} - err = dao.GetRows(db, &stores, sql, sqlParams) - for _, v := range stores { - result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat)) - if result["regeocode"] != nil { - street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string) - if street != "" { - storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, []int{v.ID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") - storeMap := storeMaps[0] - storeMap.JdsStreetName = street - dao.UpdateEntity(db, storeMap, "JdsStreetName") - } - } - } + // var stores []*model.Store + // var db = dao.GetDB() + // sql := ` + // SELECT b.* + // FROM store_map a, store b + // WHERE a.store_id = b.id + // AND a.vendor_store_id = '' AND a.vendor_id = 5 AND a.deleted_at = ? + // AND b.deleted_at = ? + // ` + // sqlParams := []interface{}{utils.DefaultTimeValue, utils.DefaultTimeValue} + // err = dao.GetRows(db, &stores, sql, sqlParams) + // for _, v := range stores { + // result, _ := api.AutonaviAPI.GetCoordinateAreaInfo(jxutils.IntCoordinate2Standard(v.Lng), jxutils.IntCoordinate2Standard(v.Lat)) + // if result["regeocode"] != nil { + // street := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{})["township"].(string) + // if street != "" { + // storeMaps, _ := dao.GetStoresMapList(db, []int{model.VendorIDJDShop}, []int{v.ID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") + // storeMap := storeMaps[0] + // storeMap.JdsStreetName = street + // dao.UpdateEntity(db, storeMap, "JdsStreetName") + // } + // } + // } // var stores []*model.Store // sql := ` @@ -1610,6 +1610,21 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } + + // type tStore struct { + // } + + // sql := ` + // SELECT count(a.unit_price) count,a.name_id,a.store_id FROM ( + // SELECT DISTINCT a.unit_price,b.name_id,a.store_id from store_sku_bind a,sku b,store c + // where a.sku_id = b.id + // and c.id = a.store_id and c.deleted_at = '1970-01-01 00:00:00' + // and a.store_id = ? + // and a.deleted_at = '1970-01-01 00:00:00')a + // GROUP BY 2,3 + // HAVING count(a.unit_price) > 1 + // ` + // sqlParams := []interface{}{} return err } From e3eda17c0b4d8312b1c9e566776c9751e62fe09f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 17:41:53 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E6=B7=B7=E8=BD=AE=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 49 ++++++++++++++++++++++--------- business/model/dao/store_sku.go | 4 ++- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 744aed916..007e837cf 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1610,21 +1610,42 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // continue // } // } - - // type tStore struct { + db := dao.GetDB() + type tStore struct { + NameID int `orm:column(name_id)` + StoreID int `orm:column(store_id)` + } + var resultList []*tStore + stores, _ := dao.GetStoreList(db, nil, nil, nil, nil, "") + for _, v := range stores { + var resultList2 []*tStore + sql := ` + SELECT a.name_id,a.store_id FROM ( + SELECT DISTINCT a.unit_price,b.name_id,a.store_id from store_sku_bind a,sku b,store c + where a.sku_id = b.id + and c.id = a.store_id and c.deleted_at = '1970-01-01 00:00:00' + and a.store_id = ? + and a.deleted_at = '1970-01-01 00:00:00')a + GROUP BY 1,2 + HAVING count(a.unit_price) > 1 + ` + sqlParams := []interface{}{v.ID} + err = dao.GetRows(db, &resultList2, sql, sqlParams) + resultList = append(resultList, resultList2...) + } + fmt.Println("resultList", utils.Format4Output(resultList, false)) + // var skuBindInfos []*cms.StoreSkuBindInfo + // for _, v := range resultList { + // storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) + // unitPirce := storeSkus[0].UnitPrice + // skuBindInfo := &cms.StoreSkuBindInfo{ + // StoreID: v.StoreID, + // NameID: v.NameID, + // UnitPrice: int(unitPirce), + // } + // skuBindInfos = append(skuBindInfos, skuBindInfo) // } - - // sql := ` - // SELECT count(a.unit_price) count,a.name_id,a.store_id FROM ( - // SELECT DISTINCT a.unit_price,b.name_id,a.store_id from store_sku_bind a,sku b,store c - // where a.sku_id = b.id - // and c.id = a.store_id and c.deleted_at = '1970-01-01 00:00:00' - // and a.store_id = ? - // and a.deleted_at = '1970-01-01 00:00:00')a - // GROUP BY 2,3 - // HAVING count(a.unit_price) > 1 - // ` - // sqlParams := []interface{}{} + // _, err = cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false) return err } diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index ebc1b5575..8993304df 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -997,7 +997,9 @@ func GetStoreSkusByNameIDs(db *DaoDB, storeIDs []int, nameID int) (skuList []*St sql += " AND a.store_id in (" + GenQuestionMarks(len(storeIDs)) + ")" sqlParams = append(sqlParams, storeIDs) } - sql += " AND a.status != ?" + sql += ` AND a.status != ? + ORDER BY a.created_at + ` sqlParams = append(sqlParams, model.SkuStatusDeleted) err = GetRows(db, &skuList, sql, sqlParams...) return skuList, err From 6f6dcb142f4aecce88021b4cae1338ee54636ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 17:47:09 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E6=B7=B7=E8=BD=AE=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 007e837cf..fa52cd125 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1633,7 +1633,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { err = dao.GetRows(db, &resultList2, sql, sqlParams) resultList = append(resultList, resultList2...) } - fmt.Println("resultList", utils.Format4Output(resultList, false)) + fmt.Println("testresultList", utils.Format4Output(resultList, false)) // var skuBindInfos []*cms.StoreSkuBindInfo // for _, v := range resultList { // storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) From ebc5733c34b365fb5937f30f977c1b18be2c935c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 17:52:30 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E6=B7=B7=E8=BD=AE=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index fa52cd125..6cfc8d336 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1612,8 +1612,8 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // } db := dao.GetDB() type tStore struct { - NameID int `orm:column(name_id)` - StoreID int `orm:column(store_id)` + NameID int `orm:"column(name_id)"` + StoreID int `orm:"column(store_id)"` } var resultList []*tStore stores, _ := dao.GetStoreList(db, nil, nil, nil, nil, "") From 93a21411714e9ad01328ad58409156d5d80122bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 17:52:50 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E6=B7=B7=E8=BD=AE=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 6cfc8d336..4d07f08e9 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1633,7 +1633,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { err = dao.GetRows(db, &resultList2, sql, sqlParams) resultList = append(resultList, resultList2...) } - fmt.Println("testresultList", utils.Format4Output(resultList, false)) + fmt.Println("testresultList2", utils.Format4Output(resultList, false)) // var skuBindInfos []*cms.StoreSkuBindInfo // for _, v := range resultList { // storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) From dc9ab03aef47f60aebaffd59aea92c5b460fdef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 18:03:59 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E6=B7=B7=E4=B9=B1=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 4d07f08e9..e743aae1b 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1633,19 +1633,21 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { err = dao.GetRows(db, &resultList2, sql, sqlParams) resultList = append(resultList, resultList2...) } - fmt.Println("testresultList2", utils.Format4Output(resultList, false)) - // var skuBindInfos []*cms.StoreSkuBindInfo - // for _, v := range resultList { - // storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) - // unitPirce := storeSkus[0].UnitPrice - // skuBindInfo := &cms.StoreSkuBindInfo{ - // StoreID: v.StoreID, - // NameID: v.NameID, - // UnitPrice: int(unitPirce), - // } - // skuBindInfos = append(skuBindInfos, skuBindInfo) - // } - // _, err = cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false) + // fmt.Println("testresultList2", utils.Format4Output(resultList, false)) + var skuBindInfos []*cms.StoreSkuBindInfo + for _, v := range resultList { + if v.StoreID == 100002 { + storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) + unitPirce := storeSkus[0].UnitPrice + skuBindInfo := &cms.StoreSkuBindInfo{ + StoreID: v.StoreID, + NameID: v.NameID, + UnitPrice: int(unitPirce), + } + skuBindInfos = append(skuBindInfos, skuBindInfo) + } + } + _, err = cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false) return err } From 363d4a5cc17e26519cd2d21a2ce29fd3bb11664d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 18:07:36 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E6=B7=B7=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index e743aae1b..32bd00711 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1636,16 +1636,16 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { // fmt.Println("testresultList2", utils.Format4Output(resultList, false)) var skuBindInfos []*cms.StoreSkuBindInfo for _, v := range resultList { - if v.StoreID == 100002 { - storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) - unitPirce := storeSkus[0].UnitPrice - skuBindInfo := &cms.StoreSkuBindInfo{ - StoreID: v.StoreID, - NameID: v.NameID, - UnitPrice: int(unitPirce), - } - skuBindInfos = append(skuBindInfos, skuBindInfo) + // if v.StoreID == 100002 { + storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) + unitPirce := storeSkus[0].UnitPrice + skuBindInfo := &cms.StoreSkuBindInfo{ + StoreID: v.StoreID, + NameID: v.NameID, + UnitPrice: int(unitPirce), } + skuBindInfos = append(skuBindInfos, skuBindInfo) + // } } _, err = cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false) return err From 1f627305ec7d2ae1abac71118c4173cff3a9662f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 3 Jul 2020 18:14:01 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E6=B7=B7=E4=B9=B1=E6=B5=8B?= =?UTF-8?q?=E8=AF=952?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 32bd00711..3c2f1f5fe 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1633,21 +1633,19 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { err = dao.GetRows(db, &resultList2, sql, sqlParams) resultList = append(resultList, resultList2...) } - // fmt.Println("testresultList2", utils.Format4Output(resultList, false)) - var skuBindInfos []*cms.StoreSkuBindInfo - for _, v := range resultList { - // if v.StoreID == 100002 { - storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) - unitPirce := storeSkus[0].UnitPrice - skuBindInfo := &cms.StoreSkuBindInfo{ - StoreID: v.StoreID, - NameID: v.NameID, - UnitPrice: int(unitPirce), - } - skuBindInfos = append(skuBindInfos, skuBindInfo) - // } - } - _, err = cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false) + fmt.Println("testresultList3", utils.Format4Output(resultList, false)) + // var skuBindInfos []*cms.StoreSkuBindInfo + // for _, v := range resultList { + // storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) + // unitPirce := storeSkus[0].UnitPrice + // skuBindInfo := &cms.StoreSkuBindInfo{ + // StoreID: v.StoreID, + // NameID: v.NameID, + // UnitPrice: int(unitPirce), + // } + // skuBindInfos = append(skuBindInfos, skuBindInfo) + // } + // _, err = cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false) return err } From ec8c7c020fb2e8ee21b87adb847e35d1eb2dfa2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 6 Jul 2020 10:30:23 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E4=B8=8D=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 35 +++++++++++++++++++++++++++++++ business/jxstore/tempop/tempop.go | 2 +- business/model/dao/store_sku.go | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index ecf373753..cdd3ce574 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1734,6 +1734,41 @@ func CopyStoreSkus(ctx *jxcontext.Context, fromStoreID int, toStoreIDs []int, co } globals.SugarLogger.Debugf("CopyStoreSkus fromStoreID:%d, toStoreID:%d, trackInfo:%s num3:%d", fromStoreID, toStoreID, ctx.GetTrackInfo(), num2) dao.Commit(db) + + //同一商品若源门店的规格少于要复制到的门店,则在复制的门店里的其他规格的unitprice不会变, + //导致复制的门店的商品unitprice不尽相同,这里先处理一下 + type tStore struct { + NameID int `orm:"column(name_id)"` + StoreID int `orm:"column(store_id)"` + } + var resultList []*tStore + sql3 := ` + SELECT a.name_id, a.store_id FROM ( + SELECT DISTINCT a.unit_price, b.name_id, a.store_id FROM store_sku_bind a, sku b, store c + WHERE a.sku_id = b.id + AND c.id = a.store_id + AND c.deleted_at = ? + AND a.store_id = ? + AND a.deleted_at = ?)a + GROUP BY 1, 2 + HAVING COUNT(a.unit_price) > 1 + ` + sqlParams3 := []interface{}{utils.DefaultTimeValue, toStoreID, utils.DefaultTimeValue} + err = dao.GetRows(db, &resultList, sql3, sqlParams3) + if len(resultList) > 0 { + var skuBindInfos []*StoreSkuBindInfo + for _, v := range resultList { + storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) + unitPirce := storeSkus[0].UnitPrice + skuBindInfo := &StoreSkuBindInfo{ + StoreID: v.StoreID, + NameID: v.NameID, + UnitPrice: int(unitPirce), + } + skuBindInfos = append(skuBindInfos, skuBindInfo) + } + _, err = updateStoresSkusWithoutSync(ctx, db, []int{toStoreID}, skuBindInfos, false, false) + } } if globals.IsAddEvent { mapAfter := make(map[string]interface{}) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 3c2f1f5fe..6f8850629 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1636,7 +1636,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { fmt.Println("testresultList3", utils.Format4Output(resultList, false)) // var skuBindInfos []*cms.StoreSkuBindInfo // for _, v := range resultList { - // storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) + // storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) // unitPirce := storeSkus[0].UnitPrice // skuBindInfo := &cms.StoreSkuBindInfo{ // StoreID: v.StoreID, diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 8993304df..9b64d2ece 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -998,7 +998,7 @@ func GetStoreSkusByNameIDs(db *DaoDB, storeIDs []int, nameID int) (skuList []*St sqlParams = append(sqlParams, storeIDs) } sql += ` AND a.status != ? - ORDER BY a.created_at + ORDER BY a.updated_at DESC ` sqlParams = append(sqlParams, model.SkuStatusDeleted) err = GetRows(db, &skuList, sql, sqlParams...) From 0a548b09beca7bcbf51b4447b41cdf8b7d60b1aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 6 Jul 2020 14:43:23 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=94=AE?= =?UTF-8?q?=E5=8D=96=E4=BB=B7=E4=BB=A3=E6=9B=BF=E4=B8=BA0=E7=9A=84?= =?UTF-8?q?=E4=BA=AC=E8=A5=BF=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/orderman_ext.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/orderman_ext.go b/business/jxcallback/orderman/orderman_ext.go index 7c3f9f1f1..044ef4745 100644 --- a/business/jxcallback/orderman/orderman_ext.go +++ b/business/jxcallback/orderman/orderman_ext.go @@ -104,6 +104,7 @@ func (c *OrderManager) GetOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID str if vendorID == model.VendorIDJD { fullSkuNameSQL = "CONCAT(t1.sku_name, IF(t3.is_spu = 1 AND LOCATE(';', t1.sku_name) = 0, CONCAT('[约', t2.spec_quality, t2.spec_unit, '/', t3.unit, ']'), ''))" } + // IF(t1.shop_price = 0, t1.sale_price, t1.shop_price) shop_price, sql := fmt.Sprintf(` SELECT t1.id, @@ -114,8 +115,8 @@ func (c *OrderManager) GetOrderSkuInfo(ctx *jxcontext.Context, vendorOrderID str t1.sku_id, t1.jx_sku_id, t1.sku_name, - IF(t1.shop_price = 0, t1.sale_price, t1.shop_price) shop_price, t1.sale_price, + t1.shop_price, CAST(IF(t1.earning_price <> 0, t1.earning_price, IF(t1.shop_price <> 0 && t1.shop_price < t1.sale_price, t1.shop_price, t1.sale_price) * IF(t5.pay_percentage > 0, t5.pay_percentage, ?) / 100) AS SIGNED) earning_price, t1.weight, t1.sku_type, From cf7e2a43d864e5a133a38fdf12fd84ed0c22d66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 6 Jul 2020 16:34:05 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E9=83=BD=E4=B8=8D=E5=88=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/misc/misc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 8d099886d..c7f20be56 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -411,7 +411,7 @@ func doDailyWork() { //刷新京东门店的等级 cms.RefreshJdLevel(jxcontext.AdminCtx) //删除操作日志 - event.DeleteOperateEventAndDetail(jxcontext.AdminCtx, time.Now().AddDate(0, -3, 0)) + // event.DeleteOperateEventAndDetail(jxcontext.AdminCtx, time.Now().AddDate(0, -3, 0)) //禁用没有绑定的门店 cms.DisabledStoreWithoutVendor(jxcontext.AdminCtx, true, true) //刷新物料订单状态 From ae33d5c080123dce6535fb2b21cf278b0261640b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 6 Jul 2020 17:32:27 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E6=9E=9C=E5=9B=AD=E6=94=B9=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E8=A7=84=E5=88=99=E5=B0=B1=E7=BB=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index 6f8850629..bb1f341db 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -1660,10 +1660,9 @@ func RefreshJXPriceChange(ctx *jxcontext.Context, storeID int) (hint string, err sql := ` SELECT * FROM store - WHERE deleted_at = ? AND status <> ? - AND id <> 100118 AND id <> 100274 AND id <> 100205 + WHERE deleted_at = ? AND pay_percentage > 50 ` - sqlParams := []interface{}{utils.DefaultTimeValue, model.StoreStatusDisabled} + sqlParams := []interface{}{utils.DefaultTimeValue} if storeID != 0 { sql += " AND id = ?" sqlParams = append(sqlParams, storeID) From c9bc47d142bc0790e522ea68f16ea95f1683c618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 6 Jul 2020 18:01:49 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E8=BE=BE=E8=BE=BE?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=A4=87=E6=B3=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/delivery/dada/waybill.go | 2 +- business/partner/delivery/mtps/waybill.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/business/partner/delivery/dada/waybill.go b/business/partner/delivery/dada/waybill.go index 0d9e54de3..10b293578 100644 --- a/business/partner/delivery/dada/waybill.go +++ b/business/partner/delivery/dada/waybill.go @@ -229,7 +229,7 @@ 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 { 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)) + 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 diff --git a/business/partner/delivery/mtps/waybill.go b/business/partner/delivery/mtps/waybill.go index 1b283639c..65acbc441 100644 --- a/business/partner/delivery/mtps/waybill.go +++ b/business/partner/delivery/mtps/waybill.go @@ -237,7 +237,7 @@ 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), // } - billParams.Note = utils.FilterMb4(order.BuyerComment) + 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) From c54a5689cd0c9fdce8db4755d77980049fd4c5af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 7 Jul 2020 08:36:42 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E5=95=86=E5=93=81=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E6=89=93=E6=A0=87=E8=AE=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sync.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index 0b654b1ce..c4fc83f79 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -1253,6 +1253,11 @@ func SyncSkuExperfixAndWatermark(ctx *jxcontext.Context) (err error) { task := tasksch.NewParallelTask("SyncSkuExperfixAndWatermark", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { skuExinfo := batchItemList[0].(*model.SkuExinfoMap) + if time.Now().Sub(skuExinfo.EndAt) > 0 { + skuExinfo.DeletedAt = time.Now() + dao.UpdateEntity(db, skuExinfo, "DeletedAt") + return retVal, err + } skus, err := dao.GetSkus(db, nil, []int{skuExinfo.NameID}, nil, nil, nil) var skuIDs []int for _, v := range skus { @@ -1262,12 +1267,10 @@ func SyncSkuExperfixAndWatermark(ctx *jxcontext.Context) (err error) { for _, v := range skuIDs { OnUpdateThing(ctx, db, nil, int64(v), model.ThingTypeSku) } - // CurVendorSync.SyncSkus(ctx, db, nil, skuIDs, true, true, ctx.GetUserName()) } else { if len(skuIDs) > 0 { SetStoreSkuSyncStatus2(db, nil, []int{skuExinfo.VendorID}, skuIDs, model.SyncFlagModifiedMask) } - // CurVendorSync.SyncStoresSkus2(ctx, nil, 0, db, []int{skuExinfo.VendorID}, nil, false, skuIDs, nil, model.SyncFlagModifiedMask, true, true) } return retVal, err }, skuExinfos) From 85ba36e1b7afb0ce2e5633ee65817e2fccc0c88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 7 Jul 2020 10:24:47 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=8F=AA=E5=88=B7=E9=AB=98=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index cdd3ce574..e304d674e 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1097,7 +1097,7 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs } unitPrice = skuBindInfo.UnitPrice if isRefreshHigh { - if allBinds[0].UnitPrice > unitPrice { + if allBinds[0].UnitPrice <= unitPrice { continue } } From 64129dcb5f2e1dcb7923aa230cd03ba3ca71344f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 7 Jul 2020 11:55:00 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E5=88=A0=E4=B8=80=E4=BA=9B=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index e304d674e..9b28ce0eb 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4648,10 +4648,8 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku if len(storeAudits) > 1 { return retVal, fmt.Errorf("查询到该门店该商品的待审核信息大于1条!storeID: %v, nameID: %v", storeAudit.StoreID, storeAudit.NameID) } - // flag := false //审核通过 if status == model.StoreAuditStatusCreated { - // flag = true storeAudits[0].UserID = ctx.GetUserID() storeAudits[0].Status = model.StoreAuditStatusCreated storeAudits[0].Remark = storeAudit.Remark @@ -4685,7 +4683,6 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku if num == 0 || !isAsync || hint == "" { hint = utils.Int64ToStr(num) } - // _, err = UpdateStoresSkus(ctx, 0, []int{storeID}, skuBindInfos, false, isAsync, isContinueWhenError) } else if status == model.StoreAuditStatusRejected { storeAudits[0].UserID = ctx.GetUserID() storeAudits[0].Status = model.StoreAuditStatusRejected