Parcourir la source

摊位的经纬度通过夜市拿到并返回

qmj il y a 1 jour
Parent
commit
233305233f

+ 20 - 2
ruoyi-admin/src/main/java/com/ruoyi/app/mendian/PosFoodController.java

@@ -171,7 +171,9 @@ public class PosFoodController extends BaseController {
             JSONObject org = new JSONObject();
             org.put("id", list.get(i).getId());
             org.put("fenlei", posFenleiService.getById(list.get(i).getFlId()));
-            org.put("store", posStoreService.getById(list.get(i).getMdid()));
+            PosStore store = posStoreService.getById(list.get(i).getMdid());
+            fillStallLocation(store);
+            org.put("store", store);
             org.put("name", list.get(i).getName());
             org.put("image", list.get(i).getImage());
             org.put("price", list.get(i).getPrice());
@@ -195,7 +197,9 @@ public class PosFoodController extends BaseController {
         PosFood posFood = posFoodService.getById(id);
         org.put("id", posFood.getId());
         org.put("fenlei", posFenleiService.getById(posFood.getFlId()));
-        org.put("store", posStoreService.getById(posFood.getMdid()));
+        PosStore store = posStoreService.getById(posFood.getMdid());
+        fillStallLocation(store);
+        org.put("store", store);
         org.put("name", posFood.getName());
         org.put("image", posFood.getImage());
         org.put("price", posFood.getPrice());
@@ -603,4 +607,18 @@ public class PosFoodController extends BaseController {
         });
         return success("成功压缩的图片数量:"+count.get());
     }
+
+    /**
+     * 当门店是摊位时,用夜市的经纬度覆盖摊位的经纬度
+     */
+    private void fillStallLocation(PosStore store) {
+        if (store != null && store.getIsStall() != null && store.getIsStall() == 1
+                && store.getNightMarketId() != null) {
+            InfoUser nightMarket = infoUserService.getById(store.getNightMarketId());
+            if (nightMarket != null) {
+                store.setLongitude(nightMarket.getLongitude());
+                store.setLatitude(nightMarket.getLatitude());
+            }
+        }
+    }
 }