AirlineReservationSystem是一个航班订票系统
技术 Struts Mybatis Layui Bootstrap Jquery Echarts
功能 前台功能 登入 注册 短信验证 机票查询 飞机订票 退票 订单查看 支付宝退款 支付宝付钱 后台功能 用户管理 航班管理 订单管理 员工管理 天气预警 日志中心 项目截图 前台
后台
数据库设计 航班信息表 表名:flightinfo
字段名 类型 注释 flid int ID flname varchar 航班名称 departdate date 出发日期(年月日) leavecity varchar 离开城市 leavetime varchar 离开时间(时分) leaveairport varchar 离开机场名称 arrivecity varchar 到达城市 arrivetime varchar 到达时间(时分) arriveairport varchar 到达机场名称 votes int 票数 fares double 票价 punctuality varchar 准点率
用户信息表 表名:userinfo
字段名 类型 注释 usid int ID account varchar 账号 password varchar 密码 name varchar 姓名 phone varchar 电话 idcard varchar 身份证
订单表 表名:orderinfo
字段名 类型 注释 orid int ID userid int 用户ID fligid int 航班ID amt double 金额 ordernumber varchar 订单号 transactionno varchar 交易流水号 paytime varchar 支付时间
部分功能代码 订票付钱退票退款 package com.action;import cn.hutool.core.date.DateUtil;import com.alipay.api.AlipayApiException;import com.alipay.api.internal.util.AlipaySignature;import com.alipay.config.AlipayConfig;import com.dao.SearchTicketDao;import com.entity.FlightInfo;import com.entity.OrderInfo;import com.entity.UserInfo;import com.opensymphony.xwork2.ActionSupport;import com.tools.GetSqlSession;import org.apache.ibatis.session.SqlSession;import org.apache.struts2.ServletActionContext;import javax.servlet.http.HttpServletRequest;import java.io.IOException;import java.io.UnsupportedEncodingException;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;public class PayMoneyAction extends ActionSupport { String app_id; String auth_app_id; String charset; String method; String out_trade_no; String seller_id; String sign; String sign_type; String timestamp; String total_amount; String trade_no; String version; public String getApp_id () { return app_id; } public void setApp_id (String app_id) { this .app_id = app_id; } public String getAuth_app_id () { return auth_app_id; } public void setAuth_app_id (String auth_app_id) { this .auth_app_id = auth_app_id; } public String getCharset () { return charset; } public void setCharset (String charset) { this .charset = charset; } public String getMethod () { return method; } public void setMethod (String method) { this .method = method; } public String getOut_trade_no () { return out_trade_no; } public void setOut_trade_no (String out_trade_no) { this .out_trade_no = out_trade_no; } public String getSeller_id () { return seller_id; } public void setSeller_id (String seller_id) { this .seller_id = seller_id; } public String getSign () { return sign; } public void setSign (String sign) { this .sign = sign; } public String getSign_type () { return sign_type; } public void setSign_type (String sign_type) { this .sign_type = sign_type; } public String getTimestamp () { return timestamp; } public void setTimestamp (String timestamp) { this .timestamp = timestamp; } public String getTotal_amount () { return total_amount; } public void setTotal_amount (String total_amount) { this .total_amount = total_amount; } public String getTrade_no () { return trade_no; } public void setTrade_no (String trade_no) { this .trade_no = trade_no; } public String getVersion () { return version; } public void setVersion (String version) { this .version = version; } public String hbname; public int punumber; public String getHbname () { return hbname; } public void setHbname (String hbname) { this .hbname = hbname; } public int getPunumber () { return punumber; } public void setPunumber (int punumber) { this .punumber = punumber; } public List flis; public List getFlis () { return flis; } public void setFlis (List flis) { this .flis = flis; } @Override public String execute () throws IOException, AlipayApiException { SqlSession session= GetSqlSession.getsSession(); SearchTicketDao se=session.getMapper(SearchTicketDao.class); HttpServletRequest request= ServletActionContext.getRequest(); Map<String,String> params = new HashMap <String,String>(); Map<String,String[]> requestParams = request.getParameterMap(); for (Iterator<String> iter = requestParams.keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); String[] values = (String[]) requestParams.get(name); String valueStr = "" ; for (int i = 0 ; i < values.length; i++) { valueStr = (i == values.length - 1 ) ? valueStr + values[i] : valueStr + values[i] + "," ; } valueStr = new String (valueStr.getBytes("ISO-8859-1" ), "utf-8" ); params.put(name, valueStr); } boolean signVerified = AlipaySignature.rsaCheckV1(params, AlipayConfig.alipay_public_key, AlipayConfig.charset, AlipayConfig.sign_type); if (signVerified) { String out_trade_no = new String (request.getParameter("out_trade_no" ).getBytes("ISO-8859-1" ),"UTF-8" ); String trade_no = new String (request.getParameter("trade_no" ).getBytes("ISO-8859-1" ),"UTF-8" ); String total_amount = new String (request.getParameter("total_amount" ).getBytes("ISO-8859-1" ),"UTF-8" ); System.out.println("商户订单号:" +out_trade_no+" " +"交易宝账号:" +trade_no+" " +"付款金额:" +total_amount); String hbid= (String) request.getSession().getAttribute("hbid" ); System.out.println("航班ID:" +hbid); int fjid=Integer.parseInt(hbid); double amount=Double.parseDouble(total_amount); List<UserInfo> usein = (List<UserInfo>) request.getSession().getAttribute("userSession" ); int userinfoid = 0 ; for (int u=0 ;u<usein.size();u++){ UserInfo us=usein.get(u); userinfoid=us.getUsId(); } System.out.println("187:用户信息:" +userinfoid); String now = DateUtil.now(); OrderInfo or=new OrderInfo (userinfoid,fjid,amount,out_trade_no,trade_no,now); int osu=se.Orderadd(or); List lis=se.Fliinfo(fjid); int ps=0 ; for (int i=0 ;i<lis.size();i++){ FlightInfo flg= (FlightInfo) lis.get(i); ps=flg.getVotes()-1 ; } FlightInfo fli=new FlightInfo (); fli.setVotes(ps); fli.setFlid(fjid); fli.setFares(amount); int uppshu=se.UpFliginfo(fli); flis=se.Fliinfo(fjid); for (int u=0 ;u<flis.size();u++){ FlightInfo flg= (FlightInfo) flis.get(u); hbname=flg.getFlname(); punumber=flg.getVotes(); } session.commit(); session.close(); return SUCCESS; }else { System.out.println("验签失败" ); return ERROR; } } }