在好例子网,分享、交流、成长!
您当前所在位置:首页Java 开发实例Java数据库编程 → 长途汽车售票管理系(源码+数据库)

长途汽车售票管理系(源码+数据库)

Java数据库编程

下载此实例
  • 开发语言:Java
  • 实例大小:5.42M
  • 下载次数:71
  • 浏览次数:754
  • 发布时间:2021-03-24
  • 实例类别:Java数据库编程
  • 发 布 人:LaoMowang
  • 文件格式:.rar
  • 所需积分:5
 相关标签: 售票 汽车 管理 java MySql

实例介绍

【实例简介】


为了化简繁琐的工作过程,使车站售票管理更加合理化和科学化,提高工作效率和节省运营成本,现应用Java程序和数据库系统开发了一个新的长途汽车售票管理系统,该系统解决了传统长途汽车售票依靠人工记录造成的效率、精确度不足的问题。长途汽车售票管理系统分为两个子系统,用户子系统可以满足用户购票,查询购票订单,修改用户信息的功能;管理员子系统可以满足车站管理员增删改车次信息、管理员信息的功能,也能根据用户需求,设置其权限,方便快捷的为用户提供服务,同时提高了售票效率,节约了运营成本。


【实例截图】长途汽车售票管理系,JAVA mysql,实现用户信息,车次信息的修改。

【核心代码】

package application.controller;

import java.net.URL;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.ResourceBundle;

import com.sun.xml.internal.fastinfoset.sax.Properties;

import application.AbstractController;
import application.Session;
import application.entity.BusSchedule;
import application.entity.Busquerybean;
import application.util.JdbcUtils;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.cell.PropertyValueFactory;

public class Modify_controller extends AbstractController implements Initializable {
@FXML
private TableView table;

@FXML
    private TextField start;

    @FXML
    private Button querybtn;

@FXML
private TableColumn<Busquerybean, String> sstation;
@FXML
private TableColumn<Busquerybean, String> arriveS;
@FXML
private TableColumn<Busquerybean, Number> busnumber;
@FXML
private TableColumn<Busquerybean, Number> price;
@FXML
private TableColumn<ButtonFileRow, String> modify;
private SimpleObjectProperty<EditButton> editButton;
List<BusSchedule> findMoreRefResult2 =null;
String sql = "SELECT * FROM bus_schedule ";
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
// TODO Auto-generated method stub

JdbcUtils jdbcUtils = new JdbcUtils();
jdbcUtils.getConnection();

// 利用反射查询单条记录






try {

findMoreRefResult2 = jdbcUtils.findMoreRefResult2(sql, new ArrayList<>(), BusSchedule.class);

} catch (Exception e1) {
e1.printStackTrace();
}


ObservableList<ButtonFileRow> data = FXCollections.observableArrayList();

for (BusSchedule busSchedule :findMoreRefResult2) {
data.add(new ButtonFileRow("修改", busSchedule.getStart_station(),
busSchedule.getEnd_station(), busSchedule.getBus_number(),
busSchedule.getTicket_price()));
}
//绑定数据源
table.setItems(data);


sstation.setCellValueFactory(new PropertyValueFactory<>("Start_station"));
arriveS.setCellValueFactory(new PropertyValueFactory<>("End_station"));
busnumber.setCellValueFactory(new PropertyValueFactory<>("Bus_number"));
price.setCellValueFactory(new PropertyValueFactory<>("Ticket_price"));
modify.setCellValueFactory(new PropertyValueFactory<>("editButton"));

querybtn.setOnAction((ActionEvent e)->{
sql = "SELECT * FROM bus_schedule where start_station like ?";



ArrayList<Object> arrayList = new ArrayList<>();
arrayList.add("%" start.getText() "%");
try {

findMoreRefResult2 = jdbcUtils.findMoreRefResult2(sql, arrayList, BusSchedule.class);

} catch (Exception e1) {
e1.printStackTrace();
}


data.clear();
for (BusSchedule busSchedule :findMoreRefResult2) {
data.add(new ButtonFileRow("修改", busSchedule.getStart_station(),
busSchedule.getEnd_station(), busSchedule.getBus_number(),
busSchedule.getTicket_price()));
}
//绑定数据源
table.setItems(data);


sstation.setCellValueFactory(new PropertyValueFactory<>("Start_station"));
arriveS.setCellValueFactory(new PropertyValueFactory<>("End_station"));
busnumber.setCellValueFactory(new PropertyValueFactory<>("Bus_number"));
price.setCellValueFactory(new PropertyValueFactory<>("Ticket_price"));
modify.setCellValueFactory(new PropertyValueFactory<>("editButton"));
});
}

//改写购票按钮
public static class EditButton extends Button {

public EditButton(String fileName, String s, String e, String bus, double ticker) {
super(fileName);
setOnAction((event) -> {
PopupModifyController popupModifyController = new PopupModifyController();

popupModifyController.setId(bus);
int showPopupWindow = showPopupWindow("view/Popupmodify.fxml",popupModifyController);
if(showPopupWindow==1) {

}

});

}
}
//生成订单号
public static String getRandomCode() {

SimpleDateFormat simpleDateFormat;

simpleDateFormat = new SimpleDateFormat("yyyyMMdd");

Date date = new Date();

String str = simpleDateFormat.format(date);

Random random = new Random();

int rannum = (int) (random.nextDouble() * (99999 - 10000 1)) 10000;// 获取5位随机数

return "CPXT-" str rannum;// 当前时间 }

}


public static class ButtonFileRow {

private final SimpleObjectProperty<EditButton> editButton;

private final SimpleStringProperty Start_station;
private final SimpleStringProperty End_station;
private final SimpleStringProperty Bus_number;
private final SimpleDoubleProperty Ticket_price;

public ButtonFileRow(String fileName, String s, String e, String bus, double ticker) {

this.Start_station = new SimpleStringProperty(s);
this.End_station = new SimpleStringProperty(e);
this.Bus_number = new SimpleStringProperty(bus);
this.Ticket_price = new SimpleDoubleProperty(ticker);
editButton = new SimpleObjectProperty(new EditButton(fileName, s, e, bus, ticker));

}

// date



// start_station
public StringProperty Start_stationProperty() {
return Start_station;
}

public String getStart_station() {
return Start_station.get();
}

public void setStart_station(String fName) {
Start_station.set(fName);
}

// end_station
public StringProperty End_stationProperty() {
return End_station;
}

public String getEnd_station() {
return End_station.get();
}

public void setEnd_station(String fName) {
End_station.set(fName);
}
// bus_number

public StringProperty Bus_numberProperty() {
return Bus_number;
}

public String getBus_number() {
return Bus_number.get();
}

public void setBus_number(String fName) {
Bus_number.set(fName);
}

// Ticket_price
public DoubleProperty Ticket_priceProperty() {
return Ticket_price;
}

public double getTicket_price() {
return Ticket_price.get();
}

public void setTicket_price(double fName) {
Ticket_price.set(fName);
}

// editButton
public EditButton getEditButton() {
return editButton.get();
}

public void setEditButton(EditButton editButton) {
this.editButton.set(editButton);
}

public ObjectProperty<EditButton> editButtonProperty() {
return editButton;
}

}

}



实例下载地址

长途汽车售票管理系(源码+数据库)

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

第 1 楼 mjapk9991 发表于: 2021-10-15 09:01 02
javafx包导入失败

支持(0) 盖楼(回复)

发表评论

(您的评论需要经过审核才能显示)

查看所有1条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警