From 9b14e872498ba2883a890bef2dbe50105fe50514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 1 Sep 2020 16:40:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BA=AC=E4=B8=9C=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/tempop/tempop.go | 47 +++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/business/jxstore/tempop/tempop.go b/business/jxstore/tempop/tempop.go index a13843fd1..ac15da539 100644 --- a/business/jxstore/tempop/tempop.go +++ b/business/jxstore/tempop/tempop.go @@ -8,17 +8,21 @@ import ( "strings" "time" + "git.rosy.net.cn/baseapi" "git.rosy.net.cn/jx-callback/business/auth2/authprovider/weixin" "git.rosy.net.cn/jx-callback/business/partner/delivery" "github.com/360EntSecGroup-Skylar/excelize" "github.com/qiniu/api.v7/storage" + "git.rosy.net.cn/baseapi/platformapi/dingdingapi" "git.rosy.net.cn/baseapi/platformapi/jdapi" "git.rosy.net.cn/baseapi/platformapi/mtwmapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils/errlist" "git.rosy.net.cn/jx-callback/business/jxstore/cms" "git.rosy.net.cn/jx-callback/business/jxutils" + "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" + "git.rosy.net.cn/jx-callback/business/jxutils/excel" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" "git.rosy.net.cn/jx-callback/business/model" @@ -1588,8 +1592,21 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { JdID string `json:"jdID"` S float64 `json:"s"` } + type SpecialtyStoreSkus struct { + StoreID int `json:"门店ID"` + StoreName string `json:"门店名"` + Area float64 `json:"面积"` + } var ( - ss []*tmp + ss []*tmp + excelTitle = []string{ + "门店ID", + "门店名", + "面积", + } + sheetList []*excel.Obj2ExcelSheetConfig + specialtyStoreSkus []*SpecialtyStoreSkus + downloadURL, fileName string ) storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJD}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") for _, v := range storeMaps { @@ -1615,7 +1632,33 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) { } } } - fmt.Println("111111111111111111111111111111111111111", utils.Format4Output(ss, false)) + for _, v := range ss { + storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), v.JdID, model.VendorIDJD) + specialtyStoreSku := &SpecialtyStoreSkus{ + StoreID: storeDetail.ID, + StoreName: storeDetail.Name, + Area: v.S, + } + specialtyStoreSkus = append(specialtyStoreSkus, specialtyStoreSku) + } + excelConf := &excel.Obj2ExcelSheetConfig{ + Title: "sheet1", + Data: specialtyStoreSkus, + CaptionList: excelTitle, + } + sheetList = append(sheetList, excelConf) + if excelConf != nil { + downloadURL, fileName, err = jxutils.UploadExeclAndPushMsg(sheetList, "面积") + } else { + baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess is nil!") + } + if err != nil { + baseapi.SugarLogger.Errorf("WriteToExcel:upload %s , %s failed error:%v", fileName, err) + } else { + noticeMsg := fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL) + ddmsg.SendUserMessage(dingdingapi.MsgTyeText, ctx.GetUserID(), "异步任务完成", noticeMsg) + baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess downloadURL: [%v]", downloadURL) + } return err }