aa
This commit is contained in:
@@ -441,7 +441,7 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
|
|||||||
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
|
handler := partner.GetPurchasePlatformFromVendorID(vendorID)
|
||||||
store, _ := handler.ReadStore(ctx, storeDetail.VendorOrgCode, storeDetail.VendorStoreID)
|
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 {
|
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")
|
dao.UpdateEntity(db, storeMaps[0], "CoverArea")
|
||||||
result.CoverArea = 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
|
return getStoreManageStateResult, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func CalculateCoverArea(coordinate []string) (area float64) {
|
func CalculateCoverArea(coordinate []string, vendorID int) (area float64) {
|
||||||
if len(coordinate) == 0 {
|
if len(coordinate) == 0 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
var xyList [][2]float64
|
var xyList [][2]float64
|
||||||
for _, v := range coordinate {
|
for _, v := range coordinate {
|
||||||
cell := strings.Split(v, ",")
|
cell := strings.Split(v, ",")
|
||||||
lat := utils.Str2Float64WithDefault(cell[0], 0)
|
var lat, lng float64
|
||||||
lng := utils.Str2Float64WithDefault(cell[1], 0)
|
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)
|
xys := jxutils.MillierConvertion(lat, lng)
|
||||||
xyList = append(xyList, xys)
|
xyList = append(xyList, xys)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user