wangming 1 天之前
父節點
當前提交
da8689f34f

+ 1 - 1
yami-shop-delivery/yami-shop-delivery-comment/src/main/java/com/yami/shop/delivery/comment/dao/Transport2Mapper.java

@@ -30,5 +30,5 @@ public interface Transport2Mapper extends BaseMapper<Transport2> {
 
     ShopTransport findShopTransports(@Param("shopId") Long shopId);
 
-
+    Transport2 findByPlatform(Integer platform);
 }

+ 3 - 0
yami-shop-delivery/yami-shop-delivery-comment/src/main/java/com/yami/shop/delivery/comment/service/Transport2Service.java

@@ -30,8 +30,11 @@ public interface Transport2Service extends IService<Transport2> {
     Transport2 getTransportAndAllItems(Long transportId);
 
     Transport2 findByDistance(Long shopId, Double distance);
+
     Transport2 findByDistance(Long shopId, Integer platform);
 
+    Transport2 findByPlatform(Integer platform);
+
     Transport2 findByDistance(Long shopId, Double distance, Double weight);
 
     ShopTransport findShopTransports(Long shopName);

+ 5 - 0
yami-shop-delivery/yami-shop-delivery-comment/src/main/java/com/yami/shop/delivery/comment/service/impl/Transport2ServiceImpl.java

@@ -79,6 +79,11 @@ public class Transport2ServiceImpl extends ServiceImpl<Transport2Mapper, Transpo
         return transportMapper.getTransportShopPlatform(shopId, platform);
     }
 
+    @Override
+    public Transport2 findByPlatform(Integer platform) {
+        return transportMapper.findByPlatform(platform);
+    }
+
     @Override
     public Transport2 findByDistance(Long shopId, Double distance, Double weight) {
         return transportMapper.getTransportWeight(shopId, distance,weight);

+ 2 - 1
yami-shop-delivery/yami-shop-delivery-comment/src/main/java/com/yami/shop/delivery/comment/service/impl/TransportManagerServiceImpl.java

@@ -232,7 +232,8 @@ public class TransportManagerServiceImpl implements TransportManagerService {
         System.out.println("门店经度"+shopDetailByShopId.getShopLat());
         System.out.println("门店纬度"+shopDetailByShopId.getShopLng());
         double v = calculateDistance(latitude, longitude, Double.valueOf(shopDetailByShopId.getShopLat()), Double.valueOf(shopDetailByShopId.getShopLng()));
-        Transport2 byDistance = transport2Service.findByDistance(shopId, platform);
+        //Transport2 byDistance = transport2Service.findByDistance(shopId, platform);
+        Transport2 byDistance = transport2Service.findByPlatform(platform);
         System.out.println("byDistance"+byDistance);
 
         TzTransportDto tzTransportDto = new TzTransportDto();

+ 7 - 1
yami-shop-delivery/yami-shop-delivery-comment/src/main/resources/mapper/Transport2Mapper.xml

@@ -78,7 +78,13 @@
         <!--        </where>-->
         WHERE shop.shop_id = #{shopId}
         GROUP BY shop.shop_id
+    </select>
 
-
+    <select id="findByPlatform" resultMap="BaseResultMap">
+        SELECT *
+        FROM tz_transport2 p
+        WHERE  p.channel_id = #{platform}
+        ORDER BY p.distance LIMIT 1
     </select>
+
 </mapper>