|
@@ -6163,6 +6163,62 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ public StoreInfoVo getStoreInfoVoWithDistanceFields(Integer storeId, String jingdu, String weidu) {
|
|
|
|
|
+ if (storeId == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
|
|
|
|
|
+ if (storeInfo == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ StoreInfoVo result = new StoreInfoVo();
|
|
|
|
|
+ BeanUtils.copyProperties(storeInfo, result);
|
|
|
|
|
+ String storePosition = result.getStorePosition();
|
|
|
|
|
+ if (StringUtils.isNotEmpty(storePosition) && storePosition.contains(",")) {
|
|
|
|
|
+ String[] pos = storePosition.split(",");
|
|
|
|
|
+ result.setStorePositionLongitude(pos[0]);
|
|
|
|
|
+ result.setStorePositionLatitude(pos[1]);
|
|
|
|
|
+ result.setLongitude(pos[0]);
|
|
|
|
|
+ result.setLatitude(pos[1]);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 用户经纬度存在时设置与用户距离(与 getClientStoreDetail 一致)
|
|
|
|
|
+ if ((jingdu != null && !jingdu.isEmpty()) && (weidu != null && !weidu.isEmpty())) {
|
|
|
|
|
+ Double distance = storeInfoMapper.getStoreDistance(jingdu + "," + weidu, result.getId());
|
|
|
|
|
+ result.setDistance(distance != null ? distance : 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 店铺到最近地铁站距离及地铁名(与 getClientStoreDetail 一致)
|
|
|
|
|
+ if (StringUtils.isNotEmpty(storePosition) && storePosition.contains(",")) {
|
|
|
|
|
+ String[] pos = storePosition.split(",");
|
|
|
|
|
+ JSONObject nearbySubway = gaoDeMapUtil.getNearbySubway(pos[0], pos[1]);
|
|
|
|
|
+ String subWayName = nearbySubway != null ? nearbySubway.getString("name") : null;
|
|
|
|
|
+ result.setSubwayName(subWayName);
|
|
|
|
|
+ String subWayJing = null;
|
|
|
|
|
+ String subWayWei = null;
|
|
|
|
|
+ if (nearbySubway != null && nearbySubway.getString("location") != null) {
|
|
|
|
|
+ String[] loc = nearbySubway.getString("location").split(",");
|
|
|
|
|
+ if (loc.length >= 2) {
|
|
|
|
|
+ subWayJing = loc[0];
|
|
|
|
|
+ subWayWei = loc[1];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subWayJing != null && !subWayJing.isEmpty() && subWayWei != null && !subWayWei.isEmpty()) {
|
|
|
|
|
+ double storeJing = Double.parseDouble(pos[0]);
|
|
|
|
|
+ double storeWei = Double.parseDouble(pos[1]);
|
|
|
|
|
+ double storeDistance2 = DistanceUtil.haversineCalculateDistance(Double.parseDouble(subWayJing), Double.parseDouble(subWayWei), storeJing, storeWei);
|
|
|
|
|
+ result.setDistance2(storeDistance2);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.setDistance2(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ result.setSubwayName(null);
|
|
|
|
|
+ result.setDistance2(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 门店位置/地址(与 getClientStoreDetail 及 LifeUserStoreService 一致)
|
|
|
|
|
+ result.setStoreLocation(result.getStoreAddress());
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
public StoreBusinessStatusVo getStoreBusinessStatus(String storeId) {
|
|
public StoreBusinessStatusVo getStoreBusinessStatus(String storeId) {
|
|
|
log.info("StoreInfoServiceImpl.getStoreBusinessStatus?storeId={}", storeId);
|
|
log.info("StoreInfoServiceImpl.getStoreBusinessStatus?storeId={}", storeId);
|
|
|
StoreBusinessStatusVo result = new StoreBusinessStatusVo();
|
|
StoreBusinessStatusVo result = new StoreBusinessStatusVo();
|