From a6c4bb3009209be17d9f56168254d8d585d89d96 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, 29 Sep 2020 08:40:45 +0800 Subject: [PATCH] =?UTF-8?q?mtps=E9=97=A8=E5=BA=97=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store.go | 131 ++++++++++++++-------------------- 1 file changed, 53 insertions(+), 78 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 534ef0cab..07d6ad1d5 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -3668,83 +3668,58 @@ func StoreAudit(ctx *jxcontext.Context, storeAudits []*model.StoreAudit, status } func GetDiffJxStoreAndMTWMStoreInfo(ctx *jxcontext.Context, storeIDs []int) (err error) { - // type tmp struct { - // JdID string `json:"jdID"` - // S int `json:"s"` - // } - // type SpecialtyStoreSkus struct { - // StoreID int `json:"门店ID"` - // StoreName string `json:"门店名"` - // City string `json:"城市"` - // Coordinate string `json:"坐标"` - // Address string `json:"地址"` - // Phone string `json:"电话"` - // CoordinateMT string `json:"坐标(美团)"` - // AddressMT string `json:"地址(美团)"` - // PhoneMT string `json:"电话(美团)"` - // Comment string `json:"对比情况"` - // } - // var ( - // ss []*tmp - // excelTitle = []string{ - // "门店ID", - // "门店名", - // "城市", - // "坐标", - // "地址", - // "电话", - // "坐标(美团)", - // "地址(美团)", - // "电话(美团)", - // "对比情况", - // } - // sheetList []*excel.Obj2ExcelSheetConfig - // specialtyStoreSkus []*SpecialtyStoreSkus - // downloadURL, fileName string - // ) - // storeMaps, _ := dao.GetStoresMapList(dao.GetDB(), []int{model.VendorIDJD}, storeIDs, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "") - // for _, v := range storeMaps { - // time.Sleep(time.Second / 3) - // station, err := jd.GetAPI("320406").GetDeliveryRangeByStationNo2(v.VendorStoreID) - // if err != nil { - // continue - // } - // if station.DeliveryRangeType == 2 { - // strs := strings.Split(station.DeliveryRange, ";") - // ss = append(ss, &tmp{ - // JdID: v.VendorStoreID, - // S: utils.Float64TwoInt(math.Ceil((jxutils.ComputeSignedArea(strs[:len(strs)-1])))), - // }) - // } - // } - // for _, v := range ss { - // storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), v.JdID, model.VendorIDJD) - // place, _ := dao.GetPlaceByCode(dao.GetDB(), storeDetail.CityCode) - // specialtyStoreSku := &SpecialtyStoreSkus{ - // StoreID: storeDetail.ID, - // StoreName: storeDetail.Name, - // City: place.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) - // } + type TmpDiffStore struct { + StoreID int `json:"门店ID"` + StoreName string `json:"门店名"` + City string `json:"城市"` + Coordinate string `json:"坐标"` + Address string `json:"地址"` + Phone string `json:"电话"` + CoordinateMT string `json:"坐标(美团)"` + AddressMT string `json:"地址(美团)"` + PhoneMT string `json:"电话(美团)"` + Comment string `json:"对比情况"` + } + var ( + excelTitle = []string{ + "门店ID", + "门店名", + "城市", + "坐标", + "地址", + "电话", + "坐标(美团)", + "地址(美团)", + "电话(美团)", + "对比情况", + } + sheetList []*excel.Obj2ExcelSheetConfig + tmpDiffStore []*TmpDiffStore + downloadURL, fileName string + db = dao.GetDB() + ) + courierStoreList, _ := dao.GetStoreCourierList(db, storeIDs, []int{model.VendorIDMTPS}, model.StoreStatusAll, model.StoreAuditStatusAll) + for _, v := range courierStoreList { + fmt.Println(v) + } + + excelConf := &excel.Obj2ExcelSheetConfig{ + Title: "sheet1", + Data: tmpDiffStore, + 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 }