基本信息
源码名称:长途汽车售票管理系(源码+数据库)
源码大小:5.42M
文件格式:.rar
开发语言:Java
更新时间:2021-03-24
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 5 元 
   源码介绍


为了化简繁琐的工作过程,使车站售票管理更加合理化和科学化,提高工作效率和节省运营成本,现应用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;
}

}

}