From ae4deb9a044d7f6de6fe1af1d3609bf87b1da8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 10:18:42 +0800 Subject: [PATCH 1/6] =?UTF-8?q?UPDATEstoresskuswithoutsync=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=BB=99storedetail=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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index a5678159a..a94e7a3c6 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -1034,9 +1034,8 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs for _, storeID := range storeIDs { // todo 可以考虑在需要更新价格再获取 storeDetail, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDJX) - if err != nil { - dao.Rollback(db) - return nil, err + if err != nil || storeDetail == nil { + continue } scaleFactor := float64(1) if isScale { From 889f05214c819eeda91d0d00d1d4f57f5117d746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 16:00:02 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BB=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 89c3637b5..6efdb0ed0 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1283,7 +1283,13 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) return "", fmt.Errorf("未查询到该门店对应的平台信息!门店:[%v]", order.StoreID) } if len(order.VendorOrderID) > 12 { - suffix := utils.Str2Int(order.VendorOrderID[12:len(order.VendorOrderID)]) + var goodsOrders []*model.GoodsOrder + sql := ` + SELECT * FROM goods_order WHERE vendor_order_id2 = ? ORDER BY vendor_order_id DESC + ` + sqlParams := []interface{}{order.VendorOrderID2} + err = dao.GetRows(db, &goodsOrders, sql, sqlParams) + suffix := utils.Str2Int(goodsOrders[0].VendorOrderID[12:len(goodsOrders[0].VendorOrderID)]) suffix++ order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(order.VendorOrderID2)*100000) + utils.Int2Str(suffix) } From 2fd374cf74bd49ce32ef9f1041c2289d6517b202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 16:21:16 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=BD=AC=E7=A7=BBiceshi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxcallback/orderman/order.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/business/jxcallback/orderman/order.go b/business/jxcallback/orderman/order.go index 6efdb0ed0..4b1a51fc0 100644 --- a/business/jxcallback/orderman/order.go +++ b/business/jxcallback/orderman/order.go @@ -1289,6 +1289,9 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int) ` sqlParams := []interface{}{order.VendorOrderID2} err = dao.GetRows(db, &goodsOrders, sql, sqlParams) + if goodsOrders[0].Status != model.OrderStatusCanceled { + err = jdshop.ChangeOrderStatus(goodsOrders[0].VendorOrderID, model.OrderStatusCanceled, "订单转移被取消") + } suffix := utils.Str2Int(goodsOrders[0].VendorOrderID[12:len(goodsOrders[0].VendorOrderID)]) suffix++ order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(order.VendorOrderID2)*100000) + utils.Int2Str(suffix) From e590c053bb7634217eb7428d29f499efc43b5570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 16:49:28 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=95=86=E5=93=81=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=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 | 17 ++++++++++++++--- controllers/cms_store_sku.go | 8 ++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 511164b9d..526fbf7fd 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4669,10 +4669,21 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto return true, err } -func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSkuAudit, status int, isAsync, isContinueWhenError bool) (hint string, err error) { +func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSkuAudit, status int, isAsync, isContinueWhenError bool) (storeSkuAudits2 []*model.StoreSkuAudit, hint string, err error) { db := dao.GetDB() if status == model.StoreAuditStatusOnline { - return "", fmt.Errorf("审核标志不正确!") + return nil, "", fmt.Errorf("审核标志不正确!") + } + for _, v := range storeSkuAudits { + skuList, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) + if len(skuList) > 0 { + if int64(v.AuditPrice) > skuList[0].UnitPrice*2 { + storeSkuAudits2 = append(storeSkuAudits2, v) + } + } + } + if len(storeSkuAudits2) > 0 { + return storeSkuAudits2, "", err } task := tasksch.NewParallelTask("StoreSkuPriceAudit", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { @@ -4751,5 +4762,5 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku _, err = task.GetResult(0) hint = "1" } - return hint, err + return nil, hint, err } diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index 4f7d3eec2..29cde0023 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -888,7 +888,11 @@ func (c *StoreSkuController) StoreSkuPriceAudit() { if err = jxutils.Strings2Objs(params.Payload, &storeSkuAudits); err != nil { return retVal, "", err } - retVal, err = cms.StoreSkuPriceAudit(params.Ctx, storeSkuAudits, params.Status, params.IsAsync, params.IsContinueWhenError) - return retVal, "", err + retVal, hint, err := cms.StoreSkuPriceAudit(params.Ctx, storeSkuAudits, params.Status, params.IsAsync, params.IsContinueWhenError) + if hint != "" { + return hint, "", err + } else { + return retVal, "", err + } }) } From c0e48d9f6707c26c0c0edb676d346a769cccb6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 17:02:45 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=95=86=E5=93=81=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA2?= =?UTF-8?q?=EF=BC=8C=E8=A1=A8=E7=A4=BA=E9=A2=84=E5=AE=A1=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 19 +++++++++++-------- controllers/cms_store_sku.go | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 526fbf7fd..073f2e42b 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4674,16 +4674,19 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku if status == model.StoreAuditStatusOnline { return nil, "", fmt.Errorf("审核标志不正确!") } - for _, v := range storeSkuAudits { - skuList, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) - if len(skuList) > 0 { - if int64(v.AuditPrice) > skuList[0].UnitPrice*2 { - storeSkuAudits2 = append(storeSkuAudits2, v) + //证明是预审核 + if status == 2 { + for _, v := range storeSkuAudits { + skuList, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID) + if len(skuList) > 0 { + if int64(v.AuditPrice) > skuList[0].UnitPrice*2 { + storeSkuAudits2 = append(storeSkuAudits2, v) + } } } - } - if len(storeSkuAudits2) > 0 { - return storeSkuAudits2, "", err + if len(storeSkuAudits2) > 0 { + return storeSkuAudits2, "", err + } } task := tasksch.NewParallelTask("StoreSkuPriceAudit", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { diff --git a/controllers/cms_store_sku.go b/controllers/cms_store_sku.go index 29cde0023..51f102cad 100644 --- a/controllers/cms_store_sku.go +++ b/controllers/cms_store_sku.go @@ -876,7 +876,7 @@ func (c *StoreSkuController) GetStoreSkuAudit() { // @Description 审核商品 // @Param token header string true "认证token" // @Param payload formData string true "json数据,storeskuaudit对象" -// @Param status formData int false "审核标志,1通过,-1 不通过" +// @Param status formData int false "审核标志,1通过,-1 不通过,2 预审核" // @Param isAsync formData bool false "是否异步,缺省是同步" // @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false" // @Success 200 {object} controllers.CallResult From 4f207c3098426daaaa8499d024e94b33bf169210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 9 Jul 2020 17:10:25 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=95=86=E5=93=81=E5=AE=A1=E6=A0=B8?= =?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 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 073f2e42b..99f1b3f47 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4684,9 +4684,7 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku } } } - if len(storeSkuAudits2) > 0 { - return storeSkuAudits2, "", err - } + return storeSkuAudits2, "", err } task := tasksch.NewParallelTask("StoreSkuPriceAudit", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {