Commit 84957ba0 by weijiguang

下单时校验订单中sku数量

parent 5d94ff84
...@@ -130,7 +130,6 @@ public class AppServiceImpl { ...@@ -130,7 +130,6 @@ public class AppServiceImpl {
} }
List<Shop> shops = null; List<Shop> shops = null;
if (locationPo == null || locationPo.isEmpty()) { if (locationPo == null || locationPo.isEmpty()) {
// 未授权位置,返回默认店铺相同区域的所有店铺 // 未授权位置,返回默认店铺相同区域的所有店铺
shops = shopMapper.selectDefaultSameLocationShops(states); shops = shopMapper.selectDefaultSameLocationShops(states);
...@@ -148,11 +147,18 @@ public class AppServiceImpl { ...@@ -148,11 +147,18 @@ public class AppServiceImpl {
return null; return null;
} }
for (Shop s : shops) { // 获取所有店铺距离 for (Shop s : shops) {
double realDistance = DistanceUtil.getRealDistance(Double.parseDouble(locationPo.getLng()), Double.parseDouble(locationPo.getLat()), Double.parseDouble(s.getLng()), Double.parseDouble(s.getLat())); if (locationPo == null || locationPo.isEmpty()) {
s.setRealDistance(realDistance); s.setRealDistance(0d);
s.setDistance(DistanceUtil.getDistanceDesc(realDistance)); s.setDistance("-1");
perfectOrderState(s, locationPo.getLng(), locationPo.getLat()); s.setOrderState(1);
} else {
// 获取所有店铺距离
double realDistance = DistanceUtil.getRealDistance(Double.parseDouble(locationPo.getLng()), Double.parseDouble(locationPo.getLat()), Double.parseDouble(s.getLng()), Double.parseDouble(s.getLat()));
s.setRealDistance(realDistance);
s.setDistance(DistanceUtil.getDistanceDesc(realDistance));
perfectOrderState(s, locationPo.getLng(), locationPo.getLat());
}
} }
shops.sort(Comparator.comparing(Shop::getRealDistance)); // 按距离排序 shops.sort(Comparator.comparing(Shop::getRealDistance)); // 按距离排序
return shops; return shops;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment