diff --git a/.classpath b/.classpath
index 582d261..9e4c6d7 100644
--- a/.classpath
+++ b/.classpath
@@ -6,23 +6,18 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..2cd8e91
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/servlet/search_fly.java=UTF-8
diff --git a/WebContent/default/css/style.css b/WebContent/default/css/style.css
index 2fc0662..b7316b4 100644
--- a/WebContent/default/css/style.css
+++ b/WebContent/default/css/style.css
@@ -12,7 +12,7 @@ body {
*/
/* 调整聊天框的样式 */
-.chat-container {
+/*.chat-container {
position: fixed;
bottom: 220px;
right: 20px;
@@ -24,11 +24,31 @@ body {
background-color: white;
z-index: 1000;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
+
+ .chat-container #chat-history {
+ height: 340px;
+ overflow-y: auto;
+ padding: 10px;
+}
+}*/
+.chat-container {
+ position: fixed;
+ top: 20%;
+ bottom: 10%;
+ right: 3%;
+ width: 30%;
+ height: 75%;
+ border: 1px solid #ccc;
+ border-radius: 5px;
+ overflow: hidden;
+ background-color: white;
+
+ box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
/* 其他样式保持不变 */
.chat-container #chat-history {
- height: 340px;
+ height: 90%;
overflow-y: auto;
padding: 10px;
}
diff --git a/WebContent/default/images/newlogo11.png b/WebContent/default/images/newlogo11.png
new file mode 100644
index 0000000..e30f131
Binary files /dev/null and b/WebContent/default/images/newlogo11.png differ
diff --git a/WebContent/default/search.jsp b/WebContent/default/search.jsp
index e1c9207..271e39d 100644
--- a/WebContent/default/search.jsp
+++ b/WebContent/default/search.jsp
@@ -1,13 +1,15 @@
<%@page import="javabean.flight"%>
<%@page import="java.util.ArrayList"%>
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@page contentType="text/html; charset=UTF-8" import="java.util.Date"%>
+<%@page contentType="text/html; charset=UTF-8" import="java.text.SimpleDateFormat"%>
<%@page import="javabean.db_conn"%>
<%@page import="java.sql.ResultSet"%>
-机票预订系统
+机票推荐系统
@@ -20,7 +22,13 @@
<%! db_conn conn2=new db_conn();
String seat;
String user_name;
- String todaydate="2019-12-01";%>
+ Date date = new Date();
+ //设置要获取到什么样的时间
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+ //获取String类型的时间
+ String todaydate = sdf.format(date);
+
+%>
@@ -40,8 +48,7 @@
-
- <%
- String todaydate="2019-12-01";
+ <%
if(session.getAttribute("user_id")!=null){
db_conn conn2=new db_conn();
String sql2="select * from p_inf where p_tel='"+session.getAttribute("user_id")+"'";
@@ -79,8 +86,8 @@
class="icon-bar">
-
@@ -157,10 +164,22 @@
- <%=flight_info.getF_s_t() %>
- —
- <%=flight_info.getF_a_t() %>
-
+ <%
+ db_conn conn3=new db_conn();
+ String a_code="";//出发地机场三字码
+ String d_code="";//到达地机场三字码
+ String sql3="SELECT code FROM codetoname WHERE airportname = '"+flight_info.getF_a_a()+"'";
+ String sql4="SELECT code FROM codetoname WHERE airportname = '"+flight_info.getF_s_a()+"'";
+ ResultSet res3=conn3.executeQuery(sql3);
+ if(res3.next()) a_code=res3.getString(1);
+ ResultSet res4=conn3.executeQuery(sql4);
+ if(res4.next()) d_code=res4.getString(1);
+ String Domainname="https://flights.ctrip.com/";
+ Domainname+="online/list/oneway-"+d_code+"-"+a_code+"?_=1&depdate="+flight_info.getF_d()+"&containstax=1";
+ %>
<%if(session.getAttribute("user_id")!=null){ %>
<%} %>
+ class="btn btn-danger btn-sm" onClick="window.location.href ='<%= Domainname%>';">订票<%} %>
<%if(session.getAttribute("user_id")==null){ %>
<%} %>
@@ -171,8 +190,10 @@
- - 今日剩余座位数:<%=seat %>
- - 价格:¥<%=flight_info.getF_p() %>
+ - 价格:¥<%=flight_info.getF_p() %>
+ - 延误率:<%=flight_info.getF_delay() %>
+ - 餐食:<%=flight_info.getF_food() %>
+ - 座位宽度:<%=flight_info.getF_wide() %>
diff --git a/codetoname.xlsx b/codetoname.xlsx
new file mode 100644
index 0000000..4a0dae1
Binary files /dev/null and b/codetoname.xlsx differ
diff --git a/src/javabean/db_conn.java b/src/javabean/db_conn.java
index c370afe..980cd5f 100644
--- a/src/javabean/db_conn.java
+++ b/src/javabean/db_conn.java
@@ -13,7 +13,7 @@ public class db_conn {
//ݿʼ
public db_conn() {
- String URL="jdbc:mysql://localhost:3307/fly_ticket?useSSL=false&useUnicode=true&characterEncoding=UTF8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"; //ݿ3306
+ String URL="jdbc:mysql://localhost:3306/fly_ticket?useSSL=false&useUnicode=true&characterEncoding=UTF8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC"; //ݿ3306
String USER="root"; //ݿû
String PWD="123456"; //ݿ
try{
diff --git a/src/javabean/flight.java b/src/javabean/flight.java
index a5c4fd9..363a8b2 100644
--- a/src/javabean/flight.java
+++ b/src/javabean/flight.java
@@ -8,8 +8,35 @@ public class flight { //
private String f_s_t=null;//ʱ
private String f_a_t=null;//ʱ
private String f_p=null;//Ʊ
+ private String f_d=null;//
+ private String f_delay=null;//
+ private String f_food=null;//ʳ
+ private String f_wide=null;//λ
-
+ public String getF_wide() {
+ return f_wide;
+ }
+ public void setF_wide(String f_wide) {
+ this.f_wide=f_wide;
+ }
+ public String getF_food() {
+ return f_food;
+ }
+ public void setF_food(String f_food) {
+ this.f_food=f_food;
+ }
+ public String getF_delay() {
+ return f_delay;
+ }
+ public void setF_delay(String f_delay) {
+ this.f_delay=f_delay;
+ }
+ public String getF_d() {
+ return f_d;
+ }
+ public void setF_d(String f_d) {
+ this.f_d=f_d;
+ }
public String getF_n() {
return f_n;
}
diff --git a/src/servlet/search_fly.java b/src/servlet/search_fly.java
index 97c07b8..07fab82 100644
--- a/src/servlet/search_fly.java
+++ b/src/servlet/search_fly.java
@@ -41,7 +41,7 @@ public class search_fly extends HttpServlet {
String sql = null;
if (departure.isEmpty() && destination.isEmpty() && departureYear.isEmpty() && departureMonth.isEmpty() && departureDay.isEmpty()) {
- // 如果所有字段都为空,重定向到原页面
+ // 濡傛灉鎵�鏈夊瓧娈甸兘涓虹┖锛岄噸瀹氬悜鍒板師椤甸潰
resp.sendRedirect(url);
} else {
sql = "SELECT * FROM flight WHERE 1=1";
@@ -53,7 +53,7 @@ public class search_fly extends HttpServlet {
sql += " AND f_a_p='" + destination + "'";
}
if (!departureYear.isEmpty() && !departureMonth.isEmpty() && !departureDay.isEmpty()) {
- // 验证日期格式
+ // 楠岃瘉鏃ユ湡鏍煎紡
try {
int year = Integer.parseInt(departureYear);
int month = Integer.parseInt(departureMonth);
@@ -62,10 +62,10 @@ public class search_fly extends HttpServlet {
String departureDate = String.format("%04d-%02d-%02d", year, month, day);
sql += " AND DATE(f_Date)='" + departureDate + "'";
} else {
- req.setAttribute("errorMsg", "日期格式不正确,请输入有效的年、月、日");
+ req.setAttribute("errorMsg", "鏃ユ湡鏍煎紡涓嶆纭紝璇疯緭鍏ユ湁鏁堢殑骞淬�佹湀銆佹棩");
}
} catch (NumberFormatException e) {
- req.setAttribute("errorMsg", "日期格式不正确,请输入数字");
+ req.setAttribute("errorMsg", "鏃ユ湡鏍煎紡涓嶆纭紝璇疯緭鍏ユ暟瀛�");
}
}
@@ -84,11 +84,15 @@ public class search_fly extends HttpServlet {
flight_info.setF_s_t(res.getString(6));
flight_info.setF_a_t(res.getString(7));
flight_info.setF_p(res.getString(8));
+ flight_info.setF_d(res.getString(9));
+ flight_info.setF_delay(res.getString(10));
+ flight_info.setF_food(res.getString(11));
+ flight_info.setF_wide(res.getString(12));
flightlist.add(flight_info);
}
req.setAttribute("flightlist", flightlist);
} catch (SQLException e) {
- System.out.println("错误信息:" + e);
+ System.out.println("閿欒淇℃伅锛�" + e);
} finally {
conn.closeDB();
}
diff --git a/target/classes/META-INF/MANIFEST.MF b/target/classes/META-INF/MANIFEST.MF
index 9bdf3b1..38f1f7e 100644
--- a/target/classes/META-INF/MANIFEST.MF
+++ b/target/classes/META-INF/MANIFEST.MF
@@ -1,4 +1,4 @@
Manifest-Version: 1.0
-Build-Jdk-Spec: 21
+Build-Jdk-Spec: 22
Created-By: Maven Integration for Eclipse
diff --git a/target/classes/META-INF/maven/air_ticket_book/air_ticket_book/pom.properties b/target/classes/META-INF/maven/air_ticket_book/air_ticket_book/pom.properties
index 22866d9..fc7157f 100644
--- a/target/classes/META-INF/maven/air_ticket_book/air_ticket_book/pom.properties
+++ b/target/classes/META-INF/maven/air_ticket_book/air_ticket_book/pom.properties
@@ -1,7 +1,7 @@
#Generated by Maven Integration for Eclipse
-#Sun Oct 06 18:10:33 CST 2024
+#Thu Oct 17 20:23:36 CST 2024
artifactId=air_ticket_book
groupId=air_ticket_book
-m2e.projectLocation=D\:\\college\\SE2\\air_ticket_book-master\\\u8F6F\u4EF6\u5DE5\u7A0B\u8BFE\u7A0B\u8BBE\u8BA1\\air_ticket_book
+m2e.projectLocation=C\:\\Users\\RichardWang\\Desktop\\ai_agent
m2e.projectName=air_ticket_book
version=0.0.1-SNAPSHOT
diff --git a/target/classes/javabean/db_conn.class b/target/classes/javabean/db_conn.class
index 8d11bcd..8f493cb 100644
Binary files a/target/classes/javabean/db_conn.class and b/target/classes/javabean/db_conn.class differ