fix(订单中心):首页附近景区列表数据逻辑优化,删除用户为直接删除数据逻辑优化
This commit is contained in:
+84
-2
@@ -6,6 +6,7 @@ import com.central.common.model.LoginAppUser;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.order.model.Tourism;
|
||||
import com.central.order.model.TourismWithDistance;
|
||||
import com.central.order.service.ITourismService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -18,17 +19,21 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Tourism information
|
||||
* 景区管理控制器
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2024-12-19 17:51:47
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Tag(name = "Tourism管理")
|
||||
@Tag(name = "景区管理")
|
||||
@RequestMapping("/tourism")
|
||||
@RequiredArgsConstructor
|
||||
public class TourismController {
|
||||
@@ -91,4 +96,81 @@ public class TourismController {
|
||||
return Result.failed("获取景区设备列表失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询附近景区列表
|
||||
*/
|
||||
@Operation(summary = "查询附近景区列表")
|
||||
@Parameters({
|
||||
@Parameter(name = "longitude", description = "经度", required = true, in = ParameterIn.QUERY),
|
||||
@Parameter(name = "latitude", description = "纬度", required = true, in = ParameterIn.QUERY),
|
||||
@Parameter(name = "radius", description = "搜索半径(公里),默认10km", required = false, in = ParameterIn.QUERY),
|
||||
@Parameter(name = "limit", description = "返回数量限制,默认20个", required = false, in = ParameterIn.QUERY)
|
||||
})
|
||||
@GetMapping("/nearby")
|
||||
public Result<List<TourismWithDistance>> findNearbyTourisms(
|
||||
@RequestParam BigDecimal longitude,
|
||||
@RequestParam BigDecimal latitude,
|
||||
@RequestParam(required = false) Double radius,
|
||||
@RequestParam(required = false) Integer limit) {
|
||||
try {
|
||||
log.info("查询附近景区,经度: {}, 纬度: {}, 半径: {}km, 限制数量: {}", longitude, latitude, radius, limit);
|
||||
List<TourismWithDistance> tourisms = tourismService.findNearbyTourisms(longitude, latitude, radius, limit);
|
||||
return Result.succeed(tourisms, "查询附近景区成功");
|
||||
} catch (Exception e) {
|
||||
log.error("查询附近景区失败", e);
|
||||
return Result.failed("查询附近景区失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据经纬度范围查询景区
|
||||
*/
|
||||
@Operation(summary = "根据经纬度范围查询景区")
|
||||
@Parameters({
|
||||
@Parameter(name = "minLongitude", description = "最小经度", required = true, in = ParameterIn.QUERY),
|
||||
@Parameter(name = "maxLongitude", description = "最大经度", required = true, in = ParameterIn.QUERY),
|
||||
@Parameter(name = "minLatitude", description = "最小纬度", required = true, in = ParameterIn.QUERY),
|
||||
@Parameter(name = "maxLatitude", description = "最大纬度", required = true, in = ParameterIn.QUERY)
|
||||
})
|
||||
@GetMapping("/bounds")
|
||||
public Result<List<Tourism>> findTourismsByBounds(
|
||||
@RequestParam BigDecimal minLongitude,
|
||||
@RequestParam BigDecimal maxLongitude,
|
||||
@RequestParam BigDecimal minLatitude,
|
||||
@RequestParam BigDecimal maxLatitude) {
|
||||
try {
|
||||
log.info("根据经纬度范围查询景区,经度范围: [{}, {}], 纬度范围: [{}, {}]",
|
||||
minLongitude, maxLongitude, minLatitude, maxLatitude);
|
||||
List<Tourism> tourisms = tourismService.findTourismsByBounds(minLongitude, maxLongitude, minLatitude, maxLatitude);
|
||||
return Result.succeed(tourisms, "查询景区成功");
|
||||
} catch (Exception e) {
|
||||
log.error("根据经纬度范围查询景区失败", e);
|
||||
return Result.failed("查询景区失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新景区经纬度信息
|
||||
*/
|
||||
@Operation(summary = "更新景区经纬度信息")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "景区ID", required = true, in = ParameterIn.PATH),
|
||||
@Parameter(name = "longitude", description = "经度", required = true, in = ParameterIn.QUERY),
|
||||
@Parameter(name = "latitude", description = "纬度", required = true, in = ParameterIn.QUERY)
|
||||
})
|
||||
@PutMapping("/{id}/location")
|
||||
public Result updateTourismLocation(
|
||||
@PathVariable Long id,
|
||||
@RequestParam BigDecimal longitude,
|
||||
@RequestParam BigDecimal latitude) {
|
||||
try {
|
||||
log.info("更新景区经纬度信息,景区ID: {}, 经度: {}, 纬度: {}", id, longitude, latitude);
|
||||
return tourismService.updateTourismLocation(id, longitude, latitude);
|
||||
} catch (Exception e) {
|
||||
log.error("更新景区经纬度信息失败", e);
|
||||
return Result.failed("更新景区经纬度信息失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ package com.central.order.mapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.central.db.mapper.SuperMapper;
|
||||
import com.central.order.model.Tourism;
|
||||
import com.central.order.model.TourismWithDistance;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -40,4 +42,34 @@ public interface TourismMapper extends SuperMapper<Tourism> {
|
||||
*/
|
||||
List<Map<String, Object>> getDevicesByTourismId(@Param("tourismId") Long tourismId);
|
||||
|
||||
/**
|
||||
* 查询附近景区列表
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
* @param radius 搜索半径(公里)
|
||||
* @param limit 返回数量限制
|
||||
* @return 附近景区列表(包含距离信息)
|
||||
*/
|
||||
List<TourismWithDistance> findNearbyTourisms(
|
||||
@Param("longitude") BigDecimal longitude,
|
||||
@Param("latitude") BigDecimal latitude,
|
||||
@Param("radius") Double radius,
|
||||
@Param("limit") Integer limit
|
||||
);
|
||||
|
||||
/**
|
||||
* 根据经纬度范围查询景区
|
||||
* @param minLongitude 最小经度
|
||||
* @param maxLongitude 最大经度
|
||||
* @param minLatitude 最小纬度
|
||||
* @param maxLatitude 最大纬度
|
||||
* @return 景区列表
|
||||
*/
|
||||
List<Tourism> findTourismsByBounds(
|
||||
@Param("minLongitude") BigDecimal minLongitude,
|
||||
@Param("maxLongitude") BigDecimal maxLongitude,
|
||||
@Param("minLatitude") BigDecimal minLatitude,
|
||||
@Param("maxLatitude") BigDecimal maxLatitude
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,10 +8,11 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Device information
|
||||
* 景区信息实体类
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2024-12-19 17:51:47
|
||||
@@ -34,6 +35,16 @@ public class Tourism extends SuperEntity {
|
||||
private String tourismPhone;
|
||||
private String tourismEmail;
|
||||
|
||||
/**
|
||||
* 景区经度
|
||||
*/
|
||||
private BigDecimal longitude;
|
||||
|
||||
/**
|
||||
* 景区纬度
|
||||
*/
|
||||
private BigDecimal latitude;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
|
||||
+34
-1
@@ -4,11 +4,14 @@ import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.common.service.ISuperService;
|
||||
import com.central.order.model.Tourism;
|
||||
import com.central.order.model.TourismWithDistance;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Firmware file information
|
||||
* 景区信息服务接口
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2024-12-19 17:52:54
|
||||
@@ -43,5 +46,35 @@ public interface ITourismService extends ISuperService<Tourism> {
|
||||
* @return 设备列表
|
||||
*/
|
||||
java.util.List<java.util.Map<String, Object>> getDevicesByTourismId(Long tourismId);
|
||||
|
||||
/**
|
||||
* 查询附近景区列表
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
* @param radius 搜索半径(公里)
|
||||
* @param limit 返回数量限制
|
||||
* @return 附近景区列表(包含距离信息)
|
||||
*/
|
||||
List<TourismWithDistance> findNearbyTourisms(BigDecimal longitude, BigDecimal latitude, Double radius, Integer limit);
|
||||
|
||||
/**
|
||||
* 根据经纬度范围查询景区
|
||||
* @param minLongitude 最小经度
|
||||
* @param maxLongitude 最大经度
|
||||
* @param minLatitude 最小纬度
|
||||
* @param maxLatitude 最大纬度
|
||||
* @return 景区列表
|
||||
*/
|
||||
List<Tourism> findTourismsByBounds(BigDecimal minLongitude, BigDecimal maxLongitude,
|
||||
BigDecimal minLatitude, BigDecimal maxLatitude);
|
||||
|
||||
/**
|
||||
* 更新景区经纬度信息
|
||||
* @param id 景区ID
|
||||
* @param longitude 经度
|
||||
* @param latitude 纬度
|
||||
* @return 更新结果
|
||||
*/
|
||||
Result updateTourismLocation(Long id, BigDecimal longitude, BigDecimal latitude);
|
||||
}
|
||||
|
||||
|
||||
+121
-1
@@ -6,16 +6,22 @@ import com.central.common.model.Result;
|
||||
import com.central.common.service.impl.SuperServiceImpl;
|
||||
import com.central.order.mapper.TourismMapper;
|
||||
import com.central.order.model.Tourism;
|
||||
import com.central.order.model.TourismWithDistance;
|
||||
import com.central.order.model.TourismFile;
|
||||
import com.central.order.service.ITourismService;
|
||||
import com.central.order.service.ITourismFileService;
|
||||
import com.central.order.feign.FileCenterService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Order information
|
||||
* 景区信息服务实现类
|
||||
*
|
||||
* @author lsl
|
||||
* @date 2024-12-19 17:52:54
|
||||
@@ -24,6 +30,12 @@ import java.util.Map;
|
||||
@Service
|
||||
public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism> implements ITourismService {
|
||||
|
||||
@Autowired
|
||||
private ITourismFileService tourismFileService;
|
||||
|
||||
@Autowired
|
||||
private FileCenterService fileCenterService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
@@ -52,4 +64,112 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
|
||||
return baseMapper.getDevicesByTourismId(tourismId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TourismWithDistance> findNearbyTourisms(BigDecimal longitude, BigDecimal latitude, Double radius, Integer limit) {
|
||||
log.info("查询附近景区,经度: {}, 纬度: {}, 半径: {}km, 限制数量: {}", longitude, latitude, radius, limit);
|
||||
|
||||
// 参数验证
|
||||
if (longitude == null || latitude == null) {
|
||||
log.warn("经纬度参数不能为空");
|
||||
return List.of();
|
||||
}
|
||||
|
||||
if (radius == null || radius <= 0) {
|
||||
radius = 10.0; // 默认10公里
|
||||
}
|
||||
|
||||
if (limit == null || limit <= 0) {
|
||||
limit = 20; // 默认返回20个
|
||||
}
|
||||
|
||||
List<TourismWithDistance> tourisms = baseMapper.findNearbyTourisms(longitude, latitude, radius, limit);
|
||||
log.info("查询到附近景区数量: {}", tourisms.size());
|
||||
|
||||
// 为每个景区添加订单展示图片
|
||||
for (TourismWithDistance tourism : tourisms) {
|
||||
try {
|
||||
// 查询景区的订单展示图片(type=6)
|
||||
List<TourismFile> tourismFiles = tourismFileService.getByTourismId(tourism.getId());
|
||||
if (tourismFiles != null && !tourismFiles.isEmpty()) {
|
||||
// 查找订单展示图(type=6)
|
||||
TourismFile orderShowFile = tourismFiles.stream()
|
||||
.filter(file -> file.getType() == 6)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (orderShowFile != null && orderShowFile.getImageUrl() != null) {
|
||||
// 获取图片的完整URL
|
||||
String imageUrl = fileCenterService.getViewUrlByPath(orderShowFile.getImageUrl());
|
||||
tourism.setOrderShowImageUrl(imageUrl);
|
||||
log.debug("景区 {} 设置订单展示图片: {}", tourism.getTourismName(), imageUrl);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取景区 {} 订单展示图片失败: {}", tourism.getTourismName(), e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return tourisms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Tourism> findTourismsByBounds(BigDecimal minLongitude, BigDecimal maxLongitude,
|
||||
BigDecimal minLatitude, BigDecimal maxLatitude) {
|
||||
log.info("根据经纬度范围查询景区,经度范围: [{}, {}], 纬度范围: [{}, {}]",
|
||||
minLongitude, maxLongitude, minLatitude, maxLatitude);
|
||||
|
||||
// 参数验证
|
||||
if (minLongitude == null || maxLongitude == null || minLatitude == null || maxLatitude == null) {
|
||||
log.warn("经纬度范围参数不能为空");
|
||||
return List.of();
|
||||
}
|
||||
|
||||
List<Tourism> tourisms = baseMapper.findTourismsByBounds(minLongitude, maxLongitude, minLatitude, maxLatitude);
|
||||
log.info("查询到景区数量: {}", tourisms.size());
|
||||
|
||||
return tourisms;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result updateTourismLocation(Long id, BigDecimal longitude, BigDecimal latitude) {
|
||||
log.info("更新景区经纬度信息,景区ID: {}, 经度: {}, 纬度: {}", id, longitude, latitude);
|
||||
|
||||
// 参数验证
|
||||
if (id == null) {
|
||||
return Result.failed("景区ID不能为空");
|
||||
}
|
||||
|
||||
if (longitude == null || latitude == null) {
|
||||
return Result.failed("经纬度不能为空");
|
||||
}
|
||||
|
||||
// 验证经纬度范围
|
||||
if (longitude.compareTo(BigDecimal.valueOf(-180)) < 0 || longitude.compareTo(BigDecimal.valueOf(180)) > 0) {
|
||||
return Result.failed("经度范围应在-180到180之间");
|
||||
}
|
||||
|
||||
if (latitude.compareTo(BigDecimal.valueOf(-90)) < 0 || latitude.compareTo(BigDecimal.valueOf(90)) > 0) {
|
||||
return Result.failed("纬度范围应在-90到90之间");
|
||||
}
|
||||
|
||||
// 查询景区是否存在
|
||||
Tourism tourism = getById(id);
|
||||
if (tourism == null) {
|
||||
return Result.failed("景区不存在");
|
||||
}
|
||||
|
||||
// 更新经纬度
|
||||
tourism.setLongitude(longitude);
|
||||
tourism.setLatitude(latitude);
|
||||
|
||||
boolean result = updateById(tourism);
|
||||
if (result) {
|
||||
log.info("景区经纬度更新成功,景区ID: {}", id);
|
||||
return Result.succeed(tourism, "经纬度更新成功");
|
||||
} else {
|
||||
log.error("景区经纬度更新失败,景区ID: {}", id);
|
||||
return Result.failed("经纬度更新失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,4 +36,42 @@
|
||||
AND t.is_del = 0
|
||||
ORDER BY q.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询附近景区列表 -->
|
||||
<select id="findNearbyTourisms" resultType="com.central.order.model.TourismWithDistance">
|
||||
<![CDATA[
|
||||
SELECT
|
||||
*,
|
||||
(
|
||||
6371 * acos(
|
||||
cos(radians(#{latitude})) *
|
||||
cos(radians(latitude)) *
|
||||
cos(radians(longitude) - radians(#{longitude})) +
|
||||
sin(radians(#{latitude})) *
|
||||
sin(radians(latitude))
|
||||
)
|
||||
) AS distance
|
||||
FROM tourisms
|
||||
WHERE is_del = 0
|
||||
AND status = 1
|
||||
AND longitude IS NOT NULL
|
||||
AND latitude IS NOT NULL
|
||||
HAVING distance <= #{radius}
|
||||
ORDER BY distance ASC
|
||||
]]>
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据经纬度范围查询景区 -->
|
||||
<select id="findTourismsByBounds" resultType="com.central.order.model.Tourism">
|
||||
SELECT * FROM tourisms
|
||||
WHERE is_del = 0
|
||||
AND status = 1
|
||||
AND longitude BETWEEN #{minLongitude} AND #{maxLongitude}
|
||||
AND latitude BETWEEN #{minLatitude} AND #{maxLatitude}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
+3
-5
@@ -470,10 +470,8 @@ public class SysUserController {
|
||||
/**
|
||||
* 用户注销账户
|
||||
*/
|
||||
@PostMapping("/users/logout")
|
||||
@PostMapping("/users/account/logout")
|
||||
@Operation(summary = "用户注销账户")
|
||||
@CacheEvict(value = "user", key = "#result?.data?.username")
|
||||
@AuditLog(operation = "'用户注销账户:' + #result?.data?.username")
|
||||
public Result<String> logout() {
|
||||
try {
|
||||
SysUser currentUser = LoginUserUtils.getCurrentSysUser();
|
||||
@@ -485,8 +483,8 @@ public class SysUserController {
|
||||
|
||||
log.info("用户 {} 执行账户注销操作", currentUser.getUsername());
|
||||
|
||||
// 执行用户账户注销(逻辑删除)
|
||||
boolean success = appUserService.delUser(currentUser.getId());
|
||||
// 执行用户账户注销(直接删除)
|
||||
boolean success = appUserService.removeById(currentUser);
|
||||
|
||||
if (success) {
|
||||
log.info("用户 {} 账户注销成功", currentUser.getUsername());
|
||||
|
||||
+38
@@ -4,6 +4,7 @@ import {
|
||||
ProFormText,
|
||||
ProFormSelect,
|
||||
ProFormTextArea,
|
||||
ProFormDigit,
|
||||
} from '@ant-design/pro-components';
|
||||
import React from 'react';
|
||||
|
||||
@@ -30,6 +31,14 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
const formRules = {
|
||||
required: { required: true, message: '此项为必填项' },
|
||||
phone: { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' },
|
||||
longitude: {
|
||||
pattern: /^-?((1[0-7][0-9]|[1-9]?[0-9])\.\d{1,6}|180\.0{1,6})$/,
|
||||
message: '经度范围应在-180到180之间,最多6位小数'
|
||||
},
|
||||
latitude: {
|
||||
pattern: /^-?([1-8]?[0-9]\.\d{1,6}|90\.0{1,6})$/,
|
||||
message: '纬度范围应在-90到90之间,最多6位小数'
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -79,6 +88,35 @@ const UpdateForm: React.FC<UpdateFormProps> = ({
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<ProFormDigit
|
||||
name="longitude"
|
||||
label="经度"
|
||||
width="md"
|
||||
rules={[formRules.longitude]}
|
||||
placeholder="请输入经度(-180到180)"
|
||||
fieldProps={{
|
||||
precision: 6,
|
||||
min: -180,
|
||||
max: 180,
|
||||
}}
|
||||
tooltip="经度范围:-180到180,用于附近景区查询功能"
|
||||
/>
|
||||
<ProFormDigit
|
||||
name="latitude"
|
||||
label="纬度"
|
||||
width="md"
|
||||
rules={[formRules.latitude]}
|
||||
placeholder="请输入纬度(-90到90)"
|
||||
fieldProps={{
|
||||
precision: 6,
|
||||
min: -90,
|
||||
max: 90,
|
||||
}}
|
||||
tooltip="纬度范围:-90到90,用于附近景区查询功能"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="tenantId"
|
||||
|
||||
@@ -10,8 +10,9 @@ import {
|
||||
ProFormSelect,
|
||||
ProFormTextArea,
|
||||
ProTable,
|
||||
ProFormDigit,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Typography, message, Popconfirm, Button, Space } from 'antd';
|
||||
import { Typography, message, Popconfirm, Button, Space, Tag } from 'antd';
|
||||
import React, { useRef, useState, useCallback } from 'react';
|
||||
|
||||
const { Link } = Typography;
|
||||
@@ -142,6 +143,22 @@ const TableList: React.FC = () => {
|
||||
dataIndex: 'tourismPhone',
|
||||
copyable: true,
|
||||
},
|
||||
{
|
||||
title: '经纬度',
|
||||
dataIndex: 'location',
|
||||
hideInSearch: true,
|
||||
render: (_, record) => {
|
||||
const hasLocation = record.longitude && record.latitude;
|
||||
return hasLocation ? (
|
||||
<Space direction="vertical" size="small">
|
||||
<Tag color="blue">经度: {record.longitude}</Tag>
|
||||
<Tag color="green">纬度: {record.latitude}</Tag>
|
||||
</Space>
|
||||
) : (
|
||||
<Tag color="red">未设置</Tag>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '租户ID',
|
||||
dataIndex: 'tenantId',
|
||||
@@ -192,6 +209,14 @@ const TableList: React.FC = () => {
|
||||
const formRules = {
|
||||
required: { required: true, message: '此项为必填项' },
|
||||
phone: { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号' },
|
||||
longitude: {
|
||||
pattern: /^-?((1[0-7][0-9]|[1-9]?[0-9])\.\d{1,6}|180\.0{1,6})$/,
|
||||
message: '经度范围应在-180到180之间,最多6位小数'
|
||||
},
|
||||
latitude: {
|
||||
pattern: /^-?([1-8]?[0-9]\.\d{1,6}|90\.0{1,6})$/,
|
||||
message: '纬度范围应在-90到90之间,最多6位小数'
|
||||
},
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -265,6 +290,35 @@ const TableList: React.FC = () => {
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<ProFormDigit
|
||||
name="longitude"
|
||||
label="经度"
|
||||
width="md"
|
||||
rules={[formRules.longitude]}
|
||||
placeholder="请输入经度(-180到180)"
|
||||
fieldProps={{
|
||||
precision: 6,
|
||||
min: -180,
|
||||
max: 180,
|
||||
}}
|
||||
tooltip="经度范围:-180到180,用于附近景区查询功能"
|
||||
/>
|
||||
<ProFormDigit
|
||||
name="latitude"
|
||||
label="纬度"
|
||||
width="md"
|
||||
rules={[formRules.latitude]}
|
||||
placeholder="请输入纬度(-90到90)"
|
||||
fieldProps={{
|
||||
precision: 6,
|
||||
min: -90,
|
||||
max: 90,
|
||||
}}
|
||||
tooltip="纬度范围:-90到90,用于附近景区查询功能"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="tenantId"
|
||||
|
||||
@@ -33,12 +33,20 @@ declare namespace ORDERS {
|
||||
tourismNo: string;
|
||||
tourismAddress: string;
|
||||
tourismPhone: string;
|
||||
longitude?: number; // 经度
|
||||
latitude?: number; // 纬度
|
||||
createTime?: string;
|
||||
status: number;
|
||||
tenantId?: string;
|
||||
updateTime?: string;
|
||||
}
|
||||
|
||||
type TourismWithDistance = Tourism & {
|
||||
distance?: number; // 距离(公里)
|
||||
distanceDesc?: string; // 距离描述
|
||||
orderShowImageUrl?: string; // 景区订单展示图片URL
|
||||
}
|
||||
|
||||
type TourismFile = {
|
||||
id: number;
|
||||
tourismId: string;
|
||||
|
||||
Reference in New Issue
Block a user