Merge branch 'mark' of e.coding.net:rosydev/jx-callback into mark

This commit is contained in:
gazebo
2019-12-12 18:02:30 +08:00
2 changed files with 16 additions and 5 deletions

View File

@@ -727,14 +727,15 @@ func (c *OrderManager) RefreshHistoryOrdersEarningPrice(ctx *jxcontext.Context,
return nil, err
}
dao.Commit(db)
retVal = num
retVal = []string{utils.Int64ToStr(num)}
return retVal, err
}, orderList)
tasksch.HandleTask(task, nil, true).Run()
if !isAsync {
resultNum, err2 := task.GetResult(0)
err = err2
hint = resultNum[0].(string)
if err = err2; err == nil {
hint = resultNum[0].(string)
}
} else {
hint = task.GetID()
}

View File

@@ -2182,6 +2182,7 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io.
skuBindInfoList []*StoreSkuBindInfo
errMsg string
isErr bool = false
nameMap = make(map[string]string)
)
dataLock.dataFailedList = dataLock.dataFailedList[0:0]
dataLock.dataSuccessList = dataLock.dataSuccessList[0:0]
@@ -2196,6 +2197,7 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io.
taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
switch step {
case 0:
// xlsx, err := excelize.OpenFile("111.xlsx")
xlsx, err := excelize.OpenReader(reader)
if err != nil {
return "", err
@@ -2206,7 +2208,7 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io.
continue
}
storeSkuNamePrice := &model.StoreSkuNamePrice{}
errMsg += GetCellIntoStruct(rowNum, row, sheetParam, storeSkuNamePrice)
errMsg += GetCellIntoStruct(rowNum, row, sheetParam, storeSkuNamePrice, nameMap)
storeSkuNamePriceList = append(storeSkuNamePriceList, storeSkuNamePrice)
}
if errMsg != "" {
@@ -2380,7 +2382,7 @@ func StoreSkuNamePriceList2Map(ctx *jxcontext.Context, storeSkuNamePriceList []*
return result
}
func GetCellIntoStruct(rowNum int, row []string, sheetParam *SheetParam, storeSkuNamePrice *model.StoreSkuNamePrice) (errMsg string) {
func GetCellIntoStruct(rowNum int, row []string, sheetParam *SheetParam, storeSkuNamePrice *model.StoreSkuNamePrice, nameMap map[string]string) (errMsg string) {
for k, cell := range row {
if k == sheetParam.OutSkuIDCol {
if IsChineseChar(cell) {
@@ -2397,6 +2399,14 @@ func GetCellIntoStruct(rowNum int, row []string, sheetParam *SheetParam, storeSk
if cellReplace[len(cellReplace)-1:len(cellReplace)] == "," {
cellReplace = cellReplace[0 : len(cellReplace)-1]
}
nameIDs := strings.Split(cellReplace, ",")
for _, v := range nameIDs {
if nameMap[v] != "" {
return fmt.Sprintf(" Excel中含有重复的nameID[%v]列,[%v]行nameID [%v]\n", k+1, rowNum+1, v)
} else {
nameMap[v] = v
}
}
}
storeSkuNamePrice.NameIDGroup = cellReplace
}