java書店體系卒業設計 整體設計(1)。本站提示廣大學習愛好者:(java書店體系卒業設計 整體設計(1))文章只能為提供參考,不一定能成為您想要的結果。以下是java書店體系卒業設計 整體設計(1)正文
java書店體系項目功效需求:
1、能停止操感化戶的注冊,修正根本信息,刪除和查詢。
2、能對圖書的根本信息停止增長、刪除、修正和查詢操作。
3、能填寫進貨單,一張進貨單帶有多條詳細的進貨信息,進貨的書本必需是圖書治理外面曾經有的;進貨的同時修正庫存對應書本的存貨量。
4、能填寫發賣單,一張發賣單帶有多條詳細的發賣信息,發賣的書本必需是圖書治理外面曾經有的,並且發賣的數目不克不及跨越以後庫存的數目;發賣的同時修正庫存對應書本的存貨量。
5、可以檢查庫存的明細,可以依照前提停止查找詳細的圖書的庫存值。
6、權限方面停止簡化,做固定的權限掌握。把用戶依照模塊分紅分歧操作權限的人員,特設一個admin的用戶,可以操作全體的功效。
項目根本設計:
★ 架構設計:
全體框架、模塊劃分
模塊劃分:用戶、圖書、進貨、發賣和庫存5個模塊
★ 體系功效構造設計:
每一個功效模塊的詳細功效子模塊
★ 數據庫設計:
項目框架完成:分模塊、分層、分包、構建運用法式
焦點框架—-完成每一個界面的轉換
package cn.hncu.bookStore; import cn.hncu.bookStore.login.ui.Login; /** * *@author<a href="mailto:[email protected]">xzm</a> */ public class bookStoreApp extends javax.swing.JFrame { private static final long serialVersionUID = 1L; /** Creates new form bookStoreApp */ public bookStoreApp() { initComponents(); this.setContentPane(new Login(this));//添加登錄界面 this.validate(); getContentPane().setLocation(150, 50); } //GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { menuBar = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); openMenuItem = new javax.swing.JMenuItem(); saveMenuItem = new javax.swing.JMenuItem(); saveAsMenuItem = new javax.swing.JMenuItem(); exitMenuItem = new javax.swing.JMenuItem(); editMenu = new javax.swing.JMenu(); cutMenuItem = new javax.swing.JMenuItem(); copyMenuItem = new javax.swing.JMenuItem(); pasteMenuItem = new javax.swing.JMenuItem(); deleteMenuItem = new javax.swing.JMenuItem(); helpMenu = new javax.swing.JMenu(); contentsMenuItem = new javax.swing.JMenuItem(); aboutMenuItem = new javax.swing.JMenuItem(); jMenu1 = new javax.swing.JMenu(); menuItemUser = new javax.swing.JMenuItem(); menuItemBook = new javax.swing.JMenuItem(); menuItemInMain = new javax.swing.JMenuItem(); MenuItemOutMain = new javax.swing.JMenuItem(); menuItemStock = new javax.swing.JMenuItem(); menuItemLogin = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMinimumSize(new java.awt.Dimension(800, 600)); getContentPane().setLayout(null); fileMenu.setText("File"); openMenuItem.setText("Open"); fileMenu.add(openMenuItem); saveMenuItem.setText("Save"); fileMenu.add(saveMenuItem); saveAsMenuItem.setText("Save As ..."); fileMenu.add(saveAsMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); editMenu.setText("Edit"); cutMenuItem.setText("Cut"); editMenu.add(cutMenuItem); copyMenuItem.setText("Copy"); editMenu.add(copyMenuItem); pasteMenuItem.setText("Paste"); editMenu.add(pasteMenuItem); deleteMenuItem.setText("Delete"); editMenu.add(deleteMenuItem); menuBar.add(editMenu); helpMenu.setText("Help"); contentsMenuItem.setText("Contents"); helpMenu.add(contentsMenuItem); aboutMenuItem.setText("About"); helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); jMenu1.setText("Menu"); menuItemUser.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.CTRL_MASK)); menuItemUser.setText("\u7528\u6237\u6a21\u5757"); menuItemUser.setEnabled(false); menuItemUser.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItemUserActionPerformed(evt); } }); jMenu1.add(menuItemUser); menuItemBook.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.CTRL_MASK)); menuItemBook.setText("\u56fe\u4e66\u6a21\u5757"); menuItemBook.setEnabled(false); menuItemBook.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItemBookActionPerformed(evt); } }); jMenu1.add(menuItemBook); menuItemInMain.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK)); menuItemInMain.setText("\u8fdb\u8d27\u6a21\u5757"); menuItemInMain.setEnabled(false); menuItemInMain.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItemInMainActionPerformed(evt); } }); jMenu1.add(menuItemInMain); MenuItemOutMain.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); MenuItemOutMain.setText("\u9500\u552e\u6a21\u5757"); MenuItemOutMain.setEnabled(false); MenuItemOutMain.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { MenuItemOutMainActionPerformed(evt); } }); jMenu1.add(MenuItemOutMain); menuItemStock.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); menuItemStock.setText("\u5e93\u5b58\u6a21\u5757"); menuItemStock.setEnabled(false); menuItemStock.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItemStockActionPerformed(evt); } }); jMenu1.add(menuItemStock); menuItemLogin.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK)); menuItemLogin.setText("\u6ce8\u9500"); menuItemLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuItemLoginActionPerformed(evt); } }); jMenu1.add(menuItemLogin); menuBar.add(jMenu1); setJMenuBar(menuBar); pack(); }// </editor-fold> //GEN-END:initComponents private void menuItemLoginActionPerformed(java.awt.event.ActionEvent evt) { //切換到登錄界面,滅失落切換到五個界面的功效菜單 menuItemBook.setEnabled(false); menuItemInMain.setEnabled(false); MenuItemOutMain.setEnabled(false); menuItemStock.setEnabled(false); menuItemUser.setEnabled(false); this.setContentPane(new Login(this)); this.validate(); } void menuItemStockActionPerformed(java.awt.event.ActionEvent evt) { //切換到庫存模塊 this.setContentPane(new cn.hncu.bookStore.store.ui.listPanel(this)); this.validate(); } void MenuItemOutMainActionPerformed(java.awt.event.ActionEvent evt) { //切換到發賣模塊 this.setContentPane(new cn.hncu.bookStore.out.ui.listPanel(this)); this.validate(); } void menuItemInMainActionPerformed(java.awt.event.ActionEvent evt) { //切換到進貨模塊 this.setContentPane(new cn.hncu.bookStore.in.ui.listPanel(this)); this.validate(); } void menuItemBookActionPerformed(java.awt.event.ActionEvent evt) { //切換到圖書模塊 this.setContentPane(new cn.hncu.bookStore.book.ui.listPanel(this)); this.validate(); } private void menuItemUserActionPerformed(java.awt.event.ActionEvent evt) { //切換到用戶模塊 this.setContentPane(new cn.hncu.bookStore.user.ui.listPanel(this)); this.validate(); } public javax.swing.JMenuItem getMenuItemOutMain() { return MenuItemOutMain; } public javax.swing.JMenuItem getMenuItemBook() { return menuItemBook; } public javax.swing.JMenuItem getMenuItemInMain() { return menuItemInMain; } public javax.swing.JMenuItem getMenuItemStock() { return menuItemStock; } public javax.swing.JMenuItem getMenuItemUser() { return menuItemUser; } private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed System.exit(0); }//GEN-LAST:event_exitMenuItemActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new bookStoreApp().setVisible(true); } }); } //GEN-BEGIN:variables // Variables declaration - do not modify private javax.swing.JMenuItem MenuItemOutMain; private javax.swing.JMenuItem aboutMenuItem; private javax.swing.JMenuItem contentsMenuItem; private javax.swing.JMenuItem copyMenuItem; private javax.swing.JMenuItem cutMenuItem; private javax.swing.JMenuItem deleteMenuItem; private javax.swing.JMenu editMenu; private javax.swing.JMenuItem exitMenuItem; private javax.swing.JMenu fileMenu; private javax.swing.JMenu helpMenu; private javax.swing.JMenu jMenu1; private javax.swing.JMenuBar menuBar; private javax.swing.JMenuItem menuItemBook; private javax.swing.JMenuItem menuItemInMain; private javax.swing.JMenuItem menuItemLogin; private javax.swing.JMenuItem menuItemStock; private javax.swing.JMenuItem menuItemUser; private javax.swing.JMenuItem openMenuItem; private javax.swing.JMenuItem pasteMenuItem; private javax.swing.JMenuItem saveAsMenuItem; private javax.swing.JMenuItem saveMenuItem; // End of variables declaration//GEN-END:variables }
對象包:
package cn.hncu.bookStore.utils; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateUtils { /** * 把long型時光轉換成日期格局"yyyy年MM月dd日HH:mm:ss:"的字符串 * @param t * 待轉換的(long型)時光 * @return * 日期格局的字符串 */ public static String longToString(long t){ Date d=new Date(); DateFormat df=new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss:"); return df.format(d); } /** * 把日期格局"yyyy-MM-dd-HH:mm:ss:"的字符串轉換成long型時光 * @param str * 待轉換的日期字符串 * @return * long型時光 * @throws ParseException */ public static long stringToLong(String str) throws ParseException{ DateFormat df=new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss:"); Date d=df.parse(str); return d.getTime(); } }
package cn.hncu.bookStore.utils; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.List; public class FileIOUtil { /** * 結構函數公有化 */ private FileIOUtil(){ } /** * 把目次fileName裡的數據讀出 * @param fileName * 文件地址 * @return * 前往對應類型的聚集 */ public static<E> List<E> readFromFile(String fileName){//界說在靜態辦法上的泛型 File file=new File(fileName);//但凡讀文件,最好用File開道 if(!file.exists()){//文件不存在前往空聚集 return new ArrayList<E>(); } ObjectInputStream in=null; try { in=new ObjectInputStream(new FileInputStream(file)); @SuppressWarnings("unchecked") List<E> list=(List<E>)in.readObject(); return list; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); }finally{ if(in!=null){ try { in.close(); } catch (IOException e) { throw new RuntimeException("數據文件封閉掉敗", e); } } } return new ArrayList<E>(); } /** * 存儲:向目次fileName裡讀入數據 * @param list * 待存入數據的聚集 * @param fileName * 文件地址 * @return * 存儲勝利就前往true,不然,前往false */ public static<E> boolean writeToFile(List<E> list,String fileName){ ObjectOutputStream out=null; try { out=new ObjectOutputStream(new FileOutputStream(fileName)); out.writeObject(list); return true; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }finally{ if(out!=null){ try { out.close(); } catch (IOException e) { throw new RuntimeException("數據文件封閉掉敗", e); } } } return false; } }
公共功效:
package cn.hncu.bookStore.common; public enum uuidModelConstance { /** * 列舉:把user的五品種型UserModel,BookModel,InMainModel,InDetailModel,OutMainModel,OutDetailModel,StockModel列舉出來 */ User("UserModel"),Book("BookModel"),In_Main("InMainModel"),In_Detail("InDetailModel"), Out_Main("OutMainModel"),Out_Detail("OutDetailModel"),Stock("StockModel"); private final String name; private uuidModelConstance(String name){ this.name=name; } public String getName() { return name; } }
package cn.hncu.bookStore.common.uuid.vo; import java.io.Serializable; public class uuidModel implements Serializable{ /** * 用唱票模子主動生成uuid編號 * 封裝uuid,主動生成uuid */ private static final long serialVersionUID = 1L; private String modelName;//表現UserModel,BookModel,InMainModel,InDetailModel,OutMainModel,OutDetailModel,StockModel private int currentNum;//modelName以後的uuid編號 public uuidModel(){ } //set,get public String getModelName() { return modelName; } public void setModelName(String modelName) { this.modelName = modelName; } public int getCurrentNum() { return currentNum; } public void setCurrentNum(int currentNum) { this.currentNum = currentNum; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((modelName == null) ? 0 : modelName.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; uuidModel other = (uuidModel) obj; if (modelName == null) { if (other.modelName != null) return false; } else if (!modelName.equals(other.modelName)) return false; return true; } }
package cn.hncu.bookStore.common.uuid.dao.Ebi; import cn.hncu.bookStore.common.uuidModelConstance; public interface uuidDAO { /** * 用唱票模子主動生成uuid編號 * @param umc * 須要主動生成uuid的類型(UserModel,BookModel,InMainModel,InDetailModel,OutMainModel,OutDetailModel,StockModel) * @return * 生成對應類型uuid的編號 */ public String getNextNum(uuidModelConstance umc); }
package cn.hncu.bookStore.common.uuid.dao.Ebo; import java.util.List; import cn.hncu.bookStore.common.uuidModelConstance; import cn.hncu.bookStore.common.uuid.dao.Ebi.uuidDAO; import cn.hncu.bookStore.common.uuid.vo.uuidModel; import cn.hncu.bookStore.utils.FileIOUtil; public class uuidEbo implements uuidDAO { private final static String FILE_NAME="uuid.txt";//把數據存儲到uuid.txt文件中,或讀取 @Override public String getNextNum(uuidModelConstance umc) { String modelName=umc.getName();//取得待生成uuid編號的user類型 List<uuidModel> list=FileIOUtil.readFromFile(FILE_NAME);//從文件中讀取一切已生成user類型uuid的數據 for(uuidModel um:list){ if(um.getModelName().equals(modelName.trim())){//假如modelName在文件中存在,則前往此類型uuid下一個編號 int res=um.getCurrentNum(); um.setCurrentNum(res+1); FileIOUtil.writeToFile(list, FILE_NAME);//把經由更新的uuid數據存入文件夾 return ""+res; } } //假如for輪回沒有找到,解釋modelName是第一個,編號為1 //new一個此類型的對象,存入文件夾 uuidModel um=new uuidModel(); um.setModelName(modelName); um.setCurrentNum(2); list.add(um); FileIOUtil.writeToFile(list, FILE_NAME); return ""+1; } }
package cn.hncu.bookStore.common.uuid.dao.factory; import cn.hncu.bookStore.common.uuid.dao.Ebi.uuidDAO; import cn.hncu.bookStore.common.uuid.dao.Ebo.uuidEbo; public class uuidDAOFactory { /** * 結構函數公有化 */ private uuidDAOFactory(){ } /** * 取得接口uuidDAO * @return * uuidDAO */ public static uuidDAO getUuidDAO(){ return new uuidEbo(); } }
以上就是本文的全體內容,願望對年夜家的進修有所贊助,也願望年夜家多多支撐。