永辉Excel接口修改

This commit is contained in:
苏尹岚
2019-11-22 18:03:12 +08:00
parent 92b9f96889
commit 70bf3a70a9
2 changed files with 29 additions and 12 deletions

View File

@@ -165,13 +165,13 @@ func (d *DataFailedLock) AppendData2(dataFailed DataFailed) {
} }
func LoadExcelByYongHui(ctx *jxcontext.Context, files []*multipart.FileHeader, isAsync, isContinueWhenError bool) (hint string, err error) { func LoadExcelByYongHui(ctx *jxcontext.Context, files []*multipart.FileHeader, isAsync, isContinueWhenError bool) (hint string, err error) {
// if len(files) == 0 { if len(files) == 0 {
// return "", errors.New("没有文件上传!") return "", errors.New("没有文件上传!")
// } }
// fileHeader := files[0] fileHeader := files[0]
// file, err := fileHeader.Open() file, err := fileHeader.Open()
hint, err = LoadExcelBinByYongHui(ctx, nil, true, true) hint, err = LoadExcelBinByYongHui(ctx, file, true, true)
// file.Close() file.Close()
return hint, err return hint, err
} }
@@ -189,8 +189,7 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is
switch step { switch step {
case 0: case 0:
//读取excel文件 //读取excel文件
// xlsx, err := excelize.OpenReader(reader) xlsx, err := excelize.OpenReader(reader)
xlsx, err := excelize.OpenFile("111.xlsx")
if err != nil { if err != nil {
return "", err return "", err
} }
@@ -275,7 +274,7 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is
} else { } else {
costPrice = skuMap[spuCode].Price costPrice = skuMap[spuCode].Price
} }
// _, _, _ = updateWeiMobGoods(costPrice, skuMap[spuCode].Price, skuList[0].Unit, isCompare, goodsDetail) _, _, _ = updateWeiMobGoods(costPrice, skuMap[spuCode].Price, skuList[0].Unit, isCompare, goodsDetail)
} }
} else { } else {
//下架微盟商品 //下架微盟商品
@@ -298,7 +297,7 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is
for _, v := range batchItemList { for _, v := range batchItemList {
int64Slice = append(int64Slice, v.(int64)) int64Slice = append(int64Slice, v.(int64))
} }
// PutAwayWeiMobSku(int64Slice) PutAwayWeiMobSku(int64Slice)
return retVal, err return retVal, err
} }
taskParallel4 := tasksch.NewParallelTask("下架微盟商品", tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetBatchSize(UpdateGoodsShelfStatusCount), ctx, taskFunc4, goodsIDListForPutAway) taskParallel4 := tasksch.NewParallelTask("下架微盟商品", tasksch.NewParallelConfig().SetParallelCount(parallelCount).SetBatchSize(UpdateGoodsShelfStatusCount), ctx, taskFunc4, goodsIDListForPutAway)

View File

@@ -14,7 +14,7 @@ type YongHuiController struct {
// @Title 读取永辉excel文件 // @Title 读取永辉excel文件
// @Description 读取永辉excel文件 // @Description 读取永辉excel文件
// @Param token header string false "认证token" // @Param token header string true "认证token"
// @Param isAsync query bool true "是否异步,缺省是同步" // @Param isAsync query bool true "是否异步,缺省是同步"
// @Param isContinueWhenError query bool true "单个同步失败是否继续缺省false" // @Param isContinueWhenError query bool true "单个同步失败是否继续缺省false"
// @Success 200 {object} controllers.CallResult // @Success 200 {object} controllers.CallResult
@@ -42,3 +42,21 @@ func (c *YongHuiController) LoadExcelByYongHui() {
}) })
} }
} }
// @Title 根据微盟商品更新京西价格
// @Description 根据微盟商品更新京西价格
// @Param token header string true "认证token"
// @Param storeIDs formData string false "门店ID列表"
// @Param isAsync formData bool true "是否异步,缺省是同步"
// @Param isContinueWhenError formData bool true "单个同步失败是否继续缺省false"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateJxPriceByWeimob [post]
func (c *YongHuiController) UpdateJxPriceByWeimob() {
// c.callLoadExcelByYongHui(func(params *tYonghuiLoadExcelByYongHuiParams) (retVal interface{}, errCode string, err error) {
// r := c.Ctx.Request
// files := r.MultipartForm.File["userfiles"]
// retVal, err = yonghui.LoadExcelByYongHui(params.Ctx, files, params.IsAsync, params.IsContinueWhenError)
// return retVal, "", err
// })
}