Commit 84957ba0 by weijiguang

下单时校验订单中sku数量

parent 5d94ff84
......@@ -130,7 +130,6 @@ public class AppServiceImpl {
}
List<Shop> shops = null;
if (locationPo == null || locationPo.isEmpty()) {
// 未授权位置,返回默认店铺相同区域的所有店铺
shops = shopMapper.selectDefaultSameLocationShops(states);
......@@ -148,12 +147,19 @@ public class AppServiceImpl {
return null;
}
for (Shop s : shops) { // 获取所有店铺距离
for (Shop s : shops) {
if (locationPo == null || locationPo.isEmpty()) {
s.setRealDistance(0d);
s.setDistance("-1");
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)); // 按距离排序
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