修改细节

This commit is contained in:
Rosy-zhudan
2019-09-17 10:32:49 +08:00
parent 6199a2e714
commit 957db04544
3 changed files with 25 additions and 32 deletions

View File

@@ -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"
@@ -26,9 +27,9 @@ const (
)
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],
@@ -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 {
@@ -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,

View File

@@ -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)
}

View File

@@ -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()