ソースを参照

修复骑手查看可接订单(按商家分组)接口根据经纬度距离排序失效问题

codingliang 1 年間 前
コミット
b6dc47e207

+ 11 - 5
src/main/java/com/sqx/modules/errand/service/impl/TbIndentServiceImpl.java

@@ -36,11 +36,15 @@ import com.sqx.modules.errand.dto.RiderDeliveryDTO;
 import com.sqx.modules.errand.dto.RiderTransferByOrderIdDTO;
 import com.sqx.modules.errand.dto.RiderTransferOrderDTO;
 import com.sqx.modules.errand.dto.WaitForAcceptOrderQueryDTO;
-import com.sqx.modules.errand.entity.*;
+import com.sqx.modules.errand.entity.ErrandAddress;
+import com.sqx.modules.errand.entity.ErrandEvaluate;
+import com.sqx.modules.errand.entity.ErrandRedPacket;
+import com.sqx.modules.errand.entity.TbIndent;
+import com.sqx.modules.errand.entity.TbIndentSmsSendLog;
+import com.sqx.modules.errand.entity.TransferRecordEntity;
 import com.sqx.modules.errand.service.TbIndentService;
 import com.sqx.modules.errand.service.TbIndentSmsSendLogService;
 import com.sqx.modules.errand.service.TbIndentSmsTemplateService;
-import com.sqx.modules.errand.service.TransferRecordService;
 import com.sqx.modules.errand.util.LonLatUtil;
 import com.sqx.modules.errand.vo.ShopWaitAcceptOrderVO;
 import com.sqx.modules.errand.vo.queryOrderInfoVo;
@@ -58,7 +62,6 @@ import com.sqx.modules.pay.controller.app.AliPayController;
 import com.sqx.modules.pay.dao.PayDetailsDao;
 import com.sqx.modules.pay.entity.PayDetails;
 import com.sqx.modules.pay.service.WxService;
-import com.sqx.modules.printInfo.entity.PrintInfo;
 import com.sqx.modules.riderStation.entity.RiderStation;
 import com.sqx.modules.riderStation.service.RiderStationService;
 import com.sqx.modules.shop.service.ShopMessageService;
@@ -599,8 +602,11 @@ public class TbIndentServiceImpl extends ServiceImpl<TbIndentDao, TbIndent> impl
             queryDTO.setDistances(Double.valueOf(one.getValue()));
             indent = baseMapper.findNewIndentByDistancesGroupByShop(pages, queryDTO);
         } else {
-//            String city = getCurrentCityByLngAndLat(queryDTO.getRiderLng(), queryDTO.getRiderLat());
-//            queryDTO.setCity(city);
+            // 如果city为空,则根据骑手经纬度获取当前城市
+            if (StrUtil.isBlank(queryDTO.getCity())) {
+                String city = getCurrentCityByLngAndLat(queryDTO.getRiderLng(), queryDTO.getRiderLat());
+                queryDTO.setCity(city);
+            }
 
             indent = baseMapper.findNewIndentByCityGroupByShop(pages, queryDTO);
         }

+ 17 - 16
src/main/resources/mapper/errand/TbIndentMapper.xml

@@ -124,26 +124,27 @@
 
     <select id="findNewIndentByCityGroupByShop" resultType="com.sqx.modules.errand.vo.ShopWaitAcceptOrderVO">
         select
-        shop_id, shop_name, count(indent_id) as countOfWaitAccept,
-        (st_distance_sphere (point (shop_lng,shop_lat),point(115.82770500,28.70783200))) AS distancess
+            shop_id, shop_name,
+            count(indent_id) as countOfWaitAccept,
+            st_distance_sphere(point (shop_lng, shop_lat), point(#{queryDTO.riderLng}, #{queryDTO.riderLat})) AS distancess
         from
-        tb_indent
+            tb_indent
         where
-        indent_state = 2
-        and shop_city like concat('%',#{queryDTO.city},'%')
-        <if test="queryDTO.indentType!=null and queryDTO.indentType!=''">
-            and indent_type = #{queryDTO.indentType}
-        </if>
-        <if test="queryDTO.buyType != null and queryDTO.buyType != ''">
-            and buy_type = #{queryDTO.buyType}
-        </if>
-        <if test="queryDTO.shopId != null">
-            and shop_id = #{queryDTO.shopId}
-        </if>
+            indent_state = 2
+            and shop_city like concat('%', #{queryDTO.city}, '%')
+            <if test="queryDTO.indentType!=null and queryDTO.indentType!=''">
+                and indent_type = #{queryDTO.indentType}
+            </if>
+            <if test="queryDTO.buyType != null and queryDTO.buyType != ''">
+                and buy_type = #{queryDTO.buyType}
+            </if>
+            <if test="queryDTO.shopId != null">
+                and shop_id = #{queryDTO.shopId}
+            </if>
         group by
-        shop_id, shop_name, shop_lng, shop_lat
+            shop_id, shop_name
         order by
-        distancess asc
+            distancess asc
     </select>
 
     <select id="findIndentByNumber" resultType="com.sqx.modules.errand.entity.TbIndent">