This commit is contained in:
2025-10-14 14:01:09 +08:00
parent b053809142
commit 6a082ca162
28 changed files with 2368 additions and 0 deletions

View File

@@ -0,0 +1,130 @@
package com.fly.boot.biz.ai.controller;
import cn.dev33.satoken.stp.StpUtil;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fly.boot.biz.ai.service.AITravelPlanService;
import com.fly.boot.common.result.Result;
import com.fly.boot.common.util.redis.RedisPrefix;
import com.fly.boot.common.util.redis.RedisService;
import com.fly.boot.core.annotation.SecurityParameter;
import com.fly.boot.modules.thirdParty.entity.query.*;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
/**
* 第三方域名管理
*/
@RestController
@RequestMapping("/boot/AITravelPlan")
@AllArgsConstructor
public class AITravelPlanController {
private final AITravelPlanService aiTravelPlanService;
private final RedisService redisService;
@SecurityParameter(inDecode = false)
@GetMapping("/getDestinationIndex")
public Result<Page<Object>> getDestinationIndex(@RequestParam(required = false) String comName,
@RequestParam String comType,
@RequestParam(required = false , defaultValue = "1") Integer pageNo,
@RequestParam(required = false , defaultValue = "10") Integer pageSize,
@RequestParam(required = false, defaultValue = "1") Integer IsHot,
@RequestParam(required = false, defaultValue = "1") Integer IsRecommond){
Long phone = Long.parseLong(String.valueOf(StpUtil.getExtra(StpUtil.getTokenValue(), "phone")));
Object objectUser = redisService.get(RedisPrefix.THIRD_PARTY_USER_INFO + phone);
if(objectUser == null){
aiTravelPlanService.travelPlanningLogin();
}
return Result.success(aiTravelPlanService.getDestinationIndex(comName,comType,pageNo,pageSize,IsHot,IsRecommond));
}
@SecurityParameter
@PostMapping("/Map/round")
public Result<Map<String,Object>> userSurroundings(@RequestBody AITravelPlanPOIParam aiTravelPlanPOIParam){
return Result.success(aiTravelPlanService.userSurroundings(aiTravelPlanPOIParam));
}
@SecurityParameter
@PostMapping("/travels/api/many/inputList")
public Result<JSONArray> poiSearchInterface(@RequestBody PoiSearchParam poiSearchParam){
return Result.success(aiTravelPlanService.poiSearchInterface(poiSearchParam));
}
@SecurityParameter
@PostMapping("/ope2/prefer")
public Result<Object> scenicAreaRecommendation(@RequestBody ScenicParam scenicParam){
return Result.success(aiTravelPlanService.scenicAreaRecommendation(scenicParam));
}
@SecurityParameter(inDecode = false)
@GetMapping("/travel/userLineInfo")
public Result<JSONArray> userLineInfo(@RequestParam(required = false , defaultValue = "100") Integer pageSize,
@RequestParam(required = false , defaultValue = "1") Integer pageNo
){
return Result.success(aiTravelPlanService.userLineInfo(pageNo,pageSize));
}
@SecurityParameter(inDecode = false)
@GetMapping("/thirdApi/line/detail")
public Result<JSONObject> lineDetails(@RequestParam Integer lineId){
return Result.success(aiTravelPlanService.lineDetails(lineId));
}
@SecurityParameter
@PostMapping("/thirdApi/map/replace")
public Result<JSONObject> projectReplaceList(@RequestBody ProjectReplaceParam projectReplaceParam){
return Result.success(aiTravelPlanService.projectReplaceList(projectReplaceParam));
}
@SecurityParameter
@PostMapping("/Map/travel/bxComLineAndComCodeAndComLineType")
public Result<JSONArray> systemRecommendedRoute(@RequestBody SystemLineParam systemLineParam){
return Result.success(aiTravelPlanService.systemRecommendedRoute(systemLineParam));
}
@SecurityParameter
@PostMapping("/third/user")
public Result<JSONObject> AITravelPlanningLogin(){
return Result.success(aiTravelPlanService.travelPlanningLogin());
}
@SecurityParameter
@PostMapping("/tou/v4")
public Result<JSONArray> AIApplyForRecommendedRoutes(@RequestBody AIRoutesParam aiRoutesParam){
return Result.success(aiTravelPlanService.AIApplyForRecommendedRoutes(aiRoutesParam));
}
@SecurityParameter(inDecode = false)
@GetMapping("/thirdApi/travel/tags")
public Result<JSONArray> preferenceTags(@RequestParam(required = false , defaultValue = "100") Integer pageSize,
@RequestParam(required = false , defaultValue = "1") Integer pageNo){
return Result.success(aiTravelPlanService.preferenceTags(pageNo,pageSize));
}
@SecurityParameter
@PostMapping("/tou/myline1")
public Result<JSONObject> saveCustomRoute(@RequestBody UserLineParam userLineParam){
return Result.success(aiTravelPlanService.saveCustomRoute(userLineParam));
}
@SecurityParameter(inDecode = false)
@GetMapping("/tou/single/details")
public Result<JSONObject> getPOICaption(@RequestParam String productId){
return Result.success(aiTravelPlanService.getPOICaption(productId));
}
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.fly.boot.biz.ai.dto;
import com.fly.boot.biz.ai.entity.AiScenicEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* ai语音解说景区景点表 数据传输对象实体类
*
* @author jinghan
* @since 2024-04-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class AiScenicDTO extends AiScenicEntity {
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.fly.boot.biz.ai.dto;
import com.fly.boot.biz.ai.entity.AiSysareaEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* ai语音解说地域表 数据传输对象实体类
*
* @author jinghan
* @since 2024-04-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class AiSysareaDTO extends AiSysareaEntity {
private static final long serialVersionUID = 1L;
}

View File

@@ -0,0 +1,242 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.fly.boot.biz.ai.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fly.boot.common.entity.BaseEntity;
////
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* ai语音解说景区景点表
* @author jinghan
* @since 2024-04-10
*/
@Data
@TableName("ai_scenic")
@EqualsAndHashCode(callSuper = true)
public class AiScenicEntity extends BaseEntity {
@JsonSerialize(using = ToStringSerializer.class)
//
private Long id;
/**
* 景区名称
*/
//
private String sName;
/**
* 1景区2景点3展品(...........)
*/
//")
private Integer sType;
/**
* 景区等级 如:1 :A 2:AA 3:AAA 4:AAAA 5:AAAAAA
*/
//
private String grade;
/**
* 坐标 采集时间
*/
//
private String createName;
/**
*
*/
//
private Date operationTime;
/**
*
*/
//
private String operationName;
/**
* 景区介绍
*/
//
private String introduce;
/**
* 地址
*/
//
private String address;
/**
* 开放时间
*/
//
private String openTime;
/**
* 票价详情
*/
//
private String priceDesc;
/**
* 小贴士
*/
//
private String tips;
/**
* 景区电话
*/
//
private String telephone;
/**
* 温馨提示
*/
//
private String suitable;
/**
* 交通信息
*/
//
private String traffic;
/**
* 一句话概括景区
*/
//
private String sign;
/**
* 数据来源
1:后台添加
2:启航景区添加
3:采集器添加
4:app主播自己加的景点
5:导入数据
*/
//
private Integer dataSource;
/**
* 二维码
*/
//
private Integer qrCode;
/**
* 二维码地址
*/
//
private String qrCodeUrl;
/**
* 编码(排序)
*/
//")
private String codeSort;
/**
* 是否托管:1启航管理(托管) 0巡洋舰自己管理 2启航自己应用在小程序里,APP中不显示此类景点
*/
// 0巡洋舰自己管理 2启航自己应用在小程序里,APP中不显示此类景点")
private Integer isSetSail;
/**
* 父子级
*/
//
private Long pid;
/**
* 所属地区(国内代表市ID,国外代表省[市]ID)
*/
//")
private Integer cnAreaId;
/**
* 是否显示 0:不显示(默认) 1:显示
*/
//
private Integer isShow;
/**
* 是否必听 0:不 1:必听
*/
//
private Integer isListen;
/**
*
*/
//
private Double gaoDeLon;
/**
*
*/
//
private Double gaoDeLat;
/**
* 海拔
*/
//
private String aiTitude;
/**
* 最佳播放距离
*/
//
private Double distance;
/**
* 空间标识
*/
//
private String spaceCode;
/**
* 方图URL
*/
//
private String squarePicUrl;
/**
* 评分
*/
//
private Double score;
/**
* 所属地区(国内代表省ID,国外代表国ID)
*/
//")
private Integer countryCnAreaId;
/**
* 非中文名
*/
//
private String alias;
/**
*
*/
//
private Long testId;
/**
* 手绘地图URL
*/
//
private String drawingMapUrl;
/**
* 手绘地图层级(11-18的正整数) 默认:15
*/
// 默认:15")
private Integer drawingMapHierarchy;
/**
* 是否落地 1:否 2:是 默认1
*/
//
private Integer isGround;
/**
* 落地时间
*/
//
private Date landingTime;
}

View File

@@ -0,0 +1,149 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.fly.boot.biz.ai.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fly.boot.common.entity.BaseEntity;
////
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* ai语音解说地域表 实体类
*
* @author jinghan
* @since 2024-04-10
*/
@Data
@TableName("ai_sysarea")
//
@EqualsAndHashCode(callSuper = true)
public class AiSysareaEntity extends BaseEntity {
@JsonSerialize(using = ToStringSerializer.class)
//
@TableId(value = "id")
private Long id;
/**
* 父级Id
*/
//
private Integer pid;
/**
* 名称
*/
//
private String areaName;
/**
* 地区图片
*/
//
private String areaImgUrl;
/**
* 长图
*/
//
private String areaLongImgUrl;
/**
* 首字母
*/
//
private String areaFirstLetter;
/**
* 1:国内 2:国际
*/
//
private Integer areaType;
/**
* 全拼
*/
//
private String fullPinYin;
/**
* 1省份、2特别行政区、5台湾省下的市、14直辖市(省级)、15直辖市(市级)
*/
//、15直辖市(市级)")
private Integer versionNo;
/**
* 暂时不需要。默认0
*/
//
private Integer isHot;
/**
* 地区级别(1.州 2.国家 3.省 4.市 5.区【县】)
*/
//")
private Integer areaLevel;
/**
* 缩略图
*/
//
private String areaThumbnail;
/**
* 英文名称
*/
//
private String english;
/**
* 景区个数
*/
//
private Integer areaScinceNumber;
/**
* 攻略个数
*/
//
private Integer raidersNum;
/**
* 地区故事图片个数
*/
//
private Integer areaImgNum;
/**
*
*/
//
private Double gaoDeLat;
/**
*
*/
//
private Double gaoDeLon;
/**
* 是否显示 0:不显示 1:显示(默认)
*/
//
private Integer isShow;
/**
* 城市简介
*/
//
private String areaIntroduction;
/**
* 二维码图片URL
*/
//
private String qrCodeUrl;
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.fly.boot.biz.ai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fly.boot.biz.ai.entity.AiScenicEntity;
import com.fly.boot.biz.ai.vo.AiScenicPageReqVO;
import com.fly.boot.biz.ai.vo.AiScenicVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ai语音解说景区景点表 Mapper 接口
*
* @author jinghan
* @since 2024-04-10
*/
@Mapper
public interface AiScenicMapper extends BaseMapper<AiScenicEntity> {
/**
* 自定义分页
*
* @param page
* @param reqVO
* @return
*/
List<AiScenicVO> selectAiScenicPage(IPage page, @Param("vo") AiScenicPageReqVO reqVO);
}

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fly.boot.biz.ai.mapper.AiScenicMapper">
<!-- 通用查询映射结果 -->
<resultMap id="aiScenicResultMap" type="com.fly.boot.biz.ai.entity.AiScenicEntity">
</resultMap>
<sql id="base_sql">
id
, s_name, s_type, grade, create_name,
operation_time, operation_name, introduce, address,
open_time, price_desc, tips, telephone,
suitable, traffic, sign, data_source,
qr_code, qr_code_url, code_sort, is_set_sail,
pid, cn_area_id, is_show, is_listen,
gao_de_lon, gao_de_lat, ai_titude, distance,
space_code, square_pic_url, score, country_cn_area_id,
alias, test_id, drawing_map_url, drawing_map_hierarchy,
is_ground, landing_time, create_user, create_dept,
create_time, update_user, update_time, status, is_deleted
</sql>
<select id="selectAiScenicPage" resultType="com.fly.boot.biz.ai.vo.AiScenicVO">
select
<include refid="base_sql"></include>
FROM
ai_scenic
<where>
is_deleted = 0
<if test="vo.sName != null and vo.sName != ''">
and s_name LIKE CONCAT('%', #{vo.sName}, '%')
</if>
<if test="vo.sType != null and vo.sType!=''">
AND s_type = #{vo.sType}
</if>
<if test="vo.cnAreaId != null and vo.cnAreaId">
AND cn_area_id = #{vo.cnAreaId}
</if>
<if test="vo.pid != null and vo.pid !=''">
AND pid = #{vo.pid}
</if>
<if test="vo.isShow != null">
AND is_show = #{vo.isShow}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.fly.boot.biz.ai.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fly.boot.biz.ai.entity.AiSysareaEntity;
import com.fly.boot.biz.ai.vo.AiSysareaReqVO;
import com.fly.boot.biz.ai.vo.AiSysareaRespVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ai语音解说地域表 Mapper 接口
*
* @author jinghan
* @since 2024-04-10
*/
@Mapper
public interface AiSysareaMapper extends BaseMapper<AiSysareaEntity> {
/**
* 查询所有 有景区的 城市
*
* @param sysareaReqVO
* @return
*/
List<AiSysareaRespVO> selectAiSysarea(@Param("vo") AiSysareaReqVO sysareaReqVO);
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fly.boot.biz.ai.mapper.AiSysareaMapper">
<!-- 通用查询映射结果 -->
<resultMap id="aiSysareaResultMap" type="com.fly.boot.biz.ai.entity.AiSysareaEntity">
</resultMap>
<select id="selectAiSysarea" parameterType="com.fly.boot.biz.ai.vo.AiSysareaReqVO" resultType="com.fly.boot.biz.ai.vo.AiSysareaRespVO">
select a.* from ai_scenic s
inner JOIN ai_sysarea a on s.cn_area_id = a.id
<where>
<if test="vo.areaLevel != null and vo.areaLevel !=''">
and a.area_level = #{vo.areaLevel}
</if>
<if test="vo.areaType != null and vo.areaType !=''">
and a.area_type = #{vo.areaType}
</if>
</where>
GROUP BY a.id
</select>
</mapper>

View File

@@ -0,0 +1,113 @@
package com.fly.boot.biz.ai.service;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fly.boot.modules.thirdParty.entity.query.*;
import java.util.Map;
public interface AITravelPlanService {
/**
* 目的地首页接口
* @param comName
* @param comType
* @param pageNo
* @param pageSize
* @param isHot
* @param isRecommond
* @return
*/
Page<Object> getDestinationIndex(String comName, String comType, Integer pageNo, Integer pageSize, Integer isHot, Integer isRecommond);
/**
* 用户周边的POI检索
* @param aiTravelPlanPOIParam
* @return
*/
Map<String,Object> userSurroundings(AITravelPlanPOIParam aiTravelPlanPOIParam);
/**
* 系统推荐路线
* @param aiTravelPlanPOIParam
* @return
*/
JSONArray systemRecommendedRoute(SystemLineParam systemLineParam);
/**
* AI旅行规划登录
* @param phone
* @return
*/
JSONObject travelPlanningLogin();
/**
* 申请AI智能推荐路线
* @param aiRoutesParam
* @return
*/
JSONArray AIApplyForRecommendedRoutes(AIRoutesParam aiRoutesParam);
/**
* POI搜索接口(应用场景:必去景点,不去景点等等)
* @param poiSearchParam
* @return
*/
JSONArray poiSearchInterface(PoiSearchParam poiSearchParam);
/**
* 必去&不去景区的推荐列表
* @param scenicParam
* @return
*/
Object scenicAreaRecommendation(ScenicParam scenicParam);
/**
* 查看个人保存的线路列表
* @param phone
* @param pageNo
* @param pageSize
* @return
*/
JSONArray userLineInfo(Integer pageNo, Integer pageSize);
/**
* 线路详情
* @param phone
* @param lineId
* @return
*/
JSONObject lineDetails(Integer lineId);
/**
* 项目替换的可选择列表
* @param projectReplaceParam
* @return
*/
JSONObject projectReplaceList(ProjectReplaceParam projectReplaceParam);
/**
* 需求偏好标签列表
* @param pageNo
* @param pageNo1
* @return
*/
JSONArray preferenceTags(Integer pageNo, Integer pageSize);
/**
* 保存定制线路
* @param userLineParam
* @return
*/
JSONObject saveCustomRoute(UserLineParam userLineParam);
/**
* 获取POI的解说词
* @param productId
* @return
*/
JSONObject getPOICaption(String productId);
}

View File

@@ -0,0 +1,331 @@
package com.fly.boot.biz.ai.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fly.boot.biz.ai.service.AITravelPlanService;
import com.fly.boot.biz.base.service.ParamService;
import com.fly.boot.common.constant.AITravelPlanConstant;
import com.fly.boot.common.result.ResultCode;
import com.fly.boot.common.util.jwt.JwtUtils;
import com.fly.boot.common.util.redis.RedisPrefix;
import com.fly.boot.common.util.redis.RedisService;
import com.fly.boot.core.excetion.FlyException;
import com.fly.boot.modules.thirdParty.entity.query.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
public class AITravelPlanServiceImpl implements AITravelPlanService {
@Resource
private RedisService redisService;
@Resource
private JwtUtils jwtUtils;
@Resource
private ParamService paramService;
@Override
public Page<Object> getDestinationIndex(String comName, String comType, Integer pageNo, Integer pageSize, Integer isHot, Integer isRecommond) {
Map<String, Object> paramMap = new HashMap<>();
if (comName!=null && !"".equalsIgnoreCase(comName)) {
paramMap.put("comName",comName); // 目的地类型 景区:A1;城市:A2
}
paramMap.put("comType",comType); // 目的地类型 景区:A1;城市:A2
paramMap.put("traId",paramService.getAITravelPlatformId()); // 机构ID
paramMap.put("pageNo",pageNo); // 分页页码,从1开始
paramMap.put("pageSize",pageSize); // 分页页码,从1开始
paramMap.put("isHot",isHot); // 是否热门:0=否;1=是
paramMap.put("isRecommond",isRecommond); // 是否推荐:0=否;1=是
//链式构建请求
String result2 = HttpUtil.get(AITravelPlanConstant.GET_ONLINE_URL,paramMap);
JSONObject jsonObject = JSONObject.parseObject(result2);
Page<Object> page = new Page<>();
page.setSize(pageSize);
page.setTotal(Long.parseLong(String.valueOf(jsonObject.get("count"))));
page.setCurrent(pageNo);
JSONArray data = JSONArray.parseArray(jsonObject.get("data").toString());
List<Object> list = JSONArray.parseArray(data.toString(), Object.class);
page.setRecords(list);
return page;
}
@Override
public Map<String,Object> userSurroundings(AITravelPlanPOIParam aiTravelPlanPOIParam) {
Map<String,Object> data = new HashMap<>();
//链式构建请求
String result = HttpUtil.post(AITravelPlanConstant.MAP_ROUND_URL,JSONUtil.parseObj(aiTravelPlanPOIParam));
JSONObject jsonObject = JSONObject.parseObject(JSONObject.parseObject(result).get("data").toString());
data.put("coordinate",jsonObject.get("coordinate"));
data.put("count",jsonObject.get("count"));
data.put("list",Collections.singletonList(JSONArray.parseArray(jsonObject.get("list").toString())));
return data;
}
@Override
public JSONArray systemRecommendedRoute(SystemLineParam systemLineParam) {
//链式构建请求
String result = HttpUtil.post(AITravelPlanConstant.SYSTEM_RECOMMENDED_ROUTE,JSONUtil.parseObj(systemLineParam));
Object objectData = JSONObject.parseObject(result).get("data");
if(objectData == null){
return new JSONArray();
}
return JSONArray.parseArray(objectData.toString());
}
@Override
public JSONObject travelPlanningLogin() {
Long phone = Long.parseLong(String.valueOf(StpUtil.getExtra(StpUtil.getTokenValue(), "phone")));
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("phone",phone);
paramMap.put("platform",paramService.getAITravelPlatformId());
//链式构建请求
String result = HttpUtil.get(AITravelPlanConstant.USER_LOGIN,paramMap);
log.info("用户参数:{}",result);
JSONObject returnData = JSONObject.parseObject(JSONObject.parseObject(result).get("data").toString());
redisService.set(RedisPrefix.THIRD_PARTY_USER_INFO + phone,returnData, jwtUtils.EXPIRATION_TIME_MINUTE);
return returnData;
}
@Override
public JSONArray AIApplyForRecommendedRoutes(AIRoutesParam aiRoutesParam) {
Map<String, String > heads = new HashMap<>();
heads.put("Content-Type", "application/json;charset=UTF-8");
String result = HttpRequest.post(AITravelPlanConstant.AI_RECOMMENDED_ROUTE)
.headerMap(heads, false)
.body(String.valueOf(JSONUtil.parseObj(aiRoutesParam))).execute().body();
log.info("请求的url: {}",AITravelPlanConstant.AI_RECOMMENDED_ROUTE);
log.info("请求的header: {}",heads);
log.info("返回的结果: {}",result);
int code = Integer.parseInt(JSONObject.parseObject(result).get("result").toString());
if(code != 1 ) {
throw new FlyException(ResultCode.FAILURE.code(), JSONObject.parseObject(result).get("message").toString());
}
return JSONArray.parseArray(JSONObject.parseObject(result).get("schedule").toString());
}
@Override
public JSONArray poiSearchInterface(PoiSearchParam poiSearchParam) {
//链式构建请求
String result = HttpUtil.post(AITravelPlanConstant.POI_SEARCH_INTERFACE,JSONUtil.parseObj(poiSearchParam));
Object objectData = JSONObject.parseObject(result).get("data");
if(objectData == null){
return new JSONArray();
}
return JSONArray.parseArray(objectData.toString());
}
@Override
public Object scenicAreaRecommendation(ScenicParam scenicParam) {
//链式构建请求
String result = HttpUtil.post(AITravelPlanConstant.RECOMMENDATION_SCENIC_SPOTS, JSONUtil.parseObj(scenicParam));
log.info("返回的数据: {}",result);
Integer code = Integer.valueOf(JSONObject.parseObject(result).get("code").toString());
if(code != 1){
return new Object();
}
Object objectData = JSONObject.parseObject(result).get("data");
if(objectData == null){
return new Object();
}
Integer size = Integer.valueOf(JSONObject.parseObject(objectData.toString()).get("size").toString());
if(size == 0){
return new Object();
}
Object list = JSONObject.parseObject(objectData.toString()).get("BxMerchantList");
log.info("返回的数据list: {}",list);
return list;
}
@Override
public JSONArray userLineInfo(Integer pageNo, Integer pageSize) {
Long phone = Long.parseLong(String.valueOf(StpUtil.getExtra(StpUtil.getTokenValue(), "phone")));
Object objectUser = redisService.get(RedisPrefix.THIRD_PARTY_USER_INFO + phone);
if(objectUser == null){
travelPlanningLogin();
objectUser = redisService.get(RedisPrefix.THIRD_PARTY_USER_INFO + phone);
}
String userId = JSONObject.parseObject(objectUser.toString()).get("bxUserId").toString();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("userId",userId);
paramMap.put("pageNo",pageNo);
paramMap.put("pageSize",pageSize);
paramMap.put("lang",1);
//链式构建请求
String result = HttpUtil.get(AITravelPlanConstant.USER_LINE_INFO,paramMap);
log.info("result: {}",result);
Object objectData = JSONObject.parseObject(result).get("data");
if(objectData == null){
return new JSONArray();
}
return JSONArray.parseArray(objectData.toString());
}
@Override
public JSONObject lineDetails(Integer lineId) {
Long phone = Long.parseLong(String.valueOf(StpUtil.getExtra(StpUtil.getTokenValue(), "phone")));
Object objectUser = redisService.get(RedisPrefix.THIRD_PARTY_USER_INFO + phone);
if(objectUser == null){
travelPlanningLogin();
objectUser = redisService.get(RedisPrefix.THIRD_PARTY_USER_INFO + phone);
}
String userId = JSONObject.parseObject(objectUser.toString()).get("bxUserId").toString();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("userId",userId);
paramMap.put("id",lineId);
paramMap.put("lang",1);
String result = HttpUtil.get(AITravelPlanConstant.LINE_DETAILS,paramMap);
log.info("返回参数: {}",result);
JSONObject jsonObject = null;
try {
jsonObject = JSONObject.parseObject(result);
return JSONObject.parseObject(JSONObject.parseObject(result).get("data").toString());
}catch (RuntimeException e){
throw new RuntimeException("旅行规划调用失败!");
}
}
@Override
public JSONObject projectReplaceList(ProjectReplaceParam projectReplaceParam) {
log.info("projectReplaceParam: {}",projectReplaceParam);
//链式构建请求
// String result = HttpUtil.post(AITravelPlanConstant.PROJECT_REPLACEMENT_LIST,JSONUtil.parseObj(projectReplaceParam));
String result = HttpRequest.post(AITravelPlanConstant.PROJECT_REPLACEMENT_LIST)
.body(JSONObject.toJSONString(projectReplaceParam)).execute().body();
log.info("projectReplaceParam: {}",JSONObject.toJSONString(projectReplaceParam));
log.info("result: {}",result);
Object objectData = JSONObject.parseObject(result).get("data");
if(objectData == null){
return new JSONObject();
}
return JSONObject.parseObject(objectData.toString());
}
@Override
public JSONArray preferenceTags(Integer pageNo, Integer pageSize) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("pageNo",pageNo);
paramMap.put("pageSize",pageSize);
paramMap.put("lang",1);
//链式构建请求
String result = HttpUtil.get(AITravelPlanConstant.PREFERENCE_TAGS,paramMap);
Object objectData = JSONObject.parseObject(result).get("data");
if(objectData == null){
return new JSONArray();
}
return JSONArray.parseArray(objectData.toString());
}
@Override
public JSONObject saveCustomRoute(UserLineParam userLineParam) {
Long phone = Long.parseLong(String.valueOf(StpUtil.getExtra(StpUtil.getTokenValue(), "phone")));
userLineParam.setPhone(phone);
Object objectUser = redisService.get(RedisPrefix.THIRD_PARTY_USER_INFO + userLineParam.getPhone());
if(objectUser == null){
travelPlanningLogin();
objectUser = redisService.get(RedisPrefix.THIRD_PARTY_USER_INFO + userLineParam.getPhone());
}
String userId = JSONObject.parseObject(objectUser.toString()).get("bxUserId").toString();
String userToken = JSONObject.parseObject(objectUser.toString()).get("userToken").toString();
userLineParam.setUserid(userId);
log.info("传参:{}",JSONUtil.parseObj(userLineParam));
Map<String, String > heads = new HashMap<>();
heads.put("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
String jsonString = JSONObject.toJSONString(userLineParam);
log.info("head参数:{}",heads);
// JSONObject userLineJsonObject = JSONObject.parseObject(jsonString);
Map<String,Object> param = new HashMap<>();
param.put("line_level",userLineParam.getLine_level());
param.put("line_name",userLineParam.getLine_name());
param.put("userid", userId);
param.put("phone",userLineParam.getPhone());
log.info("mapList:{}",JSONArray.parseArray(JSONObject.toJSONString(userLineParam.getList())));
param.put("list",JSONArray.parseArray(JSON.toJSONString(userLineParam.getList())).toString());
log.info("param:{}",param);
String result = HttpRequest.post(AITravelPlanConstant.SAVE_CUSTOM_ROUTE)
.headerMap(heads, false)
.form(param).execute().body();
log.info("result: {}",result);
if(!"1".equalsIgnoreCase(JSONObject.parseObject(result).get("result").toString())){
throw new FlyException(JSONObject.parseObject(result).get("message").toString());
}
return JSONObject.parseObject(JSONObject.parseObject(result).get("data").toString());
}
@Override
public JSONObject getPOICaption(String productId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("product_id",productId);
paramMap.put("lang",1);
//链式构建请求
String result = HttpUtil.get(AITravelPlanConstant.GET_POI_CAPTION,paramMap);
return JSONObject.parseObject(JSONObject.parseObject(result).get("data").toString());
}
}

View File

@@ -0,0 +1,125 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.fly.boot.biz.ai.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fly.boot.biz.ai.convert.AiConverter;
import com.fly.boot.biz.ai.entity.AiScenicEntity;
import com.fly.boot.biz.ai.mapper.AiScenicMapper;
import com.fly.boot.biz.ai.service.IAiAudioService;
import com.fly.boot.biz.ai.service.IAiScenicService;
import com.fly.boot.biz.ai.vo.AiAudioVO;
import com.fly.boot.biz.ai.vo.AiScenicDetailVO;
import com.fly.boot.biz.ai.vo.AiScenicPageReqVO;
import com.fly.boot.biz.ai.vo.AiScenicVO;
import com.fly.boot.common.constant.AiAudioConstant;
import com.fly.boot.common.util.coordinateBounds.CoordinateBoundsUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* ai语音解说景区景点表 服务实现类
*
* @author jinghan
* @since 2024-04-10
*/
@AllArgsConstructor
@Service
public class AiScenicServiceImpl extends ServiceImpl<AiScenicMapper, AiScenicEntity> implements IAiScenicService {
private final IAiAudioService aiAudioService;
@Override
public Page<AiScenicVO> selectPage(AiScenicPageReqVO aiScenicPageReqVO) {
Page<AiScenicVO> page = new Page<>(aiScenicPageReqVO.getCurrentPage(), aiScenicPageReqVO.getPageSize());
if (StringUtils.hasLength(aiScenicPageReqVO.getRegionDocumentId()) && !StringUtils.hasLength(aiScenicPageReqVO.getCnAreaId())) {
}
// 景区关联剔除区域管理
if (StrUtil.isNotEmpty(aiScenicPageReqVO.getPid())) {
aiScenicPageReqVO.setCnAreaId(null);
}
if (aiScenicPageReqVO.getIsShow() == null) {
aiScenicPageReqVO.setIsShow(AiAudioConstant.ShowStatus.SHOW.getValue());
}
List<AiScenicVO> aiScenicVOS = baseMapper.selectAiScenicPage(page, aiScenicPageReqVO);
if (aiScenicVOS.isEmpty()) {
return page.setRecords(aiScenicVOS);
}
if (aiScenicPageReqVO.getLatitude() != null && aiScenicPageReqVO.getLongitude() != null) {
aiScenicVOS.forEach(vo -> {
if (vo.getGaoDeLat() != null && vo.getGaoDeLon() != null) {
double distance = CoordinateBoundsUtils.calculateDistance(vo.getGaoDeLon(), vo.getGaoDeLat(), aiScenicPageReqVO.getLongitude(), aiScenicPageReqVO.getLatitude());
vo.setPeopleDistance(distance);
}
});
// 依据距离排序
aiScenicVOS = aiScenicVOS.stream().sorted(Comparator.comparing(AiScenicVO::getPeopleDistance)).collect(Collectors.toList());
}
// 构建音频数据
List<Long> scenicIds = aiScenicVOS.stream().map(AiScenicVO::getId).collect(Collectors.toList());
Map<Long, List<AiAudioVO>> byScenicId = aiAudioService.findByScenicId(scenicIds);
aiScenicVOS.forEach(v -> {
v.setAiAudioVOS(byScenicId.get(v.getId()));
});
return page.setRecords(aiScenicVOS);
}
/**
* 景区详细
*
* @param id
* @return
*/
@Override
public AiScenicDetailVO scenicDetail(String id) {
AiScenicEntity scenicEntity = this.getById(id);
Assert.notNull(scenicEntity, "景区不存在");
AiScenicDetailVO aiScenicDetailVO = AiConverter.INSTANCE.convertToVO(scenicEntity);
aiScenicDetailVO.setAiAudioVOS(aiAudioService.findByScenicId(Long.valueOf(id)));
// 构建 下级景点数据
Optional.ofNullable(list(Wrappers.lambdaQuery(AiScenicEntity.class)
.eq(AiScenicEntity::getPid, id)
.ne(AiScenicEntity::getId, id)
.eq(AiScenicEntity::getIsShow, AiAudioConstant.ShowStatus.SHOW.getValue())))
.filter(attractions -> !attractions.isEmpty())
.ifPresent(attractions -> {
List<AiScenicVO> childrenScenicVOS = AiConverter.INSTANCE.convertToScenicVOList(attractions);
// 构建音频数据
Map<Long, List<AiAudioVO>> byScenicId = aiAudioService.findByScenicId(childrenScenicVOS.stream().map(AiScenicVO::getId).collect(Collectors.toList()));
childrenScenicVOS.forEach(v -> {
v.setAiAudioVOS(byScenicId.get(v.getId()));
});
aiScenicDetailVO.setChildrenScenicVOS(childrenScenicVOS);
}
);
return aiScenicDetailVO;
}
}

View File

@@ -0,0 +1,87 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.fly.boot.biz.ai.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fly.boot.biz.ai.convert.AiConverter;
import com.fly.boot.biz.ai.entity.AiSysareaEntity;
import com.fly.boot.biz.ai.mapper.AiSysareaMapper;
import com.fly.boot.biz.ai.service.IAiSysareaService;
import com.fly.boot.biz.ai.vo.AiSysareaReqVO;
import com.fly.boot.biz.ai.vo.AiSysareaRespVO;
import com.fly.boot.common.constant.AiAudioConstant;
import com.fly.boot.common.util.coordinateBounds.CoordinateBoundsUtils;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* ai语音解说地域表 服务实现类
*
* @author jinghan
* @since 2024-04-10
*/
@Service
@AllArgsConstructor
public class AiSysareaServiceImpl extends ServiceImpl<AiSysareaMapper, AiSysareaEntity> implements IAiSysareaService {
@Override
public List<AiSysareaRespVO> selectAiSysarea(AiSysareaReqVO areaReqVO) {
// 默认国内市
if (StrUtil.isBlank(areaReqVO.getAreaLevel())) {
areaReqVO.setAreaLevel(AiAudioConstant.AREA_LEVEL_CITY);
}
if (StrUtil.isBlank(areaReqVO.getAreaType())) {
areaReqVO.setAreaType(AiAudioConstant.AREA_TYPE_CN);
}
return baseMapper.selectAiSysarea(areaReqVO);
}
@Override
public List<AiSysareaRespVO> selectByPid(String pid) {
LambdaQueryWrapper<AiSysareaEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(AiSysareaEntity::getIsDeleted, "0");
queryWrapper.eq(AiSysareaEntity::getPid, pid);
List<AiSysareaEntity> entities = baseMapper.selectList(queryWrapper);
return AiConverter.INSTANCE.convertToVOList(entities);
}
@Override
public List<AiSysareaRespVO> areaNearCity(AiSysareaReqVO sysareaReqVO) {
List<AiSysareaRespVO> aiSysareaRespVOS = selectAiSysarea(sysareaReqVO);
return aiSysareaRespVOS.stream()
.filter(v -> v.getGaoDeLon() != null && v.getGaoDeLat() != null)
.map(vo -> {
double distance = CoordinateBoundsUtils.calculateDistance(vo.getGaoDeLon(), vo.getGaoDeLat(), sysareaReqVO.getLongitude(), sysareaReqVO.getLatitude());
vo.setPeopleDistance(distance);
return vo;
})
.sorted(Comparator.comparingDouble(AiSysareaRespVO::getPeopleDistance))
.collect(Collectors.toList());
}
@Override
public List<AiSysareaEntity> all() {
return list(Wrappers.lambdaQuery(AiSysareaEntity.class).eq(AiSysareaEntity::getIsDeleted, false));
}
}

View File

@@ -0,0 +1,36 @@
package com.fly.boot.biz.ai.vo;
import com.fly.boot.biz.ai.entity.AiScenicEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* 景区景点详细
* @author jinghan
* @since 2024-04-10
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class AiScenicDetailVO extends AiScenicEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 下级景点目录
*/
private List<AiScenicVO> childrenScenicVOS;
/**
* 当前景区的音频列表
*/
private List<AiAudioVO> aiAudioVOS;
/**
* 距离
*/
private double peopleDistance;
}

View File

@@ -0,0 +1,71 @@
package com.fly.boot.biz.ai.vo;
import lombok.Data;
/**
* 景区
*
* @author jinghan
* @since 2024-04-10
*/
@Data
public class AiScenicPageReqVO {
/**
* 地理位置id
*/
private String regionDocumentId;
/**
* 每页条数
*/
public Integer pageSize = 10;
/**
* 当前页
*/
public Integer currentPage = 1;
/**
* 所属地区id(国内代表市ID,国外代表省[市]ID)
*/
private String cnAreaId;
/**
* 景区名称
*/
private String sName;
/**
* 1景区2景点3展品(...........)
*/
private String sType;
/**
* 父级景区id
*/
private String pid;
/**
* 是否显示 0:不显示(默认) 1:显示
*/
private Integer isShow;
/**
* 当传入纬度时会进行排序",example = "30.666453
*/
private Double latitude;
/**
* 经度
*/
private Double longitude;
}

View File

@@ -0,0 +1,233 @@
package com.fly.boot.biz.ai.vo;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
////
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* ai语音解说景区景点表 视图实体类
*
* @author jinghan
* @since 2024-04-10
*/
//
@Data
public class AiScenicVO {
private static final long serialVersionUID = 1L;
@JsonSerialize(using = ToStringSerializer.class)
//
@TableId(value = "id")
private Long id;
/**
* 景区名称
*/
//
private String sName;
/**
* 1景区2景点3展品(...........)
*/
//")
private Integer sType;
/**
* 景区等级 如:1 :A 2:AA 3:AAA 4:AAAA 5:AAAAAA
*/
//
private String grade;
/**
* 坐标 采集时间
*/
//
private String createName;
/**
*
*/
//
private Date operationTime;
/**
*
*/
//
private String operationName;
/**
* 景区介绍
*/
//
private String introduce;
/**
* 地址
*/
//
private String address;
/**
* 开放时间
*/
//
private String openTime;
/**
* 票价详情
*/
//
private String priceDesc;
/**
* 小贴士
*/
//
private String tips;
/**
* 景区电话
*/
//
private String telephone;
/**
* 温馨提示
*/
//
private String suitable;
/**
* 交通信息
*/
//
private String traffic;
/**
* 一句话概括景区
*/
//
private String sign;
/**
* 数据来源
1:后台添加
2:启航景区添加
3:采集器添加
4:app主播自己加的景点
5:导入数据
*/
//
private Integer dataSource;
/**
* 二维码
*/
//
private Integer qrCode;
/**
* 二维码地址
*/
//
private String qrCodeUrl;
/**
* 编码(排序)
*/
//")
private String codeSort;
/**
* 是否托管:1启航管理(托管) 0巡洋舰自己管理 2启航自己应用在小程序里,APP中不显示此类景点
*/
// 0巡洋舰自己管理 2启航自己应用在小程序里,APP中不显示此类景点")
private Integer isSetSail;
/**
* 父子级
*/
//
private Long pid;
/**
* 所属地区(国内代表市ID,国外代表省[市]ID)
*/
//")
private Integer cnAreaId;
/**
* 是否显示 0:不显示(默认) 1:显示
*/
//
private Integer isShow;
/**
* 是否必听 0:不 1:必听
*/
//
private Integer isListen;
/**
*
*/
//
private Double gaoDeLon;
/**
*
*/
//
private Double gaoDeLat;
/**
* 海拔
*/
//
private String aiTitude;
/**
* 最佳播放距离
*/
//
private Double distance;
/**
* 空间标识
*/
//
private String spaceCode;
/**
* 方图URL
*/
//
private String squarePicUrl;
/**
* 评分
*/
//
private Double score;
/**
* 所属地区(国内代表省ID,国外代表国ID)
*/
//")
private Integer countryCnAreaId;
/**
* 非中文名
*/
//
private String alias;
/**
*
*/
//
private Long testId;
/**
* 手绘地图URL
*/
//
private String drawingMapUrl;
/**
* 手绘地图层级(11-18的正整数) 默认:15
*/
// 默认:15")
private Integer drawingMapHierarchy;
/**
* 是否落地 1:否 2:是 默认1
*/
//
private Integer isGround;
/**
* 落地时间
*/
//
private Date landingTime;
private List<AiAudioVO> aiAudioVOS;
//
private double peopleDistance;
}

View File

@@ -0,0 +1,43 @@
package com.fly.boot.biz.ai.vo;
////
import lombok.Data;
import java.io.Serializable;
/**
* 查询地区
*
* @author jinghan
* @since 2024-04-10
*/
@Data
public class AiSysareaReqVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 1:国内 2:国际
*/
private String areaType;
/**
* 地区级别(1.州 2.国家 3.省 4.市 5.区【县】)
*/
private String areaLevel;
/**
* 纬度
*/
private Double latitude;
/**
* 经度
*/
private Double longitude;
}

View File

@@ -0,0 +1,23 @@
package com.fly.boot.biz.ai.vo;
import com.fly.boot.biz.ai.entity.AiSysareaEntity;
////
import lombok.Data;
/**
* 景区地区列表
*
* @author jinghan
* @since 2024-04-10
*/
//
@Data
public class AiSysareaRespVO extends AiSysareaEntity {
private static final long serialVersionUID = 1L;
//
private double peopleDistance;
}

View File

@@ -0,0 +1,51 @@
package com.fly.boot.biz.customer.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum AliYunAuthCodeEnum {
SUCCESS(200, "认证通过"),
NAME_IDCARD_NOT_MATCH(201, "姓名和身份证不一致"),
NOT_ID_CARD(202, "查询不到身份信息"),
NOT_IMAGE(203, "查询不到照片或照片不可用"),
FACE_NOT_PASS(204, "人脸比对不一致"),
FACE_IS_ERROR(205, "活体检测存在风险"),
SERVICE_NOT_PASS(206, "业务策略限制"),
FACE_NOT_ISCARD(207, "人脸与身份证人脸比对不一致"),
COMPARISON_SOURCE_ANOMALY(209, "权威比对源异常"),
EXPRESSION_NOT_PASS(220, "意愿判定不通过"),
VOICE_NOT_PASS(221, "声纹比对不一致"),
GET_ID_CARD_ERROR(222, "获取证件信息失败"),
;
final int code ;
final String msg;
/**
* 匹配枚举值
*
* @param name 名称
* @return OssEnum
*/
public static AliYunAuthCodeEnum of(Integer code) {
if (code == null) {
return null;
}
AliYunAuthCodeEnum[] values = AliYunAuthCodeEnum.values();
for (AliYunAuthCodeEnum authCodeEnum : values) {
if (authCodeEnum.code == code) {
return authCodeEnum;
}
}
return null;
}
}

View File

@@ -0,0 +1,36 @@
package com.fly.boot.biz.flightTrain.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @author jinghan
* @since 2024-04-10
*/
@Data
@EqualsAndHashCode
public class AirPortPageReqVO {
@NotNull(message = "每页条数不能为空")
@Min(value = 1, message = "每页条数不能小于1")
public Integer pageSize = 10;
@NotNull(message = "当前页不能为空")
@Min(value = 1, message = "当前页不能小于1")
public Integer currentPage = 1;
/**
* 搜索内容
*/
private String searchText;
}

View File

@@ -0,0 +1,26 @@
package com.fly.boot.biz.payment.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "alipay")
public class AliPayConfiguration {
private String host;
private String appId;
private String publicKey;
private String privateKey;
private String aesKey;
private String signType;
private String notifyUrl;
}

View File

@@ -0,0 +1,135 @@
package com.fly.boot.biz.payment.service;
import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import com.alipay.easysdk.payment.app.models.AlipayTradeAppPayResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeCloseResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeFastpayRefundQueryResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
import com.alipay.easysdk.payment.common.models.AlipayTradeRefundResponse;
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePayResponse;
import com.fly.boot.biz.payment.config.AliPayConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Slf4j
@Component
public class AliPayment extends AbstractPayService {
@Resource
private AliPayConfiguration configuration;
@PostConstruct
public void initConfig() {
Config config = new Config();
config.protocol = "https";
config.gatewayHost = configuration.getHost();
config.signType = configuration.getSignType();
config.appId = configuration.getAppId();
config.merchantPrivateKey = configuration.getPrivateKey();
config.alipayPublicKey = configuration.getPublicKey();
config.notifyUrl = configuration.getNotifyUrl();
config.encryptKey = configuration.getAesKey();
Factory.setOptions(config);
}
@Override
public String pay(BigDecimal paymentAmount, String tradeNo , String remark) throws Exception {
if (paymentAmount == null || paymentAmount.compareTo(BigDecimal.ZERO) < 1 || !StringUtils.hasLength(tradeNo)) {
throw new RuntimeException("参数错误");
}
AlipayTradeAppPayResponse pay = Factory.Payment.App().pay(remark, tradeNo, String.valueOf(paymentAmount.setScale(2, RoundingMode.HALF_UP)));
return pay.getBody();
}
public Boolean payScan(String userCode, BigDecimal amount, String orderNumber) throws Exception {
if (amount == null || amount.compareTo(BigDecimal.ZERO) < 0 || !StringUtils.hasLength(orderNumber) || !StringUtils.hasLength(userCode)) {
throw new RuntimeException("参数错误");
}
AlipayTradePayResponse response = Factory.Payment.FaceToFace()
.pay(orderNumber, orderNumber, String.valueOf(amount.setScale(2, RoundingMode.UP)), userCode);
return response.getCode().equalsIgnoreCase("10000");
}
@Override
public Boolean query(String tradeNo) throws Exception {
if (!StringUtils.hasLength(tradeNo)) {
throw new RuntimeException("参数错误");
}
AlipayTradeQueryResponse query = Factory.Payment.Common().query(tradeNo);
log.info("支付宝账单:[{}]的支付结果为:{}", tradeNo, query.getHttpBody());
return query.getTradeStatus().equalsIgnoreCase("TRADE_SUCCESS")
|| query.getTradeStatus().equalsIgnoreCase("TRADE_FINISHED");
}
@Override
public String refund(BigDecimal refundAmount, String tradeNo) throws Exception {
//全退
AlipayTradeRefundResponse refund = Factory.Payment.Common().refund(tradeNo, String.valueOf(refundAmount));
return refund.getTradeNo();
}
public String refundPartial(BigDecimal refundAmount, String tradeNo, String refundNo) throws Exception {
//部分退
AlipayTradeRefundResponse refund = Factory.Payment.Common().optional("out_request_no", refundNo).refund(tradeNo, String.valueOf(refundAmount));
return refund.getTradeNo();
}
@Override
public Boolean queryRefund(String tradeNo, String refundNo) throws Exception {
AlipayTradeFastpayRefundQueryResponse query = Factory.Payment.Common().queryRefund(tradeNo, refundNo);
log.info("支付宝账单:[{}]的退款结果为:{}", tradeNo, query.getHttpBody());
return query.getCode().equals("10000") && query.getMsg().equalsIgnoreCase("Success");
}
@Override
public Boolean closeOrder(String tradeNo) throws Exception {
AlipayTradeCloseResponse response = Factory.Payment.Common().close(tradeNo);
return response.getCode().equals("10000") && response.getMsg().equalsIgnoreCase("Success");
}
public Boolean verifyNotify(Map<String, String> params) throws Exception {
// 验签
return Factory.Payment.Common().verifyNotify(params);
}
// 将request中的参数转换成Map
public static Map<String, String> convertRequestParamsToMap(HttpServletRequest request) {
Map<String, String> retMap = new HashMap<>();
Set<Map.Entry<String, String[]>> entrySet = request.getParameterMap().entrySet();
for (Map.Entry<String, String[]> entry : entrySet) {
String name = entry.getKey();
String[] values = entry.getValue();
int valLen = values.length;
if (valLen == 1) {
retMap.put(name, values[0]);
} else if (valLen > 1) {
StringBuilder sb = new StringBuilder();
for (String val : values) {
sb.append(",").append(val);
}
retMap.put(name, sb.substring(1));
} else {
retMap.put(name, "");
}
}
return retMap;
}
}

View File

@@ -0,0 +1,35 @@
package com.fly.boot.common.constant;
public interface AITravelPlanConstant {
Integer TRA_ID = 19;
String URL = "https://www.ai-peer.com";
String GET_ONLINE_URL = URL + "/thirdApi/travel/getOnLine";
String MAP_ROUND_URL = URL + "/thirdApi/Map/round";
String SYSTEM_RECOMMENDED_ROUTE = URL + "/thirdApi/travel/bxComLineAndComCodeAndComLineType";
String POI_SEARCH_INTERFACE = URL + "/travels/api/many/inputList/";
String RECOMMENDATION_SCENIC_SPOTS = URL + "/ope2/prefer";
String USER_LOGIN = URL + "/thirdApi/third/user";
String USER_LINE_INFO = URL + "/thirdApi/travel/userLineInfo";
String LINE_DETAILS = URL + "/thirdApi/line/detail";
String PROJECT_REPLACEMENT_LIST = URL + "/thirdApi/Map/replace";
String AI_RECOMMENDED_ROUTE = URL + "/tou/v4/";
String PREFERENCE_TAGS = URL + "/thirdApi/travel/tags";
String SAVE_CUSTOM_ROUTE = URL + "/tou/myline1/";
String GET_POI_CAPTION = URL + "/tou/single/details";
}

View File

@@ -0,0 +1,64 @@
package com.fly.boot.common.constant;
import java.math.BigDecimal;
/**
* 阿里云服务商对接的信息
*/
public class AliParameter {
//阿里云短信服务
public static class SMSData{
public static String regionId = "cn-zhangjiakou";
public static String accessKeyId = "LTAI5tGePjTg9pYdQoQNpsiv"; //
public static String secret = "cb4VYWlZ95bg02n0MDu0JUpHEzik5A";
public static String registerTemplate = "SMS_460750318";
public static String paymentTemplate = "SMS_461440361";
public static String sendTemplate = "SMS_461410388";
public static String receiveTemplate = "SMS_461295377";
public static String changePasswordTemplate = "";
public static String signName = "成都智游飘科技文化有限公司";
public static String domain = "dysmsapi.aliyuncs.com";
public static String version = "2017-05-25";
public static String action = "SendSms";
}
/**
* 阿里云人脸识别密钥
*/
public static class AuthSecretKey{
public static String accessKey = "LTAI5tRvZb36EjPg5xtFdfUi";
public static String accessKeySecret = "uTV331Ewp6cViJBnVUhNBO4jjnqU68";
public static Long sceneId = 1000006721L;
public static BigDecimal money = new BigDecimal("2.9"); //线上价格
}
/**
* 阿里云支付信息
*/
public static class AliPay{
public static final String alipayAppId = "2021003187630296";
public static final String host = "openapi.alipay.com";
public static final String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAi7OzADQG2QGFU6pqxrw/jVEuoeneFu8EI9Wx4IA7uPbn6V53wMO6Xlz4UoiYKzFaHvTzSYyc2HKSezkULp434sECT6Z+8SslAMBZh7PM4Um/t9A3uyjJrLMjSupj5N9ayxb5+JMlgSVzPWqdlnLR1uc3aoUqQfj9q021xutnb/Qqi5DinqnGlGtgAJoupSvgmSpeeYziIgd2f9ElRiSocv4jrgxZQRZs3DSumhMH0HkApS88+57SnuK2wwN3bx7ecYehml5YNgiZaed75myqlTNqMCti/QS77ZlqdEVm9g+9sQXvlytvLhdZjkDDMsAGKyXA4U5f7kcVBZxcVjytKwIDAQAB";
public static final String alipayPrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDLtpPIGL+PMc5DNK6LIZc3dSQ92yKDU/1drFhfbtwuzBvm75AfxuQYXbOfYBqq851klfLn/czhlVA54OU48Gm3PCsVjvd/ZhxELkcRG5gfzc8p0vJvNiNvqfoLH7uFMq6ivSs4+BygQeUMqHFq9jRtafYn6vnGCMqAexGqQ4tavBR0r7B/8wHPtPeYA0wXWLZbmxrMZpg9TyHm0wyrKiE6V8BY92048S7ylenrV9bs63vrXZvRaz0gNM7kCvTkmtGiCEcWbnVZoTNdGP/NeSmQTn9oHn4H36lEcYPoz3WPQmKxEULfjjubeSkmpYr7iWZEmBA7+Pq8o2repB5iPq9XAgMBAAECggEBAMOr/ctHqkh7CKqZIcbWXw+P313i7QXEWSvu7XvNWoVA3NQ36/H58wJMjspZX4QxOE9zkLyxlmhgKY1Orh7BHmo4yxGMH8Mpa6E56l1OahKyd3iu/NtB30vUsy6YLmDEy+XZWnkAKU7tvHsqGLcrAjTOgPjaxUwpCYnbrJ4k/ugI5IC13c/Zg8aOFQ/qfiVm8Jhr4qpb9c9sUNG//6JzfP/1NnJStqKD26poqNGROY5DwdWfSTpohCbyCsz5Bsa0WVBihu+JjDYEPTyPacjaYsT2u4niYqwBepAk2Lt9JJp59OM8khjEDwZ0QimxA8Y2WjdfyzUgbTj890ArFJBmT3ECgYEA9rRwW+iw4GCmVWRSrSz/l1NghRonGcDbdpf0jSZWptb+q4Hy+Smh98Dg5zLdWlaH7pKpyloyVabckDxLWJXfbw8r+VVbgP1ULDLi9DwGCxyipM/Ew0Sn0HfL8SW9fCZLvBwkV5jYMzVH0cguZsdITbgsf+JxKB6Ye5Ho3n95dUsCgYEA02N3velzEBnmj8vDPOqBokaigFQoaSNsNbbszq4GiK5Hzej6vPaERwVQPY6XUK1WCsZYQbNFwslHg+pexEjUpb6o5zUgzHWs5l4bom8qoqGJrNV5Po4jgs5bcQoVcmV/ET0ipKPWm6tWiHJGDuwLiyhteQ1DyPtKtUVrCvBygqUCgYBkqLK/jW293zF+3fQt3JJcuBRFuqoBhAMHnHCXtvDcGhTG/bqZlzcS04vwSXyvg2brHMRSYALxl6ee4jsL5frIYbRbg0xWkQZrEkgvxt3gYsqp3Gw4ECc4k+iOeAucQDPeiMz7QM3V9wNawQbNwLnrnB3sAASTjghBQwN05SY1iQKBgQCC01yYPJLptB3tgL4kRT5VoEGSCoO4DiQ6WivU/f8tOC9YUIhdynOzQKaYcldTpvNJV9fnUXwrQUbxbWuZLznsGkOOVGMoJuwK5tNThFlurWr3fGa9QFrZ6bzOCN+dHRO3J475Nizryu6TI6YYNh4u0aZu9Lau/FcQORY2fvlfwQKBgQDl5lM0SDcmW+ZhXcJhLC2U0gOK9z/3a2F3ktfejBtf84dU+/9aSpMDKXqYbAol3RccGaT/zVeh72Sq0+qRWBYzuCuCvs3o7gIjJkw0YruRYtx72zcsrVP4sBpYz3rRkGvwQXATytirX3IFO/dOwK5i8TxOqrhEgKN013l9uks+Eg==";
public static final String aesKey = "51kKRp1IadI6dJzfC7TrIQ==";
// public static final String callbackUrl = "https://83k91561s1.yicp.fun/payment/notify/alipay";
public static final String callbackUrl = "https://www.qufangfei.com/user/payment/notify/alipay";
public static final String signType = "RSA2";
}
/**
* 阿里云OSS
*/
public static class AliOSS{
public static final String bucketName = "zhiyoupiao";
public static final String endpoint = "oss-cn-wulanchabu.aliyuncs.com";
public static final String accessKeyId = "LTAI5tGePjTg9pYdQoQNpsiv";
public static final String secretAccessKey = "cb4VYWlZ95bg02n0MDu0JUpHEzik5A";
}
}

View File

@@ -0,0 +1,69 @@
package com.fly.boot.modules.thirdParty.entity.query;
import com.alibaba.fastjson2.JSONObject;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class AIRoutesParam implements Serializable {
//
private String Versions = "v1.1";
//
private String departure_time;
//
private String arrival_time;
//
private Integer departure;
//
private Integer return_land;
//
private List<Integer> destination;
//
private Integer departure_station;
//
private Integer arrival_station;
//
private List<String> scene_within;
//
private List<String> scene_without;
//
private String price_range;
//
private List<Integer> hotel_level;
//
private Integer intracity_traffic;
//
private Integer predilection;
//
private JSONObject destination_details;
//
private List<Integer> prefers;
//
private JSONObject departure_poi;
//
private JSONObject arrival_poi;
}

View File

@@ -0,0 +1,26 @@
package com.fly.boot.modules.thirdParty.entity.query;
////
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
//
public class AITravelLoginParam implements Serializable {
//
private String phone;
//
private Integer userId;
//
private Integer pageNo;
//
private Integer pageSize;
}

View File

@@ -0,0 +1,48 @@
package com.fly.boot.modules.thirdParty.entity.query;
import com.baomidou.mybatisplus.annotation.TableField;
////
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
//
public class AITravelPlanPOIParam implements Serializable {
//
@NotBlank(message = "定位坐标不能为空")
private String poi;
//
@NotBlank(message = "项目类型不能为空")
private Integer[] MerType;
//默认1000米",required = true)
private Integer distance = 1000;
//
private Integer begin;
//
private Integer finish;
//
@NotBlank(message = "城市不能为空")
private String city;
//
@NotBlank(message = "坐标系不能为空")
private Integer PoiType;
//
private String comCode;
//
private Integer comLineType;
}

View File

@@ -0,0 +1,58 @@
package com.fly;// package com.fly;
//
// import cn.hutool.core.date.DateTime;
// import cn.hutool.core.date.DateUtil;
// import cn.hutool.core.lang.UUID;
// import com.aliyun.oss.OSSClient;
// import com.aliyun.oss.model.CannedAccessControlList;
// import com.aliyun.oss.model.CreateBucketRequest;
// import com.aliyun.oss.model.PutObjectRequest;
// import com.aliyun.oss.model.PutObjectResult;
// import lombok.extern.slf4j.Slf4j;
// import org.junit.Test;
// <dependency>
// <groupId>com.aliyun.oss</groupId>
// <artifactId>aliyun-sdk-oss</artifactId>
// <version>3.17.4</version>
// </dependency>
// import java.io.File;
// // @SpringBootTest(classes = ZYPBootApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
// // @RunWith(SpringRunner.class)
// @Slf4j
// public class AliOssTest {
// @Test
// public void ossTest() {
// String bucketName = "zhiyoupiao";
// String endpoint = "oss-cn-wulanchabu.aliyuncs.com";
// String accessKeyId = "LTAI5tGePjTg9pYdQoQNpsiv";
// String secretAccessKey = "cb4VYWlZ95bg02n0MDu0JUpHEzik5A";
// File file = new File("d:\\Users\\jingh\\Pictures\\2024731yGhMRgzLIVEG.png");
// DateTime parse = DateUtil.parse("2025-11-08" + " 23:59:59");
// log.info("parse: {}", parse);
// // 创建OSSClient实例。
// OSSClient ossClient = new OSSClient(endpoint, accessKeyId, secretAccessKey);
// try {
// // 判断容器是否存在,不存在就创建
// if (!ossClient.doesBucketExist(bucketName)) {
// ossClient.createBucket(bucketName);
// CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
// createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead);
// ossClient.createBucket(createBucketRequest);
// }
// // 设置权限(公开读)
// ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
// // 设置文件路径和名称
// String folderNamePath = "images/";
// String fileUrl = folderNamePath + (UUID.randomUUID().toString().replace("-", "") + "-" + file.getName());
// String url = "https://" + bucketName + "." + endpoint + "/" + fileUrl;
// // 上传文件
// PutObjectResult result = ossClient.putObject(new PutObjectRequest(bucketName, fileUrl, file));
// if (result != null) {
// log.info("------OSS文件上传成功------" + fileUrl);
// log.info("------OSS文件上传成功------" + url);
// }
// } catch (Exception oe) {
// log.error("------OSS error-----", oe);
// }
// }
// }