master
parent
991b3c3b61
commit
da67fe8884
@ -1,31 +0,0 @@
|
||||
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);
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
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);
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package com.softegg.freetogo.HeatMap.controller;
|
||||
|
||||
public class HeatMapController {
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.softegg.freetogo.HeatMap.service;
|
||||
|
||||
public interface HeatMapService {
|
||||
int[] provinceDemandsHeatMap();//获得每个省份的游客需求数目
|
||||
|
||||
int[] cityDemandsHeatMap(String province);//获得目标省份的游客需求数目
|
||||
|
||||
int[] provinceGuideServiceHeatMap();
|
||||
|
||||
int[] cityGuideServiceHeatMap(String province);
|
||||
}
|
@ -1,192 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,77 +0,0 @@
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
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);//注册
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
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 未输入姓名
|
@ -1,4 +0,0 @@
|
||||
package com.softegg.freetogo.Search.controller;
|
||||
|
||||
public class SearchController {
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package com.softegg.freetogo.Search.service;
|
||||
|
||||
public interface SearchService {
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package com.softegg.freetogo.Search.service;
|
||||
|
||||
public class SearchServiceImpl {
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
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);
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
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);
|
||||
}
|
Loading…
Reference in new issue