From edd32038eb9cd6d153a3e94878ffea94ed65874e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 22 Nov 2019 16:49:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E6=B0=B8=E8=BE=89excel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/yonghui/yonghui.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/business/jxstore/yonghui/yonghui.go b/business/jxstore/yonghui/yonghui.go index 255e49447..1ae1454d7 100644 --- a/business/jxstore/yonghui/yonghui.go +++ b/business/jxstore/yonghui/yonghui.go @@ -39,12 +39,12 @@ type SheetParam struct { } type DataSuccessLock struct { - dataSuccessList []*DataSuccess + dataSuccessList []DataSuccess locker sync.RWMutex } type DataFailedLock struct { - dataFailedList []*DataFailed + dataFailedList []DataFailed locker sync.RWMutex } @@ -152,13 +152,13 @@ const ( fileExt = ".xlsx" ) -func (d *DataSuccessLock) AppendData(dataSuccess *DataSuccess) { +func (d *DataSuccessLock) AppendData(dataSuccess DataSuccess) { d.locker.Lock() defer d.locker.Unlock() d.dataSuccessList = append(d.dataSuccessList, dataSuccess) } -func (d *DataFailedLock) AppendData2(dataFailed *DataFailed) { +func (d *DataFailedLock) AppendData2(dataFailed DataFailed) { d.locker.Lock() defer d.locker.Unlock() d.dataFailedList = append(d.dataFailedList, dataFailed) @@ -236,7 +236,7 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is for k, _ := range skuMap { //表示excel上有,微盟上没有 if goodsInfoAndDetailMap[k] == nil { - outPutData := &DataFailed{ + outPutData := DataFailed{ GoodsID: k, GoodsName: skuMap[k].Name, Comment: "在微盟上未找到该商品", @@ -257,7 +257,7 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is //获取京西库商品 skuList, _ := dao.GetSkus(db, nil, []int{int(utils.Str2Int64(goodsDetail.SkuMap.SingleSku.OuterSkuCode))}, nil, nil) if len(skuList) == 0 { - outPutData := &DataFailed{ + outPutData := DataFailed{ GoodsID: spuCode, GoodsName: skuMap[spuCode].Name, Comment: "在京西库中未找到该商品", @@ -277,7 +277,7 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is _, _, err = updateWeiMobGoods(costPrice, skuMap[spuCode].Price, isCompare, goodsDetail) if err != nil { if errExt, ok := err.(*utils.ErrorWithCode); ok { - outPutData := &DataFailed{ + outPutData := DataFailed{ GoodsID: spuCode, GoodsName: skuMap[spuCode].Name, Comment: errExt.ErrMsg(), @@ -285,7 +285,7 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is dataFailed.AppendData2(outPutData) } } else { - outPutData := &DataSuccess{ + outPutData := DataSuccess{ NameID: goodsDetail.SkuMap.SingleSku.OuterSkuCode, Name: goodsDetail.Title, Unit: skuList[0].Unit, @@ -665,7 +665,7 @@ func GetReplaceNewTitle(title, prefix string) (newTitle string) { } } -func WriteToExcel(task *tasksch.SeqTask, dataSuccess []*DataSuccess, dataFailed []*DataFailed) (err error) { +func WriteToExcel(task *tasksch.SeqTask, dataSuccess []DataSuccess, dataFailed []DataFailed) (err error) { var sheetList1 []*excel.Obj2ExcelSheetConfig var sheetList2 []*excel.Obj2ExcelSheetConfig var downloadURL1, downloadURL2, fileName1, fileName2 string