fix(优惠券中心):携程订单接口对接第一版完成对接,新增加密请求体方法

This commit is contained in:
2025-08-14 20:17:29 +08:00
parent 31c62956e8
commit 993fcc2fa4
13 changed files with 172 additions and 15 deletions
@@ -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);
@@ -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",
@@ -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
);
/**
@@ -54,4 +54,9 @@ public class Tourism extends SuperEntity {
private String tenantId;
private String company;
private Integer isDel;
/**
* 是否在首页显示(0:不显示,1:显示)
*/
private Integer showInHomepage;
}
@@ -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);
/**
* 根据经纬度范围查询景区
@@ -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());
// 为每个景区添加订单展示图片
@@ -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
]]>