Before Width: | Height: | Size: 270 KiB |
Before Width: | Height: | Size: 810 KiB |
After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 730 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 39 KiB |
After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 745 KiB |
Before Width: | Height: | Size: 190 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 760 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 445 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 166 KiB After Width: | Height: | Size: 217 KiB |
Before Width: | Height: | Size: 41 KiB |
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$/walktofree" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<label for="user-input"></label>
|
||||
<input type="text" id="user-input" v-model="userInput" placeholder="请输入">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userInput: '', // 初始化为空字符串
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
@ -1,11 +0,0 @@
|
||||
<script setup>
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -1,67 +0,0 @@
|
||||
<template>
|
||||
<div class="home-container">
|
||||
<h1>消息页面</h1>
|
||||
|
||||
<!-- 在这里添加你的主页内容 -->
|
||||
|
||||
<div class="footer-nav">
|
||||
<button @click="gotohome()">首页</button>
|
||||
<button @click="gotomessage()">消息</button>
|
||||
<button @click="gotomine()">我的</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.home-container {
|
||||
/* 添加你的样式 */
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
/* 可能需要为内容添加一些底部空间以容纳底部导航 */
|
||||
padding-bottom: 50px;
|
||||
}
|
||||
|
||||
.footer-nav {
|
||||
/* 定义底部导航的样式 */
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 10px;
|
||||
background-color: #f5f5f5; /* 示例背景色 */
|
||||
}
|
||||
|
||||
.footer-nav button {
|
||||
/* 定义按钮的样式 */
|
||||
flex: 1;
|
||||
border: none;
|
||||
padding: 10px;
|
||||
background-color: #ccc;
|
||||
color: #333;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.footer-nav button:hover {
|
||||
/* 按钮点击时的样式 */
|
||||
background-color: #bbb;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Message',
|
||||
methods: {
|
||||
gotohome() {
|
||||
this.$router.push('/home');
|
||||
},
|
||||
gotomessage() {
|
||||
this.$router.push('/message');
|
||||
},
|
||||
gotomine() {
|
||||
this.$router.push('/mine');
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
@ -0,0 +1,28 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'return',
|
||||
methods: {
|
||||
gotohome() {
|
||||
this.$router.push('/home');
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="return">
|
||||
<button class="return-button" @click="gotohome()">返回</button>
|
||||
</div>
|
||||
</template>
|
||||
<style>.return-button {
|
||||
/* 定义返回按钮的样式 */
|
||||
position: fixed; /* 使按钮位置固定 */
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
margin: 0;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background-color: #ccc;
|
||||
color: #333;
|
||||
cursor: pointer;
|
||||
} </style>
|
@ -0,0 +1,6 @@
|
||||
export type AreaList = {
|
||||
code: string;
|
||||
level: number;
|
||||
name: string;
|
||||
areaList: AreaList[];
|
||||
};
|
Before Width: | Height: | Size: 787 KiB After Width: | Height: | Size: 787 KiB |
@ -1,9 +1,13 @@
|
||||
import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import router from './router';
|
||||
import ElementPlus from 'element-plus';
|
||||
import 'element-plus/theme-chalk/index.css';
|
||||
import VueDatePicker from '@vuepic/vue-datepicker';
|
||||
import '@vuepic/vue-datepicker/dist/main.css'
|
||||
|
||||
const app = createApp(App);
|
||||
|
||||
app.use(ElementPlus);
|
||||
app.use(router);
|
||||
|
||||
app.component('VueDatePicker', VueDatePicker);
|
||||
app.mount('#app');
|
@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<div>
|
||||
<h1>任务列表</h1>
|
||||
<div v-for="task in tasks" :key="task.id" class="task-item">
|
||||
<div>{{ task.title }}</div>
|
||||
<div>{{ task.description }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tasks: []
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchTasks();
|
||||
},
|
||||
methods: {
|
||||
async fetchTasks() {
|
||||
try {
|
||||
const response = await fetch('http://localhost:3000/tasks');
|
||||
const data = await response.json();
|
||||
this.tasks = data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.task-item {
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<div class="user-feedback">
|
||||
<!-- 输入评价 -->
|
||||
<div class="feedback-input">
|
||||
<h2>写下你的评价吧</h2>
|
||||
<form @submit.prevent="submitFeedback">
|
||||
<textarea id="feedback" v-model.trim="feedback" rows="4" cols="50" placeholder="在这里输入您的评价"></textarea>
|
||||
<button type="submit">发布评价</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- 已发布评价 -->
|
||||
<div class="submitted-feedback" v-if="submittedFeedback">
|
||||
<h2>已发布评价</h2>
|
||||
<div class="feedback-item">
|
||||
<p>{{ submittedFeedback }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
feedback: '',
|
||||
submittedFeedback: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
submitFeedback() {
|
||||
if (!this.feedback.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
axios.post('/api/feedback', { feedback: this.feedback.trim() })
|
||||
.then(response => {
|
||||
this.submittedFeedback = response.data.feedback;
|
||||
this.feedback = ''; // 清空输入框
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error submitting feedback:', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-feedback {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.feedback-input {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
font-size: 16px;
|
||||
border: 1px solid #28a7a3;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 8px 16px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: #007bff;
|
||||
color: #003f3f;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.submitted-feedback {
|
||||
border-top: 1px solid #a6cfee;
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.feedback-item {
|
||||
background-color: #abd4ee;
|
||||
border: 1px solid #c2f1fb;
|
||||
border-radius: 4px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.feedback-item p {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
@ -1,40 +0,0 @@
|
||||
|
||||
<template>
|
||||
|
||||
<div class="home-container">
|
||||
|
||||
<h1>欢迎来到主页</h1>
|
||||
|
||||
<!-- 在这里添加你的主页内容 -->
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<style scoped>
|
||||
|
||||
.home-container {
|
||||
|
||||
/* 添加你的样式 */
|
||||
|
||||
text-align: center;
|
||||
|
||||
padding: 20px;
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
|
||||
name: 'Home'
|
||||
|
||||
}
|
||||
|
||||
</script>
|
@ -0,0 +1,115 @@
|
||||
<!--suppress TypeScriptValidateTypes -->
|
||||
<script lang="ts" setup>
|
||||
import { ref, onBeforeMount, watch, watchEffect } from 'vue'
|
||||
import axios from 'axios'
|
||||
import { ElSelect, ElOption } from 'element-plus'
|
||||
import { AreaList } from '@/components/types'
|
||||
import { format, addDays } from 'date-fns'
|
||||
import Return from '../components/return.vue'
|
||||
|
||||
const province = ref('')
|
||||
const city = ref('')
|
||||
const area = ref('')
|
||||
const remark = ref('')
|
||||
|
||||
const provinceList = ref<AreaList[]>([])
|
||||
const cityList = ref<AreaList[]>([])
|
||||
const areaList = ref<AreaList[]>([])
|
||||
const rangeValue = ref<string[]>([format(new Date(), 'yyyy-MM-dd'), format(addDays(new Date(), 1), 'yyyy-MM-dd')])
|
||||
|
||||
// 获取到JSON数据
|
||||
const getProvinceList = async () => {
|
||||
const res = await axios.get<AreaList[]>('https://yjy-oss-files.oss-cn-zhangjiakou.aliyuncs.com/tuxian/area.json')
|
||||
provinceList.value = res.data;
|
||||
console.log(provinceList.value)
|
||||
}
|
||||
const publish = () => {
|
||||
// 在这里编写发布时需要执行的逻辑
|
||||
if(city.value!=''){
|
||||
axios.post(`http://106.52.218.118:12607/users/pupdate`,{city:city.value,time:rangeValue.value,remark:remark.value})
|
||||
.then(response => {
|
||||
alert("发布成功")
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('发布失败', error);
|
||||
});}
|
||||
else{
|
||||
alert("请输入目的地")
|
||||
}
|
||||
};
|
||||
onBeforeMount(async()=>{
|
||||
getProvinceList()
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
console.log('rangeValue:', rangeValue.value)
|
||||
})
|
||||
// 监听省份的值改变调用的函数
|
||||
watch(province, (newValue, oldValue) => {
|
||||
const matchedProvince = provinceList.value.find(item => item.name === newValue)
|
||||
if (matchedProvince) {
|
||||
cityList.value = matchedProvince.areaList
|
||||
city.value = '' // 重置城市选择
|
||||
areaList.value = [] // 重置区县选项
|
||||
console.log(cityList.value)
|
||||
}
|
||||
})
|
||||
// 监听 市 的值改变调用的函数
|
||||
watch(city, (newValue, oldValue) => {
|
||||
const matchedCity = cityList.value.find(item => item.name === newValue)
|
||||
if (matchedCity) {
|
||||
areaList.value = matchedCity.areaList
|
||||
area.value = '' // 重置区县选择
|
||||
console.log(areaList.value)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<Return></Return>
|
||||
</div>
|
||||
|
||||
<div><h2>发布需求</h2></div>
|
||||
<div class="addDemand-container">
|
||||
<div style="display: flex;">
|
||||
<p style="color: red;">*</p>
|
||||
<el-select v-model="province" clearable placeholder="省份">
|
||||
<el-option v-for="item in provinceList" :key="item.code" :label="item.name" :value="item.name" />
|
||||
</el-select>
|
||||
<el-select v-model="city" clearable placeholder="城市">
|
||||
<el-option v-for="item in cityList" :key="item.code" :label="item.name" :value="item.name" />
|
||||
</el-select>
|
||||
<!--<el-select v-model="area" clearable placeholder="Select">
|
||||
<el-option v-for="item in areaList" :key="item.code" :label="item.name" :value="item.name" />
|
||||
</el-select>-->
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<VueDatePicker
|
||||
placeholder="请选择出行时间"
|
||||
range
|
||||
:min-date="new Date()"
|
||||
format="yyyy-MM-dd"
|
||||
:width="280"
|
||||
v-model="rangeValue" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="user-input">备注信息:</label>
|
||||
<input type="text" id="remark" v-model="remark" placeholder="">
|
||||
</div>
|
||||
|
||||
<el-button type="primary" @click="publish">发布</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.addDemand-container {
|
||||
max-width: 400px;
|
||||
margin: 0 auto;
|
||||
padding: 30px;
|
||||
border: 1px solid #00ff00;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,8 @@
|
||||
<template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
@ -1,33 +0,0 @@
|
||||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
@ -1,2 +0,0 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
|
@ -0,0 +1,19 @@
|
||||
package com.softegg.freetogo.Demand.Dao;
|
||||
|
||||
import com.softegg.freetogo.Demand.bean.Demands;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:继承Jpa数据库接口类
|
||||
* @author:wuyifan
|
||||
* @date:2024/5/10 19:50
|
||||
*/
|
||||
public interface DemandsRepository extends JpaRepository<Demands, Integer> {
|
||||
List<Demands> findByPhone(String phone);
|
||||
|
||||
List<Demands> findByCity(String city);
|
||||
|
||||
List<Demands> findByProvince(String province);
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package com.softegg.freetogo.Demand.service;
|
||||
|
||||
import com.softegg.freetogo.Demand.Dao.DemandsRepository;
|
||||
import com.softegg.freetogo.Demand.bean.Demands;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:数据库操作接口实现类
|
||||
* @author:wuyifan
|
||||
* @date:2024/5/10 19:50
|
||||
*/
|
||||
@Component
|
||||
public class DemandsServiceImpl implements DemandsService {
|
||||
@Autowired
|
||||
private DemandsRepository DemandsRepository;
|
||||
|
||||
/**
|
||||
* @description: 查找所有游客需求
|
||||
* @param: null
|
||||
* @return: java.util.List<com.softegg.freetogo.Demand.Bean.Demands>
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/10 19:53
|
||||
*/
|
||||
public List<Demands> findAll() {
|
||||
System.out.println("查询成功");
|
||||
return DemandsRepository.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 以demand为游客需求入库
|
||||
* @param: demand
|
||||
* @return: void
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/10 19:55
|
||||
*/
|
||||
public void add(Demands demand) {
|
||||
DemandsRepository.save(demand);
|
||||
System.out.println("添加成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除对应序号id的需求
|
||||
* @param: id
|
||||
* @return: void
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/10 19:59
|
||||
*/
|
||||
public void deleteById(int did) {
|
||||
DemandsRepository.deleteById(did);
|
||||
System.out.println("删除成功对应did:");
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获得对应手机号游客的需求
|
||||
* @param: id
|
||||
* @return: com.softegg.freetogo.Demand.Bean.Demands
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/10 20:02
|
||||
*/
|
||||
public Demands getDemandById(int id) {
|
||||
return DemandsRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 更新需求信息
|
||||
* @param: demand
|
||||
* @return: void
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/10 20:05
|
||||
*/
|
||||
public void update(Demands demand) {
|
||||
DemandsRepository.save(demand);
|
||||
System.out.println("需求更新成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据手机号获得游客用户的所有需求
|
||||
* @param: phone
|
||||
* @return: com.softegg.freetogo.GuideService.Bean.GuideService
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/15 20:18
|
||||
*/
|
||||
|
||||
public List<Demands> getDemandsByPhone(String phone) {
|
||||
List<Demands> demandsList = DemandsRepository.findByPhone(phone);
|
||||
Iterator<Demands> iterator = demandsList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Demands demand = iterator.next();
|
||||
if (demand.getStatus() == 4) {
|
||||
iterator.remove(); // 使用迭代器的 remove 方法
|
||||
}
|
||||
}
|
||||
return demandsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据城市获得游客用户的所有需求
|
||||
* @param: city
|
||||
* @return: com.softegg.freetogo.GuideService.Bean.GuideService
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/15 20:18
|
||||
*/
|
||||
|
||||
public List<Demands> getDemandsByCity(String city) {
|
||||
return DemandsRepository.findByCity(city);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据城市获得游客用户的所有需求
|
||||
* @param: city
|
||||
* @return: com.softegg.freetogo.GuideService.Bean.GuideService
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/15 20:18
|
||||
*/
|
||||
public List<Demands> getDemandsByProvince(String province) {
|
||||
return DemandsRepository.findByProvince(province);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.softegg.freetogo.DemandMatch.service;
|
||||
|
||||
import com.softegg.freetogo.Demand.bean.Demands;
|
||||
import com.softegg.freetogo.GuideService.bean.GuideService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DemandMatchService {
|
||||
List<GuideService> guideMatchAccount(int did);
|
||||
|
||||
int match(int did, int gid);
|
||||
|
||||
int confirmed(int did, int gid);
|
||||
|
||||
List<GuideService> confirmedPage(int did);
|
||||
|
||||
int refuse(int did);
|
||||
|
||||
int finish(int did);
|
||||
|
||||
int delete(int did);
|
||||
|
||||
double timeScore(int gsum, String gddate, String gedate, int dsum, String dddate, String dedate);
|
||||
|
||||
double messageScore(String gmessage, String dmessage);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.softegg.freetogo.Evaluate.Dao;
|
||||
|
||||
import com.softegg.freetogo.Evaluate.bean.Evaluations;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* @description: 继承Jpa数据库接口类
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/10 9:27
|
||||
*/
|
||||
public interface EvaluateRepository extends JpaRepository<Evaluations, Integer> {
|
||||
// List<Evaluations> findByEditorPhone(String phone);
|
||||
|
||||
// List<Evaluations> findByEditedPhone(String phone);
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.softegg.freetogo.Evaluate.bean;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:zhanglinhao
|
||||
* @date:2024/5/10 9:07
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "evaluation")
|
||||
@Setter
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Evaluations {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private int eid;//评价id
|
||||
@Column(name = "createtime")
|
||||
private String ct;//创建日期
|
||||
@Column(name = "modifytime")
|
||||
private String mt;//编辑日期
|
||||
@Column
|
||||
private String ebody;//评价本体
|
||||
@Column
|
||||
private int satisfaction;//满意度整数1-5
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package com.softegg.freetogo.Evaluate.controller;
|
||||
|
||||
import com.softegg.freetogo.Evaluate.bean.Evaluations;
|
||||
import com.softegg.freetogo.Evaluate.service.EvaluateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description: 对评价的操作
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/11 17:33
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/evaluate")
|
||||
public class EvaluationController {
|
||||
@Autowired
|
||||
EvaluateService evaluateService;
|
||||
|
||||
/**
|
||||
* @description: 获取所有需求
|
||||
* @param: null
|
||||
* @return: java.util.List<com.softegg.freetogo.Evaluate.bean.Evaluations>
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/12 0:11
|
||||
*/
|
||||
@GetMapping("findAllEvaluation")
|
||||
public List<Evaluations> findAllEvaluation() {
|
||||
return evaluateService.evaluationList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 添加评价
|
||||
* @param: ebody
|
||||
* @return: void
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/12 0:28
|
||||
*/
|
||||
@PostMapping("addEvaluation")
|
||||
public void addEvaluation(@RequestBody Map<String, String> ebody) {
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
Evaluations evaluation = new Evaluations();
|
||||
evaluation.setEid(Integer.parseInt(ebody.get("eid")));
|
||||
evaluation.setEbody(ebody.get("ebody"));
|
||||
evaluation.setSatisfaction(Integer.parseInt(ebody.get("satisfaction")));
|
||||
evaluation.setCt(currentTime.toString());
|
||||
evaluation.setMt(currentTime.toString());
|
||||
evaluateService.addEvaluation(evaluation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取该用户对别人的评价
|
||||
* @param: phone
|
||||
* @return: java.util.List<com.softegg.freetogo.Evaluate.bean.Evaluations>
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/12 0:30
|
||||
*/
|
||||
// @GetMapping("evaluationByPhone")
|
||||
// public List<Evaluations> evaluationByPhone(String phone) {
|
||||
// return evaluateService.getEListByPhone(phone);
|
||||
// }
|
||||
@GetMapping("getEvaluation")
|
||||
public Evaluations getEvaluation(int eid) {
|
||||
return evaluateService.getEvaluationById(eid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 编辑评论
|
||||
* @param: eid
|
||||
* @param: ebody
|
||||
* @return: void
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/12 13:31
|
||||
*/
|
||||
@PostMapping("editEvaluation")
|
||||
public void editEvaluation(@RequestBody Map<String, String> ebody) {
|
||||
System.out.println("接收的json:" + ebody);
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
Evaluations evaluation = new Evaluations(Integer.parseInt(ebody.get("eid")), ebody.get("ct"), currentTime.toString(), ebody.get("ebody"), Integer.parseInt(ebody.get("satisfaction")));
|
||||
evaluateService.editEvaluation(evaluation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除评论
|
||||
* @param: eid
|
||||
* @return: void
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/12 13:32
|
||||
*/
|
||||
@GetMapping("deleteEvaluation")
|
||||
public void deleteEvaluation(int eid) {
|
||||
evaluateService.deleteEvaluation(eid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取该用户的受满意程度
|
||||
* @param: phone
|
||||
* @return: int
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/12 13:39
|
||||
*/
|
||||
// @GetMapping("getSatisfaction")
|
||||
// public String getSatisfaction(String phone) {
|
||||
// List<Evaluations> elist = evaluateService.getEvaluatedByPhone(phone);
|
||||
// float sumOfSatisfaction = 0;
|
||||
// for (Evaluations evaluation : elist) {
|
||||
// sumOfSatisfaction += evaluation.getSatisfaction();
|
||||
// }
|
||||
// System.out.println("查询满意度:"+ sumOfSatisfaction);
|
||||
// return Float.toString(sumOfSatisfaction /elist.size());
|
||||
// }
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.softegg.freetogo.Evaluate.service;
|
||||
|
||||
import com.softegg.freetogo.Evaluate.bean.Evaluations;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:zhanglinhao
|
||||
* @date:2024/5/10 8:52
|
||||
*/
|
||||
@Service
|
||||
public interface EvaluateService {
|
||||
List<Evaluations> evaluationList();//获取所有评论
|
||||
|
||||
// List<Evaluations> getEListByPhone(String phone);//根据电话筛选评价
|
||||
|
||||
// List<Evaluations> getEvaluatedByPhone(String phone);
|
||||
Evaluations getEvaluationById(int eid);//根据id获取评论
|
||||
|
||||
void addEvaluation(Evaluations evaluation);//添加评论
|
||||
|
||||
void editEvaluation(Evaluations evaluation);//编辑评论
|
||||
|
||||
void deleteEvaluation(int eid);//删除评论
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
package com.softegg.freetogo.Evaluate.service;
|
||||
|
||||
import com.softegg.freetogo.Evaluate.Dao.EvaluateRepository;
|
||||
import com.softegg.freetogo.Evaluate.bean.Evaluations;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:zhanglinhao
|
||||
* @date:2024/5/10 9:25
|
||||
*/
|
||||
@Component
|
||||
public class EvaluateServiceImpl implements EvaluateService {
|
||||
|
||||
@Autowired
|
||||
EvaluateRepository evaluateRepository;
|
||||
|
||||
/**
|
||||
* @description: 获取所有评论
|
||||
* @param: null
|
||||
* @return: void
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/10 9:25
|
||||
*/
|
||||
@Override
|
||||
public List<Evaluations> evaluationList() {
|
||||
System.out.println("查询评论");
|
||||
return evaluateRepository.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据id获取评论
|
||||
* @param: eid
|
||||
* @return: com.softegg.freetogo.Evaluate.bean.Evaluations
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/15 8:13
|
||||
*/
|
||||
@Override
|
||||
public Evaluations getEvaluationById(int eid) {
|
||||
return evaluateRepository.findById(eid).get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description: 根据电话筛选评价
|
||||
* @param: phone
|
||||
* @return: java.util.List<com.softegg.freetogo.Evaluate.bean.Evaluations>
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/11 16:28
|
||||
*/
|
||||
// @Override
|
||||
// public List<Evaluations> getEListByPhone(String phone) {
|
||||
// System.out.println("查询" + phone + "的评论");
|
||||
// return evaluateRepository.findByEditorPhone(phone);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @description: 获取该用户所有被他人评价的评价
|
||||
* @param: phone
|
||||
* @return: java.util.List<com.softegg.freetogo.Evaluate.bean.Evaluations>
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/12 21:21
|
||||
*/
|
||||
// @Override
|
||||
// public List<Evaluations> getEvaluatedByPhone(String phone) {
|
||||
// return evaluateRepository.findByEditedPhone(phone);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @description: 添加评论
|
||||
* @param: evaluation
|
||||
* @return: void
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/10 21:20
|
||||
*/
|
||||
@Override
|
||||
public void addEvaluation(Evaluations evaluation) {
|
||||
evaluateRepository.save(evaluation);
|
||||
System.out.println("添加评论:" + evaluation.getEbody());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 编辑评论
|
||||
* @param: eid
|
||||
* @return: void
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/11 17:10
|
||||
*/
|
||||
@Override
|
||||
public void editEvaluation(Evaluations evaluation) {
|
||||
int eid = evaluation.getEid();
|
||||
System.out.println("编辑评论:" + eid);
|
||||
evaluateRepository.save(evaluation);
|
||||
System.out.println("编辑成功:" + eid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 删除评论
|
||||
* @param: eid
|
||||
* @return: void
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/11 17:28
|
||||
*/
|
||||
@Override
|
||||
public void deleteEvaluation(int eid) {
|
||||
evaluateRepository.deleteById(eid);
|
||||
System.out.println("删除评论:" + eid);
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.softegg.freetogo.FeedBack;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/20 11:14
|
||||
*/
|
||||
public class bean {
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.softegg.freetogo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class FreeToGoApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FreeToGoApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.softegg.freetogo.GuideMatch.service;
|
||||
|
||||
import com.softegg.freetogo.Demand.bean.Demands;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:抽象需求发送服务接口类
|
||||
* @author:wuyifan
|
||||
* @date:2024/5/28 19:45
|
||||
*/
|
||||
@Service
|
||||
public interface GuideMatchService {
|
||||
|
||||
List<Demands> guideMatchAccount(int gid);
|
||||
|
||||
int match(int gid, int did);
|
||||
|
||||
List<Demands> confirmedPage(int gid);
|
||||
|
||||
int confirmed(int did, int gid);
|
||||
|
||||
int refuse(int gid);
|
||||
|
||||
int delete(int gid);
|
||||
|
||||
double timeScore(int gsum, String gddate, String gedate, int dsum, String dddate, String dedate);
|
||||
|
||||
double messageScore(String gmessage, String dmessage);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.softegg.freetogo.GuideService.Dao;
|
||||
|
||||
import com.softegg.freetogo.Demand.bean.Demands;
|
||||
import com.softegg.freetogo.GuideService.bean.GuideService;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:继承Jpa数据库接口类
|
||||
* @author:wuyifan
|
||||
* @date:2024/5/13 9:17
|
||||
*/
|
||||
public interface GuideServiceRepository extends JpaRepository<GuideService, Integer> {
|
||||
List<GuideService> findByPhone(String phone);
|
||||
|
||||
List<GuideService> findByCity(String city);
|
||||
|
||||
List<GuideService> findByProvince(String province);
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.softegg.freetogo.HeatMap.controller;
|
||||
|
||||
public class HeatMapController {
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.softegg.freetogo.HeatMap.service;
|
||||
|
||||
public interface HeatMapService {
|
||||
int[] provinceDemandsHeatMap();//获得每个省份的游客需求数目
|
||||
|
||||
int[] cityDemandsHeatMap(String province);//获得目标省份的游客需求数目
|
||||
|
||||
int[] provinceGuideServiceHeatMap();
|
||||
|
||||
int[] cityGuideServiceHeatMap(String province);
|
||||
}
|
@ -0,0 +1,192 @@
|
||||
package com.softegg.freetogo.HeatMap.service;
|
||||
|
||||
import com.softegg.freetogo.Demand.bean.Demands;
|
||||
import com.softegg.freetogo.Demand.service.DemandsService;
|
||||
import com.softegg.freetogo.GuideService.service.GuideServiceService;
|
||||
|
||||
import com.softegg.freetogo.GuideService.bean.GuideService;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* description:热力图实现类
|
||||
* @author:wuyifan
|
||||
* date:2024/6/6 10:51
|
||||
*/
|
||||
@Component
|
||||
public class HeatMapServiceImpl implements HeatMapService {
|
||||
@Autowired
|
||||
DemandsService demandsService;
|
||||
@Autowired
|
||||
GuideServiceService guideServiceService;
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<String> provinceList = new ArrayList<>();
|
||||
JSONParser parser = new JSONParser();
|
||||
|
||||
try {
|
||||
// 读取 JSON 文件内容并解析为 JSONObject
|
||||
Object obj = parser.parse(new FileReader("C:/Users/WYF/Desktop/软件体系结构/FreeToGo/src/main/java/com/softegg/freetogo/HeatMap/service/area.json")); // 直接使用文件名表示相对路径
|
||||
JSONObject jsonObject = (JSONObject) obj;
|
||||
|
||||
for (Object province : jsonObject.keySet()) {
|
||||
provinceList.add(province.toString());
|
||||
}
|
||||
System.out.println("所有省份列表:");
|
||||
for (String province : provinceList) {
|
||||
System.out.println(province);
|
||||
}
|
||||
} catch (IOException | ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获得所有省份的List
|
||||
* @param: null
|
||||
* @return: List<String>
|
||||
* @author: wuyifan
|
||||
* @date: 2024/6/6 15:48
|
||||
*/
|
||||
public List<String> getAllProvinces() {
|
||||
List<String> provinceList = new ArrayList<>();
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
|
||||
try {
|
||||
// 读取 JSON 文件内容并解析为 JSONObject
|
||||
Object obj = parser.parse(new FileReader("C:/Users/WYF/Desktop/软件体系结构/FreeToGo/src/main/java/com/softegg/freetogo/HeatMap/service/area.json"));
|
||||
JSONObject jsonObject = (JSONObject) obj;
|
||||
|
||||
// 遍历每个省份
|
||||
for (Object province : jsonObject.keySet()) {
|
||||
// 将省份添加到列表中
|
||||
provinceList.add(province.toString());
|
||||
}
|
||||
} catch (IOException | ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return provinceList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获得目标省份的所有城市的List
|
||||
* @param: String
|
||||
* @return: List<String>
|
||||
* @author: wuyifan
|
||||
* @date: 2024/6/6 15:48
|
||||
*/
|
||||
public List<String> getCitiesInProvince(String province) {
|
||||
List<String> cityList = new ArrayList<>();
|
||||
|
||||
JSONParser parser = new JSONParser();
|
||||
|
||||
try {
|
||||
// 读取 JSON 文件内容并解析为 JSONObject
|
||||
Object obj = parser.parse(new FileReader("C:/Users/WYF/Desktop/软件体系结构/FreeToGo/src/main/java/com/softegg/freetogo/HeatMap/service/area.json"));
|
||||
JSONObject jsonObject = (JSONObject) obj;
|
||||
|
||||
// 获取湖南省的城市信息
|
||||
JSONObject hunanCities = (JSONObject) jsonObject.get(province);
|
||||
|
||||
// 遍历每个城市并将城市名称添加到列表中
|
||||
for (Object city : hunanCities.keySet()) {
|
||||
cityList.add(city.toString());
|
||||
}
|
||||
} catch (IOException | ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return cityList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获得所有省份的游客需求数目
|
||||
* @param: null
|
||||
* @return: int[]
|
||||
* @author: wuyifan
|
||||
* @date: 2024/6/6 15:48
|
||||
*/
|
||||
@Override
|
||||
public int[] provinceDemandsHeatMap(){
|
||||
List<String> provinceList = getAllProvinces();
|
||||
int[] sum = new int[provinceList.size()];
|
||||
int i = 0;
|
||||
for (String province : provinceList) {
|
||||
List<Demands> demandsList = demandsService.getDemandsByProvince(province);
|
||||
sum[i] = demandsList.size();
|
||||
i++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获得目标省份的游客需求数目
|
||||
* @param: String
|
||||
* @return: int[]
|
||||
* @author: wuyifan
|
||||
* @date: 2024/6/6 15:48
|
||||
*/
|
||||
@Override
|
||||
public int[] cityDemandsHeatMap(String province){
|
||||
List<String> cityList = getCitiesInProvince(province);
|
||||
int[] sum = new int[cityList.size()];
|
||||
int i = 0;
|
||||
for (String city : cityList) {
|
||||
List<Demands> demandsList = demandsService.getDemandsByCity(city);
|
||||
sum[i] = demandsList.size();
|
||||
i++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获得所有省份的游客需求数目
|
||||
* @param: null
|
||||
* @return: int[]
|
||||
* @author: wuyifan
|
||||
* @date: 2024/6/6 15:48
|
||||
*/
|
||||
@Override
|
||||
public int[] provinceGuideServiceHeatMap(){
|
||||
List<String> provinceList = getAllProvinces();
|
||||
int[] sum = new int[provinceList.size()];
|
||||
int i = 0;
|
||||
for (String province : provinceList) {
|
||||
List<GuideService> guideServiceList = guideServiceService.getGuideServiceByProvince(province);
|
||||
sum[i] = guideServiceList.size();
|
||||
i++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获得目标省份的游客需求数目
|
||||
* @param: String
|
||||
* @return: int[]
|
||||
* @author: wuyifan
|
||||
* @date: 2024/6/6 15:48
|
||||
*/
|
||||
@Override
|
||||
public int[] cityGuideServiceHeatMap(String province){
|
||||
List<String> cityList = getCitiesInProvince(province);
|
||||
int[] sum = new int[cityList.size()];
|
||||
int i = 0;
|
||||
for (String city : cityList) {
|
||||
List<GuideService> guideServiceList = guideServiceService.getGuideServiceByCity(city);
|
||||
sum[i] = guideServiceList.size();
|
||||
i++;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.softegg.freetogo.Login.controller;
|
||||
|
||||
import com.softegg.freetogo.Login.service.LoginService;
|
||||
import com.softegg.freetogo.User.Dao.GuidesRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description:登录服务前后端交互
|
||||
* @author:zhanglinhao
|
||||
* @date:2024/5/9 9:35
|
||||
*/
|
||||
@RestController
|
||||
//@CrossOrigin(origins = "*")
|
||||
@RequestMapping("/Login")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
LoginService loginService;
|
||||
|
||||
@Autowired
|
||||
GuidesRepository guidesRepository;
|
||||
|
||||
/**
|
||||
* @description: 登录的交互逻辑
|
||||
* @param: map
|
||||
* @return: java.lang.String
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/9 22:44
|
||||
*/
|
||||
@PostMapping("login")
|
||||
public int Login(@RequestBody Map<String, Object> map) {
|
||||
System.out.println(map);
|
||||
System.out.println("phone:" + map.get("phone").toString());
|
||||
System.out.println("password" + map.get("password").toString());
|
||||
int tag = loginService.loginAccount(map.get("phone").toString(), map.get("password").toString());
|
||||
System.out.println("LoginTag:" + tag);
|
||||
return switch (tag) {
|
||||
case 1000 -> 1;//登陆成功
|
||||
case 1001 -> 2;//密码或账号错误
|
||||
case 1002 -> 3;//该账户未注册
|
||||
case 1005 -> 6;//未输入账号密码
|
||||
case 1006 -> 7;//未输入账号
|
||||
case 1007 -> 8;//未输入密码
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 注册的交互逻辑
|
||||
* @param: map
|
||||
* @return: java.lang.String
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/9 22:45
|
||||
*/
|
||||
@PostMapping("register")
|
||||
public int Register(@RequestBody Map<String, Object> map) {
|
||||
System.out.println(map);
|
||||
int tag = loginService.registerAccount((String) map.get("name"), (String) map.get("password"), (String) map.get("phone"), (String) map.get("nickname"), (String) map.get("IDCard"));
|
||||
System.out.println("RegisterTag:" + tag);
|
||||
return switch (tag) {
|
||||
case 1003 -> 4;//该账户已经注册
|
||||
case 1004 -> 5;//注册成功
|
||||
case 1008 -> 9;//身份证输入错误18位
|
||||
case 1010 -> 11;//手机号输入错误11位
|
||||
case 1011 -> 12;//密码过短最少8位
|
||||
case 1012 -> 13;//姓名未输入
|
||||
default -> 0;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.softegg.freetogo.Login.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @description:抽象登录服务接口类
|
||||
* @author:zhanglinhao
|
||||
* @date:2024/5/9 8:37
|
||||
*/
|
||||
@Service
|
||||
public interface LoginService {
|
||||
int loginAccount(String phone, String password);//登录
|
||||
// int registerAccount(String phone, String password);
|
||||
|
||||
int registerAccount(String name,
|
||||
String password,
|
||||
String phone,
|
||||
String nickname,
|
||||
String IDCard);//注册
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
1000->1 登录成功
|
||||
1001->2 密码或账号错误
|
||||
1002->3 该账户未注册
|
||||
1003->4 该账户已经注册
|
||||
1004->5 注册成功
|
||||
1005->6 未输入账号密码
|
||||
1006->7 未输入账号
|
||||
1007->8 身份证输入错误
|
||||
1008->9 成功注册导游
|
||||
1009->10 已是导游
|
||||
1010->11 手机号输入错误
|
||||
1011->12 密码过短
|
||||
1012->13 未输入姓名
|
@ -0,0 +1,4 @@
|
||||
package com.softegg.freetogo.Search.controller;
|
||||
|
||||
public class SearchController {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.softegg.freetogo.Search.service;
|
||||
|
||||
public interface SearchService {
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package com.softegg.freetogo.Search.service;
|
||||
|
||||
public class SearchServiceImpl {
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.softegg.freetogo.SendDemand.controller;
|
||||
|
||||
import com.softegg.freetogo.Demand.bean.Demands;
|
||||
import com.softegg.freetogo.Demand.service.DemandsService;
|
||||
import com.softegg.freetogo.GuideService.bean.GuideService;
|
||||
import com.softegg.freetogo.SendDemand.service.SendDemandService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description:登录服务前后端交互
|
||||
* @author:wuyifan
|
||||
* @date:2024/5/10 23:09
|
||||
*/
|
||||
|
||||
@RestController
|
||||
//@CrossOrigin(origins = "*")
|
||||
@RequestMapping("/SendDemand")
|
||||
public class SendDemandController {
|
||||
|
||||
@Autowired
|
||||
SendDemandService sendDemandService;
|
||||
@Autowired
|
||||
DemandsService demandsService;
|
||||
|
||||
/**
|
||||
* @description: 发送需求的交互逻辑
|
||||
* @param: map
|
||||
* @return: java.lang.String
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/10 22:45
|
||||
*/
|
||||
@PostMapping("register")
|
||||
public String SendDemand(@RequestBody Map<String, Object> map) {
|
||||
return switch (sendDemandService.sendnewDemandAccount(map.get("city").toString(), map.get("phone").toString(), map.get("time").toString(), (String) map.get("remark"))) {
|
||||
case 1005 -> "1";//需求发送成功
|
||||
default -> "0";
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 发送该用户所有游客需求的交互逻辑
|
||||
* @param: map
|
||||
* @return: java.lang.String
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/16 11:01
|
||||
*/
|
||||
@GetMapping("sendAllDemands")
|
||||
public List<Demands> sendAllDemand(String phone) {
|
||||
System.out.println("收到目标用户手机号:" + phone);
|
||||
List<Demands> dlist = demandsService.getDemandsByPhone(phone);
|
||||
System.out.println(dlist);
|
||||
return dlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 发送需求的交互逻辑
|
||||
* @param: map
|
||||
* @return: java.lang.String
|
||||
* @author: wuyifan
|
||||
* @date: 2024/6/4 16:12
|
||||
*/
|
||||
@GetMapping("demand")
|
||||
public Demands demand(int did) {
|
||||
System.out.println("需求did:"+did);
|
||||
return demandsService.getDemandById(did);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.softegg.freetogo.SendDemand.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @description:抽象需求发送服务接口类
|
||||
* @author:wuyifan
|
||||
* @date:2024/5/10 23:31
|
||||
*/
|
||||
@Service
|
||||
public interface SendDemandService {
|
||||
int sendnewDemandAccount(String city, String phone, String date, String message);
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.softegg.freetogo.SendGuideService.controller;
|
||||
|
||||
import com.softegg.freetogo.GuideService.bean.GuideService;
|
||||
import com.softegg.freetogo.GuideService.service.GuideServiceService;
|
||||
import com.softegg.freetogo.SendGuideService.service.SendGuideServiceService;
|
||||
import com.softegg.freetogo.User.bean.Users;
|
||||
import com.softegg.freetogo.User.service.UsersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description:登录服务前后端交互
|
||||
* @author:wuyifan
|
||||
* @date:2024/5/13 10:47
|
||||
*/
|
||||
@RestController
|
||||
//@CrossOrigin(origins = "*")
|
||||
@RequestMapping("/SendGuideService")
|
||||
public class SendGuideServiceController {
|
||||
@Autowired
|
||||
SendGuideServiceService sendGuideServiceService;
|
||||
@Autowired
|
||||
UsersService usersService;
|
||||
@Autowired
|
||||
GuideServiceService guideServiceService;
|
||||
|
||||
/**
|
||||
* @description: 发送需求的交互逻辑
|
||||
* @param: map
|
||||
* @return: java.lang.String
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/13 10:48
|
||||
*/
|
||||
@PostMapping("register")
|
||||
public int SendDemand(@RequestBody Map<String, Object> map) {
|
||||
String phone = map.get("phone").toString();
|
||||
Users user = usersService.getUserByPhone(phone);
|
||||
if (user.isMembertype()) {
|
||||
return switch (sendGuideServiceService.sendnewGuideServiceAccount(map.get("city").toString(), map.get("phone").toString(), map.get("time").toString(), (String) map.get("remark"))) {
|
||||
case 1005 -> 1;//服务发送成功
|
||||
default -> 0;
|
||||
};
|
||||
} else {
|
||||
return 2;//用户非导游
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 发送该用户所有导游服务的交互逻辑
|
||||
* @param: map
|
||||
* @return: java.lang.String
|
||||
* @author: wuyifan
|
||||
* @date: 2024/5/16 11:01
|
||||
*/
|
||||
@GetMapping("sendAllGuideService")
|
||||
public List<GuideService> sendAllGuideService(String phone) {
|
||||
List<GuideService> glist = guideServiceService.getGuideServiceByPhone(phone);
|
||||
return glist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 发送需求的交互逻辑
|
||||
* @param: map
|
||||
* @return: java.lang.String
|
||||
* @author: wuyifan
|
||||
* @date: 2024/6/4 16:10
|
||||
*/
|
||||
@GetMapping("GuideService")
|
||||
public GuideService GuideService(int gid) {
|
||||
return guideServiceService.getGuideServiceById(gid);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.softegg.freetogo.SendGuideService.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @description:抽象需求发送服务接口类
|
||||
* @author:wuyifan
|
||||
* @date:2024/5/13 11:11
|
||||
*/
|
||||
@Service
|
||||
public interface SendGuideServiceService {
|
||||
|
||||
int sendnewGuideServiceAccount(String city, String phone, String date, String message);
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.softegg.freetogo.User.Dao;
|
||||
|
||||
import com.softegg.freetogo.User.bean.Guides;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* @description: 继承Jpa数据库接口类
|
||||
* @author: zhanglinhao
|
||||
* @date: 2024/5/16 10:44
|
||||
*/
|
||||
public interface GuidesRepository extends JpaRepository<Guides, Integer> {
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.softegg.freetogo.User.Dao;
|
||||
|
||||
import com.softegg.freetogo.User.bean.Users;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
/**
|
||||
* @description:继承Jpa数据库接口类
|
||||
* @author:zhanglinhao
|
||||
* @date:2024/5/8 8:50
|
||||
*/
|
||||
public interface UsersRepository extends JpaRepository<Users, Integer> {
|
||||
Users findByPhone(String phone);//自定义函数,根据手机号进行查找返回对应对象
|
||||
}
|