修改细节
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
@@ -18,17 +19,17 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
canWriteTolocal = false
|
||||
needStatistic = true
|
||||
canWriteTolocal = false
|
||||
needStatistic = true
|
||||
isFilterToBeCreateAndNotSale = true
|
||||
parallelCount = 5
|
||||
fileExt = ".xlsx"
|
||||
parallelCount = 5
|
||||
fileExt = ".xlsx"
|
||||
)
|
||||
|
||||
var (
|
||||
diffFileName = map[bool]string {
|
||||
true : "export/JXCSAndVendorSkuDiff",
|
||||
false : "export/JXGYAndVendorSkuDiff",
|
||||
diffFileName = map[bool]string{
|
||||
true: "export/JXCSAndVendorSkuDiff",
|
||||
false: "export/JXGYAndVendorSkuDiff",
|
||||
}
|
||||
vendorNameList = map[int]string{
|
||||
model.VendorIDMTWM: model.VendorChineseNames[model.VendorIDMTWM],
|
||||
@@ -86,7 +87,7 @@ type DiffData struct {
|
||||
SkuID string `json:"SkuID"`
|
||||
SyncStatus string `json:"同步状态"`
|
||||
ToBeCreate string `json:"待创建"`
|
||||
ToBeDel string `json:"待删除"`
|
||||
ToBeDel string `json:"待删除"`
|
||||
JxSkuName string `json:"京西商品名"`
|
||||
VendorSkuName string `json:"平台商品名"`
|
||||
JxStatus string `json:"京西可售状态"`
|
||||
@@ -94,11 +95,11 @@ type DiffData struct {
|
||||
}
|
||||
|
||||
type StatisticData struct {
|
||||
JxVendorStatus string `json:"京西和平台商品状态"`
|
||||
ToBeCreate string `json:"待创建"`
|
||||
JxSaleStatus string `json:"京西可售状态"`
|
||||
Count string `json:"数量"`
|
||||
Percent string `json:"占比"`
|
||||
JxVendorStatus string `json:"京西和平台商品状态"`
|
||||
ToBeCreate string `json:"待创建"`
|
||||
JxSaleStatus string `json:"京西可售状态"`
|
||||
Count string `json:"数量"`
|
||||
Percent string `json:"占比"`
|
||||
}
|
||||
|
||||
func (d *DiffDataLock) AppendData(vendorID int, diffData DiffData) {
|
||||
@@ -111,14 +112,6 @@ func (d *DiffDataLock) InitData() {
|
||||
d.diffDataMap = make(map[int][]DiffData)
|
||||
}
|
||||
|
||||
func IsMultiStore(vendorID int) bool {
|
||||
if _, ok := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IMultipleStoresHandler); ok {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func InitMultiStoreData() {
|
||||
multiStoreAllSkuInfoMap = make(map[int]map[int]*partner.SkuNameInfo)
|
||||
multiStoreAllSkuInfoList = make(map[int][]*partner.StoreSkuInfo)
|
||||
@@ -141,7 +134,7 @@ func GetMultiStoreAllSkuInfo(ctx *jxcontext.Context, vendorMap map[int]bool) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if IsMultiStore(vendorID) {
|
||||
if partner.IsMultiStore(vendorID) {
|
||||
multiHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IMultipleStoresHandler)
|
||||
allSkuNameInfoList, err := multiHandler.GetSkus(ctx, 0, "", "")
|
||||
if err != nil {
|
||||
@@ -267,7 +260,7 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
syncStatus := utils.Int2Str(int(status))
|
||||
toBeCreate := GetBoolName(model.IsSyncStatusNeedCreate(status))
|
||||
toBeDel := GetBoolName(model.IsSyncStatusNeedDelete(status))
|
||||
|
||||
|
||||
if vendorSkuInfo != nil {
|
||||
vendorSkuDetailName := vendorSkuInfo.SkuList[0].SkuName
|
||||
vendorSkuSaleStatusName := GetSkuSaleStatusName(vendorSkuInfo.SkuList[0].Status)
|
||||
@@ -276,7 +269,7 @@ func CompareJxAndVendor(vendorID int, storeIDStr, vendorStoreID, storeName strin
|
||||
isNameDiff := jxSkuDetailName != vendorSkuDetailName
|
||||
if jxSkuDetailName != "" && vendorSkuDetailName != "" && strings.Contains(jxSkuDetailName, vendorSkuDetailName) {
|
||||
isNameDiff = false
|
||||
}
|
||||
}
|
||||
if isSaleStatusDiff || isNameDiff {
|
||||
outPutData := DiffData{storeIDStr, vendorStoreID, storeName, skuIDStr, syncStatus, toBeCreate, toBeDel, jxSkuDetailName, vendorSkuDetailName, jxSkuSaleStatusName, vendorSkuSaleStatusName}
|
||||
diffData.AppendData(vendorID, outPutData)
|
||||
@@ -334,7 +327,7 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int,
|
||||
var filterJxSkuInfoMap map[int]*StoreSkuNameExt
|
||||
for _, vendorListValue := range jxStoreInfoListValue.StoreMaps {
|
||||
vendorID := int(utils.MustInterface2Int64(vendorListValue["vendorID"]))
|
||||
|
||||
|
||||
if isGetJxSkuInfoData == false { //only get once jx sku info list every store id
|
||||
isGetJxSkuInfoData = true
|
||||
jxSkuInfoData, _ := GetStoreSkus(ctx, storeID, []int{}, true, "", true, map[string]interface{}{}, 0, -1)
|
||||
@@ -344,7 +337,7 @@ func CheckSkuDiffBetweenJxAndVendor(ctx *jxcontext.Context, vendorIDList []int,
|
||||
vendorStoreID := utils.Interface2String(vendorListValue["vendorStoreID"])
|
||||
baseapi.SugarLogger.Debugf("CheckSkuDiffBetweenJxAndVendor storeID:%d vendorID:%d vendorStoreID:%s vendorListValue:%v", storeID, vendorID, vendorStoreID, vendorListValue)
|
||||
|
||||
if IsMultiStore(vendorID) {
|
||||
if partner.IsMultiStore(vendorID) {
|
||||
singleStoreHandler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformStoreSkuHandler)
|
||||
allSkuInfoList := GetMultiStoreAllSkuInfoList(vendorID)
|
||||
skuBareInfoList, err := singleStoreHandler.GetStoreSkusBareInfo(ctx, task, storeID, vendorStoreID, allSkuInfoList)
|
||||
@@ -433,14 +426,14 @@ func AddStatisticSheet(sheetName string, data []DiffData) (sheet *excel.Obj2Exce
|
||||
}
|
||||
}
|
||||
for index, value := range count {
|
||||
percent[index] = float32(value * 100) / float32(totalCount)
|
||||
percent[index] = float32(value*100) / float32(totalCount)
|
||||
countStr := utils.Int2Str(value)
|
||||
percentStr := fmt.Sprintf("%.2f%%", percent[index])
|
||||
subStatisticData := statisticDataList[index]
|
||||
statisticData[index] = StatisticData{subStatisticData[0], subStatisticData[1], subStatisticData[2], countStr, percentStr}
|
||||
}
|
||||
sheetName = sheetName + "统计"
|
||||
sheet = &excel.Obj2ExcelSheetConfig {
|
||||
sheet = &excel.Obj2ExcelSheetConfig{
|
||||
Title: sheetName,
|
||||
Data: statisticData,
|
||||
CaptionList: statisticTitleList,
|
||||
|
||||
@@ -2,9 +2,10 @@ package misc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
)
|
||||
|
||||
func TestStartOrEndOpStore(t *testing.T) {
|
||||
StartOrEndOpStore(jxcontext.AdminCtx, true, []int{}, []int{}, 0, 0, false, true)
|
||||
StartOrEndOpStore(jxcontext.AdminCtx, true, nil, nil, 0, 0, false, true)
|
||||
}
|
||||
|
||||
@@ -657,10 +657,9 @@ func ScheduleScoreStore() {
|
||||
func CheckScoreStore() {
|
||||
if !isScoring {
|
||||
curTime := time.Now()
|
||||
year, month, day := curTime.Date()
|
||||
checkTimeStr1 := fmt.Sprintf("%d-%d-%d "+scoreStoreTimeList[0], year, int(month), day)
|
||||
checkTimeStr1 := fmt.Sprintf("%s %s", utils.Time2DateStr(curTime), scoreStoreTimeList[0])
|
||||
checkTime1 := utils.Str2Time(checkTimeStr1)
|
||||
checkTimeStr2 := fmt.Sprintf("%d-%d-%d "+scoreStoreCheckTimeEnd, year, int(month), day)
|
||||
checkTimeStr2 := fmt.Sprintf("%s %s", utils.Time2DateStr(curTime), scoreStoreCheckTimeEnd)
|
||||
checkTime2 := utils.Str2Time(checkTimeStr2)
|
||||
if curTime.Unix() >= checkTime1.Unix() && curTime.Unix() <= checkTime2.Unix() {
|
||||
db := dao.GetDB()
|
||||
|
||||
Reference in New Issue
Block a user