parent
bfa49ec0eb
commit
89c2fba28a
@ -0,0 +1,33 @@
|
|||||||
|
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/
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.softegg.freetogo.Api.authencation;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/23 15:47
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class authenticationController {
|
||||||
|
@Autowired
|
||||||
|
com.softegg.freetogo.Api.authencation.authenticationService authenticationService;
|
||||||
|
|
||||||
|
@GetMapping("authenticate")
|
||||||
|
public void authenticate(String idc, String phone, String name) throws IOException {
|
||||||
|
authenticationService.authenticate(idc, phone, name);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.softegg.freetogo.Api.captcha;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/24 9:54
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class captchaController {
|
||||||
|
@Autowired
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
|
||||||
|
@RequestMapping("/captcha")
|
||||||
|
public JsonResult captcha(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
SpecCaptcha specCaptcha = new SpecCaptcha(130, 48, 5);
|
||||||
|
String verCode = specCaptcha.text().toLowerCase();
|
||||||
|
String key = UUID.randomUUID().toString();
|
||||||
|
// 存入redis并设置过期时间为30分钟
|
||||||
|
redisUtil.setEx(key, verCode, 30, TimeUnit.MINUTES);
|
||||||
|
// 将key和base64返回给前端
|
||||||
|
return JsonResult.ok().put("key", key).put("image", specCaptcha.toBase64());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@PostMapping("/login")
|
||||||
|
public JsonResult login(String username,String password,String verCode,String verKey){
|
||||||
|
// 获取redis中的验证码
|
||||||
|
String redisCode = redisUtil.get(verKey);
|
||||||
|
// 判断验证码
|
||||||
|
if (verCode==null || !redisCode.equals(verCode.trim().toLowerCase())) {
|
||||||
|
return JsonResult.error("验证码不正确");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.softegg.freetogo.Api.captcha;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.geom.GeneralPath;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/24 9:27
|
||||||
|
*/
|
||||||
|
public class captchaService {
|
||||||
|
}
|
@ -0,0 +1,316 @@
|
|||||||
|
package com.softegg.freetogo.Api.phoneVerification;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.client.HttpClient;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
import org.apache.http.client.methods.HttpDelete;
|
||||||
|
import org.apache.http.client.methods.HttpGet;
|
||||||
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
import org.apache.http.client.methods.HttpPut;
|
||||||
|
import org.apache.http.conn.ClientConnectionManager;
|
||||||
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||||
|
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||||
|
import org.apache.http.entity.ByteArrayEntity;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
/**
|
||||||
|
* @description: 阿里云http工具包
|
||||||
|
* @author: aliyun
|
||||||
|
* @date: 2024/5/29 15:36
|
||||||
|
*/
|
||||||
|
public class HttpUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doGet(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpGet request = new HttpGet(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* post form
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param bodys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
Map<String, String> bodys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bodys != null) {
|
||||||
|
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
|
||||||
|
|
||||||
|
for (String key : bodys.keySet()) {
|
||||||
|
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
|
||||||
|
}
|
||||||
|
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
|
||||||
|
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
|
request.setEntity(formEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post String
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
String body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(body)) {
|
||||||
|
request.setEntity(new StringEntity(body, "utf-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post stream
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
byte[] body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body != null) {
|
||||||
|
request.setEntity(new ByteArrayEntity(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put String
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPut(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
String body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(body)) {
|
||||||
|
request.setEntity(new StringEntity(body, "utf-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put stream
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPut(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
byte[] body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body != null) {
|
||||||
|
request.setEntity(new ByteArrayEntity(body));
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doDelete(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
|
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
|
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient.execute(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
|
||||||
|
StringBuilder sbUrl = new StringBuilder();
|
||||||
|
sbUrl.append(host);
|
||||||
|
if (!StringUtils.isBlank(path)) {
|
||||||
|
sbUrl.append(path);
|
||||||
|
}
|
||||||
|
if (null != querys) {
|
||||||
|
StringBuilder sbQuery = new StringBuilder();
|
||||||
|
for (Map.Entry<String, String> query : querys.entrySet()) {
|
||||||
|
if (0 < sbQuery.length()) {
|
||||||
|
sbQuery.append("&");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
|
||||||
|
sbQuery.append(query.getValue());
|
||||||
|
}
|
||||||
|
if (!StringUtils.isBlank(query.getKey())) {
|
||||||
|
sbQuery.append(query.getKey());
|
||||||
|
if (!StringUtils.isBlank(query.getValue())) {
|
||||||
|
sbQuery.append("=");
|
||||||
|
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (0 < sbQuery.length()) {
|
||||||
|
sbUrl.append("?").append(sbQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sbUrl.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HttpClient wrapClient(String host) {
|
||||||
|
HttpClient httpClient = new DefaultHttpClient();
|
||||||
|
if (host.startsWith("https://")) {
|
||||||
|
sslClient(httpClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
return httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void sslClient(HttpClient httpClient) {
|
||||||
|
try {
|
||||||
|
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||||
|
X509TrustManager tm = new X509TrustManager() {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public void checkClientTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
|
||||||
|
}
|
||||||
|
public void checkServerTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctx.init(null, new TrustManager[] { tm }, null);
|
||||||
|
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
|
||||||
|
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||||
|
ClientConnectionManager ccm = httpClient.getConnectionManager();
|
||||||
|
SchemeRegistry registry = ccm.getSchemeRegistry();
|
||||||
|
registry.register(new Scheme("https", 443, ssf));
|
||||||
|
} catch (KeyManagementException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.softegg.freetogo.Debug;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:调试函数
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/29 8:41
|
||||||
|
*/
|
||||||
|
public class utils {
|
||||||
|
/**
|
||||||
|
* @description: 输出调试信息
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/29 14:52
|
||||||
|
*/
|
||||||
|
public <T> void printInfo(T text){
|
||||||
|
Date currentDate = new Date();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd|HH:mm:ss");
|
||||||
|
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||||
|
StackTraceElement element = stackTrace[2]; // 获取调用printFileAndLine方法的方法的堆栈信息
|
||||||
|
String fileName = element.getFileName();
|
||||||
|
int lineNumber = element.getLineNumber();
|
||||||
|
System.out.println("["+sdf.format(currentDate)+"]"+"File: " + fileName + ", Line: " + lineNumber + ", Info: "+ text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取今日日期
|
||||||
|
* @description:
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/29 14:52
|
||||||
|
*/
|
||||||
|
public String getToday(){
|
||||||
|
Date currentDate = new Date();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
return sdf.format(currentDate);
|
||||||
|
}
|
||||||
|
}
|
@ -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,119 @@
|
|||||||
|
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);
|
||||||
|
// 使用迭代器的 remove 方法
|
||||||
|
demandsList.removeIf(demand -> demand.getStatus() == 4);
|
||||||
|
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,143 @@
|
|||||||
|
package com.softegg.freetogo.Evaluate.service;
|
||||||
|
|
||||||
|
import com.softegg.freetogo.Demand.service.DemandsService;
|
||||||
|
import com.softegg.freetogo.Evaluate.Dao.EvaluateRepository;
|
||||||
|
import com.softegg.freetogo.Evaluate.bean.Evaluations;
|
||||||
|
import com.softegg.freetogo.GuideService.service.GuideServiceService;
|
||||||
|
import com.softegg.freetogo.User.service.GuidesService;
|
||||||
|
import com.softegg.freetogo.User.service.UsersService;
|
||||||
|
import com.softegg.freetogo.Demand.bean.Demands;
|
||||||
|
import com.softegg.freetogo.User.service.GuidesService;
|
||||||
|
import com.softegg.freetogo.User.Dao.GuidesRepository;
|
||||||
|
import com.softegg.freetogo.User.bean.Guides;
|
||||||
|
import com.softegg.freetogo.User.bean.Users;
|
||||||
|
import com.softegg.freetogo.GuideService.bean.GuideService;
|
||||||
|
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;
|
||||||
|
@Autowired
|
||||||
|
GuideServiceService guideServiceService;
|
||||||
|
@Autowired
|
||||||
|
UsersService usersService;
|
||||||
|
@Autowired
|
||||||
|
DemandsService demandsService;
|
||||||
|
@Autowired
|
||||||
|
GuidesService guidesService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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);
|
||||||
|
int did = evaluation.getEid();
|
||||||
|
Demands demands = demandsService.getDemandById(did);
|
||||||
|
int gid = demands.getGuideServiceId();
|
||||||
|
GuideService guideService = guideServiceService.getGuideServiceById(gid);
|
||||||
|
String phone = guideService.getPhone();
|
||||||
|
Users user = usersService.getUserByPhone(phone);
|
||||||
|
Guides guide = guidesService.getGuideById(user.getUid()).get();
|
||||||
|
int stars = evaluation.getSatisfaction();
|
||||||
|
int sum = guide.getSum();
|
||||||
|
sum++;
|
||||||
|
int guideStars = guide.getStars();
|
||||||
|
guideStars = (guideStars + stars) / sum;
|
||||||
|
// guidesService.update()
|
||||||
|
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,78 @@
|
|||||||
|
package com.softegg.freetogo.HeatMap.controller;
|
||||||
|
|
||||||
|
import com.softegg.freetogo.Demand.bean.Demands;
|
||||||
|
import com.softegg.freetogo.GuideService.bean.GuideService;
|
||||||
|
import com.softegg.freetogo.HeatMap.bean.HeatMap;
|
||||||
|
import com.softegg.freetogo.GuideService.service.GuideServiceService;
|
||||||
|
import com.softegg.freetogo.GuideMatch.service.GuideMatchService;
|
||||||
|
import com.softegg.freetogo.HeatMap.service.HeatMapService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
//@CrossOrigin(origins = "*")
|
||||||
|
@RequestMapping("/HeatMap")
|
||||||
|
public class HeatMapController {
|
||||||
|
@Autowired
|
||||||
|
GuideMatchService guideMatchService;
|
||||||
|
@Autowired
|
||||||
|
GuideServiceService guideServiceService;
|
||||||
|
@Autowired
|
||||||
|
HeatMapService heatMapService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 各省导游服务交互逻辑
|
||||||
|
* @param: map
|
||||||
|
* @return: java.lang.String
|
||||||
|
* @author: wuyifan
|
||||||
|
* @date: 2024/5/30 20:48
|
||||||
|
*/
|
||||||
|
@GetMapping("guideServiceHeatMapRegister")
|
||||||
|
public List<HeatMap> GuideServiceHeatMapRegister() {
|
||||||
|
return heatMapService.provinceGuideServiceHeatMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 各省游客需求交互逻辑
|
||||||
|
* @param: map
|
||||||
|
* @return: java.lang.String
|
||||||
|
* @author: wuyifan
|
||||||
|
* @date: 2024/5/30 20:48
|
||||||
|
*/
|
||||||
|
@GetMapping("demandsHeatMapRegister")
|
||||||
|
public List<HeatMap> DemandsHeatMapRegister() {
|
||||||
|
return heatMapService.provinceDemandsHeatMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 目标省份导游服务交互逻辑
|
||||||
|
* @param: map
|
||||||
|
* @return: java.lang.String
|
||||||
|
* @author: wuyifan
|
||||||
|
* @date: 2024/5/30 20:48
|
||||||
|
*/
|
||||||
|
@PostMapping("demandsCityHeatMap")
|
||||||
|
public int[] DemandsProvinceHeatMap(@RequestBody Map<String, Object> map) {
|
||||||
|
String province = map.get("province").toString();
|
||||||
|
return heatMapService.cityDemandsHeatMap(province);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 目标省份导游服务交互逻辑
|
||||||
|
* @param: map
|
||||||
|
* @return: java.lang.String
|
||||||
|
* @author: wuyifan
|
||||||
|
* @date: 2024/5/30 20:48
|
||||||
|
*/
|
||||||
|
@PostMapping("guideServiceCityHeatMap")
|
||||||
|
public int[] GuideServiceProvinceHeatMap(@RequestBody Map<String, Object> map) {
|
||||||
|
String province = map.get("province").toString();
|
||||||
|
return heatMapService.cityGuideServiceHeatMap(province);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.softegg.freetogo.HeatMap.service;
|
||||||
|
|
||||||
|
import com.softegg.freetogo.HeatMap.bean.HeatMap;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface HeatMapService {
|
||||||
|
List<HeatMap> provinceDemandsHeatMap();//获得每个省份的游客需求数目
|
||||||
|
|
||||||
|
int[] cityDemandsHeatMap(String province);//获得目标省份的游客需求数目
|
||||||
|
|
||||||
|
List<HeatMap> provinceGuideServiceHeatMap();//获得每个省份的导游服务数目
|
||||||
|
|
||||||
|
int[] cityGuideServiceHeatMap(String province);//获得目标省份的游客服务数目
|
||||||
|
}
|
@ -0,0 +1,208 @@
|
|||||||
|
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 com.softegg.freetogo.HeatMap.bean.HeatMap;
|
||||||
|
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.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
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
|
||||||
|
// String json = String.valueOf(new FileReader("D:/Code/FreeToGo/src/main/java/com/softegg/freetogo/HeatMap/service/area.json"));
|
||||||
|
String filePath = "D:/Code/FreeToGo/src/main/java/com/softegg/freetogo/HeatMap/service/area.json"; // 修改为你的文件路径
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(filePath));
|
||||||
|
System.out.println(String.valueOf(reader));
|
||||||
|
Object obj = parser.parse(reader);
|
||||||
|
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("D:/Code/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 List<HeatMap> provinceDemandsHeatMap(){
|
||||||
|
List<String> provinceList = getAllProvinces();
|
||||||
|
List<HeatMap> dataList = new ArrayList<>();
|
||||||
|
for (String province : provinceList) {
|
||||||
|
List<Demands> demandsList = demandsService.getDemandsByProvince(province);
|
||||||
|
System.out.println(province);
|
||||||
|
dataList.add(new HeatMap(province, demandsList.size()));
|
||||||
|
System.out.println(demandsList.size());
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 List<HeatMap> provinceGuideServiceHeatMap(){
|
||||||
|
List<String> provinceList = getAllProvinces();
|
||||||
|
List<HeatMap> dataList = new ArrayList<>();
|
||||||
|
int max=0;
|
||||||
|
for (String province : provinceList) {
|
||||||
|
List<GuideService> guideServiceList = guideServiceService.getGuideServiceByProvince(province);
|
||||||
|
dataList.add(new HeatMap(province, guideServiceList.size()));
|
||||||
|
if (guideServiceList.size() > max) {
|
||||||
|
max = guideServiceList.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataList.add(new HeatMap("最大", max));
|
||||||
|
for (HeatMap heatMap : dataList) {
|
||||||
|
System.out.println(heatMap);
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
@ -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,32 @@
|
|||||||
|
package com.softegg.freetogo.Search.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 SearchService {
|
||||||
|
|
||||||
|
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,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("province").toString(), 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 province, 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("province").toString(), 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 province, 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);//自定义函数,根据手机号进行查找返回对应对象
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.softegg.freetogo.User.bean;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 导游实体类
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/16 10:33
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "guides")
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Guides {
|
||||||
|
@Id
|
||||||
|
private Integer uid;
|
||||||
|
@Column(name = "residence")
|
||||||
|
private String rsd;
|
||||||
|
@Column(name = "familiarareas")
|
||||||
|
private String fa;
|
||||||
|
@Column(name = "synopsis")
|
||||||
|
private String syns;
|
||||||
|
@Column(name = "experance")
|
||||||
|
private boolean re;
|
||||||
|
@Column(name = "stars")
|
||||||
|
private int stars;
|
||||||
|
@Column(name = "sum")
|
||||||
|
private int sum;
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.softegg.freetogo.User.bean;
|
||||||
|
|
||||||
|
import jakarta.persistence.*;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:数据库中表users的对应实体类
|
||||||
|
* @author:zhanglinhao
|
||||||
|
* @date:2024/5/7 15:36
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "users")
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class Users {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Integer uid;
|
||||||
|
@Column
|
||||||
|
private String name;
|
||||||
|
@Column
|
||||||
|
private String email;
|
||||||
|
@Column
|
||||||
|
private String password;
|
||||||
|
@Column
|
||||||
|
private String createtime;
|
||||||
|
@Column(name="IDCard")
|
||||||
|
private String idcard;
|
||||||
|
@Column
|
||||||
|
private int reputation;
|
||||||
|
@Column
|
||||||
|
private boolean gender;//ture:male, false:female
|
||||||
|
@Column
|
||||||
|
private boolean membertype;//true:guide, false:visitor
|
||||||
|
@Column
|
||||||
|
private String phone;
|
||||||
|
@Column
|
||||||
|
private String nickname;
|
||||||
|
@Column
|
||||||
|
private int status;
|
||||||
|
|
||||||
|
public Users(String name, String email, String psw, String ct, int rpt, String phone, String nkn, String idc, boolean gender, boolean type, int status) {
|
||||||
|
this.name = name;
|
||||||
|
this.email = email;
|
||||||
|
this.password = psw;
|
||||||
|
this.createtime = ct;
|
||||||
|
this.reputation = rpt;
|
||||||
|
this.phone = phone;
|
||||||
|
this.nickname = nkn;
|
||||||
|
this.idcard = idc;
|
||||||
|
this.gender = gender;
|
||||||
|
this.membertype = type;
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.softegg.freetogo.User.service;
|
||||||
|
|
||||||
|
import com.softegg.freetogo.User.bean.Guides;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 数据库操作抽象接口类
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/16 10:45
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public interface GuidesService {
|
||||||
|
boolean registerToGuide(Guides guide);//注册成为导游,将导游注册信息入库
|
||||||
|
Optional<Guides> getGuideById(int id);
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.softegg.freetogo.User.service;
|
||||||
|
|
||||||
|
import com.softegg.freetogo.User.Dao.GuidesRepository;
|
||||||
|
import com.softegg.freetogo.User.bean.Guides;
|
||||||
|
import com.softegg.freetogo.User.bean.Users;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 数据库操作接口实现类
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/16 10:46
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class GuidesServiceImpl implements GuidesService {
|
||||||
|
@Autowired
|
||||||
|
GuidesRepository guidesRepository;
|
||||||
|
@Autowired
|
||||||
|
UsersService usersService;
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void registerToGuide(Guides guide) {
|
||||||
|
// guidesRepository.save(guide);
|
||||||
|
// System.out.println("成功保存注册导游信息!");
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 注册成为导游
|
||||||
|
* @param: guide
|
||||||
|
* @return: int
|
||||||
|
* @author: zhanglinhao
|
||||||
|
* @date: 2024/5/15 21:19
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean registerToGuide(Guides guide) {
|
||||||
|
System.out.println("注册成为导游id:" + guide.getUid());
|
||||||
|
Users user = usersService.getUserById(guide.getUid());
|
||||||
|
user.setMembertype(true);
|
||||||
|
guidesRepository.save(guide);
|
||||||
|
if (user.isMembertype()) {
|
||||||
|
System.out.println("注册成功!");
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
System.out.println("注册失败!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<Guides> getGuideById(int id) {
|
||||||
|
return guidesRepository.findById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.softegg.freetogo.User.service;
|
||||||
|
|
||||||
|
import com.softegg.freetogo.User.bean.Users;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:数据库操作抽象接口类
|
||||||
|
* @author:zhanglinhaon
|
||||||
|
* @date:2024/5/7 16:06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public interface UsersService {
|
||||||
|
List<Users> findAll();//查找所有用户
|
||||||
|
|
||||||
|
void add(Users user);//以user为用户入库
|
||||||
|
|
||||||
|
void deleteById(int id);//删除对应id用户
|
||||||
|
|
||||||
|
Users getUserById(int id);//获得对应id用户
|
||||||
|
|
||||||
|
void update(Users user);//更新用户信息
|
||||||
|
|
||||||
|
boolean isRegister(String phone);//判断该手机号(账号)是否已经入库
|
||||||
|
|
||||||
|
Users getUserByPhone(String phone);//根据手机号获得用户
|
||||||
|
|
||||||
|
boolean isGuide(String phone);//查询是否是导游
|
||||||
|
|
||||||
|
int getIdByPhone(String phone);//查找uid
|
||||||
|
void showInfo(Users user);//打印所有信息
|
||||||
|
}
|
@ -0,0 +1,250 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Apache Maven Wrapper startup batch script, version 3.3.1
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir, required when download maven via java source
|
||||||
|
# MVNW_REPOURL - repo url base for downloading maven distribution
|
||||||
|
# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
||||||
|
# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
set -euf
|
||||||
|
[ "${MVNW_VERBOSE-}" != debug ] || set -x
|
||||||
|
|
||||||
|
# OS specific support.
|
||||||
|
native_path() { printf %s\\n "$1"; }
|
||||||
|
case "$(uname)" in
|
||||||
|
CYGWIN* | MINGW*)
|
||||||
|
[ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
|
||||||
|
native_path() { cygpath --path --windows "$1"; }
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# set JAVACMD and JAVACCMD
|
||||||
|
set_java_home() {
|
||||||
|
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
|
||||||
|
if [ -n "${JAVA_HOME-}" ]; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
JAVACCMD="$JAVA_HOME/jre/sh/javac"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
JAVACCMD="$JAVA_HOME/bin/javac"
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
|
||||||
|
echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
|
||||||
|
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="$(
|
||||||
|
'set' +e
|
||||||
|
'unset' -f command 2>/dev/null
|
||||||
|
'command' -v java
|
||||||
|
)" || :
|
||||||
|
JAVACCMD="$(
|
||||||
|
'set' +e
|
||||||
|
'unset' -f command 2>/dev/null
|
||||||
|
'command' -v javac
|
||||||
|
)" || :
|
||||||
|
|
||||||
|
if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
|
||||||
|
echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# hash string like Java String::hashCode
|
||||||
|
hash_string() {
|
||||||
|
str="${1:-}" h=0
|
||||||
|
while [ -n "$str" ]; do
|
||||||
|
char="${str%"${str#?}"}"
|
||||||
|
h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
|
||||||
|
str="${str#?}"
|
||||||
|
done
|
||||||
|
printf %x\\n $h
|
||||||
|
}
|
||||||
|
|
||||||
|
verbose() { :; }
|
||||||
|
[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
|
||||||
|
|
||||||
|
die() {
|
||||||
|
printf %s\\n "$1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
|
||||||
|
while IFS="=" read -r key value; do
|
||||||
|
case "${key-}" in
|
||||||
|
distributionUrl) distributionUrl="${value-}" ;;
|
||||||
|
distributionSha256Sum) distributionSha256Sum="${value-}" ;;
|
||||||
|
esac
|
||||||
|
done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
|
||||||
|
case "${distributionUrl##*/}" in
|
||||||
|
maven-mvnd-*bin.*)
|
||||||
|
MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
|
||||||
|
case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
|
||||||
|
*AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
|
||||||
|
:Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
|
||||||
|
:Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
|
||||||
|
:Linux*x86_64*) distributionPlatform=linux-amd64 ;;
|
||||||
|
*)
|
||||||
|
echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
|
||||||
|
distributionPlatform=linux-amd64
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
|
||||||
|
;;
|
||||||
|
maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
|
||||||
|
*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
||||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
||||||
|
[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
|
||||||
|
distributionUrlName="${distributionUrl##*/}"
|
||||||
|
distributionUrlNameMain="${distributionUrlName%.*}"
|
||||||
|
distributionUrlNameMain="${distributionUrlNameMain%-bin}"
|
||||||
|
MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
|
||||||
|
|
||||||
|
exec_maven() {
|
||||||
|
unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
|
||||||
|
exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -d "$MAVEN_HOME" ]; then
|
||||||
|
verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
||||||
|
exec_maven "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "${distributionUrl-}" in
|
||||||
|
*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
|
||||||
|
*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# prepare tmp dir
|
||||||
|
if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
|
||||||
|
clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
|
||||||
|
trap clean HUP INT TERM EXIT
|
||||||
|
else
|
||||||
|
die "cannot create temp dir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p -- "${MAVEN_HOME%/*}"
|
||||||
|
|
||||||
|
# Download and Install Apache Maven
|
||||||
|
verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
||||||
|
verbose "Downloading from: $distributionUrl"
|
||||||
|
verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||||
|
|
||||||
|
# select .zip or .tar.gz
|
||||||
|
if ! command -v unzip >/dev/null; then
|
||||||
|
distributionUrl="${distributionUrl%.zip}.tar.gz"
|
||||||
|
distributionUrlName="${distributionUrl##*/}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# verbose opt
|
||||||
|
__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
|
||||||
|
[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
|
||||||
|
|
||||||
|
# normalize http auth
|
||||||
|
case "${MVNW_PASSWORD:+has-password}" in
|
||||||
|
'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
||||||
|
has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
|
||||||
|
verbose "Found wget ... using wget"
|
||||||
|
wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
|
||||||
|
elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
|
||||||
|
verbose "Found curl ... using curl"
|
||||||
|
curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
|
||||||
|
elif set_java_home; then
|
||||||
|
verbose "Falling back to use Java to download"
|
||||||
|
javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
|
||||||
|
targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||||
|
cat >"$javaSource" <<-END
|
||||||
|
public class Downloader extends java.net.Authenticator
|
||||||
|
{
|
||||||
|
protected java.net.PasswordAuthentication getPasswordAuthentication()
|
||||||
|
{
|
||||||
|
return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
|
||||||
|
}
|
||||||
|
public static void main( String[] args ) throws Exception
|
||||||
|
{
|
||||||
|
setDefault( new Downloader() );
|
||||||
|
java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END
|
||||||
|
# For Cygwin/MinGW, switch paths to Windows format before running javac and java
|
||||||
|
verbose " - Compiling Downloader.java ..."
|
||||||
|
"$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
|
||||||
|
verbose " - Running Downloader.java ..."
|
||||||
|
"$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
||||||
|
if [ -n "${distributionSha256Sum-}" ]; then
|
||||||
|
distributionSha256Result=false
|
||||||
|
if [ "$MVN_CMD" = mvnd.sh ]; then
|
||||||
|
echo "Checksum validation is not supported for maven-mvnd." >&2
|
||||||
|
echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
||||||
|
exit 1
|
||||||
|
elif command -v sha256sum >/dev/null; then
|
||||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
|
||||||
|
distributionSha256Result=true
|
||||||
|
fi
|
||||||
|
elif command -v shasum >/dev/null; then
|
||||||
|
if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
|
||||||
|
distributionSha256Result=true
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
|
||||||
|
echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ $distributionSha256Result = false ]; then
|
||||||
|
echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
|
||||||
|
echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# unzip and move
|
||||||
|
if command -v unzip >/dev/null; then
|
||||||
|
unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
|
||||||
|
else
|
||||||
|
tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
|
||||||
|
fi
|
||||||
|
printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
|
||||||
|
mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
|
||||||
|
|
||||||
|
clean || :
|
||||||
|
exec_maven "$@"
|
@ -0,0 +1,146 @@
|
|||||||
|
<# : batch portion
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. You may obtain a copy of the License at
|
||||||
|
@REM
|
||||||
|
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@REM
|
||||||
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Apache Maven Wrapper startup batch script, version 3.3.1
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM MVNW_REPOURL - repo url base for downloading maven distribution
|
||||||
|
@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
|
||||||
|
@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
|
||||||
|
@SET __MVNW_CMD__=
|
||||||
|
@SET __MVNW_ERROR__=
|
||||||
|
@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
|
||||||
|
@SET PSModulePath=
|
||||||
|
@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
|
||||||
|
IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
|
||||||
|
)
|
||||||
|
@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
|
||||||
|
@SET __MVNW_PSMODULEP_SAVE=
|
||||||
|
@SET __MVNW_ARG0_NAME__=
|
||||||
|
@SET MVNW_USERNAME=
|
||||||
|
@SET MVNW_PASSWORD=
|
||||||
|
@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*)
|
||||||
|
@echo Cannot start maven from wrapper >&2 && exit /b 1
|
||||||
|
@GOTO :EOF
|
||||||
|
: end batch / begin powershell #>
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
if ($env:MVNW_VERBOSE -eq "true") {
|
||||||
|
$VerbosePreference = "Continue"
|
||||||
|
}
|
||||||
|
|
||||||
|
# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
|
||||||
|
$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
|
||||||
|
if (!$distributionUrl) {
|
||||||
|
Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
}
|
||||||
|
|
||||||
|
switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
|
||||||
|
"maven-mvnd-*" {
|
||||||
|
$USE_MVND = $true
|
||||||
|
$distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
|
||||||
|
$MVN_CMD = "mvnd.cmd"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
$USE_MVND = $false
|
||||||
|
$MVN_CMD = $script -replace '^mvnw','mvn'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# apply MVNW_REPOURL and calculate MAVEN_HOME
|
||||||
|
# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-<version>,maven-mvnd-<version>-<platform>}/<hash>
|
||||||
|
if ($env:MVNW_REPOURL) {
|
||||||
|
$MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" }
|
||||||
|
$distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')"
|
||||||
|
}
|
||||||
|
$distributionUrlName = $distributionUrl -replace '^.*/',''
|
||||||
|
$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
|
||||||
|
$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain"
|
||||||
|
$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
|
||||||
|
$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
|
||||||
|
|
||||||
|
if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
|
||||||
|
Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
|
||||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
||||||
|
exit $?
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
|
||||||
|
Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
|
||||||
|
}
|
||||||
|
|
||||||
|
# prepare tmp dir
|
||||||
|
$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
|
||||||
|
$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
|
||||||
|
$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
|
||||||
|
trap {
|
||||||
|
if ($TMP_DOWNLOAD_DIR.Exists) {
|
||||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
||||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
|
||||||
|
|
||||||
|
# Download and Install Apache Maven
|
||||||
|
Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
|
||||||
|
Write-Verbose "Downloading from: $distributionUrl"
|
||||||
|
Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
|
||||||
|
|
||||||
|
$webclient = New-Object System.Net.WebClient
|
||||||
|
if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
|
||||||
|
$webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
|
||||||
|
}
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
|
||||||
|
|
||||||
|
# If specified, validate the SHA-256 sum of the Maven distribution zip file
|
||||||
|
$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
|
||||||
|
if ($distributionSha256Sum) {
|
||||||
|
if ($USE_MVND) {
|
||||||
|
Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
|
||||||
|
}
|
||||||
|
Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
|
||||||
|
if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
|
||||||
|
Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# unzip and move
|
||||||
|
Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
|
||||||
|
Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null
|
||||||
|
try {
|
||||||
|
Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
|
||||||
|
} catch {
|
||||||
|
if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
|
||||||
|
Write-Error "fail to move MAVEN_HOME"
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
|
||||||
|
catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
|
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>3.2.5</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.softegg</groupId>
|
||||||
|
<artifactId>FreeToGo</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>FreeToGo</name>
|
||||||
|
<description>FreeToGo</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jdbc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>2.8.9</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.json-simple</groupId>
|
||||||
|
<artifactId>json-simple</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,31 @@
|
|||||||
|
#-------------------------------------------------------------------------------#
|
||||||
|
# Qodana analysis is configured by qodana.yaml file #
|
||||||
|
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
|
||||||
|
#-------------------------------------------------------------------------------#
|
||||||
|
version: "1.0"
|
||||||
|
|
||||||
|
#Specify inspection profile for code analysis
|
||||||
|
profile:
|
||||||
|
name: qodana.starter
|
||||||
|
|
||||||
|
#Enable inspections
|
||||||
|
#include:
|
||||||
|
# - name: <SomeEnabledInspectionId>
|
||||||
|
|
||||||
|
#Disable inspections
|
||||||
|
#exclude:
|
||||||
|
# - name: <SomeDisabledInspectionId>
|
||||||
|
# paths:
|
||||||
|
# - <path/where/not/run/inspection>
|
||||||
|
|
||||||
|
projectJDK: 17 #(Applied in CI/CD pipeline)
|
||||||
|
|
||||||
|
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
|
||||||
|
#bootstrap: sh ./prepare-qodana.sh
|
||||||
|
|
||||||
|
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
|
||||||
|
#plugins:
|
||||||
|
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
|
||||||
|
|
||||||
|
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
|
||||||
|
linter: jetbrains/qodana-jvm:latest
|
@ -0,0 +1,2 @@
|
|||||||
|
spring.application.name=FreeToGo
|
||||||
|
server.port=8080
|
@ -0,0 +1,10 @@
|
|||||||
|
spring:
|
||||||
|
jpa:
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: update
|
||||||
|
show-sql: true
|
||||||
|
datasource:
|
||||||
|
username: root
|
||||||
|
password: zlh1260788704
|
||||||
|
url: jdbc:mysql://localhost:3306/freetogo?useSSL=false&useUnicode=true&characterEncoding=utf-8
|
||||||
|
driverClassName: com.mysql.cj.jdbc.Driver
|
Loading…
Reference in new issue