bug修复
This commit is contained in:
parent
27a6006fd0
commit
c434fc9321
@ -29,7 +29,7 @@ public interface EbikeRegionMapper extends BaseMapper<EbikeRegion> {
|
||||
* @param point 用户当前位置
|
||||
* @return 列表
|
||||
*/
|
||||
List<EbikeRegion> findAllRegionsOrderByDistance(Point point,Long operatorId);
|
||||
List<EbikeRegion> findAllRegionsOrderByDistance(Point point,Long operatorId,Boolean isAdmin);
|
||||
|
||||
/**
|
||||
* 根据当前位置查询当前运营区及站点
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.io.file.FileNameUtil;
|
||||
import com.cdzy.common.ex.EbikeException;
|
||||
import com.cdzy.common.model.dto.ResGPSDto;
|
||||
import com.cdzy.common.model.response.CommonEbikeRole;
|
||||
import com.cdzy.common.model.response.CommonStaffInfo;
|
||||
import com.cdzy.operations.enums.*;
|
||||
import com.cdzy.operations.mapper.*;
|
||||
@ -800,7 +801,15 @@ public class EbikeBikeOrderServiceImpl extends ServiceImpl<EbikeBikeOrderMapper,
|
||||
if (point != null) {
|
||||
String loginId = StpUtil.getLoginIdAsString();
|
||||
CommonStaffInfo staffInfo = (CommonStaffInfo) StpUtil.getSession().get(loginId);
|
||||
return regionMapper.findAllRegionsOrderByDistance(point, staffInfo.getOperatorId());
|
||||
List<CommonEbikeRole> roles = staffInfo.getRoles();
|
||||
boolean admin = Boolean.FALSE;
|
||||
for (CommonEbikeRole role : roles) {
|
||||
if (role.getSysAdmin()){
|
||||
admin = Boolean.TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return regionMapper.findAllRegionsOrderByDistance(point, staffInfo.getOperatorId(),admin);
|
||||
} else {
|
||||
return regionMapper.selectAll();
|
||||
}
|
||||
|
||||
@ -20,17 +20,21 @@
|
||||
|
||||
<select id="findAllRegionsOrderByDistance" resultType="com.cdzy.operations.model.entity.EbikeRegion">
|
||||
SELECT
|
||||
ebike_region.*,
|
||||
ST_Distance ( region_polygon::geometry, ST_SetSRID ( ST_MakePoint ( #{point.x}, #{point.y}), 4326 ) :: geography ) AS distance_meters,
|
||||
ST_Contains ( ST_SetSRID(region_polygon::geometry, 4326), ST_SetSRID ( ST_MakePoint ( #{point.x}, #{point.y}), 4326 ) ) AS is_within_region
|
||||
ebike_region.*,
|
||||
ST_Distance ( region_polygon::geometry, ST_SetSRID ( ST_MakePoint ( #{point.x}, #{point.y}), 4326 ) :: geography
|
||||
) AS distance_meters,
|
||||
ST_Contains ( ST_SetSRID(region_polygon::geometry, 4326), ST_SetSRID ( ST_MakePoint ( #{point.x}, #{point.y}),
|
||||
4326 ) ) AS is_within_region
|
||||
FROM
|
||||
ebike_region
|
||||
ebike_region
|
||||
WHERE
|
||||
is_deleted IS NOT TRUE
|
||||
is_deleted IS NOT TRUE
|
||||
<if test="!isAdmin">
|
||||
AND operator_id = #{operatorId}
|
||||
</if>
|
||||
ORDER BY
|
||||
is_within_region DESC,
|
||||
distance_meters
|
||||
is_within_region DESC,
|
||||
distance_meters
|
||||
</select>
|
||||
|
||||
<resultMap id="FeignEbikeSiteVoMap" type="com.ebike.feign.model.vo.FeignEbikeSiteVo">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user