同步错误返回

This commit is contained in:
苏尹岚
2019-12-04 17:34:45 +08:00
parent 16a14e8b4d
commit 6d677bab43
6 changed files with 61 additions and 28 deletions

View File

@@ -23,9 +23,12 @@ import (
type SyncErrResult struct {
SkuID int `json:"商品ID"`
StoreID int `json:"门店ID"`
VendorID int `json:"平台ID"`
VendorSkuID string `json:"平台商品ID"`
NameID int `json:"商品nameID"`
VendorPrice int64 `json:"平台价"`
SyncType string `json:"同步类型"`
ErrMsg string `json:"错误信息"`
}
@@ -71,9 +74,12 @@ var (
ErrEntityNotExist = errors.New("找不到相应实体")
SyncErrResultTitle = []string{
"商品ID",
"门店ID",
"平台ID",
"平台商品ID",
"商品nameID",
"平台价",
"同步类型",
"错误信息",
}
syncErrResultLock SyncErrResultLock
@@ -760,9 +766,12 @@ func WirteToExcelBySyncFailed(task tasksch.ITask, ctx *jxcontext.Context) (err e
for _, vv := range v.([]*partner.StoreSkuInfoWithErr) {
result := SyncErrResult{
SkuID: vv.StoreSkuInfo.SkuID,
StoreID: vv.StoreID,
VendorID: vv.VendoreID,
VendorSkuID: vv.StoreSkuInfo.VendorSkuID,
NameID: vv.StoreSkuInfo.NameID,
VendorPrice: vv.StoreSkuInfo.VendorPrice,
SyncType: vv.SyncType,
ErrMsg: vv.ErrMsg,
}
syncErrResultLock.AppendData(result)
@@ -775,7 +784,7 @@ func WirteToExcelBySyncFailed(task tasksch.ITask, ctx *jxcontext.Context) (err e
}
sheetList1 = append(sheetList1, excelConf1)
if excelConf1 != nil {
downloadURL1, fileName1, err = jxutils.UploadExeclAndPushMsg(sheetList1, time.Now().Format("2006-01-02")+"同步错误返回")
downloadURL1, fileName1, err = jxutils.UploadExeclAndPushMsg(sheetList1, time.Now().Format("200601021504")+"同步错误返回")
baseapi.SugarLogger.Debug("WriteToExcel: download is [%v]", downloadURL1)
} else {
baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess is nil!")

View File

@@ -485,7 +485,7 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo
updateList = append(updateList, calVendorPrice4StoreSku(batchedStoreSkuList[0], storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
err = nil
} else {
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(batchedStoreSkuList, err2)...)
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(batchedStoreSkuList, err2, storeID, vendorID, "查询是否有该商品")...)
}
if len(failedList) > 0 {
task.AddErrMsg(failedList)