Merge branch 'develop' of https://gitee.com/L-Shilin/go-fly-platform-services into feature_dzc
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
||||
package com.central.order.constants;
|
||||
|
||||
/**
|
||||
* 支付类型常量
|
||||
*
|
||||
* @author system
|
||||
* @date 2024-12-19
|
||||
*/
|
||||
public class PayTypeConstants {
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
*/
|
||||
public static final Integer WECHAT_PAY = 1;
|
||||
|
||||
/**
|
||||
* 优惠券支付
|
||||
*/
|
||||
public static final Integer COUPON_PAY = 2;
|
||||
|
||||
private PayTypeConstants() {
|
||||
// 私有构造函数,防止实例化
|
||||
}
|
||||
}
|
||||
+71
-43
@@ -766,6 +766,11 @@ public class OrderController {
|
||||
}
|
||||
orderFileMap.put("videoList", videoList);
|
||||
|
||||
// 添加showVideoEditOnly字段
|
||||
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
|
||||
Integer showVideoEditOnly = qrCode != null ? qrCode.getShowVideoEditOnly() : 1; // 默认值为1
|
||||
orderFileMap.put("showVideoEditOnly", showVideoEditOnly);
|
||||
|
||||
return Result.succeed(orderFileMap, "查询成功");
|
||||
}
|
||||
|
||||
@@ -878,6 +883,14 @@ public class OrderController {
|
||||
.collect(Collectors.toSet());
|
||||
Map<Long, Tourism> tourismMap = tourismService.getTourismsByIds(tourismIds);
|
||||
|
||||
// 批量获取所有二维码信息
|
||||
List<String> codeIds = result.getData().stream()
|
||||
.map(Order::getCodeId)
|
||||
.collect(Collectors.toList());
|
||||
List<QrCode> qrCodes = qrCodeService.getByCodeIds(codeIds);
|
||||
Map<String, QrCode> qrCodeMap = qrCodes.stream()
|
||||
.collect(Collectors.toMap(QrCode::getCodeId, qrCode -> qrCode));
|
||||
|
||||
// 预计算所有文件路径的URL,避免重复调用
|
||||
Set<String> allFilePaths = new HashSet<>();
|
||||
orderFilesMap.values().forEach(files ->
|
||||
@@ -913,11 +926,17 @@ public class OrderController {
|
||||
Tourism tourism = tourismMap.get(order.getTourismId());
|
||||
orderFileMap.put("addr", tourism != null ? tourism.getTourismAddress() : "");
|
||||
orderFileMap.put("orderNo", order.getOrderNo());
|
||||
orderFileMap.put("orderStatus", order.getOrderStatus());
|
||||
|
||||
// 从缓存获取二维码信息
|
||||
QrCode qrCode = qrCodeMap.get(order.getCodeId());
|
||||
Integer showVideoEditOnly = qrCode != null ? qrCode.getShowVideoEditOnly() : 1; // 默认值为1
|
||||
orderFileMap.put("showVideoEditOnly", showVideoEditOnly);
|
||||
|
||||
// 从缓存获取文件列表
|
||||
List<OrderFile> allFiles = orderFilesMap.getOrDefault(order.getOrderNo(), new ArrayList<>());
|
||||
|
||||
// aiVideo - 使用缓存URL
|
||||
// aiVideo - 使用缓存URL(始终返回)
|
||||
List<OrderFile> aiVideoFiles = allFiles.stream()
|
||||
.filter(f -> "ai_video".equals(f.getFileTag()))
|
||||
.toList();
|
||||
@@ -927,51 +946,60 @@ public class OrderController {
|
||||
}
|
||||
orderFileMap.put("aiVideo", aiVideoUrl);
|
||||
|
||||
// 图片素材 - 使用缓存URL
|
||||
List<OrderFile> imgFiles = allFiles.stream()
|
||||
.filter(f -> "image/jpeg".equals(f.getFileType()))
|
||||
.toList();
|
||||
List<Map<String,String>> imgList = new ArrayList<>();
|
||||
Map<String, String> fileMap = new HashMap<>();
|
||||
fileMap.put("style", fileStyle);
|
||||
for (OrderFile orderFile : imgFiles){
|
||||
Map<String,String> imgMap = new HashMap<>();
|
||||
imgMap.put("url", fileUrlMap.get(orderFile.getFilePath()));
|
||||
imgMap.put("contentType", orderFile.getFileType());
|
||||
imgMap.put("path", orderFile.getFilePath());
|
||||
fileMap.put("path", orderFile.getFilePath());
|
||||
String viewUrl = fileCenterService.getViewUrlByPathStyle(fileMap);
|
||||
imgMap.put("viewUrl", viewUrl);
|
||||
imgList.add(imgMap);
|
||||
}
|
||||
orderFileMap.put("imgList", imgList);
|
||||
|
||||
// 视频素材 - 使用缓存URL
|
||||
List<OrderFile> videoFiles = allFiles.stream()
|
||||
.filter(f -> "raw_video".equals(f.getFileTag()))
|
||||
.toList();
|
||||
List<Map<String,String>> videoList = new ArrayList<>();
|
||||
for (int i = 0; i < videoFiles.size(); i++){
|
||||
OrderFile orderFile = videoFiles.get(i);
|
||||
Map<String,String> videoMap = new HashMap<>();
|
||||
videoMap.put("url", fileUrlMap.get(orderFile.getFilePath()));
|
||||
videoMap.put("contentType", orderFile.getFileType());
|
||||
videoMap.put("path", orderFile.getFilePath());
|
||||
// 根据showVideoEditOnly属性决定是否返回图片和视频素材
|
||||
if (showVideoEditOnly == null || showVideoEditOnly == 1) {
|
||||
// 只显示一键成片,不返回图片和视频素材
|
||||
orderFileMap.put("imgList", new ArrayList<>());
|
||||
orderFileMap.put("videoList", new ArrayList<>());
|
||||
} else {
|
||||
// 显示所有功能,返回图片和视频素材
|
||||
|
||||
// 为视频生成缩略图URL - 使用对应的图片作为缩略图
|
||||
String thumbnailUrl = null;
|
||||
if (!imgList.isEmpty() && i < imgList.size()) {
|
||||
// 使用对应索引的图片作为缩略图
|
||||
thumbnailUrl = imgList.get(i).get("viewUrl");
|
||||
} else if (!imgList.isEmpty()) {
|
||||
// 如果视频数量超过图片数量,使用第一张图片作为缩略图
|
||||
thumbnailUrl = imgList.get(0).get("viewUrl");
|
||||
// 图片素材 - 使用缓存URL
|
||||
List<OrderFile> imgFiles = allFiles.stream()
|
||||
.filter(f -> "image/jpeg".equals(f.getFileType()))
|
||||
.toList();
|
||||
List<Map<String,String>> imgList = new ArrayList<>();
|
||||
Map<String, String> fileMap = new HashMap<>();
|
||||
fileMap.put("style", fileStyle);
|
||||
for (OrderFile orderFile : imgFiles){
|
||||
Map<String,String> imgMap = new HashMap<>();
|
||||
imgMap.put("url", fileUrlMap.get(orderFile.getFilePath()));
|
||||
imgMap.put("contentType", orderFile.getFileType());
|
||||
imgMap.put("path", orderFile.getFilePath());
|
||||
fileMap.put("path", orderFile.getFilePath());
|
||||
String viewUrl = fileCenterService.getViewUrlByPathStyle(fileMap);
|
||||
imgMap.put("viewUrl", viewUrl);
|
||||
imgList.add(imgMap);
|
||||
}
|
||||
videoMap.put("viewUrl", thumbnailUrl);
|
||||
|
||||
videoList.add(videoMap);
|
||||
orderFileMap.put("imgList", imgList);
|
||||
|
||||
// 视频素材 - 使用缓存URL
|
||||
List<OrderFile> videoFiles = allFiles.stream()
|
||||
.filter(f -> "raw_video".equals(f.getFileTag()))
|
||||
.toList();
|
||||
List<Map<String,String>> videoList = new ArrayList<>();
|
||||
for (int i = 0; i < videoFiles.size(); i++){
|
||||
OrderFile orderFile = videoFiles.get(i);
|
||||
Map<String,String> videoMap = new HashMap<>();
|
||||
videoMap.put("url", fileUrlMap.get(orderFile.getFilePath()));
|
||||
videoMap.put("contentType", orderFile.getFileType());
|
||||
videoMap.put("path", orderFile.getFilePath());
|
||||
|
||||
// 为视频生成缩略图URL - 使用对应的图片作为缩略图
|
||||
String thumbnailUrl = null;
|
||||
if (!imgList.isEmpty() && i < imgList.size()) {
|
||||
// 使用对应索引的图片作为缩略图
|
||||
thumbnailUrl = imgList.get(i).get("viewUrl");
|
||||
} else if (!imgList.isEmpty()) {
|
||||
// 如果视频数量超过图片数量,使用第一张图片作为缩略图
|
||||
thumbnailUrl = imgList.get(0).get("viewUrl");
|
||||
}
|
||||
videoMap.put("viewUrl", thumbnailUrl);
|
||||
|
||||
videoList.add(videoMap);
|
||||
}
|
||||
orderFileMap.put("videoList", videoList);
|
||||
}
|
||||
orderFileMap.put("videoList", videoList);
|
||||
|
||||
page.add(orderFileMap);
|
||||
}
|
||||
|
||||
+18
-1
@@ -279,6 +279,18 @@ public class OrderFileController {
|
||||
|
||||
Tourism tourism = tourismService.getTourismById(qrCode.getTourismId());
|
||||
|
||||
// 自动更新订单状态为设备执行完成
|
||||
if (!OrderStatus.COMPLETE.getId().equals(order.getOrderStatus())) {
|
||||
order.setOrderStatus(OrderStatus.COMPLETE.getId());
|
||||
boolean updateResult = orderService.updateOrder(order);
|
||||
if (updateResult) {
|
||||
log.info("订单状态已自动更新为设备执行完成: orderNo={}, oldStatus={}, newStatus={}",
|
||||
order.getOrderNo(), order.getOrderStatus(), OrderStatus.COMPLETE.getId());
|
||||
} else {
|
||||
log.error("订单状态更新失败: orderNo={}", order.getOrderNo());
|
||||
}
|
||||
}
|
||||
|
||||
//发送用户素材上传成功通知
|
||||
sendMessageForResouresUploaded(order,tourism);
|
||||
|
||||
@@ -346,12 +358,17 @@ public class OrderFileController {
|
||||
String tip = "素材上传完成";
|
||||
String orderName = tourism.getTourismName();
|
||||
String pageUrl = "pages/album/album";
|
||||
// 处理支付时间为空的情况
|
||||
String payTimeStr = "";
|
||||
if (order.getPayTime() != null) {
|
||||
payTimeStr = DateUtils.sdf.format(order.getPayTime());
|
||||
}
|
||||
wxMiniSubscribeService.sendServiceProcessMsg(
|
||||
sysUser.getOpenId(),
|
||||
orderName,
|
||||
tip,
|
||||
order.getOrderNo(),
|
||||
DateUtils.sdf.format(order.getPayTime()),
|
||||
payTimeStr,
|
||||
"",
|
||||
pageUrl
|
||||
);
|
||||
|
||||
+15
@@ -149,4 +149,19 @@ public class QrCodeController {
|
||||
map.put("waylineId",qrCode.getWaylineId());
|
||||
return map;
|
||||
}
|
||||
|
||||
@GetMapping("/device/{deviceId}")
|
||||
public Map<String,Object> getQrcodeByDeviceId(@PathVariable("deviceId") String deviceId, @RequestParam("qrcodeType") Integer qrcodeType){
|
||||
// 根据设备ID和二维码类型查询二维码信息
|
||||
QrCode qrCode = qrCodeService.getByDeviceIdAndType(deviceId, qrcodeType);
|
||||
Assert.notNull(qrCode,"二维码数据不能为空");
|
||||
|
||||
String waylineFilePath = fileCenterService.getFileViewUrl(qrCode.getWaylineId());
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("waylineFilePath",waylineFilePath);
|
||||
map.put("waylineId",qrCode.getWaylineId());
|
||||
map.put("codeId",qrCode.getCodeId());
|
||||
map.put("tourismId",qrCode.getTourismId());
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -105,17 +105,19 @@ public class TourismController {
|
||||
@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)
|
||||
@Parameter(name = "limit", description = "返回数量限制,默认20个", required = false, in = ParameterIn.QUERY),
|
||||
@Parameter(name = "showInHomepage", description = "是否在首页显示(0:不显示,1:显示),默认1(只显示设置为显示的景区)", 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) {
|
||||
@RequestParam(required = false) Integer limit,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer showInHomepage) {
|
||||
try {
|
||||
log.info("查询附近景区,经度: {}, 纬度: {}, 半径: {}km, 限制数量: {}", longitude, latitude, radius, limit);
|
||||
List<TourismWithDistance> tourisms = tourismService.findNearbyTourisms(longitude, latitude, radius, limit);
|
||||
log.info("查询附近景区,经度: {}, 纬度: {}, 半径: {}km, 限制数量: {}, 首页显示: {}", longitude, latitude, radius, limit, showInHomepage);
|
||||
List<TourismWithDistance> tourisms = tourismService.findNearbyTourisms(longitude, latitude, radius, limit, showInHomepage);
|
||||
return Result.succeed(tourisms, "查询附近景区成功");
|
||||
} catch (Exception e) {
|
||||
log.error("查询附近景区失败", e);
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.central.order.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 支付类型枚举
|
||||
*
|
||||
* @author system
|
||||
* @date 2024-12-19
|
||||
*/
|
||||
@Getter
|
||||
public enum PayTypeEnum {
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
*/
|
||||
WECHAT_PAY(1, "微信支付"),
|
||||
|
||||
/**
|
||||
* 优惠券支付
|
||||
*/
|
||||
COUPON_PAY(2, "优惠券支付");
|
||||
|
||||
private final Integer code;
|
||||
private final String desc;
|
||||
|
||||
PayTypeEnum(Integer code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
*/
|
||||
public static PayTypeEnum getByCode(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
}
|
||||
for (PayTypeEnum payType : values()) {
|
||||
if (payType.getCode().equals(code)) {
|
||||
return payType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断code是否有效
|
||||
*/
|
||||
public static boolean isValidCode(Integer code) {
|
||||
return getByCode(code) != null;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -532,7 +532,7 @@ public interface DashboardMapper {
|
||||
|
||||
@Select({
|
||||
"<script>",
|
||||
"SELECT code_id as value, name as label FROM qrcodes",
|
||||
"SELECT code_id as value, CONCAT(name, ' | ¥', FORMAT(price/100, 2), '元') as label FROM qrcodes",
|
||||
"WHERE is_del = 0",
|
||||
"<if test='p.includeTestQrcodes == null or p.includeTestQrcodes == false'>",
|
||||
" AND is_test = 0",
|
||||
|
||||
@@ -32,4 +32,19 @@ public interface QrCodeMapper extends SuperMapper<QrCode> {
|
||||
// ID查询
|
||||
QrCode getByCodeId(@Param("codeId") String codeId);
|
||||
|
||||
/**
|
||||
* 根据设备ID和二维码类型查询二维码信息
|
||||
* @param deviceId 设备ID
|
||||
* @param qrcodeType 二维码类型
|
||||
* @return 二维码信息
|
||||
*/
|
||||
QrCode getByDeviceIdAndType(@Param("deviceId") String deviceId, @Param("qrcodeType") Integer qrcodeType);
|
||||
|
||||
/**
|
||||
* 根据二维码ID列表批量查询二维码信息
|
||||
* @param codeIds 二维码ID列表
|
||||
* @return 二维码信息列表
|
||||
*/
|
||||
List<QrCode> getByCodeIds(@Param("codeIds") List<String> codeIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -48,13 +48,15 @@ public interface TourismMapper extends SuperMapper<Tourism> {
|
||||
* @param latitude 纬度
|
||||
* @param radius 搜索半径(公里)
|
||||
* @param limit 返回数量限制
|
||||
* @param showInHomepage 是否在首页显示(0:不显示,1:显示,null:显示所有)
|
||||
* @return 附近景区列表(包含距离信息)
|
||||
*/
|
||||
List<TourismWithDistance> findNearbyTourisms(
|
||||
@Param("longitude") BigDecimal longitude,
|
||||
@Param("latitude") BigDecimal latitude,
|
||||
@Param("radius") Double radius,
|
||||
@Param("limit") Integer limit
|
||||
@Param("limit") Integer limit,
|
||||
@Param("showInHomepage") Integer showInHomepage
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.central.common.model.SuperEntity;
|
||||
import com.central.order.enums.PayTypeEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -33,7 +35,11 @@ public class Order extends SuperEntity {
|
||||
private String workspaceId;
|
||||
|
||||
private String orderAmount;
|
||||
@Schema(description = "订单状态")
|
||||
private Integer orderStatus;
|
||||
|
||||
@Schema(description = "支付类型(1:微信支付,2:优惠券支付)")
|
||||
private Integer payType;
|
||||
|
||||
private Date payTime;
|
||||
|
||||
|
||||
@@ -105,4 +105,16 @@ public class QrCode extends SuperEntity {
|
||||
@Schema(description = "是否为测试二维码")
|
||||
private Integer isTest;
|
||||
|
||||
/**
|
||||
* 二维码类型(1:游客下单,2:定时巡查,3:其他)
|
||||
*/
|
||||
@Schema(description = "二维码类型(1:游客下单,2:定时巡查,3:其他)")
|
||||
private Integer qrcodeType;
|
||||
|
||||
/**
|
||||
* 是否只显示一键成片(0:否,1:是)
|
||||
*/
|
||||
@Schema(description = "是否只显示一键成片(0:否,1:是)")
|
||||
private Integer showVideoEditOnly;
|
||||
|
||||
}
|
||||
|
||||
@@ -54,4 +54,9 @@ public class Tourism extends SuperEntity {
|
||||
private String tenantId;
|
||||
private String company;
|
||||
private Integer isDel;
|
||||
|
||||
/**
|
||||
* 是否在首页显示(0:不显示,1:显示)
|
||||
*/
|
||||
private Integer showInHomepage;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.central.common.model.PageResult;
|
||||
import com.central.common.service.ISuperService;
|
||||
import com.central.order.model.QrCode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -34,5 +35,20 @@ public interface IQrCodeService extends ISuperService<QrCode> {
|
||||
* @return
|
||||
*/
|
||||
QrCode getByCodeId(String codeId);
|
||||
|
||||
/**
|
||||
* 根据设备ID和二维码类型查询二维码信息
|
||||
* @param deviceId 设备ID
|
||||
* @param qrcodeType 二维码类型
|
||||
* @return 二维码信息
|
||||
*/
|
||||
QrCode getByDeviceIdAndType(String deviceId, Integer qrcodeType);
|
||||
|
||||
/**
|
||||
* 根据二维码ID列表批量查询二维码信息
|
||||
* @param codeIds 二维码ID列表
|
||||
* @return 二维码信息列表
|
||||
*/
|
||||
List<QrCode> getByCodeIds(List<String> codeIds);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -53,9 +53,10 @@ public interface ITourismService extends ISuperService<Tourism> {
|
||||
* @param latitude 纬度
|
||||
* @param radius 搜索半径(公里)
|
||||
* @param limit 返回数量限制
|
||||
* @param showInHomepage 是否在首页显示(0:不显示,1:显示,null:显示所有)
|
||||
* @return 附近景区列表(包含距离信息)
|
||||
*/
|
||||
List<TourismWithDistance> findNearbyTourisms(BigDecimal longitude, BigDecimal latitude, Double radius, Integer limit);
|
||||
List<TourismWithDistance> findNearbyTourisms(BigDecimal longitude, BigDecimal latitude, Double radius, Integer limit, Integer showInHomepage);
|
||||
|
||||
/**
|
||||
* 根据经纬度范围查询景区
|
||||
|
||||
+14
@@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -51,6 +52,19 @@ public class QrCodeServiceImpl extends SuperServiceImpl<QrCodeMapper, QrCode> im
|
||||
return baseMapper.getByCodeId(codeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QrCode getByDeviceIdAndType(String deviceId, Integer qrcodeType) {
|
||||
return baseMapper.getByDeviceIdAndType(deviceId, qrcodeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<QrCode> getByCodeIds(List<String> codeIds) {
|
||||
if (codeIds == null || codeIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return baseMapper.getByCodeIds(codeIds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
-3
@@ -67,8 +67,8 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TourismWithDistance> findNearbyTourisms(BigDecimal longitude, BigDecimal latitude, Double radius, Integer limit) {
|
||||
log.info("查询附近景区,经度: {}, 纬度: {}, 半径: {}km, 限制数量: {}", longitude, latitude, radius, limit);
|
||||
public List<TourismWithDistance> findNearbyTourisms(BigDecimal longitude, BigDecimal latitude, Double radius, Integer limit, Integer showInHomepage) {
|
||||
log.info("查询附近景区,经度: {}, 纬度: {}, 半径: {}km, 限制数量: {}, 首页显示: {}", longitude, latitude, radius, limit, showInHomepage);
|
||||
|
||||
// 参数验证
|
||||
if (longitude == null || latitude == null) {
|
||||
@@ -84,7 +84,12 @@ public class TourismServiceImpl extends SuperServiceImpl<TourismMapper, Tourism>
|
||||
limit = 20; // 默认返回20个
|
||||
}
|
||||
|
||||
List<TourismWithDistance> tourisms = baseMapper.findNearbyTourisms(longitude, latitude, radius, limit);
|
||||
// 默认只显示设置为显示的景区
|
||||
if (showInHomepage == null) {
|
||||
showInHomepage = 1;
|
||||
}
|
||||
|
||||
List<TourismWithDistance> tourisms = baseMapper.findNearbyTourisms(longitude, latitude, radius, limit, showInHomepage);
|
||||
log.info("查询到附近景区数量: {}", tourisms.size());
|
||||
|
||||
// 为每个景区添加订单展示图片
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
<if test="p.deviceSn != null and p.deviceSn != ''">
|
||||
AND q.device_sn = #{p.deviceSn}
|
||||
</if>
|
||||
<if test="p.qrcodeType != null">
|
||||
AND q.qrcode_type = #{p.qrcodeType}
|
||||
</if>
|
||||
<if test="p.showVideoEditOnly != null">
|
||||
AND q.show_video_edit_only = #{p.showVideoEditOnly}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY q.create_time DESC
|
||||
</select>
|
||||
@@ -44,4 +50,22 @@
|
||||
INSERT INTO qrcodes (code_id, tourism_id, device_sn)
|
||||
VALUES (#{codeId}, #{tourismId}, #{deviceSn})
|
||||
</insert>
|
||||
|
||||
<select id="getByDeviceIdAndType" resultMap="QrCodeResultMap">
|
||||
SELECT * FROM qrcodes
|
||||
WHERE device_sn = #{deviceId}
|
||||
AND qrcode_type = #{qrcodeType}
|
||||
AND is_del = 0
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getByCodeIds" resultMap="QrCodeResultMap">
|
||||
SELECT * FROM qrcodes
|
||||
WHERE code_id IN
|
||||
<foreach collection="codeIds" item="codeId" open="(" separator="," close=")">
|
||||
#{codeId}
|
||||
</foreach>
|
||||
AND is_del = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -56,6 +56,21 @@
|
||||
AND status = 1
|
||||
AND longitude IS NOT NULL
|
||||
AND latitude IS NOT NULL
|
||||
]]>
|
||||
<choose>
|
||||
<when test="showInHomepage != null">
|
||||
<if test="showInHomepage == 1">
|
||||
AND (show_in_homepage = 1 OR show_in_homepage IS NULL)
|
||||
</if>
|
||||
<if test="showInHomepage == 0">
|
||||
AND show_in_homepage = 0
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (show_in_homepage = 1 OR show_in_homepage IS NULL)
|
||||
</otherwise>
|
||||
</choose>
|
||||
<![CDATA[
|
||||
HAVING distance <= #{radius}
|
||||
ORDER BY distance ASC
|
||||
]]>
|
||||
|
||||
Reference in New Issue
Block a user