Commit eda4d4f8 by 吕明尚

修改门店距离排序

parent 6af7b2a7
...@@ -76,7 +76,7 @@ public class SStoreVo extends BaseEntity ...@@ -76,7 +76,7 @@ public class SStoreVo extends BaseEntity
private String storeType; private String storeType;
@ApiModelProperty(value = "距离(KM)") @ApiModelProperty(value = "距离(KM)")
private String distance; private Double distance;
@ApiModelProperty(value = "房间列表") @ApiModelProperty(value = "房间列表")
private List<SRoomVo> roomVoList; private List<SRoomVo> roomVoList;
......
...@@ -323,7 +323,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme ...@@ -323,7 +323,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
double distance = geo.calcDistance(nowPoint, geo.makePoint(Double.parseDouble(o.getLongitude()), Double.parseDouble(o.getLatitude()))) * DistanceUtils.DEG_TO_KM; double distance = geo.calcDistance(nowPoint, geo.makePoint(Double.parseDouble(o.getLongitude()), Double.parseDouble(o.getLatitude()))) * DistanceUtils.DEG_TO_KM;
SStoreVo vo = new SStoreVo(); SStoreVo vo = new SStoreVo();
BeanUtils.copyProperties(o, vo); BeanUtils.copyProperties(o, vo);
vo.setDistance(distance + ""); vo.setDistance(distance);
// 计算当天预定最后预定时间 // 计算当天预定最后预定时间
SOrder order = orderMap.get(vo.getId()); SOrder order = orderMap.get(vo.getId());
if (order != null) { if (order != null) {
...@@ -350,7 +350,6 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme ...@@ -350,7 +350,6 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
}); });
//排序条件 getStatus()从小到大并且getDistance()从小到大 //排序条件 getStatus()从小到大并且getDistance()从小到大
voList.sort(Comparator.comparing(SStoreVo::getStatus).thenComparing(SStoreVo::getDistance)); voList.sort(Comparator.comparing(SStoreVo::getStatus).thenComparing(SStoreVo::getDistance));
// voList.stream().sorted(Comparator.comparing(storeVo -> Double.parseDouble(storeVo.getDistance()))).collect(Collectors.toList());
} }
return voList; return voList;
} }
......
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