From 8be5e69016c85e80bcaf5db3080dfe25e2be29fc Mon Sep 17 00:00:00 2001 From: Rosy-zhudan Date: Fri, 9 Aug 2019 12:03:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9BBUG?= =?UTF-8?q?=EF=BC=8C=E4=BB=A3=E7=A0=81=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku_check.go | 15 +++++++++++---- business/jxstore/misc/misc2.go | 13 +++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/store_sku_check.go b/business/jxstore/cms/store_sku_check.go index ef4169535..626cdcd80 100644 --- a/business/jxstore/cms/store_sku_check.go +++ b/business/jxstore/cms/store_sku_check.go @@ -22,10 +22,13 @@ const ( canWriteTolocal = false parallelCount = 5 fileExt = ".xlsx" - diffFileName = "export/京西和平台商品差异" ) var ( + diffFileName = map[bool]string { + true : "export/JXCSAndVendorSkuDiff", + false : "export/JXGYAndVendorSkuDiff", + } vendorNameList = map[int]string{ model.VendorIDMTWM: model.VendorChineseNames[model.VendorIDMTWM], model.VendorIDEBAI: model.VendorChineseNames[model.VendorIDEBAI], @@ -42,7 +45,7 @@ var ( "平台可售状态", } - diffData DiffDataLock + diffData DiffDataLock multiStoreAllSkuInfoMap map[int]map[int]*partner.SkuNameInfo multiStoreAllSkuInfoList map[int][]*partner.StoreSkuInfo @@ -291,6 +294,10 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int, tasksch.HandleTask(taskSeq, nil, true).Run() } +func IsJXCS() bool { + return globals.IsMainProductEnv() +} + func WriteToExcel(task *tasksch.SeqTask, data map[int][]DiffData) { var sheetList []*excel.Obj2ExcelSheetConfig for key, value := range data { @@ -306,7 +313,7 @@ func WriteToExcel(task *tasksch.SeqTask, data map[int][]DiffData) { if len(sheetList) > 0 { excelBin := excel.Obj2Excel(sheetList) timeStr := utils.Int64ToStr(time.Now().Unix()) - diffFullFileName := diffFileName + timeStr + fileExt + diffFullFileName := diffFileName[IsJXCS()] + timeStr + fileExt if canWriteTolocal { jxutils.WriteFile(diffFullFileName, excelBin) } @@ -315,7 +322,7 @@ func WriteToExcel(task *tasksch.SeqTask, data map[int][]DiffData) { if err != nil { baseapi.SugarLogger.Errorf("WriteToExcel:upload %s failed error:%v", diffFullFileName, err) } else { - noticeMsg := fmt.Sprintf("[详情点我](%s/billshow/?normal=true&path=%s) \n", globals.BackstageHost, downloadURL) + noticeMsg := fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL) task.SetNoticeMsg(noticeMsg) baseapi.SugarLogger.Debugf("WriteToExcel:upload %s success, downloadURL:%s", diffFullFileName, downloadURL) } diff --git a/business/jxstore/misc/misc2.go b/business/jxstore/misc/misc2.go index 4c21d844e..e29593972 100644 --- a/business/jxstore/misc/misc2.go +++ b/business/jxstore/misc/misc2.go @@ -110,6 +110,16 @@ func SetSpecialSkuStatus(storeID, vendorID int, vendorStoreID string, storeSkuNa } } +func GetFilterStoreSkuList(storeSkuList []*partner.StoreSkuInfo) (storeSkuListOut []*partner.StoreSkuInfo) { + for _, value := range storeSkuList { + if value.SkuID != 0 { + storeSkuListOut = append(storeSkuListOut, value) + } + } + + return storeSkuListOut +} + func StartOrEndOpStore(isStart bool, vendorIDList []int, storeIDList []int, startTime, endTime int16, isAsync, isContinueWhenError bool) (retVal interface{}, err error) { startProcessTime := time.Now().Unix() vendorMap := make(map[int]bool) @@ -162,6 +172,9 @@ func StartOrEndOpStore(isStart bool, vendorIDList []int, storeIDList []int, star SetSkuStock(isStart, storeSkuNameList) SetSpecialSkuStatus(storeID, vendorID, vendorStoreID, storeSkuNameList) storeSkuList := putils.StoreSkuFullList2Bare(storeSkuNameList) + if vendorID == model.VendorIDMTWM { + storeSkuList = GetFilterStoreSkuList(storeSkuList) + } if len(storeSkuList) > 0 { if !isStart { AddOrDelExtraStoreOptime(vendorID, storeID, vendorStoreID, &storeListValue.Store, startOpStoreTime, endOpStoreTime, false)