From 83cbb071b0f14929e8ccad60533510121dc2564d 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, 9 Mar 2021 11:59:23 +0800 Subject: [PATCH] aa --- business/jxstore/report/report.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/business/jxstore/report/report.go b/business/jxstore/report/report.go index 21259675c..6ef37efce 100644 --- a/business/jxstore/report/report.go +++ b/business/jxstore/report/report.go @@ -441,7 +441,7 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f handler := partner.GetPurchasePlatformFromVendorID(vendorID) store, _ := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID) if storeMaps, err := dao.GetStoresMapList(db, []int{vendorID}, []int{v}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "", ""); len(storeMaps) > 0 && err == nil { - storeMaps[0].CoverArea = CalculateCoverArea(strings.Split(store.DeliveryRange, ";")) + storeMaps[0].CoverArea = CalculateCoverArea(strings.Split(store.DeliveryRange, ";"), vendorID) dao.UpdateEntity(db, storeMaps[0], "CoverArea") result.CoverArea = storeMaps[0].CoverArea } @@ -451,15 +451,21 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f return getStoreManageStateResult, err } -func CalculateCoverArea(coordinate []string) (area float64) { +func CalculateCoverArea(coordinate []string, vendorID int) (area float64) { if len(coordinate) == 0 { return 0 } var xyList [][2]float64 for _, v := range coordinate { cell := strings.Split(v, ",") - lat := utils.Str2Float64WithDefault(cell[0], 0) - lng := utils.Str2Float64WithDefault(cell[1], 0) + var lat, lng float64 + if vendorID == model.VendorIDJD { + lng = utils.Str2Float64WithDefault(cell[0], 0) + lat = utils.Str2Float64WithDefault(cell[1], 0) + } else { + lat = utils.Str2Float64WithDefault(cell[0], 0) + lng = utils.Str2Float64WithDefault(cell[1], 0) + } xys := jxutils.MillierConvertion(lat, lng) xyList = append(xyList, xys) }