This commit is contained in:
苏尹岚
2021-03-09 11:21:15 +08:00
parent 9d8377d453
commit 9e48e96001

View File

@@ -440,6 +440,7 @@ func GetStoreManageState(ctx *jxcontext.Context, storeIDs []int, vendorID int, f
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, ";"))
fmt.Println("store.DeliveryRange", store.DeliveryRange)
dao.UpdateEntity(db, storeMaps[0], "CoverArea")
result.CoverArea = storeMaps[0].CoverArea
}
@@ -461,6 +462,7 @@ func CalculateCoverArea(coordinate []string) (area float64) {
xys := jxutils.MillierConvertion(lat, lng)
xyList = append(xyList, xys)
}
fmt.Println("xyList", xyList)
var sum float64
for i := 0; i < len(xyList)-1; i++ {
sum += (xyList[i+1][0] - xyList[i][0]) * (xyList[i+1][1] + xyList[i+1][1])