| 
					
				 | 
			
			
				@@ -14,16 +14,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.bean.app.dto.ShopHeadInfoDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yami.shop.bean.model.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.bean.param.ShopDetailParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.bean.enums.AuditStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.bean.enums.OfflineHandleEventStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.bean.enums.OfflineHandleEventType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.bean.enums.ShopStatus; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.bean.event.OpenShopInitEvent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yami.shop.bean.model.OfflineHandleEvent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yami.shop.bean.model.ShopAuditing; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yami.shop.bean.model.ShopDetail; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.yami.shop.bean.model.ShopWallet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.bean.param.OfflineHandleEventAuditParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.common.exception.GlobalException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.common.exception.YamiShopBindException; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -31,6 +28,7 @@ import com.yami.shop.common.util.PageParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.dao.ProductMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.dao.ShopDetailMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.dao.ShopWalletMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yami.shop.dao.UserAddrMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.service.OfflineHandleEventService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.service.ShopAuditingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yami.shop.service.ShopDetailService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -48,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.annotation.Resource; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @author lgh on 2018/08/29. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -71,6 +70,7 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private final ApplicationContext applicationContext; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private final PasswordEncoder passwordEncoder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private final UserAddrMapper userAddrMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ShopWalletService shopWalletService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -311,7 +311,7 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<ShopDetail> shopDetails = shopDetailMapper.neighborShop(lat, lon,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ShopDetail> shopDetails = shopDetailMapper.neighborShop(lat, lon, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ShopHeadInfoDto dto = new ShopHeadInfoDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dto.setShopId(shopDetails.get(0).getShopId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dto.setShopName(shopDetails.get(0).getShopName()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -319,16 +319,31 @@ public class ShopDetailServiceImpl extends ServiceImpl<ShopDetailMapper, ShopDet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon,Integer platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<ShopDetail> shopDetails = shopDetailMapper.neighborShop(lat, lon,platform); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResponseEntity<ShopHeadInfoDto> neighborShop(String lat, String lon, Integer platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ShopDetail> shopDetails = shopDetailMapper.neighborShop(lat, lon, platform); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ShopHeadInfoDto dto = new ShopHeadInfoDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(ObjectUtils.isNotEmpty(shopDetails)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ObjectUtils.isNotEmpty(shopDetails)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dto.setShopId(shopDetails.get(0).getShopId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             dto.setShopName(shopDetails.get(0).getShopName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return ResponseEntity.ok(dto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResponseEntity<List<ShopHeadInfoDto>> neighborShopList(String lat, String lon, Integer platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ShopHeadInfoDto> collect = shopDetailMapper.neighborShop(lat, lon, platform) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .stream().map((s) -> ShopHeadInfoDto.builder().shopId(s.getShopId()).shopName(s.getShopName()).build()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return ResponseEntity.ok(collect); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public ResponseEntity<List<ShopHeadInfoDto>> neighborShopByAddr(Long addr, Integer platform) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        UserAddr userAddr = userAddrMapper.selectById(addr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<ShopHeadInfoDto> collect = shopDetailMapper.neighborShop(userAddr.getLatitude().toString(), userAddr.getLongitude().toString(), platform) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .stream().map((s) -> ShopHeadInfoDto.builder().shopId(s.getShopId()).shopName(s.getShopName()).build()).collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return ResponseEntity.ok(collect); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @CacheEvict(cacheNames = "shop_detail", key = "#shopId") 
			 |