├── .classpath ├── .gitignore ├── .project ├── .settings ├── org.eclipse.core.resources.prefs └── org.eclipse.jdt.core.prefs ├── README.md ├── bin ├── bigImage │ ├── 图标.png │ ├── 欢迎界面.jpg │ ├── 登录界面.jpg │ └── 背景界面.jpg ├── com │ └── zhbit │ │ ├── Clinet │ │ ├── Login$1.class │ │ ├── Login$2.class │ │ ├── Login.class │ │ ├── ManagerUI$1.class │ │ ├── ManagerUI$10.class │ │ ├── ManagerUI$11.class │ │ ├── ManagerUI$12.class │ │ ├── ManagerUI$2.class │ │ ├── ManagerUI$3.class │ │ ├── ManagerUI$4.class │ │ ├── ManagerUI$5.class │ │ ├── ManagerUI$6.class │ │ ├── ManagerUI$7.class │ │ ├── ManagerUI$8.class │ │ ├── ManagerUI$9.class │ │ ├── ManagerUI.class │ │ ├── StudentUI$1.class │ │ ├── StudentUI$2.class │ │ ├── StudentUI$3.class │ │ ├── StudentUI$4.class │ │ ├── StudentUI$5.class │ │ ├── StudentUI$6.class │ │ ├── StudentUI$7.class │ │ ├── StudentUI$8.class │ │ ├── StudentUI$9.class │ │ └── StudentUI.class │ │ ├── Util │ │ ├── AESUtil.class │ │ ├── DB.class │ │ ├── ExpressMassage$1.class │ │ ├── ExpressMassage.class │ │ └── ExpressMassageRemind.class │ │ ├── entity │ │ ├── Manager.class │ │ ├── ManagerService.class │ │ ├── ManagerServiceImpl.class │ │ ├── Person.class │ │ ├── Student.class │ │ ├── StudentService.class │ │ └── StudentServiceImpl.class │ │ ├── excetion │ │ ├── DataBaseException.class │ │ ├── PasswordNotMatchException.class │ │ ├── QueryResultIsNullException.class │ │ ├── UpdateDataException.class │ │ └── UpdateSuccessException.class │ │ ├── form │ │ ├── CheckPasswordForm.class │ │ ├── LoginForm.class │ │ ├── UpdatePassWordForm.class │ │ └── UpdatePersonalInfoForm.class │ │ ├── managerUI │ │ ├── About.class │ │ ├── ChangPWD$1.class │ │ ├── ChangPWD$2.class │ │ ├── ChangPWD.class │ │ ├── Curfew.class │ │ ├── Dormitory.class │ │ ├── DormitoryInfo.class │ │ ├── First.class │ │ ├── LeaveComeStu.class │ │ ├── ManaInfo$1.class │ │ ├── ManaInfo$2.class │ │ ├── ManaInfo.class │ │ ├── StuInOut_Add.class │ │ ├── StuKuaidi.class │ │ ├── StuOut.class │ │ ├── View_MR_Stu_It$1.class │ │ ├── View_MR_Stu_It$2.class │ │ ├── View_MR_Stu_It$3.class │ │ ├── View_MR_Stu_It$4.class │ │ ├── View_MR_Stu_It$5.class │ │ ├── View_MR_Stu_It.class │ │ ├── View_Student_College$1.class │ │ ├── View_Student_College$2.class │ │ ├── View_Student_College.class │ │ └── mhelpText.class │ │ ├── queryResult │ │ ├── AllDormitoryInfo.class │ │ ├── AllMaintanceRecord.class │ │ ├── AllStudentInfo.class │ │ ├── DormitoryBuildingInfo.class │ │ ├── MaintanceRecord.class │ │ ├── ManagerInfo.class │ │ └── StudentInfo.class │ │ └── stuUI │ │ ├── About.class │ │ ├── ChangPWD$1.class │ │ ├── ChangPWD$2.class │ │ ├── ChangPWD.class │ │ ├── First.class │ │ ├── SCurfew.class │ │ ├── SKuaidi.class │ │ ├── SMR.class │ │ ├── StuInfo$1.class │ │ ├── StuInfo$2.class │ │ ├── StuInfo.class │ │ ├── StuPassword.class │ │ └── shelpText.class └── jdbc.properties └── src ├── bigImage ├── 图标.png ├── 欢迎界面.jpg ├── 登录界面.jpg └── 背景界面.jpg ├── com └── zhbit │ ├── Clinet │ ├── Login.java │ ├── ManagerUI.java │ └── StudentUI.java │ ├── Util │ ├── AESUtil.java │ ├── DB.java │ ├── ExpressMassage.java │ └── ExpressMassageRemind.java │ ├── entity │ ├── Manager.java │ ├── ManagerService.java │ ├── ManagerServiceImpl.java │ ├── Person.java │ ├── Student.java │ ├── StudentService.java │ └── StudentServiceImpl.java │ ├── excetion │ ├── DataBaseException.java │ ├── PasswordNotMatchException.java │ ├── QueryResultIsNullException.java │ ├── UpdateDataException.java │ └── UpdateSuccessException.java │ ├── form │ ├── CheckPasswordForm.java │ ├── LoginForm.java │ ├── UpdatePassWordForm.java │ └── UpdatePersonalInfoForm.java │ ├── managerUI │ ├── About.java │ ├── ChangPWD.java │ ├── Curfew.java │ ├── Dormitory.java │ ├── DormitoryInfo.java │ ├── First.java │ ├── LeaveComeStu.java │ ├── ManaInfo.java │ ├── StuInOut_Add.java │ ├── StuKuaidi.java │ ├── StuOut.java │ ├── View_MR_Stu_It.java │ ├── View_Student_College.java │ └── mhelpText.java │ ├── queryResult │ ├── AllDormitoryInfo.java │ ├── AllMaintanceRecord.java │ ├── AllStudentInfo.java │ ├── DormitoryBuildingInfo.java │ ├── MaintanceRecord.java │ ├── ManagerInfo.java │ └── StudentInfo.java │ └── stuUI │ ├── About.java │ ├── ChangPWD.java │ ├── First.java │ ├── SCurfew.java │ ├── SKuaidi.java │ ├── SMR.java │ ├── StuInfo.java │ ├── StuPassword.java │ └── shelpText.java └── jdbc.properties /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.setting 2 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Dormitory_Management_System_100 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.7 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.7 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dormitory_Management_System 2 | 宿舍管理系统,Java Swing 项目 3 | -------------------------------------------------------------------------------- /bin/bigImage/图标.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/bigImage/图标.png -------------------------------------------------------------------------------- /bin/bigImage/欢迎界面.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/bigImage/欢迎界面.jpg -------------------------------------------------------------------------------- /bin/bigImage/登录界面.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/bigImage/登录界面.jpg -------------------------------------------------------------------------------- /bin/bigImage/背景界面.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/bigImage/背景界面.jpg -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/Login$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/Login$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/Login$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/Login$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/Login.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/Login.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$10.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$10.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$11.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$11.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$12.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$12.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$3.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$4.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$5.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$6.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$7.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$8.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI$9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI$9.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/ManagerUI.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/ManagerUI.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$3.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$4.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$5.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$6.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$7.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$8.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI$9.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI$9.class -------------------------------------------------------------------------------- /bin/com/zhbit/Clinet/StudentUI.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Clinet/StudentUI.class -------------------------------------------------------------------------------- /bin/com/zhbit/Util/AESUtil.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Util/AESUtil.class -------------------------------------------------------------------------------- /bin/com/zhbit/Util/DB.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Util/DB.class -------------------------------------------------------------------------------- /bin/com/zhbit/Util/ExpressMassage$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Util/ExpressMassage$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/Util/ExpressMassage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Util/ExpressMassage.class -------------------------------------------------------------------------------- /bin/com/zhbit/Util/ExpressMassageRemind.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/Util/ExpressMassageRemind.class -------------------------------------------------------------------------------- /bin/com/zhbit/entity/Manager.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/entity/Manager.class -------------------------------------------------------------------------------- /bin/com/zhbit/entity/ManagerService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/entity/ManagerService.class -------------------------------------------------------------------------------- /bin/com/zhbit/entity/ManagerServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/entity/ManagerServiceImpl.class -------------------------------------------------------------------------------- /bin/com/zhbit/entity/Person.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/entity/Person.class -------------------------------------------------------------------------------- /bin/com/zhbit/entity/Student.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/entity/Student.class -------------------------------------------------------------------------------- /bin/com/zhbit/entity/StudentService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/entity/StudentService.class -------------------------------------------------------------------------------- /bin/com/zhbit/entity/StudentServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/entity/StudentServiceImpl.class -------------------------------------------------------------------------------- /bin/com/zhbit/excetion/DataBaseException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/excetion/DataBaseException.class -------------------------------------------------------------------------------- /bin/com/zhbit/excetion/PasswordNotMatchException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/excetion/PasswordNotMatchException.class -------------------------------------------------------------------------------- /bin/com/zhbit/excetion/QueryResultIsNullException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/excetion/QueryResultIsNullException.class -------------------------------------------------------------------------------- /bin/com/zhbit/excetion/UpdateDataException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/excetion/UpdateDataException.class -------------------------------------------------------------------------------- /bin/com/zhbit/excetion/UpdateSuccessException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/excetion/UpdateSuccessException.class -------------------------------------------------------------------------------- /bin/com/zhbit/form/CheckPasswordForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/form/CheckPasswordForm.class -------------------------------------------------------------------------------- /bin/com/zhbit/form/LoginForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/form/LoginForm.class -------------------------------------------------------------------------------- /bin/com/zhbit/form/UpdatePassWordForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/form/UpdatePassWordForm.class -------------------------------------------------------------------------------- /bin/com/zhbit/form/UpdatePersonalInfoForm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/form/UpdatePersonalInfoForm.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/About.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/About.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/ChangPWD$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/ChangPWD$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/ChangPWD$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/ChangPWD$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/ChangPWD.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/ChangPWD.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/Curfew.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/Curfew.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/Dormitory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/Dormitory.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/DormitoryInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/DormitoryInfo.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/First.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/First.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/LeaveComeStu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/LeaveComeStu.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/ManaInfo$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/ManaInfo$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/ManaInfo$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/ManaInfo$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/ManaInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/ManaInfo.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/StuInOut_Add.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/StuInOut_Add.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/StuKuaidi.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/StuKuaidi.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/StuOut.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/StuOut.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_MR_Stu_It$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_MR_Stu_It$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_MR_Stu_It$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_MR_Stu_It$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_MR_Stu_It$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_MR_Stu_It$3.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_MR_Stu_It$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_MR_Stu_It$4.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_MR_Stu_It$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_MR_Stu_It$5.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_MR_Stu_It.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_MR_Stu_It.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_Student_College$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_Student_College$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_Student_College$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_Student_College$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/View_Student_College.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/View_Student_College.class -------------------------------------------------------------------------------- /bin/com/zhbit/managerUI/mhelpText.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/managerUI/mhelpText.class -------------------------------------------------------------------------------- /bin/com/zhbit/queryResult/AllDormitoryInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/queryResult/AllDormitoryInfo.class -------------------------------------------------------------------------------- /bin/com/zhbit/queryResult/AllMaintanceRecord.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/queryResult/AllMaintanceRecord.class -------------------------------------------------------------------------------- /bin/com/zhbit/queryResult/AllStudentInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/queryResult/AllStudentInfo.class -------------------------------------------------------------------------------- /bin/com/zhbit/queryResult/DormitoryBuildingInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/queryResult/DormitoryBuildingInfo.class -------------------------------------------------------------------------------- /bin/com/zhbit/queryResult/MaintanceRecord.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/queryResult/MaintanceRecord.class -------------------------------------------------------------------------------- /bin/com/zhbit/queryResult/ManagerInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/queryResult/ManagerInfo.class -------------------------------------------------------------------------------- /bin/com/zhbit/queryResult/StudentInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/queryResult/StudentInfo.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/About.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/About.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/ChangPWD$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/ChangPWD$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/ChangPWD$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/ChangPWD$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/ChangPWD.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/ChangPWD.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/First.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/First.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/SCurfew.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/SCurfew.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/SKuaidi.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/SKuaidi.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/SMR.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/SMR.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/StuInfo$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/StuInfo$1.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/StuInfo$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/StuInfo$2.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/StuInfo.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/StuInfo.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/StuPassword.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/StuPassword.class -------------------------------------------------------------------------------- /bin/com/zhbit/stuUI/shelpText.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/bin/com/zhbit/stuUI/shelpText.class -------------------------------------------------------------------------------- /bin/jdbc.properties: -------------------------------------------------------------------------------- 1 | #sql server JDBC properties 2 | #1433 port DatabaseName=Lib Lib 数据库名称 3 | jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver 4 | jdbc.url=jdbc:sqlserver://localhost:1433;DatabaseName=DMSystem 5 | jdbc.username=sa 6 | jdbc.password= -------------------------------------------------------------------------------- /src/bigImage/图标.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/src/bigImage/图标.png -------------------------------------------------------------------------------- /src/bigImage/欢迎界面.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/src/bigImage/欢迎界面.jpg -------------------------------------------------------------------------------- /src/bigImage/登录界面.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/src/bigImage/登录界面.jpg -------------------------------------------------------------------------------- /src/bigImage/背景界面.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenyueling/Dormitory_Management_System/4ac257ab236d4dd597b857658ba4048bc3d00861/src/bigImage/背景界面.jpg -------------------------------------------------------------------------------- /src/com/zhbit/Clinet/Login.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.Clinet; 2 | 3 | import java.awt.EventQueue; 4 | import java.awt.Font; 5 | import java.awt.Toolkit; 6 | import java.awt.event.ActionEvent; 7 | import java.awt.event.ActionListener; 8 | import java.awt.event.KeyAdapter; 9 | import java.awt.event.KeyEvent; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import java.sql.Statement; 13 | 14 | import javax.swing.DefaultComboBoxModel; 15 | import javax.swing.ImageIcon; 16 | import javax.swing.JButton; 17 | import javax.swing.JComboBox; 18 | import javax.swing.JFrame; 19 | import javax.swing.JLabel; 20 | import javax.swing.JOptionPane; 21 | import javax.swing.JPanel; 22 | import javax.swing.JPasswordField; 23 | import javax.swing.JTextField; 24 | import javax.swing.UIManager; 25 | import javax.swing.border.EmptyBorder; 26 | 27 | import com.zhbit.Util.AESUtil; 28 | import com.zhbit.Util.DB; 29 | import com.zhbit.excetion.DataBaseException; 30 | import com.zhbit.excetion.QueryResultIsNullException; 31 | import com.zhbit.form.LoginForm; 32 | 33 | @SuppressWarnings("serial") 34 | public class Login extends JFrame { 35 | 36 | private JPanel contentPane; 37 | private JTextField txtID; 38 | private JPasswordField txtPassword; 39 | private JFrame sr = this; 40 | private JButton butLogin ; 41 | private JLabel labImage; 42 | private ImageIcon image; 43 | JComboBox boxUser; 44 | 45 | /** 46 | * Launch the application. 47 | */ 48 | 49 | public static void main(String[] args) { 50 | try { 51 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 52 | } catch (ClassNotFoundException | InstantiationException| IllegalAccessException | UnsupportedLookAndFeelException e1) { 53 | // TODO 自动生成的 catch 块 54 | e1.printStackTrace(); 55 | } 56 | EventQueue.invokeLater(new Runnable() { 57 | public void run() { 58 | try { 59 | Login frame = new Login(); 60 | frame.setVisible(true); 61 | UIManager.LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels(); 62 | final String plafName; 63 | //plafName = infos[1].getClassName(); 64 | //UIManager.setLookAndFeel(plafName); 65 | //SwingUtilities.updateComponentTreeUI(frame); 66 | 67 | } catch (Exception e) { 68 | e.printStackTrace(); 69 | } 70 | } 71 | }); 72 | } 73 | 74 | public void login(LoginForm loginForm) throws DataBaseException, 75 | QueryResultIsNullException { 76 | 77 | String sql = null; 78 | if (loginForm.getUserType().equals("学生")) { 79 | sql = "select * from StuAccountPassword where StuId ='" 80 | + loginForm.getId() + "' and Password = '" 81 | + loginForm.getPassword() + "'"; 82 | } 83 | if (loginForm.getUserType().equals("管理员")) { 84 | sql = "select * from DMAccountPassword where DMId ='" 85 | + loginForm.getId() + "' and Password ='" 86 | + loginForm.getPassword() + "'"; 87 | } 88 | 89 | Statement stmt = DB.CreateStatement(); 90 | //System.out.println(sql); 91 | try { 92 | ResultSet rs = stmt.executeQuery(sql); 93 | if (!rs.next()) { 94 | throw new QueryResultIsNullException(); 95 | } 96 | } catch (SQLException e) { 97 | e.printStackTrace(); 98 | throw new DataBaseException(); 99 | 100 | } 101 | 102 | } 103 | 104 | /** 105 | * Create the frame. 106 | */ 107 | public Login() { 108 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 109 | setIconImage(Toolkit.getDefaultToolkit().getImage(Login.class.getResource("/bigImage/图标.png"))); 110 | setTitle("宿舍管理系统"); 111 | setBounds(400, 100, 450, 300); 112 | contentPane = new JPanel(); 113 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 114 | setContentPane(contentPane); 115 | contentPane.setLayout(null); 116 | 117 | txtID = new JTextField(); 118 | txtID.setFont(new Font("宋体", Font.PLAIN, 17)); 119 | txtID.setBounds(194, 90, 190, 30); 120 | contentPane.add(txtID); 121 | txtID.setColumns(10); 122 | setResizable(false); 123 | txtPassword = new JPasswordField(); 124 | txtPassword.setFont(new Font("宋体", Font.PLAIN, 17)); 125 | txtPassword.addKeyListener(new KeyAdapter() { 126 | @Override 127 | public void keyPressed(KeyEvent arg0) { 128 | if(arg0.getKeyCode()==KeyEvent.VK_ENTER){ 129 | butLogin.doClick(); 130 | } 131 | } 132 | }); 133 | txtPassword.setBounds(194, 145, 190, 30); 134 | contentPane.add(txtPassword); 135 | 136 | JLabel labID = new JLabel("账号:"); 137 | labID.setFont(new Font("楷体", Font.BOLD, 17)); 138 | labID.setBounds(132, 93, 52, 27); 139 | contentPane.add(labID); 140 | 141 | JLabel labPassword = new JLabel("密码:"); 142 | labPassword.setFont(new Font("楷体", Font.BOLD, 17)); 143 | labPassword.setBounds(132, 148, 52, 27); 144 | contentPane.add(labPassword); 145 | 146 | boxUser = new JComboBox(); 147 | boxUser.setFont(new Font("宋体", Font.PLAIN, 15)); 148 | boxUser.setModel(new DefaultComboBoxModel(new String[] { "管理员", "学生" })); 149 | boxUser.setBounds(194, 197, 78, 23); 150 | contentPane.add(boxUser); 151 | 152 | butLogin = new JButton("登录"); 153 | butLogin.setFont(new Font("宋体", Font.PLAIN, 15)); 154 | butLogin.addActionListener(new ActionListener() { 155 | @SuppressWarnings("deprecation") 156 | public void actionPerformed(ActionEvent e) { 157 | LoginForm loginForm = new LoginForm(); 158 | loginForm.setId(txtID.getText()); 159 | loginForm.setPassword(AESUtil.getInstance().encrypt(txtPassword.getText().trim())); 160 | loginForm.setUserType(boxUser.getSelectedItem().toString()); 161 | 162 | try { 163 | login(loginForm); 164 | if (loginForm.getUserType().equals("学生")) { 165 | new StudentUI(loginForm.getId()); 166 | setVisible(false); 167 | } 168 | 169 | if (loginForm.getUserType().equals("管理员")) { 170 | new ManagerUI(loginForm.getId()); 171 | setVisible(false); 172 | } 173 | 174 | } catch (DataBaseException e1) { 175 | JOptionPane.showMessageDialog(sr, boxUser.getSelectedItem() 176 | + "系统异常", "系统信息", JOptionPane.WARNING_MESSAGE); 177 | //e1.printStackTrace(); 178 | } catch (QueryResultIsNullException e1) { 179 | JOptionPane.showMessageDialog(sr, boxUser.getSelectedItem() 180 | + "用户不存在或密码错误", "系统信息", JOptionPane.WARNING_MESSAGE); 181 | //e1.printStackTrace(); 182 | } 183 | 184 | } 185 | }); 186 | butLogin.setBounds(306, 197, 69, 23); 187 | contentPane.add(butLogin); 188 | 189 | image = new ImageIcon("src\\bigImage\\登录界面.jpg"); 190 | labImage = new JLabel(image); 191 | labImage.setBounds(0, 0, image.getIconWidth(),image.getIconHeight()); 192 | contentPane.add(labImage); 193 | contentPane.setOpaque(false); 194 | } 195 | 196 | } 197 | -------------------------------------------------------------------------------- /src/com/zhbit/Clinet/StudentUI.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.Clinet; 2 | 3 | import java.awt.CardLayout; 4 | import java.awt.Font; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | 8 | import javax.swing.JFrame; 9 | import javax.swing.JLabel; 10 | import javax.swing.JMenu; 11 | import javax.swing.JMenuBar; 12 | import javax.swing.JMenuItem; 13 | import javax.swing.JOptionPane; 14 | import javax.swing.JPanel; 15 | import javax.swing.JSeparator; 16 | 17 | import com.zhbit.Util.ExpressMassageRemind; 18 | import com.zhbit.entity.Student; 19 | import com.zhbit.excetion.DataBaseException; 20 | import com.zhbit.excetion.QueryResultIsNullException; 21 | import com.zhbit.stuUI.About; 22 | import com.zhbit.stuUI.ChangPWD; 23 | import com.zhbit.stuUI.First; 24 | import com.zhbit.stuUI.SCurfew; 25 | import com.zhbit.stuUI.SKuaidi; 26 | import com.zhbit.stuUI.SMR; 27 | import com.zhbit.stuUI.StuInfo; 28 | import com.zhbit.stuUI.shelpText; 29 | import java.awt.Toolkit; 30 | 31 | 32 | @SuppressWarnings("serial") 33 | public class StudentUI extends JFrame { 34 | 35 | private JPanel contentPane=null; 36 | private String STUDENT_ID; 37 | private CardLayout card; 38 | private JPanel paneStuInfo; 39 | private JPanel paneStuFirst; 40 | private JPanel paneStuPassword; 41 | private JPanel paneSKuaidi; 42 | private JPanel paneSCurfew; //夜归 43 | private JPanel paneSMR; //维修 44 | private JPanel paneSAbout; 45 | private JPanel paneshelp; 46 | private Student student = null; 47 | // public StudentUI(){ 48 | // 49 | // } 50 | 51 | public StudentUI(String STUDENT_ID) throws DataBaseException, QueryResultIsNullException { 52 | setIconImage(Toolkit.getDefaultToolkit().getImage(StudentUI.class.getResource("/bigImage/图标.png"))); 53 | this.STUDENT_ID = STUDENT_ID; 54 | student = new Student(STUDENT_ID); 55 | Thread thread = new Thread(new ExpressMassageRemind(student)); 56 | thread.start(); 57 | setTitle("学生登录"); 58 | setResizable(false); 59 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 60 | setBounds(200, 50, 805, 650); 61 | 62 | JMenuBar menuBar = new JMenuBar(); 63 | setJMenuBar(menuBar); 64 | 65 | JMenu mnUserInfo = new JMenu(" 用户管理 "); 66 | mnUserInfo.setFont(new Font("华文楷体", Font.PLAIN, 15)); 67 | menuBar.add(mnUserInfo); 68 | 69 | JMenuItem miStuInfo = new JMenuItem("学生个人信息"); 70 | miStuInfo.addActionListener(new ActionListener() { 71 | public void actionPerformed(ActionEvent e) { 72 | try { 73 | ((StuInfo) paneStuInfo).showInfo(); 74 | } catch (DataBaseException e1) { 75 | JOptionPane.showMessageDialog(null, "系统异常", "系统信息", JOptionPane.WARNING_MESSAGE); 76 | //e1.printStackTrace(); 77 | } catch (QueryResultIsNullException e1) { 78 | JOptionPane.showMessageDialog(null, "数据异常", "系统信息", JOptionPane.WARNING_MESSAGE); 79 | //e1.printStackTrace(); 80 | } 81 | card.show(contentPane, "学生个人信息"); 82 | } 83 | }); 84 | mnUserInfo.add(miStuInfo); 85 | 86 | JMenuItem miPassword = new JMenuItem("修改密码"); 87 | miPassword.addActionListener(new ActionListener() { 88 | public void actionPerformed(ActionEvent e) { 89 | card.show(contentPane, "修改密码"); 90 | 91 | } 92 | }); 93 | mnUserInfo.add(miPassword); 94 | 95 | JSeparator separator = new JSeparator(); 96 | mnUserInfo.add(separator); 97 | 98 | JMenuItem menuItem = new JMenuItem("退出"); 99 | menuItem.addActionListener(new ActionListener() { 100 | public void actionPerformed(ActionEvent e) { 101 | Login l = new Login(); 102 | l.setVisible(true); 103 | setVisible(false); 104 | } 105 | }); 106 | 107 | mnUserInfo.add(menuItem); 108 | 109 | JMenu mnRepair = new JMenu(" 信息查询 "); 110 | mnRepair.setFont(new Font("华文楷体", Font.PLAIN, 15)); 111 | mnRepair.addActionListener(new ActionListener() { 112 | public void actionPerformed(ActionEvent e) { 113 | card.show(contentPane, "维修信息"); 114 | try { 115 | ((SMR)paneSMR).showInfo(); 116 | } catch (QueryResultIsNullException e1) { 117 | JOptionPane.showMessageDialog(null, "没有结果", "系统信息", JOptionPane.WARNING_MESSAGE); 118 | //e1.printStackTrace(); 119 | } catch (DataBaseException e1) { 120 | JOptionPane.showMessageDialog(null, "数据异常", "系统信息", JOptionPane.WARNING_MESSAGE); 121 | //e1.printStackTrace(); 122 | } 123 | } 124 | }); 125 | menuBar.add(mnRepair); 126 | 127 | JMenuItem menuItem_1 = new JMenuItem("维修信息"); 128 | menuItem_1.addActionListener(new ActionListener() { 129 | public void actionPerformed(ActionEvent e) { 130 | card.show(contentPane, "维修信息"); 131 | try { 132 | ((SMR)paneSMR).showInfo(); 133 | } catch (QueryResultIsNullException e1) { 134 | JOptionPane.showMessageDialog(null, "没有结果", "系统信息", JOptionPane.WARNING_MESSAGE); 135 | //e1.printStackTrace(); 136 | } catch (DataBaseException e1) { 137 | JOptionPane.showMessageDialog(null, "数据异常", "系统信息", JOptionPane.WARNING_MESSAGE); 138 | //e1.printStackTrace(); 139 | } 140 | } 141 | }); 142 | mnRepair.add(menuItem_1); 143 | 144 | JMenuItem menuItem_2 = new JMenuItem("快递信息"); 145 | menuItem_2.addActionListener(new ActionListener() { 146 | public void actionPerformed(ActionEvent e) { 147 | card.show(contentPane, "快递信息"); 148 | try { 149 | ((SKuaidi)paneSKuaidi).showInfo(); 150 | } catch (QueryResultIsNullException e1) { 151 | JOptionPane.showMessageDialog(null, "没有结果", "系统信息", JOptionPane.WARNING_MESSAGE); 152 | //e1.printStackTrace(); 153 | } catch (DataBaseException e1) { 154 | JOptionPane.showMessageDialog(null, "数据异常", "系统信息", JOptionPane.WARNING_MESSAGE); 155 | //e1.printStackTrace(); 156 | } 157 | } 158 | }); 159 | mnRepair.add(menuItem_2); 160 | 161 | JMenuItem menuItem_3 = new JMenuItem("夜归信息"); 162 | menuItem_3.addActionListener(new ActionListener() { 163 | public void actionPerformed(ActionEvent e) { 164 | card.show(contentPane, "夜归信息"); 165 | try { 166 | ((SCurfew)paneSCurfew).showInfo(); 167 | } catch (QueryResultIsNullException e1) { 168 | JOptionPane.showMessageDialog(null, "没有结果", "系统信息", JOptionPane.WARNING_MESSAGE); 169 | //e1.printStackTrace(); 170 | } catch (DataBaseException e1) { 171 | JOptionPane.showMessageDialog(null, "数据异常", "系统信息", JOptionPane.WARNING_MESSAGE); 172 | //e1.printStackTrace(); 173 | } 174 | } 175 | }); 176 | mnRepair.add(menuItem_3); 177 | 178 | JMenu menu = new JMenu(" 帮助 "); 179 | menu.setFont(new Font("华文楷体", Font.PLAIN, 15)); 180 | menuBar.add(menu); 181 | 182 | JMenuItem menuItem_4 = new JMenuItem("如何使用"); 183 | menuItem_4.addActionListener(new ActionListener() { 184 | public void actionPerformed(ActionEvent e) { 185 | card.show(contentPane, "如何使用"); 186 | } 187 | }); 188 | menu.add(menuItem_4); 189 | 190 | JMenuItem menuItem_5 = new JMenuItem("关于"); 191 | menuItem_5.addActionListener(new ActionListener() { 192 | public void actionPerformed(ActionEvent e) { 193 | card.show(contentPane, "关于"); 194 | } 195 | }); 196 | menu.add(menuItem_5); 197 | 198 | JLabel label = new JLabel(" "); 199 | menuBar.add(label); 200 | 201 | JLabel label_1 = new JLabel("欢迎您:"); 202 | menuBar.add(label_1); 203 | 204 | JLabel lblNewLabel = new JLabel(student.getName()); 205 | menuBar.add(lblNewLabel); 206 | 207 | 208 | card = new CardLayout(0,0); 209 | contentPane = new JPanel(card); 210 | 211 | 212 | paneStuFirst = new First(); 213 | contentPane.add(paneStuFirst,"欢迎页"); 214 | 215 | 216 | paneStuInfo = new StuInfo(student); 217 | contentPane.add(paneStuInfo,"学生个人信息"); 218 | 219 | paneStuPassword = new ChangPWD(student); 220 | contentPane.add(paneStuPassword,"修改密码"); 221 | 222 | paneSMR = new SMR(this, student); 223 | contentPane.add(paneSMR,"维修信息"); 224 | 225 | paneSKuaidi = new SKuaidi(this, student); 226 | contentPane.add(paneSKuaidi,"快递信息"); 227 | 228 | paneSCurfew = new SCurfew(student); 229 | contentPane.add(paneSCurfew,"夜归信息"); 230 | 231 | paneshelp = new shelpText(); 232 | contentPane.add(paneshelp,"如何使用"); 233 | 234 | paneSAbout = new About(); 235 | contentPane.add(paneSAbout,"关于"); 236 | 237 | this.getContentPane().add(contentPane); 238 | card.show(contentPane, "欢迎页"); 239 | setVisible(true); 240 | 241 | 242 | 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /src/com/zhbit/Util/AESUtil.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.Util; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | import java.security.InvalidKeyException; 5 | import java.security.NoSuchAlgorithmException; 6 | import java.security.SecureRandom; 7 | 8 | import javax.crypto.BadPaddingException; 9 | import javax.crypto.Cipher; 10 | import javax.crypto.IllegalBlockSizeException; 11 | import javax.crypto.KeyGenerator; 12 | import javax.crypto.NoSuchPaddingException; 13 | import javax.crypto.SecretKey; 14 | import javax.crypto.spec.SecretKeySpec; 15 | 16 | 17 | /** 18 | * AES 加密工具类 19 | * @author chenyueling 20 | * 21 | */ 22 | public class AESUtil { 23 | private static AESUtil unique = null; 24 | /** 密钥 */ 25 | private final String key = "Dormitory_Key"; 26 | private AESUtil() { 27 | 28 | } 29 | public static synchronized AESUtil getInstance() { 30 | if (unique == null) { 31 | unique = new AESUtil(); 32 | } 33 | return unique; 34 | } 35 | 36 | /** 37 | * 加密 38 | * @param content 需要加密的内容 39 | * @return 密文字符串 40 | */ 41 | public String encrypt(String content) { 42 | byte[] encryptResult = encrypt(content, key); 43 | String encryptResultStr = parseByte2HexStr(encryptResult); 44 | return encryptResultStr; 45 | } 46 | 47 | 48 | 49 | /** 50 | * 加密 51 | * @param content 需要加密的内容 52 | * @param password 加密密钥 53 | * @return 密文二进制码 54 | */ 55 | public byte[] encrypt(String content, String password) { 56 | try { 57 | KeyGenerator kgen = KeyGenerator.getInstance("AES"); 58 | kgen.init(128, new SecureRandom(password.getBytes())); 59 | SecretKey secretKey = kgen.generateKey(); 60 | byte[] enCodeFormat = secretKey.getEncoded(); 61 | SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); 62 | Cipher cipher = Cipher.getInstance("AES");// 创建密码器 63 | byte[] byteContent = content.getBytes("utf-8"); 64 | cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化 65 | byte[] result = cipher.doFinal(byteContent); 66 | return result; // 加密 67 | } catch (NoSuchAlgorithmException e) { 68 | e.printStackTrace(); 69 | } catch (NoSuchPaddingException e) { 70 | e.printStackTrace(); 71 | } catch (InvalidKeyException e) { 72 | e.printStackTrace(); 73 | } catch (UnsupportedEncodingException e) { 74 | e.printStackTrace(); 75 | } catch (IllegalBlockSizeException e) { 76 | e.printStackTrace(); 77 | } catch (BadPaddingException e) { 78 | e.printStackTrace(); 79 | } 80 | return null; 81 | } 82 | 83 | /** 84 | * 使用默认密钥解密 85 | * @param encryptResultStr 86 | * @return 明文 87 | */ 88 | public String decrypt(String encryptResultStr) { 89 | byte[] decryptFrom = parseHexStr2Byte(encryptResultStr); 90 | byte[] decryptResult = decrypt(decryptFrom,key); 91 | return new String(decryptResult); 92 | } 93 | 94 | /** 95 | * 解密 96 | * @param content 待解密内容 97 | * @param password 解密密钥 98 | * @return 99 | */ 100 | public byte[] decrypt(byte[] content, String password) { 101 | try { 102 | KeyGenerator kgen = KeyGenerator.getInstance("AES"); 103 | kgen.init(128, new SecureRandom(password.getBytes())); 104 | SecretKey secretKey = kgen.generateKey(); 105 | byte[] enCodeFormat = secretKey.getEncoded(); 106 | SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); 107 | Cipher cipher = Cipher.getInstance("AES");// 创建密码器 108 | cipher.init(Cipher.DECRYPT_MODE, key);// 初始化 109 | byte[] result = cipher.doFinal(content); 110 | return result; // 解密 111 | } catch (NoSuchAlgorithmException e) { 112 | e.printStackTrace(); 113 | } catch (NoSuchPaddingException e) { 114 | e.printStackTrace(); 115 | } catch (InvalidKeyException e) { 116 | e.printStackTrace(); 117 | } catch (IllegalBlockSizeException e) { 118 | e.printStackTrace(); 119 | } catch (BadPaddingException e) { 120 | e.printStackTrace(); 121 | } 122 | return null; 123 | } 124 | 125 | /** 126 | * 将二进制转换成16进制 127 | * @param buf 128 | * @return 129 | */ 130 | public String parseByte2HexStr(byte buf[]) { 131 | StringBuffer sb = new StringBuffer(); 132 | for (int i = 0; i < buf.length; i++) { 133 | String hex = Integer.toHexString(buf[i] & 0xFF); 134 | if (hex.length() == 1) { 135 | hex = '0' + hex; 136 | } 137 | sb.append(hex.toUpperCase()); 138 | } 139 | return sb.toString(); 140 | } 141 | 142 | 143 | /** 144 | * 将16进制转换为二进制 145 | * @param hexStr 146 | * @return 147 | */ 148 | public byte[] parseHexStr2Byte(String hexStr) { 149 | if (hexStr.length() < 1) 150 | return null; 151 | byte[] result = new byte[hexStr.length() / 2]; 152 | for (int i = 0; i < hexStr.length() / 2; i++) { 153 | int high = Integer.parseInt(hexStr.substring(i*2, i*2 + 1), 16); 154 | int low = Integer.parseInt(hexStr.substring(i*2 + 1, i*2 + 2), 16); 155 | result[i] = (byte)(high * 16 + low); 156 | } 157 | return result; 158 | } 159 | 160 | 161 | 162 | } 163 | -------------------------------------------------------------------------------- /src/com/zhbit/Util/DB.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.Util; 2 | 3 | import java.io.IOException; 4 | import java.sql.Connection; 5 | import java.sql.DriverManager; 6 | import java.sql.PreparedStatement; 7 | import java.sql.SQLException; 8 | import java.sql.Statement; 9 | import java.util.Properties; 10 | 11 | import com.zhbit.excetion.DataBaseException; 12 | 13 | /** 14 | * 数据库连接工具 15 | * 16 | * @author chenyueling 17 | * 18 | */ 19 | public class DB { 20 | private static Properties props; 21 | private static Connection conn = null; 22 | private static String url; 23 | private static String user; 24 | private static String password; 25 | private static String driver; 26 | 27 | private DB() { 28 | }; 29 | 30 | static { 31 | 32 | props = new Properties(); 33 | try { 34 | props.load(DB.class.getClassLoader().getResourceAsStream( 35 | "jdbc.properties")); 36 | url = props.getProperty("jdbc.url"); 37 | user = props.getProperty("jdbc.username"); 38 | password = props.getProperty("jdbc.password"); 39 | driver = props.getProperty("jdbc.driverClassName"); 40 | Class.forName(driver); 41 | } catch (IOException e) { 42 | System.out.println("配置文件读取异常"); 43 | e.printStackTrace(); 44 | } catch (ClassNotFoundException e) { 45 | System.out.println(" 连接驱动获取失败"); 46 | e.printStackTrace(); 47 | } 48 | 49 | } 50 | 51 | public static Connection getConnection() throws DataBaseException { 52 | 53 | 54 | try { 55 | conn = DriverManager.getConnection(url, user, password); 56 | } catch (SQLException e) { 57 | System.out.println("数据库连接异常"); 58 | e.printStackTrace(); 59 | throw new DataBaseException(); 60 | 61 | } 62 | 63 | return conn; 64 | } 65 | 66 | /** 67 | * 68 | * 创建一个会话 69 | * 70 | * @return 71 | * @throws DataBaseException 72 | */ 73 | public static Statement CreateStatement() throws DataBaseException { 74 | if(conn==null){ 75 | //System.out.println("111"); 76 | getConnection(); 77 | } 78 | 79 | Statement stmt = null; 80 | try { 81 | stmt = conn.createStatement(); 82 | } catch (SQLException e) { 83 | System.out.println("会话建立失败"); 84 | throw new DataBaseException(); 85 | // e.printStackTrace(); 86 | } 87 | return stmt; 88 | } 89 | 90 | public static PreparedStatement CreatePrepare(String sql) { 91 | PreparedStatement stmt = null; 92 | try { 93 | stmt = conn.prepareStatement(sql); 94 | } catch (SQLException e) { 95 | System.out.println("PrepareStament 创建失败"); 96 | e.printStackTrace(); 97 | } 98 | return stmt; 99 | } 100 | /** 101 | * 关闭连接 102 | */ 103 | public static void Close() { 104 | if (conn != null) { 105 | try { 106 | conn.close(); 107 | } catch (SQLException e) { 108 | // TODO 自动生成的 catch 块 109 | e.printStackTrace(); 110 | } finally { 111 | conn = null; 112 | } 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/com/zhbit/Util/ExpressMassage.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.Util; 2 | 3 | import java.awt.event.ActionEvent; 4 | import java.awt.event.ActionListener; 5 | import java.util.Vector; 6 | 7 | import javax.swing.DefaultComboBoxModel; 8 | import javax.swing.JButton; 9 | import javax.swing.JComboBox; 10 | import javax.swing.JFrame; 11 | import javax.swing.JLabel; 12 | import javax.swing.JPanel; 13 | import javax.swing.JScrollPane; 14 | import javax.swing.JTable; 15 | import javax.swing.ScrollPaneConstants; 16 | import javax.swing.border.EmptyBorder; 17 | import javax.swing.table.DefaultTableModel; 18 | 19 | import com.zhbit.entity.Student; 20 | import com.zhbit.excetion.DataBaseException; 21 | import com.zhbit.excetion.QueryResultIsNullException; 22 | /** 23 | * 快递消息提示弹出窗口 24 | * @author chenyueling 25 | * 26 | */ 27 | public class ExpressMassage extends JFrame { 28 | 29 | 30 | private JPanel contentPane; 31 | private JFrame frame=this; 32 | private int remindTime=100000+5000; 33 | private JComboBox comboBox; 34 | private JTable table; 35 | private DefaultTableModel defaultTableModel; 36 | private Vector headVector; 37 | /** 38 | * Launch the application. 39 | */ 40 | /* public static void main(String[] args) { 41 | EventQueue.invokeLater(new Runnable() { 42 | public void run() { 43 | try { 44 | ExpressMassage frame = new ExpressMassage(); 45 | frame.setVisible(true); 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | }); 51 | }*/ 52 | private Student student; 53 | 54 | /** 55 | * Create the frame. 56 | */ 57 | public ExpressMassage(Student stu) { 58 | 59 | this.student = stu; 60 | 61 | setTitle("新快递信息"); 62 | //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 63 | setBounds(450, 200, 450, 300); 64 | contentPane = new JPanel(); 65 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 66 | setContentPane(contentPane); 67 | contentPane.setLayout(null); 68 | setResizable(false); 69 | 70 | comboBox = new JComboBox(); 71 | comboBox.setModel(new DefaultComboBoxModel(new String[] {"15", "30", "45", "60","本次登录不再提示"})); 72 | comboBox.setBounds(216, 165, 72, 21); 73 | contentPane.add(comboBox); 74 | 75 | JLabel label = new JLabel("修改提醒时间"); 76 | label.setBounds(107, 166, 92, 18); 77 | contentPane.add(label); 78 | 79 | JLabel label_1 = new JLabel("分钟后再提示"); 80 | label_1.setBounds(304, 166, 92, 18); 81 | contentPane.add(label_1); 82 | 83 | JButton button = new JButton("确定"); 84 | button.addActionListener(new ActionListener() { 85 | public void actionPerformed(ActionEvent arg0) { 86 | frame.setVisible(false); 87 | remindTime=Integer.parseInt(comboBox.getSelectedItem().toString())*60*1000; 88 | } 89 | }); 90 | button.setBounds(303, 217, 93, 23); 91 | contentPane.add(button); 92 | 93 | JPanel panel = new JPanel(); 94 | panel.setBounds(35, 12, 348, 143); 95 | contentPane.add(panel); 96 | panel.setLayout(null); 97 | 98 | JScrollPane scrollPane_1 = new JScrollPane(); 99 | 100 | scrollPane_1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); 101 | scrollPane_1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); 102 | 103 | 104 | 105 | scrollPane_1.setEnabled(false); 106 | scrollPane_1.setBounds(0, 0, 348, 143); 107 | panel.add(scrollPane_1); 108 | 109 | table = new JTable(); 110 | table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); 111 | table.setFillsViewportHeight(true); 112 | defaultTableModel = new DefaultTableModel(); 113 | table.setModel(defaultTableModel); 114 | headVector = new Vector(); 115 | headVector.add("快递记录号"); 116 | headVector.add("快递公司"); 117 | headVector.add("到件日期"); 118 | headVector.add("备注"); 119 | 120 | defaultTableModel.setDataVector(null, headVector); 121 | 122 | scrollPane_1.setViewportView(table); 123 | } 124 | 125 | public int getRemindTime() { 126 | return remindTime; 127 | } 128 | 129 | public void setRemindTime(int remindTime) { 130 | this.remindTime = remindTime; 131 | } 132 | 133 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 134 | 135 | Vector vector = student.showPersonalExpressInfo(); 136 | defaultTableModel.setDataVector(vector, headVector); 137 | } 138 | 139 | 140 | 141 | 142 | } 143 | -------------------------------------------------------------------------------- /src/com/zhbit/Util/ExpressMassageRemind.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.Util; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.SQLException; 5 | import java.sql.Statement; 6 | 7 | import com.zhbit.entity.Student; 8 | import com.zhbit.excetion.DataBaseException; 9 | import com.zhbit.excetion.QueryResultIsNullException; 10 | 11 | public class ExpressMassageRemind implements Runnable { 12 | 13 | private String userId=null; 14 | private Statement stmt=null; 15 | private ExpressMassage expressMassage=null; 16 | private Student student; 17 | public ExpressMassageRemind(Student stu){ 18 | this.student = stu; 19 | expressMassage = new ExpressMassage(stu); 20 | 21 | } 22 | 23 | 24 | 25 | @SuppressWarnings("unused") 26 | @Override 27 | public void run() { 28 | while (true) { 29 | 30 | 31 | try { 32 | Thread.sleep(expressMassage.getRemindTime()-100000); 33 | //Statement stmt = DB.CreateStatement(); 34 | // String sql = "select RecordNum,CName,ComeDate,Remark from ExpressTransceiver where StuId='"+userId+"'"; 35 | 36 | 37 | //ResultSet rs = null; 38 | //System.out.println(sql); 39 | //rs = stmt.executeQuery(sql); 40 | // System.out.println("快递~~~~~~~"); 41 | 42 | /*JOptionPane.showMessageDialog(null, "您有快递", "系统信息", 43 | JOptionPane.WARNING_MESSAGE);*/ 44 | /* if(expressMassage!=null){ 45 | remindTime=expressMassage.getRemindTime(); 46 | } 47 | expressMassage.showInfo(); 48 | if (rs != null && rs.next()) { 49 | if(expressMassage==null){ 50 | expressMassage = new ExpressMassage(student); 51 | 52 | expressMassage.setVisible(true); 53 | }else{ 54 | expressMassage.setVisible(true); 55 | } 56 | 57 | }*/ 58 | if(expressMassage!=null){ 59 | expressMassage.showInfo(); 60 | expressMassage.setVisible(true); 61 | Thread.sleep(100000); 62 | } 63 | 64 | } catch (InterruptedException e) { 65 | // TODO 自动生成的 catch 块 66 | e.printStackTrace(); 67 | } catch (DataBaseException e) { 68 | // TODO 自动生成的 catch 块 69 | e.printStackTrace(); 70 | 71 | } catch (QueryResultIsNullException e) { 72 | // TODO 自动生成的 catch 块 73 | e.printStackTrace(); 74 | } 75 | } 76 | } 77 | } 78 | 79 | -------------------------------------------------------------------------------- /src/com/zhbit/entity/Manager.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.entity; 2 | 3 | import java.util.Vector; 4 | 5 | import com.zhbit.excetion.DataBaseException; 6 | import com.zhbit.excetion.PasswordNotMatchException; 7 | import com.zhbit.excetion.QueryResultIsNullException; 8 | import com.zhbit.excetion.UpdateDataException; 9 | import com.zhbit.excetion.UpdateSuccessException; 10 | import com.zhbit.form.UpdatePassWordForm; 11 | import com.zhbit.form.UpdatePersonalInfoForm; 12 | import com.zhbit.queryResult.AllDormitoryInfo; 13 | import com.zhbit.queryResult.AllMaintanceRecord; 14 | import com.zhbit.queryResult.AllStudentInfo; 15 | import com.zhbit.queryResult.DormitoryBuildingInfo; 16 | import com.zhbit.queryResult.ManagerInfo; 17 | import com.zhbit.queryResult.StudentInfo; 18 | 19 | 20 | public class Manager extends Person { 21 | 22 | private String DormId; 23 | 24 | 25 | public String getDormId() { 26 | return DormId; 27 | } 28 | 29 | public void setDormId(String dormId) { 30 | DormId = dormId; 31 | } 32 | 33 | 34 | static ManagerService managerService ; 35 | 36 | static{ 37 | managerService = new ManagerServiceImpl(); 38 | } 39 | 40 | public Manager() { 41 | 42 | } 43 | 44 | public Manager(String id) throws DataBaseException, QueryResultIsNullException { 45 | this.setId(id); 46 | initPersonalInfo(); 47 | } 48 | 49 | @Override 50 | public void Login() throws PasswordNotMatchException { 51 | // TODO 自动生成的方法存根 52 | //managerService.getAllStudentInfo(); 53 | 54 | } 55 | 56 | @Override 57 | public Object PersonalInfo() { 58 | ManagerInfo myInfo = new ManagerInfo(); 59 | myInfo.setId(this.getId()); 60 | myInfo.setSex(this.getSex()); 61 | myInfo.setPhone(this.getPhone()); 62 | myInfo.setName(this.getName()); 63 | //myInfo.setHome(this.getHome()); /// 64 | return myInfo; 65 | } 66 | 67 | 68 | @Override 69 | public void PasswordUpdate(UpdatePassWordForm updatePassWordForm) throws PasswordNotMatchException, DataBaseException, UpdateSuccessException { 70 | updatePassWordForm.setOwnerId(this.getId()); 71 | managerService.PasswordUpdate(updatePassWordForm); 72 | } 73 | 74 | @Override 75 | public void UpdatePersonalInfo(UpdatePersonalInfoForm updatePersonalInfoForm) throws UpdateDataException, DataBaseException { 76 | updatePersonalInfoForm.setOwnerId(getId()); 77 | managerService.UpdatePersonalInfo(updatePersonalInfoForm); 78 | try { 79 | initPersonalInfo(); 80 | } catch (QueryResultIsNullException e) { 81 | // TODO 自动生成的 catch 块 82 | e.printStackTrace(); 83 | } 84 | } 85 | 86 | 87 | /** 88 | * 89 | * 得到所有学生的信息 90 | * @param dmid 91 | * @return 92 | * @throws QueryResultIsNullException 93 | * @throws DataBaseException 94 | */ 95 | public Vector getAllStudentInfo(String dmid) throws QueryResultIsNullException, DataBaseException{ 96 | return managerService.getAllStudentInfo(dmid); 97 | 98 | } 99 | 100 | public DormitoryBuildingInfo getDormitory() throws DataBaseException, QueryResultIsNullException{ 101 | DormitoryBuildingInfo dormitoryBuildingInfo =null; 102 | dormitoryBuildingInfo = managerService.getDormitory(this.getId()); 103 | return dormitoryBuildingInfo; 104 | } 105 | /** 106 | * 得到含有所有宿舍信息的对象 107 | * @return 108 | * @throws DataBaseException 109 | * @throws QueryResultIsNullException 110 | */ 111 | public AllDormitoryInfo getAllDormitoryInfo() throws DataBaseException, QueryResultIsNullException{ 112 | AllDormitoryInfo allDormitoryInfo =null; 113 | allDormitoryInfo = managerService.getAllDormitoryInfo(this.getDormId()); 114 | return allDormitoryInfo; 115 | 116 | } 117 | 118 | 119 | public AllMaintanceRecord getAllMaintanceRecord() throws DataBaseException, QueryResultIsNullException{ 120 | AllMaintanceRecord allMaintanceRecord = null; 121 | allMaintanceRecord = managerService.getAllMaintenanceRecord(getDormId()); 122 | return allMaintanceRecord; 123 | } 124 | 125 | 126 | @SuppressWarnings("unused") 127 | private void initPersonalInfo() throws DataBaseException, QueryResultIsNullException{ 128 | managerService.initPersonalInfo(this); 129 | } 130 | /** 131 | * 得到所有快递信息 132 | * @return 133 | * @throws QueryResultIsNullException 134 | * @throws DataBaseException 135 | */ 136 | public Vector getAllExpressInfo(String dmid) throws DataBaseException, QueryResultIsNullException { 137 | Vector vector = managerService.getAllExpressInfo(dmid); 138 | return vector; 139 | 140 | } 141 | 142 | public boolean updateExpressTransceiver(int Record, String Data){ 143 | return managerService.updateExpressTransceiver(Record, Data); 144 | } 145 | 146 | /** 147 | * 得到所有夜归记录 148 | * @return 149 | * @throws DataBaseException 150 | * @throws QueryResultIsNullException 151 | */ 152 | public Vector getAllCurfewRecord() throws DataBaseException, QueryResultIsNullException{ 153 | Vector vector = managerService.getAllCurfewRecord(getDormId()); 154 | return vector; 155 | } 156 | 157 | public boolean insertRecord(String cmid, String stuId, String data, String mark) { 158 | // TODO Auto-generated method stub 159 | return managerService.insetRecord(cmid, stuId, data, mark); 160 | } 161 | 162 | public boolean insertStu(String dormId2, String roomId, String bedId, String stuId, String data, String rmark) throws DataBaseException, QueryResultIsNullException{ 163 | // TODO Auto-generated method stub 164 | return managerService.insertStu(dormId2, roomId, bedId, stuId, data, rmark); 165 | } 166 | 167 | public boolean insertCurfew(String stuId, String stuName, String curfew,String rmark, String dMid) throws DataBaseException, QueryResultIsNullException { 168 | // TODO Auto-generated method stub 169 | return managerService.insertCurfew(stuId, stuName, curfew, rmark, dMid); 170 | } 171 | 172 | public boolean insertLCRecord(String stuId, String stuName, String data, String lC, String mark) throws DataBaseException, QueryResultIsNullException{ 173 | // TODO Auto-generated method stub 174 | return managerService.insertLCRecord(stuId, stuName, data, lC, mark); 175 | } 176 | 177 | 178 | /** 179 | * 查询学生离返校信息 180 | * @return 181 | * @throws DataBaseException 182 | * @throws QueryResultIsNullException 183 | */ 184 | public Vector getAllLiveComeStu() throws DataBaseException, QueryResultIsNullException{ 185 | return managerService.getAllLeaveComeStu(getDormId()); 186 | } 187 | 188 | public boolean outStu(String stuId, String rmark) throws DataBaseException { 189 | // TODO Auto-generated method stub 190 | return managerService.outStu(stuId, rmark); 191 | } 192 | 193 | public String getStuName(String stuId) throws DataBaseException { 194 | // TODO Auto-generated method stub 195 | return managerService.getStuName(stuId); 196 | } 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | } 208 | -------------------------------------------------------------------------------- /src/com/zhbit/entity/ManagerService.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.entity; 2 | 3 | import java.util.Vector; 4 | 5 | import com.zhbit.excetion.DataBaseException; 6 | import com.zhbit.excetion.PasswordNotMatchException; 7 | import com.zhbit.excetion.QueryResultIsNullException; 8 | import com.zhbit.excetion.UpdateDataException; 9 | import com.zhbit.excetion.UpdateSuccessException; 10 | import com.zhbit.form.UpdatePassWordForm; 11 | import com.zhbit.form.UpdatePersonalInfoForm; 12 | import com.zhbit.queryResult.AllDormitoryInfo; 13 | import com.zhbit.queryResult.AllMaintanceRecord; 14 | import com.zhbit.queryResult.AllStudentInfo; 15 | import com.zhbit.queryResult.DormitoryBuildingInfo; 16 | import com.zhbit.queryResult.StudentInfo; 17 | 18 | /** 19 | * 20 | * @author chenyueling 21 | * 22 | */ 23 | public interface ManagerService { 24 | 25 | // *****************学生信息**********************// 26 | /** 27 | * 获取所有学生的信息 28 | * @param dmid 29 | * 30 | * @throws QueryResultIsNullException 31 | * @throws DataBaseException 32 | */ 33 | public Vector getAllStudentInfo(String dmid) 34 | throws QueryResultIsNullException, DataBaseException; // 得到所有学生的信息 35 | 36 | /** 37 | * 查询学生信息by学生id 38 | * 39 | * @param studentId 40 | * @return 41 | * @throws QueryResultIsNullException 42 | * @throws DataBaseException 43 | */ 44 | public StudentInfo queryStudentInfoById(String studentId) 45 | throws QueryResultIsNullException, DataBaseException; // 查询学生信息by学生id 46 | 47 | public void queryStudentInfoByName(String studentName); // 查询学生信息by学生Name 48 | 49 | public void queryStudentInfoByDormitoryId(String dormitoryId); // 按宿舍查询学生信息 50 | 51 | // public void queryStudentInfo(String sutdentId); 52 | 53 | // public void queryStudentInfo(String studentName); 54 | 55 | // ***********************快递信息*************************************// 56 | 57 | 58 | 59 | public void getAllExpressUnSignIn(); // 得到所有未签收的快递信息 60 | 61 | public void getAllExpressSignIn(); // 得到所有已签收的快递信息 62 | 63 | public void queryExpressById(String ExpressId); // 查询快递by快递Id 64 | 65 | // ***************************维修信息********************************************// 66 | 67 | /** 68 | * 69 | * @param dormId 70 | * @return 71 | * @throws DataBaseException 72 | * @throws QueryResultIsNullException 73 | */ 74 | public AllMaintanceRecord getAllMaintenanceRecord(String dormId) throws DataBaseException, QueryResultIsNullException; // 得到所有维修信息 75 | 76 | 77 | 78 | public void getFixedInfo(); 79 | 80 | public void queryMaintenanceInfoByDormitoryId(String DormitoryId); 81 | 82 | // 要是实现报修的时候一定要检测是否已经有保修记录 83 | 84 | 85 | 86 | /** 87 | * 查询舍管所在楼栋宿舍信息 88 | * 89 | * @param DMId 90 | * @return 91 | * @throws DataBaseException 92 | * @throws QueryResultIsNullException 93 | */ 94 | public DormitoryBuildingInfo getDormitory(String DMId) 95 | throws DataBaseException, QueryResultIsNullException; 96 | 97 | /** 98 | * 得到本栋楼宿舍信息 99 | * @param string 100 | * @return 101 | * @throws DataBaseException 102 | * @throws QueryResultIsNullException 103 | */ 104 | public AllDormitoryInfo getAllDormitoryInfo(String DMid) throws DataBaseException, QueryResultIsNullException; 105 | 106 | /** 107 | * 得到所有快递信息 108 | * @return 109 | * @throws DataBaseException 110 | * @throws QueryResultIsNullException 111 | */ 112 | public Vector getAllExpressInfo(String dmid) throws DataBaseException, QueryResultIsNullException; 113 | 114 | public boolean updateExpressTransceiver(int Record, String Data); 115 | 116 | public boolean insetRecord(String cmid, String stuId, String data, String mark); 117 | /** 118 | * 查询所有夜归记录 119 | * @return 120 | * @throws DataBaseException 121 | * @throws QueryResultIsNullException 122 | */ 123 | public Vector getAllCurfewRecord(String DMID) throws DataBaseException, QueryResultIsNullException; 124 | 125 | 126 | 127 | 128 | 129 | public void queryDormitoryInfoById(String dormitoryId); 130 | 131 | public void getAllDormitoryPropertyInfo(); 132 | 133 | public void queryDormitoryPropertyInfoById(String dormitoryId); 134 | 135 | 136 | /** 137 | * 个人密码修改 138 | * 139 | * @param id 140 | * @throws PasswordNotMatchException 141 | * @throws DataBaseException 142 | * @throws UpdateSuccessException 143 | */ 144 | public void PasswordUpdate(UpdatePassWordForm updatepassWordForm) 145 | throws PasswordNotMatchException, DataBaseException, 146 | UpdateSuccessException; 147 | 148 | /** 149 | * 初始化管理员的个人信息 150 | * 151 | * @param manager 152 | * @throws DataBaseException 153 | * @throws QueryResultIsNullException 154 | */ 155 | public void initPersonalInfo(Manager manager) throws DataBaseException, 156 | QueryResultIsNullException; 157 | 158 | /** 159 | * 更新个人信息 160 | * 161 | * @param updatePersonalInfoForm 162 | * @throws UpdateDataException 163 | * @throws DataBaseException 164 | */ 165 | void UpdatePersonalInfo(UpdatePersonalInfoForm updatePersonalInfoForm) 166 | throws UpdateDataException, DataBaseException; 167 | 168 | public boolean insertStu(String dormId2, String roomId, String bedId, String stuId, String data, String rmark) throws DataBaseException, QueryResultIsNullException; 169 | 170 | public boolean insertCurfew(String stuId, String stuName, String curfew, String rmark, String dMid)throws DataBaseException, QueryResultIsNullException ; 171 | 172 | public boolean insertLCRecord(String stuId, String stuName, String data,String lC, String mark)throws DataBaseException, QueryResultIsNullException; 173 | 174 | public Vector getAllLeaveComeStu(String dormId) throws DataBaseException, QueryResultIsNullException; 175 | 176 | public boolean outStu(String stuId, String rmark) throws DataBaseException; 177 | 178 | public String getStuName(String stuId) throws DataBaseException; 179 | 180 | 181 | } 182 | -------------------------------------------------------------------------------- /src/com/zhbit/entity/Person.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.entity; 2 | 3 | import com.zhbit.form.UpdatePassWordForm; 4 | import com.zhbit.form.UpdatePersonalInfoForm; 5 | import com.zhbit.excetion.DataBaseException; 6 | import com.zhbit.excetion.PasswordNotMatchException; 7 | import com.zhbit.excetion.UpdateDataException; 8 | import com.zhbit.excetion.UpdateSuccessException; 9 | /** 10 | * 人的基类,所有人的对象都要继承person 11 | * @author chenyueling 12 | * 13 | */ 14 | public abstract class Person { 15 | private String id; // 16 | private String name; 17 | private String sex; 18 | private String phone; 19 | 20 | public Person(){ 21 | 22 | } 23 | 24 | /** 25 | * 登录 26 | * @throws PasswordNotMatchException 27 | */ 28 | public abstract void Login() throws PasswordNotMatchException; 29 | 30 | /** 31 | * 查询个人信息 32 | * @return 33 | */ 34 | public abstract Object PersonalInfo(); 35 | /** 36 | * 密码修改 37 | * @throws PasswordNotMatchException 38 | * @throws DataBaseException 39 | * @throws UpdateSuccessException 40 | */ 41 | public abstract void PasswordUpdate(UpdatePassWordForm updatePassWordForm)throws PasswordNotMatchException, DataBaseException, UpdateSuccessException; 42 | 43 | /** 44 | * 个人信息修改 45 | * @throws UpdateDataException 46 | * @throws DataBaseException 47 | */ 48 | public abstract void UpdatePersonalInfo(UpdatePersonalInfoForm updatePersonalInfoForm) throws UpdateDataException, DataBaseException; 49 | 50 | 51 | 52 | 53 | 54 | public String getId() { 55 | return id; 56 | } 57 | public void setId(String id) { 58 | this.id = id; 59 | } 60 | public String getName() { 61 | return name; 62 | } 63 | public void setName(String name) { 64 | this.name = name; 65 | } 66 | public String getSex() { 67 | return sex; 68 | } 69 | public void setSex(String sex) { 70 | this.sex = sex; 71 | } 72 | public String getPhone() { 73 | return phone; 74 | } 75 | public void setPhone(String phone) { 76 | this.phone = phone; 77 | } 78 | 79 | 80 | 81 | 82 | 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/com/zhbit/entity/Student.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.entity; 2 | 3 | import java.io.ObjectInputStream.GetField; 4 | import java.util.Vector; 5 | 6 | import com.zhbit.excetion.DataBaseException; 7 | import com.zhbit.excetion.PasswordNotMatchException; 8 | import com.zhbit.excetion.QueryResultIsNullException; 9 | import com.zhbit.excetion.UpdateDataException; 10 | import com.zhbit.excetion.UpdateSuccessException; 11 | import com.zhbit.form.UpdatePassWordForm; 12 | import com.zhbit.form.UpdatePersonalInfoForm; 13 | 14 | 15 | /** 16 | *学生类 17 | * @author chenyueling 18 | * 19 | */ 20 | public class Student extends Person { 21 | 22 | static StudentService studentService; 23 | 24 | static { 25 | studentService = new StudentServiceImpl(); 26 | } 27 | 28 | private String Home;//籍贯 29 | 30 | private String grade; //年级 31 | 32 | private String College;//学院 33 | 34 | private String major; //专业 35 | 36 | private String classNumber; //班级 37 | 38 | private String StuETime; 39 | 40 | private String DormID; //宿舍栋数 41 | 42 | private String RoomID; //房号 43 | 44 | private String BedNum; 45 | 46 | public Student(String id) throws DataBaseException, QueryResultIsNullException{ 47 | this.setId(id); 48 | initPersonalInfo(); 49 | } 50 | 51 | public String getHome() { 52 | return Home; 53 | } 54 | 55 | public String getGrade() { 56 | return grade; 57 | } 58 | 59 | public String getCollege() { 60 | return College; 61 | } 62 | 63 | public String getMajor() { 64 | return major; 65 | } 66 | 67 | public String getClassNumber() { 68 | return classNumber; 69 | } 70 | 71 | public String getStuETime() { 72 | return StuETime; 73 | } 74 | 75 | public String getDormID() { 76 | return DormID; 77 | } 78 | 79 | public String getRoomID() { 80 | return RoomID; 81 | } 82 | 83 | public String getBedNum(){ 84 | return BedNum; 85 | } 86 | 87 | @Override 88 | public void Login() throws PasswordNotMatchException { 89 | // TODO 自动生成的方法存根 90 | 91 | 92 | } 93 | @Override 94 | public void PasswordUpdate(UpdatePassWordForm updatePassWordForm) throws PasswordNotMatchException, DataBaseException, UpdateSuccessException { 95 | updatePassWordForm.setOwnerId(this.getId()); 96 | studentService.PasswordUpdate(updatePassWordForm); 97 | 98 | } 99 | @Override 100 | public Object PersonalInfo() { 101 | return null; 102 | // TODO 自动生成的方法存根 103 | 104 | 105 | } 106 | 107 | public void setHome (String Home) { 108 | this.Home = Home; 109 | } 110 | 111 | public void setGrade(String grade) { 112 | this.grade = grade; 113 | } 114 | 115 | public void setCollege(String College) { 116 | this.College = College; 117 | } 118 | 119 | public void setMajor(String major) { 120 | this.major = major; 121 | } 122 | 123 | public void setClassNumber(String class1) { 124 | classNumber = class1; 125 | } 126 | 127 | public void setStuETime(String set) { 128 | this.StuETime = set; 129 | } 130 | 131 | public void setDormID(String DormID) { 132 | this.DormID = DormID; 133 | } 134 | 135 | public void setRoomID(String RoomID) { 136 | this.RoomID = RoomID; 137 | } 138 | 139 | public void setBedNum(String BedNum){ 140 | this.BedNum = BedNum; 141 | } 142 | 143 | 144 | /** 145 | * 得到所有快递信息 146 | * @return 147 | * @throws QueryResultIsNullException 148 | * @throws DataBaseException 149 | */ 150 | public Vector getPersonalExpressInfo() throws DataBaseException, QueryResultIsNullException { 151 | Vector vector = studentService.getPersonalExpressInfo(getId()); 152 | return vector; 153 | 154 | } 155 | 156 | /** 157 | * 弹出快递信息 158 | * @return 159 | * @throws QueryResultIsNullException 160 | * @throws DataBaseException 161 | */ 162 | public Vector showPersonalExpressInfo() throws DataBaseException, QueryResultIsNullException { 163 | Vector vector = studentService.showPersonalExpressInfo(getId()); 164 | return vector; 165 | 166 | } 167 | /** 168 | * 拿到学生所在宿舍报修信息 169 | * @return 170 | * @throws DataBaseException 171 | * @throws QueryResultIsNullException 172 | */ 173 | public Vector getMaintenanceRecord() throws DataBaseException, QueryResultIsNullException { 174 | Vector vector = studentService.getMaintainceRecord(getRoomID()); 175 | return vector; 176 | 177 | } 178 | 179 | 180 | 181 | 182 | 183 | 184 | @Override 185 | public void UpdatePersonalInfo(UpdatePersonalInfoForm updatePersonalInfoForm) throws UpdateDataException, DataBaseException { 186 | updatePersonalInfoForm.setOwnerId(this.getId()); 187 | studentService.UpdatePersonalInfo(updatePersonalInfoForm); 188 | try { 189 | initPersonalInfo(); 190 | } catch (QueryResultIsNullException e) { 191 | // TODO 自动生成的 catch 块 192 | e.printStackTrace(); 193 | } 194 | 195 | } 196 | 197 | 198 | @SuppressWarnings("unused") 199 | private void initPersonalInfo() throws DataBaseException, QueryResultIsNullException{ 200 | studentService.initPersonalInfo(this); 201 | } 202 | 203 | public Vector getPersonalCurfewInfo() throws DataBaseException, QueryResultIsNullException { 204 | return studentService.getPersonalCurfewInfo(getId()); 205 | 206 | } 207 | 208 | public Vector getItem() throws DataBaseException { 209 | // TODO Auto-generated method stub 210 | return studentService.getItem(); 211 | } 212 | 213 | public boolean insertItemMa(String id, String dormId2, String roomId2, String bedNum2, String itemId, String rmark) throws DataBaseException { 214 | // TODO Auto-generated method stub 215 | return studentService.insertItemMa(id, dormId2, roomId2, bedNum2, itemId, rmark); 216 | } 217 | 218 | public boolean updateExpressTransceiver(int record, String data) throws DataBaseException { 219 | // TODO Auto-generated method stub 220 | return studentService.updateExpressTransceiver(record, data); 221 | } 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | } 230 | -------------------------------------------------------------------------------- /src/com/zhbit/entity/StudentService.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.entity; 2 | 3 | import java.util.Vector; 4 | 5 | import com.zhbit.excetion.DataBaseException; 6 | import com.zhbit.excetion.PasswordNotMatchException; 7 | import com.zhbit.excetion.QueryResultIsNullException; 8 | import com.zhbit.excetion.UpdateDataException; 9 | import com.zhbit.excetion.UpdateSuccessException; 10 | import com.zhbit.form.UpdatePassWordForm; 11 | import com.zhbit.form.UpdatePersonalInfoForm; 12 | 13 | /** 14 | * 15 | * @author chenyueling 16 | * 17 | */ 18 | public interface StudentService { 19 | //********************查询快递信息******************// 20 | 21 | 22 | 23 | //*******************查询保修信息********************// 24 | 25 | 26 | //********************查询阿姨信息*********************// 27 | 28 | 29 | //**********************查询宿舍信息*******************// 30 | 31 | //*********************个人信息***********************// 32 | public void initPersonalInfo(Student student) throws DataBaseException, 33 | QueryResultIsNullException; 34 | 35 | /** 36 | * 个人密码修改 37 | * @param updatepassWordForm 38 | * @throws PasswordNotMatchException 39 | * @throws DataBaseException 40 | * @throws UpdateSuccessException 41 | */ 42 | public void PasswordUpdate(UpdatePassWordForm updatepassWordForm) throws PasswordNotMatchException, DataBaseException, UpdateSuccessException; 43 | 44 | 45 | public void UpdatePersonalInfo(UpdatePersonalInfoForm updatePersonalInfoForm) throws UpdateDataException, DataBaseException; 46 | 47 | /** 48 | * 查询学生个人详细的快递信息 49 | * @return 50 | * @throws DataBaseException 51 | * @throws QueryResultIsNullException 52 | */ 53 | public Vector getPersonalExpressInfo(String StuId) throws DataBaseException,QueryResultIsNullException; 54 | 55 | 56 | 57 | /** 58 | *快递信息消息弹出宽显示的快递信息 59 | * @return 60 | * @throws DataBaseException 61 | * @throws QueryResultIsNullException 62 | */ 63 | public Vector showPersonalExpressInfo(String StuId) throws DataBaseException,QueryResultIsNullException; 64 | 65 | /** 66 | * 查询学生个人夜归记录 67 | * @param StuId 68 | * @return 69 | * @throws DataBaseException 70 | * @throws QueryResultIsNullException 71 | */ 72 | public Vector getPersonalCurfewInfo(String StuId)throws DataBaseException,QueryResultIsNullException; 73 | 74 | /** 75 | * 查询自己所在宿舍报修信息 76 | * @return 77 | * @throws DataBaseException 78 | * @throws QueryResultIsNullException 79 | */ 80 | public Vector getMaintainceRecord(String RoomId)throws DataBaseException,QueryResultIsNullException; 81 | 82 | public Vector getItem() throws DataBaseException; 83 | 84 | public boolean insertItemMa(String id, String dormId2, String roomId2, String bedNum2, String itemId, String rmark) throws DataBaseException; 85 | 86 | public boolean updateExpressTransceiver(int record, String data) throws DataBaseException; 87 | 88 | } 89 | 90 | 91 | -------------------------------------------------------------------------------- /src/com/zhbit/entity/StudentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.entity; 2 | 3 | import java.sql.CallableStatement; 4 | import java.sql.Connection; 5 | import java.sql.PreparedStatement; 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | import java.sql.Statement; 9 | import java.util.Vector; 10 | 11 | import com.zhbit.Util.AESUtil; 12 | import com.zhbit.Util.DB; 13 | import com.zhbit.excetion.DataBaseException; 14 | import com.zhbit.excetion.PasswordNotMatchException; 15 | import com.zhbit.excetion.QueryResultIsNullException; 16 | import com.zhbit.excetion.UpdateDataException; 17 | import com.zhbit.excetion.UpdateSuccessException; 18 | import com.zhbit.form.UpdatePassWordForm; 19 | import com.zhbit.form.UpdatePersonalInfoForm; 20 | 21 | /** 22 | * 23 | * @author lenovo 24 | * 25 | */ 26 | public class StudentServiceImpl implements StudentService { 27 | 28 | @Override 29 | public void initPersonalInfo(Student student) throws DataBaseException, 30 | QueryResultIsNullException { 31 | Statement stmt = DB.CreateStatement(); 32 | String sql = "select * from View_Student_College_StuDormRoom where stuid = '" 33 | + student.getId() + "'"; 34 | 35 | //System.out.println(sql); 36 | try { 37 | ResultSet rs = null; 38 | rs = stmt.executeQuery(sql); 39 | if (!rs.next()) { 40 | throw new QueryResultIsNullException(); 41 | } 42 | // rs.next(); 43 | student.setName(rs.getString("StuName")); 44 | //System.out.println(rs.getString("Stuname")); 45 | student.setSex(rs.getString("Stusex")); 46 | student.setHome(rs.getString("StuHome")); 47 | student.setPhone(rs.getString("StuPhone")); 48 | student.setCollege(rs.getString("College")); 49 | student.setMajor(rs.getString("Major")); 50 | student.setClassNumber(rs.getString("StuClass")); 51 | student.setStuETime(rs.getString("StuETime")); 52 | student.setDormID(rs.getString("DormId")); 53 | student.setRoomID(rs.getString("RoomId")); 54 | 55 | } catch (SQLException e) { 56 | // TODO 自动生成的 catch 块 57 | 58 | e.printStackTrace(); 59 | throw new DataBaseException(); 60 | } 61 | 62 | } 63 | 64 | 65 | 66 | 67 | @Override 68 | public void PasswordUpdate(UpdatePassWordForm updatePassWordForm) 69 | throws PasswordNotMatchException, DataBaseException, 70 | UpdateSuccessException { 71 | String oldPassword = updatePassWordForm.getOldPassword(); 72 | oldPassword = AESUtil.getInstance().encrypt(oldPassword); 73 | Statement stmt = DB.CreateStatement(); 74 | String sql = "select *from StuAccountPassword where StuId='" 75 | + updatePassWordForm.getOwnerId() + "' and Password ='" 76 | + oldPassword + "'"; 77 | //System.out.println(sql); 78 | try { 79 | ResultSet rs = stmt.executeQuery(sql); 80 | if (!rs.next()) { 81 | throw new PasswordNotMatchException(); 82 | } else { 83 | String newPassword = updatePassWordForm.getNewassword(); 84 | newPassword = AESUtil.getInstance().encrypt(newPassword); 85 | String ownerId = updatePassWordForm.getOwnerId(); 86 | String upsql = "update StuAccountPassword set Password='" 87 | + newPassword + "' where StuId='" + ownerId + "'"; 88 | System.out.println(upsql); 89 | stmt.executeUpdate(upsql); 90 | } 91 | } catch (SQLException e) { 92 | // TODO 自动生成的 catch 块 93 | e.printStackTrace(); 94 | } 95 | throw new UpdateSuccessException(); 96 | 97 | } 98 | 99 | 100 | 101 | @Override 102 | public void UpdatePersonalInfo(UpdatePersonalInfoForm updatePersonalInfoForm) 103 | throws UpdateDataException, DataBaseException { 104 | Connection connection = DB.getConnection(); 105 | String sql = "update Student set Stuphone=?,StuHome=? where StuId=" 106 | + updatePersonalInfoForm.getOwnerId(); 107 | //System.out.println(sql); 108 | try { 109 | PreparedStatement pstmt = connection.prepareStatement(sql); 110 | pstmt.setString(1, updatePersonalInfoForm.getPhone()); 111 | pstmt.setString(2, updatePersonalInfoForm.getHome()); 112 | pstmt.execute(); 113 | } catch (SQLException e) { 114 | 115 | e.printStackTrace(); 116 | throw new UpdateDataException(); 117 | 118 | } 119 | } 120 | 121 | @Override 122 | public Vector getPersonalExpressInfo(String StuId) throws DataBaseException, 123 | QueryResultIsNullException { 124 | Statement stmt = DB.CreateStatement(); 125 | String sql = "select *from ExpressTransceiver where StuId='"+StuId+"'"; 126 | ResultSet rs = null; 127 | Vector vector = null; 128 | Vector vectors = new Vector(); 129 | try { 130 | rs = stmt.executeQuery(sql); 131 | if (rs != null && !rs.next()) { 132 | throw new QueryResultIsNullException(); 133 | } 134 | vector = new Vector(); 135 | for (int i = 1; i <= 11; i++) { 136 | 137 | vector.add(rs.getString(i)); 138 | 139 | } 140 | vectors.add(vector); 141 | while (rs.next()) { 142 | vector = new Vector(); 143 | for (int i = 1; i <= 11; i++) { 144 | 145 | vector.add(rs.getString(i)); 146 | 147 | } 148 | vectors.add(vector); 149 | } 150 | } catch (SQLException e) { 151 | e.printStackTrace(); 152 | throw new DataBaseException(); 153 | } 154 | 155 | return vectors; 156 | 157 | } 158 | 159 | @Override 160 | public Vector showPersonalExpressInfo(String StuId) throws DataBaseException, 161 | QueryResultIsNullException { 162 | Statement stmt = DB.CreateStatement(); 163 | String sql = "select StuName,ComeDate,CName,Remark from ExpressTransceiver where StuId='"+StuId+"'"; 164 | ResultSet rs = null; 165 | Vector vector = null; 166 | Vector vectors = new Vector(); 167 | try { 168 | //System.out.println(sql); 169 | rs = stmt.executeQuery(sql); 170 | if (rs != null && !rs.next()) { 171 | throw new QueryResultIsNullException(); 172 | } 173 | vector = new Vector(); 174 | vector.add(rs.getString("StuName")); 175 | vector.add(rs.getString("ComeDate")); 176 | vector.add(rs.getString("CName")); 177 | vector.add(rs.getString("Remark")); 178 | 179 | vectors.add(vector); 180 | while (rs.next()) { 181 | vector = new Vector(); 182 | vector.add(rs.getString("StuName")); 183 | vector.add(rs.getString("ComeDate")); 184 | vector.add(rs.getString("CName")); 185 | vector.add(rs.getString("Remark")); 186 | 187 | vectors.add(vector); 188 | } 189 | 190 | 191 | } catch (SQLException e) { 192 | e.printStackTrace(); 193 | throw new DataBaseException(); 194 | } 195 | 196 | return vectors; 197 | 198 | } 199 | 200 | @Override 201 | public Vector getPersonalCurfewInfo(String StuId) 202 | throws DataBaseException, QueryResultIsNullException { 203 | Statement stmt = DB.CreateStatement(); 204 | String sql = "select RecordNum,Curfew,CurfewNum,Remark,DMId from Curfew where StuId='"+StuId+"'"; 205 | ResultSet rs = null; 206 | Vector vector = null; 207 | Vector vectors = new Vector(); 208 | try { 209 | //System.out.println(sql); 210 | rs = stmt.executeQuery(sql); 211 | if (rs != null && !rs.next()) { 212 | throw new QueryResultIsNullException(); 213 | } 214 | vector = new Vector(); 215 | for(int i=1;i<=5;i++){ 216 | vector.add(rs.getString(i)); 217 | } 218 | 219 | vectors.add(vector); 220 | while (rs.next()) { 221 | vector = new Vector(); 222 | for(int i=1;i<=5;i++){ 223 | vector.add(rs.getString(i)); 224 | } 225 | 226 | vectors.add(vector); 227 | } 228 | 229 | 230 | } catch (SQLException e) { 231 | e.printStackTrace(); 232 | throw new DataBaseException(); 233 | } 234 | 235 | return vectors; 236 | 237 | 238 | } 239 | 240 | @Override 241 | public Vector getMaintainceRecord(String RoomId) throws DataBaseException, 242 | QueryResultIsNullException { 243 | Statement stmt = DB.CreateStatement(); 244 | String sql = "select *from View_MR_Stu_It where RoomId='"+RoomId+"'"; 245 | ResultSet rs = null; 246 | Vector vector = null; 247 | Vector vectors = new Vector(); 248 | try { 249 | //System.out.println(sql); 250 | rs = stmt.executeQuery(sql); 251 | if (rs != null && !rs.next()) { 252 | throw new QueryResultIsNullException(); 253 | } 254 | vector = new Vector(); 255 | for(int i=1;i<=13;i++){ 256 | vector.add(rs.getString(i)); 257 | } 258 | 259 | vectors.add(vector); 260 | while (rs.next()) { 261 | vector = new Vector(); 262 | for(int i=1;i<=13;i++){ 263 | vector.add(rs.getString(i)); 264 | } 265 | 266 | vectors.add(vector); 267 | } 268 | 269 | 270 | } catch (SQLException e) { 271 | e.printStackTrace(); 272 | throw new DataBaseException(); 273 | } 274 | 275 | return vectors; 276 | } 277 | 278 | 279 | public boolean insertItemMa(String id, String dormId2,String roomId2, String bedNum2, String itemId, String rmark) throws DataBaseException { 280 | 281 | 282 | 283 | try { 284 | 285 | Connection connection = DB.getConnection(); 286 | CallableStatement cst = connection.prepareCall("{call proc_MaintenanceRecord_Repaire(?,?,?,?,?,?)}"); 287 | cst.setString(1, id); 288 | //cst.setString(2, name); 289 | cst.setString(2, dormId2); 290 | cst.setString(3, roomId2); 291 | cst.setString(4, bedNum2); 292 | cst.setString(5, itemId); 293 | cst.setString(6, rmark); 294 | int r = cst.executeUpdate(); 295 | cst.close(); 296 | if(r >0 ){ 297 | return true; 298 | }else{ 299 | return false; 300 | } 301 | 302 | } catch (SQLException e) { 303 | // TODO Auto-generated catch block 304 | e.printStackTrace(); 305 | return false; 306 | } 307 | 308 | 309 | } 310 | 311 | 312 | @Override 313 | public Vector getItem() throws DataBaseException { 314 | // TODO Auto-generated method stub 315 | 316 | Statement stmt = DB.CreateStatement(); 317 | String sql = "select ItName from ItemInfo"; 318 | ResultSet rs = null; 319 | 320 | Vector vector = null; 321 | 322 | Vector vectors = new Vector(); 323 | 324 | try { 325 | //System.out.println(sql); 326 | 327 | rs = stmt.executeQuery(sql); 328 | if (rs != null && !rs.next()) { 329 | throw new QueryResultIsNullException(); 330 | } 331 | 332 | vector = new Vector(); 333 | 334 | vector.add(rs.getString(1)); 335 | 336 | vectors.add(vector); 337 | while (rs.next()) { 338 | vector = new Vector(); 339 | 340 | vector.add(rs.getString(1)); 341 | 342 | vectors.add(vector); 343 | } 344 | 345 | 346 | } catch (SQLException | QueryResultIsNullException e) { 347 | e.printStackTrace(); 348 | throw new DataBaseException(); 349 | } 350 | 351 | return vectors; 352 | 353 | } 354 | 355 | 356 | 357 | @Override 358 | public boolean updateExpressTransceiver(int record, String data) throws DataBaseException { 359 | 360 | try { 361 | Connection connection = DB.getConnection(); 362 | CallableStatement cst = connection.prepareCall("{call proc_ExpressTransceiver_Get(?,?)}"); 363 | cst.setInt(1, record); 364 | cst.setString(2, data); 365 | int r = cst.executeUpdate(); 366 | cst.close(); 367 | if(r >0 ){ 368 | return true; 369 | }else{ 370 | return false; 371 | } 372 | 373 | } catch (SQLException e) { 374 | // TODO Auto-generated catch block 375 | e.printStackTrace(); 376 | return false; 377 | } 378 | } 379 | 380 | } 381 | -------------------------------------------------------------------------------- /src/com/zhbit/excetion/DataBaseException.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.excetion; 2 | /** 3 | * 发生SQL异常错误 4 | * @author chenyueling 5 | * 6 | */ 7 | @SuppressWarnings("serial") 8 | public class DataBaseException extends Exception { 9 | public DataBaseException(){ 10 | super("数据库错误"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/com/zhbit/excetion/PasswordNotMatchException.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.excetion; 2 | 3 | 4 | /** 5 | * 密码不匹配异常 6 | * @author chenyueling 7 | * 8 | */ 9 | @SuppressWarnings("serial") 10 | public class PasswordNotMatchException extends Exception { 11 | public PasswordNotMatchException(){ 12 | super("密码不匹配错误"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/com/zhbit/excetion/QueryResultIsNullException.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.excetion; 2 | 3 | 4 | /** 5 | * 查询不到结果跑出异常 6 | * @author chenyueling 7 | * 8 | */ 9 | @SuppressWarnings("serial") 10 | public class QueryResultIsNullException extends Exception { 11 | public QueryResultIsNullException() { 12 | super("查询结果为空"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/com/zhbit/excetion/UpdateDataException.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.excetion; 2 | /** 3 | * 数据更新失败 4 | * @author chenyueling 5 | * 6 | */ 7 | @SuppressWarnings("serial") 8 | public class UpdateDataException extends Exception { 9 | public UpdateDataException(){ 10 | super("数据更新失败!!!"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/com/zhbit/excetion/UpdateSuccessException.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.excetion; 2 | 3 | @SuppressWarnings("serial") 4 | public class UpdateSuccessException extends Exception { 5 | public UpdateSuccessException(){ 6 | super("更新成功!"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/com/zhbit/form/CheckPasswordForm.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.form; 2 | 3 | public class CheckPasswordForm { 4 | private String id; 5 | private String password; 6 | 7 | public String getID(){ 8 | return id; 9 | } 10 | 11 | public String getPassword (){ 12 | return password; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/com/zhbit/form/LoginForm.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.form; 2 | 3 | public class LoginForm { 4 | private String password; 5 | private String id; 6 | private String userType; 7 | 8 | public LoginForm() { 9 | } 10 | 11 | 12 | 13 | public String getUserType() { 14 | return userType; 15 | } 16 | public void setUserType(String userType) { 17 | this.userType = userType; 18 | } 19 | public String getPassword() { 20 | return password; 21 | } 22 | public void setPassword(String password) { 23 | this.password = password; 24 | } 25 | public String getId() { 26 | return id; 27 | } 28 | public void setId(String id) { 29 | this.id = id; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/com/zhbit/form/UpdatePassWordForm.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.form; 2 | 3 | public class UpdatePassWordForm { 4 | 5 | 6 | private String oldPassword; 7 | private String newassword; 8 | private String newPassword1; 9 | private String ownerId; 10 | 11 | 12 | public String getOwnerId() { 13 | return ownerId; 14 | } 15 | public void setOwnerId(String ownerId) { 16 | this.ownerId = ownerId; 17 | } 18 | public String getOldPassword() { 19 | return oldPassword; 20 | } 21 | public void setOldPassword(String oldPassword) { 22 | this.oldPassword = oldPassword; 23 | } 24 | public String getNewassword() { 25 | return newassword; 26 | } 27 | public void setNewassword(String newassword) { 28 | this.newassword = newassword; 29 | } 30 | public String getNewPassword1() { 31 | return newPassword1; 32 | } 33 | public void setNewPassword1(String newPassword1) { 34 | this.newPassword1 = newPassword1; 35 | } 36 | 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/com/zhbit/form/UpdatePersonalInfoForm.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.form; 2 | 3 | public class UpdatePersonalInfoForm { 4 | 5 | private String Home; 6 | private String name; 7 | private String phone; 8 | private String sex; 9 | private String ownerId; 10 | 11 | 12 | public String getOwnerId() { 13 | return ownerId; 14 | } 15 | public void setOwnerId(String ownerId) { 16 | this.ownerId = ownerId; 17 | } 18 | public String getHome() { 19 | return Home; 20 | } 21 | public String getName() { 22 | return name; 23 | } 24 | public String getPhone() { 25 | return phone; 26 | } 27 | public String getSex() { 28 | return sex; 29 | } 30 | public void setHome(String home) { 31 | Home = home; 32 | } 33 | public void setName(String name) { 34 | this.name = name; 35 | } 36 | public void setPhone(String phone) { 37 | this.phone = phone; 38 | } 39 | public void setSex(String sex) { 40 | this.sex = sex; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/About.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import javax.swing.JPanel; 4 | import javax.swing.JLabel; 5 | import javax.swing.ImageIcon; 6 | import java.awt.Color; 7 | import java.awt.Font; 8 | 9 | public class About extends JPanel { 10 | 11 | 12 | private JLabel labImage; 13 | private ImageIcon image; 14 | /** 15 | * Create the panel. 16 | */ 17 | public About() { 18 | setBackground(new Color(255, 255, 255)); 19 | setSize(800,600); 20 | setLayout(null); 21 | 22 | JLabel lblNewLabel = new JLabel(""); 23 | lblNewLabel.setIcon(new ImageIcon(About.class.getResource("/bigImage/图标.png"))); 24 | lblNewLabel.setBounds(110, 206, 200, 232); 25 | add(lblNewLabel); 26 | 27 | JLabel label = new JLabel("关于宿舍管理系统"); 28 | label.setFont(new Font("宋体", Font.BOLD, 31)); 29 | label.setBounds(248, 58, 305, 72); 30 | add(label); 31 | 32 | JLabel lblNewLabel_1 = new JLabel("宿舍管理系统5.0正式版"); 33 | lblNewLabel_1.setFont(new Font("楷体", Font.BOLD, 28)); 34 | lblNewLabel_1.setBounds(352, 207, 376, 59); 35 | add(lblNewLabel_1); 36 | 37 | JLabel lblNewLabel_2 = new JLabel("制作人:廖瑞华 陈岳凌"); 38 | lblNewLabel_2.setFont(new Font("楷体", Font.BOLD, 28)); 39 | lblNewLabel_2.setBounds(352, 281, 386, 72); 40 | add(lblNewLabel_2); 41 | 42 | JLabel label_1 = new JLabel("洪惜玉 尧莉菁 鲜璐"); 43 | label_1.setFont(new Font("楷体", Font.BOLD, 28)); 44 | label_1.setBounds(433, 366, 295, 72); 45 | add(label_1); 46 | 47 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 48 | labImage = new JLabel(image); 49 | labImage.setBounds(0, 0, 800, 600); 50 | add(labImage); 51 | this.setOpaque(false); 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/ChangPWD.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import javax.swing.JOptionPane; 4 | import javax.swing.JPanel; 5 | import javax.swing.JLabel; 6 | import javax.swing.JButton; 7 | import javax.swing.JTextField; 8 | import javax.swing.JPasswordField; 9 | import java.awt.Font; 10 | import javax.swing.*; 11 | 12 | import com.zhbit.entity.Manager; 13 | import com.zhbit.excetion.DataBaseException; 14 | import com.zhbit.excetion.PasswordNotMatchException; 15 | import com.zhbit.excetion.UpdateSuccessException; 16 | import com.zhbit.form.UpdatePassWordForm; 17 | 18 | import java.awt.event.ActionListener; 19 | import java.awt.event.ActionEvent; 20 | import java.awt.event.KeyAdapter; 21 | import java.awt.event.KeyEvent; 22 | 23 | 24 | public class ChangPWD extends JPanel { 25 | private JPasswordField txtOldPWD; 26 | private JPasswordField txtNewPWD; 27 | private JPasswordField txtCheckNewPWD; 28 | private JButton butOk; 29 | private String MANAGER_ID; 30 | private JLabel labImage; 31 | private ImageIcon image; 32 | private Manager manager; 33 | /** 34 | * Create the panel. 35 | */ 36 | 37 | public ChangPWD(Manager m) { 38 | this.manager = m; 39 | setSize(800,600); 40 | setLayout(null); 41 | 42 | JLabel labOldPWD = new JLabel("旧密码"); 43 | labOldPWD.setFont(new Font("宋体", Font.PLAIN, 15)); 44 | labOldPWD.setBounds(245, 190, 54, 15); 45 | add(labOldPWD); 46 | 47 | JLabel labNewPWD = new JLabel("新密码"); 48 | labNewPWD.setFont(new Font("宋体", Font.PLAIN, 15)); 49 | labNewPWD.setBounds(245, 257, 54, 15); 50 | add(labNewPWD); 51 | 52 | JLabel labCheckNewPWD = new JLabel("确认新密码"); 53 | labCheckNewPWD.setFont(new Font("宋体", Font.PLAIN, 15)); 54 | labCheckNewPWD.setBounds(245, 315, 93, 20); 55 | add(labCheckNewPWD); 56 | 57 | butOk = new JButton("确认"); 58 | butOk.addActionListener(new ActionListener() { 59 | public void actionPerformed(ActionEvent arg0) { 60 | UpdatePassWordForm updatePassWordForm = new UpdatePassWordForm(); 61 | updatePassWordForm.setOldPassword(txtOldPWD.getText().trim()); 62 | updatePassWordForm.setNewassword(txtNewPWD.getText().trim()); 63 | updatePassWordForm.setNewPassword1(txtCheckNewPWD.getText().trim()); 64 | if(updatePassWordForm.getNewassword().equals(updatePassWordForm.getNewPassword1())){ 65 | try { 66 | manager.PasswordUpdate(updatePassWordForm); 67 | } catch (PasswordNotMatchException e) { 68 | JOptionPane.showMessageDialog(null, "旧密码错误,修改失败!", "系统信息", JOptionPane.WARNING_MESSAGE); 69 | //e.printStackTrace(); 70 | } catch (DataBaseException e) { 71 | // TODO 自动生成的 catch 块 72 | JOptionPane.showMessageDialog(null, "数据库错误,修改失败!", "系统信息", JOptionPane.WARNING_MESSAGE); 73 | //e.printStackTrace(); 74 | } catch (UpdateSuccessException e) { 75 | JOptionPane.showMessageDialog(null, "密码修改成功,请牢记密码", "系统信息", JOptionPane.WARNING_MESSAGE); 76 | } 77 | }else{ 78 | JOptionPane.showMessageDialog(null, "新密码输入不一致", "系统信息", JOptionPane.WARNING_MESSAGE); 79 | } 80 | } 81 | }); 82 | butOk.setFont(new Font("宋体", Font.PLAIN, 15)); 83 | butOk.setBounds(267, 415, 93, 23); 84 | add(butOk); 85 | 86 | JButton butCancel = new JButton("取消"); 87 | butCancel.setFont(new Font("宋体", Font.PLAIN, 15)); 88 | butCancel.setBounds(448, 415, 93, 23); 89 | add(butCancel); 90 | 91 | txtOldPWD = new JPasswordField(); 92 | txtOldPWD.setBounds(356, 186, 185, 23); 93 | add(txtOldPWD); 94 | 95 | txtNewPWD = new JPasswordField(); 96 | txtNewPWD.setBounds(356, 253, 185, 23); 97 | add(txtNewPWD); 98 | 99 | txtCheckNewPWD = new JPasswordField(); 100 | txtCheckNewPWD.addKeyListener(new KeyAdapter() { 101 | @Override 102 | public void keyPressed(KeyEvent e) { 103 | if(e.getKeyCode()==KeyEvent.VK_ENTER){ 104 | butOk.doClick(); 105 | } 106 | } 107 | }); 108 | txtCheckNewPWD.setBounds(356, 314, 185, 23); 109 | add(txtCheckNewPWD); 110 | 111 | JLabel lblNewLabel_4 = new JLabel("修改密码"); 112 | lblNewLabel_4.setFont(new Font("微软雅黑", Font.PLAIN, 25)); 113 | lblNewLabel_4.setBounds(245, 121, 115, 34); 114 | add(lblNewLabel_4); 115 | 116 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 117 | labImage = new JLabel(image); 118 | labImage.setBounds(0, 0, 800, 600); 119 | add(labImage); 120 | this.setOpaque(false); 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/Curfew.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import javax.swing.JFrame; 4 | import javax.swing.JOptionPane; 5 | import javax.swing.JPanel; 6 | import javax.swing.JTable; 7 | import javax.swing.RowFilter; 8 | import javax.swing.ScrollPaneConstants; 9 | 10 | import java.awt.Font; 11 | import java.awt.HeadlessException; 12 | import java.util.Vector; 13 | 14 | import javax.swing.table.DefaultTableModel; 15 | import javax.swing.table.TableModel; 16 | import javax.swing.table.TableRowSorter; 17 | import javax.swing.*; 18 | 19 | import com.zhbit.entity.Manager; 20 | import com.zhbit.excetion.DataBaseException; 21 | import com.zhbit.excetion.QueryResultIsNullException; 22 | import java.awt.event.ActionListener; 23 | import java.awt.event.ActionEvent; 24 | import java.awt.event.MouseAdapter; 25 | import java.awt.event.MouseEvent; 26 | 27 | public class Curfew extends JPanel { 28 | private JTable table; 29 | private String MANAGER_ID; 30 | private JLabel labImage; 31 | private ImageIcon image; 32 | private DefaultTableModel defaultTableModel; 33 | private Vector headvector ; 34 | private Manager manager; 35 | 36 | private TableRowSorter sorter; 37 | 38 | private JFrame jframe; 39 | private JTextField jtfFilter; 40 | private JTextField textField_1; 41 | private JTextField textField_2; 42 | private JTextField textField_3; 43 | private JTextField textField_4; 44 | 45 | /** 46 | * Create the panel. 47 | */ 48 | public Curfew (JFrame jf, Manager m){ 49 | this.jframe = jf; 50 | this.manager = m; 51 | setSize(800,600); 52 | setLayout(null); 53 | 54 | JScrollPane scrollPane = new JScrollPane(); 55 | scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); 56 | scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); 57 | scrollPane.setBounds(90, 189, 612, 216); 58 | add(scrollPane); 59 | 60 | table = new JTable(); 61 | table.addMouseListener(new MouseAdapter() { 62 | @Override 63 | public void mouseClicked(MouseEvent e) { 64 | 65 | Integer n = table.getSelectedRow(); 66 | textField_1.setText((String)table.getValueAt(n, 1)); 67 | 68 | textField_2.setText((String) table.getValueAt(n, 2)); 69 | 70 | textField_3.setText((String) table.getValueAt(n, 6)); 71 | 72 | textField_4.setText((String) table.getValueAt(n, 9)); 73 | 74 | } 75 | 76 | }); 77 | scrollPane.setViewportView(table); 78 | headvector = new Vector(); 79 | headvector.add("记录号"); 80 | headvector.add("学号"); 81 | headvector.add("姓名"); 82 | headvector.add("宿舍楼栋"); 83 | headvector.add("房间号"); 84 | headvector.add("床号"); 85 | headvector.add("夜归时间"); 86 | headvector.add("第几次夜归"); 87 | headvector.add("值班宿管"); 88 | headvector.add("晚归原因"); 89 | 90 | defaultTableModel = new DefaultTableModel(); 91 | 92 | defaultTableModel.setColumnCount(10); 93 | 94 | defaultTableModel.setDataVector(null,headvector); 95 | table.setModel(defaultTableModel); 96 | table.setFont(new Font("宋体", Font.PLAIN, 15)); 97 | 98 | table.setAutoResizeMode(table.AUTO_RESIZE_OFF); //自动调整表格列的宽度,不更改其他列的大小,而是更改整个表格的大小 99 | sorter = new TableRowSorter(table.getModel()); 100 | 101 | table.setRowSorter(sorter); 102 | 103 | 104 | JLabel label = new JLabel("夜归记录表"); 105 | label.setFont(new Font("微软雅黑", Font.BOLD, 25)); 106 | label.setBounds(90, 119, 155, 34); 107 | add(label); 108 | 109 | 110 | jtfFilter = new JTextField(); 111 | jtfFilter.addActionListener(new ActionListener() { 112 | public void actionPerformed(ActionEvent e) { 113 | 114 | String text = jtfFilter.getText(); 115 | if(text.trim().length()==0) 116 | sorter.setRowFilter(null); 117 | else 118 | sorter.setRowFilter(RowFilter.regexFilter(text)); 119 | 120 | } 121 | }); 122 | jtfFilter.setBounds(90, 495, 113, 21); 123 | add(jtfFilter); 124 | jtfFilter.setColumns(10); 125 | 126 | JButton button = new JButton("查询"); 127 | button.addActionListener(new ActionListener() { 128 | public void actionPerformed(ActionEvent e) { 129 | 130 | String text = jtfFilter.getText(); 131 | if(text.trim().length()==0) 132 | sorter.setRowFilter(null); 133 | else 134 | sorter.setRowFilter(RowFilter.regexFilter(text)); 135 | } 136 | }); 137 | button.setBounds(213, 494, 67, 23); 138 | add(button); 139 | 140 | JLabel lblNewLabel = new JLabel("学号"); 141 | lblNewLabel.setBounds(90, 428, 30, 15); 142 | add(lblNewLabel); 143 | 144 | textField_1 = new JTextField(); 145 | textField_1.setBounds(121, 425, 82, 21); 146 | add(textField_1); 147 | textField_1.setColumns(10); 148 | 149 | JLabel label_1 = new JLabel("姓名"); 150 | label_1.setBounds(213, 428, 30, 15); 151 | add(label_1); 152 | 153 | textField_2 = new JTextField(); 154 | textField_2.setBounds(243, 425, 66, 21); 155 | add(textField_2); 156 | textField_2.setColumns(10); 157 | 158 | JLabel label_2 = new JLabel("夜归时间"); 159 | label_2.setBounds(319, 428, 54, 15); 160 | add(label_2); 161 | 162 | textField_3 = new JTextField(); 163 | textField_3.setBounds(372, 425, 148, 21); 164 | add(textField_3); 165 | textField_3.setColumns(10); 166 | 167 | JButton button_1 = new JButton("添加夜归记录"); 168 | button_1.addActionListener(new ActionListener() { 169 | public void actionPerformed(ActionEvent e) { 170 | 171 | 172 | try { 173 | if(insertCurfew() == true) 174 | JOptionPane.showMessageDialog(jframe, "添加成功" , "系统信息", JOptionPane.WARNING_MESSAGE); 175 | else 176 | JOptionPane.showMessageDialog(jframe, "添加失败,请重新填写信息" , "系统信息", JOptionPane.WARNING_MESSAGE); 177 | } catch (HeadlessException | DataBaseException 178 | | QueryResultIsNullException e1) { 179 | // TODO Auto-generated catch block 180 | //e1.printStackTrace(); 181 | JOptionPane.showMessageDialog(jframe, "数据库错误,添加记录失败" , "系统信息", JOptionPane.WARNING_MESSAGE); 182 | } 183 | } 184 | 185 | }); 186 | button_1.setBounds(593, 463, 109, 23); 187 | add(button_1); 188 | 189 | 190 | JLabel label_3 = new JLabel("原因"); 191 | label_3.setBounds(530, 428, 30, 15); 192 | add(label_3); 193 | 194 | textField_4 = new JTextField(); 195 | textField_4.setBounds(564, 425, 138, 21); 196 | add(textField_4); 197 | textField_4.setColumns(10); 198 | 199 | JButton button_2 = new JButton("刷新"); 200 | button_2.addActionListener(new ActionListener() { 201 | public void actionPerformed(ActionEvent e) { 202 | try { 203 | showInfo(); 204 | } catch (DataBaseException | QueryResultIsNullException e1) { 205 | // TODO Auto-generated catch block 206 | //e1.printStackTrace(); 207 | JOptionPane.showMessageDialog(jframe, "刷新失败" , "系统信息", JOptionPane.WARNING_MESSAGE); 208 | } 209 | } 210 | }); 211 | button_2.setBounds(609, 541, 93, 23); 212 | add(button_2); 213 | 214 | 215 | 216 | JButton button_3 = new JButton("重置"); 217 | button_3.addActionListener(new ActionListener() { 218 | public void actionPerformed(ActionEvent e) { 219 | 220 | textField_1.setText(""); 221 | textField_2.setText(""); 222 | textField_3.setText(""); 223 | textField_4.setText(""); 224 | 225 | } 226 | }); 227 | button_3.setBounds(490, 463, 93, 23); 228 | add(button_3); 229 | 230 | 231 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 232 | labImage = new JLabel(image); 233 | labImage.setBounds(0, 0, 800, 600); 234 | add(labImage); 235 | this.setOpaque(false); 236 | 237 | } 238 | 239 | 240 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 241 | Vector vector = manager.getAllCurfewRecord(); 242 | defaultTableModel.setDataVector(vector, headvector); 243 | } 244 | 245 | 246 | public boolean insertCurfew() throws DataBaseException, QueryResultIsNullException{ 247 | 248 | String StuId, StuName, Curfew, Rmark, DMid; 249 | StuId = textField_1.getText(); 250 | StuName = textField_2.getText(); 251 | Curfew = textField_3.getText(); 252 | Rmark = textField_4.getName(); 253 | 254 | DMid = manager.getId(); 255 | 256 | return manager.insertCurfew(StuId, StuName, Curfew, Rmark, DMid); 257 | 258 | 259 | } 260 | 261 | 262 | } 263 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/Dormitory.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import javax.swing.ImageIcon; 4 | import javax.swing.JPanel; 5 | import javax.swing.JLabel; 6 | import java.awt.Font; 7 | import javax.swing.JTextField; 8 | import javax.swing.JButton; 9 | 10 | import com.zhbit.entity.Manager; 11 | import com.zhbit.excetion.DataBaseException; 12 | import com.zhbit.excetion.QueryResultIsNullException; 13 | import com.zhbit.queryResult.DormitoryBuildingInfo; 14 | 15 | public class Dormitory extends JPanel { 16 | private JTextField txtDormID; 17 | private JTextField txtStuSex; 18 | private JTextField txtCollege; 19 | private JTextField txtEtime; 20 | private JTextField txtConNum; 21 | private JTextField txtLiveNum; 22 | private JLabel labImage; 23 | private ImageIcon image; 24 | private String MANAGER_ID; 25 | private Manager manager; 26 | /** 27 | * Create the panel. 28 | */ 29 | public Dormitory(Manager m) { 30 | this.manager = m; 31 | this.MANAGER_ID = MANAGER_ID; 32 | setSize(800,600); 33 | setLayout(null); 34 | 35 | JLabel lblNewLabel = new JLabel("宿舍楼信息"); 36 | lblNewLabel.setFont(new Font("微软雅黑", Font.BOLD, 25)); 37 | lblNewLabel.setBounds(195, 101, 125, 40); 38 | add(lblNewLabel); 39 | 40 | JLabel labDormID = new JLabel("宿舍楼ID"); 41 | labDormID.setFont(new Font("宋体", Font.PLAIN, 15)); 42 | labDormID.setBounds(195, 164, 72, 21); 43 | add(labDormID); 44 | 45 | JLabel labStuSex = new JLabel("学生性别"); 46 | labStuSex.setFont(new Font("宋体", Font.PLAIN, 15)); 47 | labStuSex.setBounds(195, 206, 72, 21); 48 | add(labStuSex); 49 | 50 | JLabel labCollege = new JLabel("学院"); 51 | labCollege.setFont(new Font("宋体", Font.PLAIN, 15)); 52 | labCollege.setBounds(195, 251, 54, 21); 53 | add(labCollege); 54 | 55 | JLabel labEtime = new JLabel("入学时间"); 56 | labEtime.setFont(new Font("宋体", Font.PLAIN, 15)); 57 | labEtime.setBounds(195, 296, 72, 21); 58 | add(labEtime); 59 | 60 | JLabel labLiveNum = new JLabel("实住人数"); 61 | labLiveNum.setFont(new Font("宋体", Font.PLAIN, 15)); 62 | labLiveNum.setBounds(195, 344, 72, 21); 63 | add(labLiveNum); 64 | 65 | txtDormID = new JTextField(); 66 | txtDormID.setBounds(292, 164, 288, 21); 67 | add(txtDormID); 68 | txtDormID.setColumns(10); 69 | 70 | txtStuSex = new JTextField(); 71 | txtStuSex.setColumns(10); 72 | txtStuSex.setBounds(292, 206, 288, 21); 73 | add(txtStuSex); 74 | 75 | txtCollege = new JTextField(); 76 | txtCollege.setColumns(10); 77 | txtCollege.setBounds(292, 251, 288, 21); 78 | add(txtCollege); 79 | 80 | txtEtime = new JTextField(); 81 | txtEtime.setColumns(10); 82 | txtEtime.setBounds(292, 296, 288, 21); 83 | add(txtEtime); 84 | 85 | txtConNum = new JTextField(); 86 | txtConNum.setColumns(10); 87 | txtConNum.setBounds(292, 387, 288, 21); 88 | add(txtConNum); 89 | 90 | JLabel labConNum = new JLabel("容纳人数"); 91 | labConNum.setFont(new Font("宋体", Font.PLAIN, 15)); 92 | labConNum.setBounds(195, 387, 72, 21); 93 | add(labConNum); 94 | 95 | txtLiveNum = new JTextField(); 96 | txtLiveNum.setColumns(10); 97 | txtLiveNum.setBounds(292, 344, 288, 21); 98 | add(txtLiveNum); 99 | 100 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 101 | labImage = new JLabel(image); 102 | labImage.setBounds(0, 0, 800, 600); 103 | add(labImage); 104 | this.setOpaque(false); 105 | } 106 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 107 | Editable(false); 108 | DormitoryBuildingInfo dormitoryBuildingInfo= manager.getDormitory(); 109 | txtDormID.setText(dormitoryBuildingInfo.getDormId()); 110 | txtCollege.setText(dormitoryBuildingInfo.getCollege()); 111 | txtEtime.setText(dormitoryBuildingInfo.getEtime()); 112 | txtConNum.setText(dormitoryBuildingInfo.getConNum()); 113 | txtLiveNum.setText(dormitoryBuildingInfo.getLiveNum()); 114 | txtStuSex.setText(dormitoryBuildingInfo.getStuSex()); 115 | } 116 | 117 | private void Editable(boolean statue){ 118 | txtStuSex.setEditable(statue); 119 | txtDormID.setEditable(statue); 120 | txtCollege.setEditable(statue); 121 | txtLiveNum.setEditable(statue); 122 | txtConNum.setEditable(statue); 123 | txtEtime.setEditable(statue); 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/First.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | 4 | import javax.swing.ImageIcon; 5 | import javax.swing.JLabel; 6 | import javax.swing.JPanel; 7 | import java.awt.Font; 8 | 9 | public class First extends JPanel { 10 | 11 | private JLabel labImage; 12 | private ImageIcon image; 13 | /** 14 | * Create the panel. 15 | */ 16 | public First() { 17 | setSize(800,600); 18 | setLayout(null); 19 | 20 | image = new ImageIcon("src\\bigImage\\欢迎界面.jpg"); 21 | labImage = new JLabel(image); 22 | labImage.setBounds(0, 0, 800, 600); 23 | add(labImage); 24 | this.setOpaque(false); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/LeaveComeStu.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import java.awt.Font; 4 | import java.awt.HeadlessException; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.awt.event.MouseAdapter; 8 | import java.awt.event.MouseEvent; 9 | import java.util.Vector; 10 | 11 | import javax.swing.ButtonGroup; 12 | import javax.swing.ImageIcon; 13 | import javax.swing.JButton; 14 | import javax.swing.JFrame; 15 | import javax.swing.JLabel; 16 | import javax.swing.JOptionPane; 17 | import javax.swing.JPanel; 18 | import javax.swing.JRadioButton; 19 | import javax.swing.JScrollPane; 20 | import javax.swing.JTable; 21 | import javax.swing.JTextField; 22 | import javax.swing.RowFilter; 23 | import javax.swing.ScrollPaneConstants; 24 | import javax.swing.table.DefaultTableModel; 25 | import javax.swing.table.TableModel; 26 | import javax.swing.table.TableRowSorter; 27 | 28 | import com.zhbit.entity.Manager; 29 | import com.zhbit.excetion.DataBaseException; 30 | import com.zhbit.excetion.QueryResultIsNullException; 31 | 32 | public class LeaveComeStu extends JPanel { 33 | private JTable tableLeaveComeStu; 34 | private JLabel labImage; 35 | private ImageIcon image; 36 | /** 37 | * Create the panel. 38 | */ 39 | private DefaultTableModel defaultTableModel; 40 | private Vector headvector ; 41 | private Manager manager; 42 | 43 | private TableRowSorter sorter; 44 | 45 | private JFrame jframe; 46 | private JTextField textField; 47 | private JTextField textField_1; 48 | private JTextField textField_2; 49 | private JTextField textField_3; 50 | private JTextField jtfFilter; 51 | private final ButtonGroup buttonGroup = new ButtonGroup(); 52 | 53 | private JRadioButton radioButton; 54 | private JRadioButton radioButton_1; 55 | 56 | 57 | public LeaveComeStu(JFrame jf, Manager m) { 58 | 59 | this.jframe = jf; 60 | this.manager = m; 61 | setSize(800,600); 62 | setLayout(null); 63 | 64 | JScrollPane scrollPane = new JScrollPane(); 65 | scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); 66 | scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); 67 | scrollPane.setBounds(66, 135, 672, 232); 68 | add(scrollPane); 69 | 70 | tableLeaveComeStu = new JTable(); 71 | 72 | 73 | tableLeaveComeStu.addMouseListener(new MouseAdapter() { 74 | @Override 75 | public void mouseClicked(MouseEvent e) { 76 | 77 | Integer n = tableLeaveComeStu.getSelectedRow(); 78 | textField.setText((String)tableLeaveComeStu.getValueAt(n, 1)); 79 | textField_1.setText((String)tableLeaveComeStu.getValueAt(n, 2)); 80 | textField_2.setText((String)tableLeaveComeStu.getValueAt(n, 6)); 81 | textField_3.setText((String)tableLeaveComeStu.getValueAt(n, 8)); 82 | 83 | String s ; 84 | 85 | s = (String)tableLeaveComeStu.getValueAt(n, 7); 86 | if(s.equals("L")) 87 | radioButton.setSelected(true); 88 | else 89 | radioButton_1.setSelected(true); 90 | 91 | } 92 | 93 | }); 94 | scrollPane.setViewportView(tableLeaveComeStu); 95 | 96 | 97 | headvector = new Vector(); 98 | headvector.add("记录号"); 99 | headvector.add("学号"); 100 | headvector.add("姓名"); 101 | headvector.add("宿舍楼"); 102 | headvector.add("房间号"); 103 | headvector.add("床号"); 104 | headvector.add("离返日期"); 105 | headvector.add("离/返校"); 106 | headvector.add("备注"); 107 | defaultTableModel = new DefaultTableModel(); 108 | 109 | defaultTableModel.setColumnCount(9); 110 | defaultTableModel.setRowCount(11); 111 | 112 | defaultTableModel.setDataVector(null,headvector); 113 | tableLeaveComeStu.setModel(defaultTableModel); 114 | tableLeaveComeStu.setFont(new Font("宋体", Font.PLAIN, 15)); 115 | 116 | tableLeaveComeStu.setAutoResizeMode(tableLeaveComeStu.AUTO_RESIZE_OFF); //自动调整表格列的宽度,不更改其他列的大小,而是更改整个表格的大小 117 | sorter = new TableRowSorter(tableLeaveComeStu.getModel()); 118 | 119 | tableLeaveComeStu.setRowSorter(sorter); 120 | 121 | 122 | 123 | tableLeaveComeStu.setFont(new Font("宋体", Font.PLAIN, 15)); 124 | 125 | JLabel labLeaveComeStu = new JLabel("离返校记录表"); 126 | labLeaveComeStu.setFont(new Font("微软雅黑", Font.BOLD, 25)); 127 | labLeaveComeStu.setBounds(66, 59, 180, 34); 128 | add(labLeaveComeStu); 129 | 130 | 131 | JLabel lblNewLabel = new JLabel("学号"); 132 | lblNewLabel.setBounds(66, 390, 30, 15); 133 | add(lblNewLabel); 134 | 135 | textField = new JTextField(); 136 | textField.setBounds(98, 387, 86, 21); 137 | add(textField); 138 | textField.setColumns(10); 139 | 140 | JLabel label = new JLabel("姓名"); 141 | label.setBounds(194, 390, 30, 15); 142 | add(label); 143 | 144 | textField_1 = new JTextField(); 145 | textField_1.setBounds(225, 387, 66, 21); 146 | add(textField_1); 147 | textField_1.setColumns(10); 148 | 149 | JLabel label_1 = new JLabel("日期"); 150 | label_1.setBounds(301, 390, 30, 15); 151 | add(label_1); 152 | 153 | textField_2 = new JTextField(); 154 | textField_2.setBounds(333, 387, 97, 21); 155 | add(textField_2); 156 | textField_2.setColumns(10); 157 | 158 | 159 | radioButton = new JRadioButton("离校"); 160 | radioButton.setOpaque(false); 161 | buttonGroup.add(radioButton); 162 | radioButton.setBounds(436, 386, 49, 23); 163 | add(radioButton); 164 | 165 | radioButton_1 = new JRadioButton("返校"); 166 | radioButton_1.setOpaque(false); 167 | buttonGroup.add(radioButton_1); 168 | radioButton_1.setBounds(487, 386, 56, 23); 169 | add(radioButton_1); 170 | 171 | JLabel label_2 = new JLabel("备注"); 172 | label_2.setBounds(543, 390, 30, 15); 173 | add(label_2); 174 | 175 | textField_3 = new JTextField(); 176 | textField_3.setBounds(583, 387, 155, 21); 177 | add(textField_3); 178 | textField_3.setColumns(10); 179 | 180 | JButton button = new JButton("添加离返校记录"); 181 | button.addActionListener(new ActionListener() { 182 | public void actionPerformed(ActionEvent e) { 183 | 184 | try { 185 | if(insertLCRecord() == true){ 186 | JOptionPane.showMessageDialog(jframe, "添加成功,点击刷新按钮即可查看到新纪录" , "系统信息", JOptionPane.WARNING_MESSAGE); 187 | }else 188 | JOptionPane.showMessageDialog(jframe, "添加失败,请重新填写信息" , "系统信息", JOptionPane.WARNING_MESSAGE); 189 | } catch (HeadlessException | DataBaseException 190 | | QueryResultIsNullException e1) { 191 | // TODO Auto-generated catch block 192 | // e1.printStackTrace(); 193 | JOptionPane.showMessageDialog(jframe, "数据库错误,添加失败" , "系统信息", JOptionPane.WARNING_MESSAGE); 194 | } 195 | 196 | } 197 | }); 198 | button.setBounds(612, 418, 126, 23); 199 | add(button); 200 | 201 | jtfFilter = new JTextField(); 202 | jtfFilter.addActionListener(new ActionListener() { 203 | public void actionPerformed(ActionEvent e) { 204 | 205 | String text = jtfFilter.getText(); 206 | if(text.trim().length()==0) 207 | sorter.setRowFilter(null); 208 | else{ 209 | sorter.setRowFilter(RowFilter.regexFilter(text)); 210 | } 211 | 212 | } 213 | }); 214 | jtfFilter.setBounds(66, 444, 118, 21); 215 | add(jtfFilter); 216 | jtfFilter.setColumns(10); 217 | 218 | JButton button_1 = new JButton("查询"); 219 | button_1.addActionListener(new ActionListener() { 220 | public void actionPerformed(ActionEvent e) { 221 | 222 | String text = jtfFilter.getText(); 223 | if(text.trim().length()==0) 224 | sorter.setRowFilter(null); 225 | else{ 226 | sorter.setRowFilter(RowFilter.regexFilter(text)); 227 | } 228 | } 229 | }); 230 | button_1.setBounds(198, 443, 56, 23); 231 | add(button_1); 232 | 233 | JButton button_2 = new JButton("重置"); 234 | button_2.addActionListener(new ActionListener() { 235 | public void actionPerformed(ActionEvent e) { 236 | textField.setText(""); 237 | textField_1.setText(""); 238 | textField_2.setText(""); 239 | textField_3.setText(""); 240 | radioButton.setSelected(false); 241 | radioButton_1.setSelected(false); 242 | 243 | } 244 | }); 245 | button_2.setBounds(524, 418, 66, 23); 246 | add(button_2); 247 | 248 | JButton button_3 = new JButton("刷新"); 249 | button_3.addActionListener(new ActionListener() { 250 | public void actionPerformed(ActionEvent e) { 251 | 252 | try { 253 | showInfo(); 254 | } catch (DataBaseException | QueryResultIsNullException e1) { 255 | // TODO Auto-generated catch block 256 | //e1.printStackTrace(); 257 | JOptionPane.showMessageDialog(jframe, "刷新失败" , "系统信息", JOptionPane.WARNING_MESSAGE); 258 | } 259 | } 260 | }); 261 | button_3.setBounds(645, 486, 93, 23); 262 | add(button_3); 263 | 264 | 265 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 266 | labImage = new JLabel(image); 267 | labImage.setBounds(0, 0, 800, 600); 268 | add(labImage); 269 | this.setOpaque(false); 270 | } 271 | 272 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 273 | 274 | Vector Datavector = manager.getAllLiveComeStu(); 275 | 276 | defaultTableModel.setDataVector(Datavector,headvector); 277 | 278 | } 279 | 280 | public boolean insertLCRecord() throws DataBaseException, QueryResultIsNullException{ 281 | String StuId, StuName, Data, LC, Mark; 282 | 283 | StuId = textField.getText(); 284 | StuName = textField_1.getText(); 285 | Data = textField_2.getText(); 286 | Mark = textField_3.getText(); 287 | LC = "L"; 288 | if(radioButton.isSelected()) 289 | LC = "L"; 290 | else if(radioButton_1.isSelected()) 291 | LC = "C"; 292 | else{ 293 | JOptionPane.showMessageDialog(jframe, "请选定离/返校" , "系统信息", JOptionPane.WARNING_MESSAGE); 294 | } 295 | 296 | return manager.insertLCRecord(StuId, StuName, Data, LC, Mark); 297 | 298 | } 299 | } 300 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/ManaInfo.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import java.awt.Font; 4 | import java.awt.TextArea; 5 | 6 | import javax.swing.ImageIcon; 7 | import javax.swing.JButton; 8 | import javax.swing.JLabel; 9 | import javax.swing.JOptionPane; 10 | import javax.swing.JPanel; 11 | import javax.swing.JRadioButton; 12 | import javax.swing.JTextField; 13 | import javax.swing.SwingConstants; 14 | 15 | import com.zhbit.entity.Manager; 16 | import com.zhbit.excetion.DataBaseException; 17 | import com.zhbit.excetion.QueryResultIsNullException; 18 | import com.zhbit.excetion.UpdateDataException; 19 | import com.zhbit.form.UpdatePersonalInfoForm; 20 | import com.zhbit.queryResult.DormitoryBuildingInfo; 21 | 22 | import javax.swing.ButtonGroup; 23 | import java.awt.event.ActionListener; 24 | import java.awt.event.ActionEvent; 25 | 26 | public class ManaInfo extends JPanel { 27 | private JRadioButton rbStuMan; 28 | private JRadioButton rbStuWoman; 29 | private JRadioButton rbWoman; 30 | private JRadioButton rbMan; 31 | private JTextField txtDMID; 32 | private JTextField txtDMName; 33 | private JTextField txtDMPhone; 34 | private JTextField txtDormID; 35 | private JTextField txtCollege; 36 | private JTextField txtLiveNum; 37 | private JTextField txtConNum; 38 | private JTextField txtETime; 39 | private JLabel labImage; 40 | private ImageIcon image; 41 | private String MANAGER_ID; 42 | private TextArea txtARemark; 43 | private Manager manager=null; 44 | private final ButtonGroup buttonGroup = new ButtonGroup(); 45 | private final ButtonGroup buttonGroup_1 = new ButtonGroup(); 46 | /** 47 | * Create the panel. 48 | */ 49 | // public ManaInfo(){ 50 | // 51 | // } 52 | // 53 | public ManaInfo(Manager m) { 54 | this.manager = m; 55 | this.MANAGER_ID = MANAGER_ID; 56 | setSize(800,600); 57 | setLayout(null); 58 | 59 | JLabel labDMID = new JLabel("工 号"); 60 | labDMID.setFont(new Font("宋体", Font.PLAIN, 17)); 61 | labDMID.setBounds(70, 84, 76, 31); 62 | add(labDMID); 63 | 64 | txtDMID = new JTextField(); 65 | txtDMID.setFont(new Font("宋体", Font.PLAIN, 16)); 66 | txtDMID.setBounds(155, 84, 172, 27); 67 | add(txtDMID); 68 | txtDMID.setColumns(10); 69 | 70 | JLabel labDMName = new JLabel("姓 名"); 71 | labDMName.setFont(new Font("宋体", Font.PLAIN, 17)); 72 | labDMName.setBounds(404, 84, 76, 31); 73 | add(labDMName); 74 | 75 | txtDMName = new JTextField(); 76 | txtDMName.setFont(new Font("宋体", Font.PLAIN, 16)); 77 | txtDMName.setColumns(10); 78 | txtDMName.setBounds(489, 84, 172, 27); 79 | add(txtDMName); 80 | 81 | JLabel labDMSex = new JLabel("性 别"); 82 | labDMSex.setFont(new Font("宋体", Font.PLAIN, 17)); 83 | labDMSex.setBounds(70, 142, 76, 31); 84 | add(labDMSex); 85 | 86 | rbMan = new JRadioButton("男"); 87 | buttonGroup.add(rbMan); 88 | rbMan.setFont(new Font("宋体", Font.PLAIN, 17)); 89 | rbMan.setBounds(163, 147, 60, 23); 90 | add(rbMan); 91 | 92 | rbWoman = new JRadioButton("女"); 93 | buttonGroup.add(rbWoman); 94 | rbWoman.setFont(new Font("宋体", Font.PLAIN, 17)); 95 | rbWoman.setBounds(231, 147, 60, 23); 96 | add(rbWoman); 97 | 98 | JLabel labDMPhone = new JLabel("电 话"); 99 | labDMPhone.setFont(new Font("宋体", Font.PLAIN, 17)); 100 | labDMPhone.setBounds(404, 142, 76, 31); 101 | add(labDMPhone); 102 | 103 | txtDMPhone = new JTextField(); 104 | txtDMPhone.setFont(new Font("宋体", Font.PLAIN, 16)); 105 | txtDMPhone.setColumns(10); 106 | txtDMPhone.setBounds(489, 142, 172, 27); 107 | add(txtDMPhone); 108 | 109 | JLabel labDormID = new JLabel("所管楼号"); 110 | labDormID.setFont(new Font("宋体", Font.PLAIN, 17)); 111 | labDormID.setBounds(70, 267, 75, 31); 112 | add(labDormID); 113 | 114 | txtDormID = new JTextField(); 115 | txtDormID.setFont(new Font("宋体", Font.PLAIN, 16)); 116 | txtDormID.setColumns(10); 117 | txtDormID.setBounds(155, 267, 172, 27); 118 | add(txtDormID); 119 | 120 | JLabel labCollege = new JLabel("学 院"); 121 | labCollege.setFont(new Font("宋体", Font.PLAIN, 17)); 122 | labCollege.setBounds(404, 267, 75, 31); 123 | add(labCollege); 124 | 125 | JLabel labInfo = new JLabel("个人资料:"); 126 | labInfo.setFont(new Font("幼圆", Font.PLAIN, 15)); 127 | labInfo.setBounds(48, 23, 102, 41); 128 | add(labInfo); 129 | 130 | JLabel labDormInfo = new JLabel("所管宿舍资料:"); 131 | labDormInfo.setFont(new Font("幼圆", Font.PLAIN, 15)); 132 | labDormInfo.setBounds(70, 201, 128, 41); 133 | add(labDormInfo); 134 | 135 | txtCollege = new JTextField(); 136 | txtCollege.setFont(new Font("宋体", Font.PLAIN, 16)); 137 | txtCollege.setColumns(10); 138 | txtCollege.setBounds(489, 267, 172, 27); 139 | add(txtCollege); 140 | 141 | JLabel labLiveNum = new JLabel("实住人数"); 142 | labLiveNum.setHorizontalAlignment(SwingConstants.CENTER); 143 | labLiveNum.setFont(new Font("宋体", Font.PLAIN, 17)); 144 | labLiveNum.setBounds(70, 393, 75, 31); 145 | add(labLiveNum); 146 | 147 | txtLiveNum = new JTextField(); 148 | txtLiveNum.setFont(new Font("宋体", Font.PLAIN, 16)); 149 | txtLiveNum.setColumns(10); 150 | txtLiveNum.setBounds(155, 393, 172, 27); 151 | add(txtLiveNum); 152 | 153 | JLabel labConNum = new JLabel("容纳人数"); 154 | labConNum.setHorizontalAlignment(SwingConstants.CENTER); 155 | labConNum.setFont(new Font("宋体", Font.PLAIN, 17)); 156 | labConNum.setBounds(404, 393, 75, 31); 157 | add(labConNum); 158 | 159 | txtConNum = new JTextField(); 160 | txtConNum.setFont(new Font("宋体", Font.PLAIN, 16)); 161 | txtConNum.setColumns(10); 162 | txtConNum.setBounds(489, 393, 172, 27); 163 | add(txtConNum); 164 | 165 | JLabel labStuSex = new JLabel("学生性别"); 166 | labStuSex.setHorizontalAlignment(SwingConstants.CENTER); 167 | labStuSex.setFont(new Font("宋体", Font.PLAIN, 17)); 168 | labStuSex.setBounds(70, 330, 75, 31); 169 | add(labStuSex); 170 | 171 | JLabel labETime = new JLabel("入学时间"); 172 | labETime.setHorizontalAlignment(SwingConstants.CENTER); 173 | labETime.setFont(new Font("宋体", Font.PLAIN, 17)); 174 | labETime.setBounds(404, 330, 75, 31); 175 | add(labETime); 176 | 177 | txtETime = new JTextField(); 178 | txtETime.setFont(new Font("宋体", Font.PLAIN, 16)); 179 | txtETime.setColumns(10); 180 | txtETime.setBounds(489, 330, 172, 27); 181 | add(txtETime); 182 | 183 | JLabel labRemark = new JLabel("备 注"); 184 | labRemark.setHorizontalAlignment(SwingConstants.CENTER); 185 | labRemark.setFont(new Font("宋体", Font.PLAIN, 17)); 186 | labRemark.setBounds(71, 457, 75, 31); 187 | add(labRemark); 188 | 189 | txtARemark = new TextArea(); 190 | txtARemark.setFont(new Font("Dialog", Font.PLAIN, 13)); 191 | txtARemark.setBounds(155, 457, 292, 110); 192 | add(txtARemark); 193 | 194 | JButton butAlter = new JButton("修改"); 195 | butAlter.addActionListener(new ActionListener() { 196 | public void actionPerformed(ActionEvent arg0) { 197 | Editable(true); 198 | } 199 | }); 200 | butAlter.setBounds(489, 536, 76, 31); 201 | add(butAlter); 202 | 203 | JButton butSave = new JButton("保存"); 204 | butSave.addActionListener(new ActionListener() { 205 | public void actionPerformed(ActionEvent arg0) { 206 | Editable(false); 207 | 208 | UpdatePersonalInfoForm updatePersonalInfoForm = new UpdatePersonalInfoForm(); 209 | String phone=txtDMPhone.getText().trim(); 210 | if(phone.equals(manager.getPhone())== false){ //如果修改的资料有改变 211 | updatePersonalInfoForm.setPhone(phone); 212 | try { 213 | manager.UpdatePersonalInfo(updatePersonalInfoForm); 214 | } catch (UpdateDataException e) { 215 | // TODO 自动生成的 catch 块 216 | //e.printStackTrace(); 217 | JOptionPane.showMessageDialog(null,"更新失败", "系统信息", JOptionPane.WARNING_MESSAGE); 218 | } catch (DataBaseException e) { 219 | // TODO 自动生成的 catch 块 220 | //e.printStackTrace(); 221 | JOptionPane.showMessageDialog(null,"数据库错误,更新失败", "系统信息", JOptionPane.WARNING_MESSAGE); 222 | } 223 | JOptionPane.showMessageDialog(null,"修改成功", "系统信息", JOptionPane.WARNING_MESSAGE); 224 | }else{ 225 | JOptionPane.showMessageDialog(null,"您没有改动任何资料", "系统信息", JOptionPane.WARNING_MESSAGE); 226 | } 227 | } 228 | }); 229 | butSave.setBounds(585, 536, 76, 31); 230 | add(butSave); 231 | 232 | rbStuMan = new JRadioButton("男"); 233 | buttonGroup_1.add(rbStuMan); 234 | rbStuMan.setFont(new Font("宋体", Font.PLAIN, 17)); 235 | rbStuMan.setBounds(163, 330, 60, 23); 236 | add(rbStuMan); 237 | 238 | rbStuWoman = new JRadioButton("女"); 239 | buttonGroup_1.add(rbStuWoman); 240 | rbStuWoman.setFont(new Font("宋体", Font.PLAIN, 17)); 241 | rbStuWoman.setBounds(231, 330, 96, 23); 242 | add(rbStuWoman); 243 | 244 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 245 | labImage = new JLabel(image); 246 | labImage.setBounds(0, 0, 800, 600); 247 | add(labImage); 248 | 249 | this.setOpaque(false); 250 | 251 | } 252 | 253 | public void init(){ 254 | 255 | } 256 | 257 | 258 | 259 | 260 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 261 | Editable(false); 262 | DormitoryBuildingInfo dormitoryBuildingInfo= manager.getDormitory(); 263 | txtDMID.setText(manager.getId()); 264 | txtDMName.setText(manager.getName()); 265 | txtDMPhone.setText(manager.getPhone()); 266 | if(manager.getSex().equals("女")){ 267 | rbWoman.setSelected(true); 268 | }else{ 269 | rbMan.setSelected(true); 270 | } 271 | 272 | txtDormID.setText(dormitoryBuildingInfo.getDormId()); 273 | txtCollege.setText(dormitoryBuildingInfo.getCollege()); 274 | txtETime.setText(dormitoryBuildingInfo.getEtime()); 275 | txtConNum.setText(dormitoryBuildingInfo.getConNum()); 276 | txtLiveNum.setText(dormitoryBuildingInfo.getLiveNum()); 277 | txtARemark.setText("计算机学院"); 278 | if(dormitoryBuildingInfo.getStuSex().equals("女")){ 279 | rbStuWoman.setSelected(true); 280 | }else{ 281 | rbStuMan.setSelected(true); 282 | } 283 | 284 | 285 | } 286 | 287 | private void Editable(boolean statue){ 288 | txtDMID.setEditable(false); 289 | txtDMName.setEditable(false); 290 | txtDMPhone.setEditable(statue); 291 | 292 | 293 | txtDormID.setEditable(false); 294 | txtCollege.setEditable(false); 295 | txtLiveNum.setEditable(false); 296 | txtConNum.setEditable(false); 297 | txtETime.setEditable(false); 298 | 299 | } 300 | 301 | } 302 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/StuInOut_Add.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import javax.swing.JPanel; 4 | import javax.swing.JLabel; 5 | import java.awt.Font; 6 | 7 | import javax.swing.ImageIcon; 8 | import javax.swing.JTextField; 9 | import javax.swing.JButton; 10 | import javax.swing.JRadioButton; 11 | 12 | public class StuInOut_Add extends JPanel { 13 | private JTextField txtRecordNum; 14 | private JTextField txtStuID; 15 | private JTextField txtStuName; 16 | private JTextField txtDormId; 17 | private JTextField textField_4; 18 | private JTextField txtRoomId; 19 | private JTextField txtBedId; 20 | private JTextField textField_7; 21 | 22 | private String STUDENT_ID; 23 | private JLabel labImage; 24 | private ImageIcon image; 25 | /** 26 | * Create the panel. 27 | */ 28 | 29 | 30 | public StuInOut_Add(String STUDENT_ID) { 31 | setSize(800,600); 32 | setLayout(null); 33 | 34 | JLabel label = new JLabel("学生入住\\退宿登记"); 35 | label.setFont(new Font("微软雅黑", Font.BOLD, 25)); 36 | label.setBounds(81, 107, 223, 34); 37 | add(label); 38 | 39 | JLabel labRecordNum = new JLabel("记录号"); 40 | labRecordNum.setFont(new Font("宋体", Font.PLAIN, 15)); 41 | labRecordNum.setBounds(100, 178, 54, 18); 42 | add(labRecordNum); 43 | 44 | JLabel labStuID = new JLabel("学号"); 45 | labStuID.setFont(new Font("宋体", Font.PLAIN, 15)); 46 | labStuID.setBounds(100, 243, 54, 18); 47 | add(labStuID); 48 | 49 | JLabel labStuName = new JLabel("姓名"); 50 | labStuName.setFont(new Font("宋体", Font.PLAIN, 15)); 51 | labStuName.setBounds(100, 303, 54, 18); 52 | add(labStuName); 53 | 54 | JLabel labDormId = new JLabel("宿舍楼号"); 55 | labDormId.setFont(new Font("宋体", Font.PLAIN, 15)); 56 | labDormId.setBounds(94, 363, 60, 18); 57 | add(labDormId); 58 | 59 | JLabel labRemark = new JLabel("备注(原因)"); 60 | labRemark.setFont(new Font("宋体", Font.PLAIN, 15)); 61 | labRemark.setBounds(94, 420, 93, 18); 62 | add(labRemark); 63 | 64 | JLabel labRoomId = new JLabel("宿舍号"); 65 | labRoomId.setFont(new Font("宋体", Font.PLAIN, 15)); 66 | labRoomId.setBounds(421, 178, 54, 18); 67 | add(labRoomId); 68 | 69 | JLabel labBedId = new JLabel("床号"); 70 | labBedId.setFont(new Font("宋体", Font.PLAIN, 15)); 71 | labBedId.setBounds(421, 243, 54, 18); 72 | add(labBedId); 73 | 74 | JLabel labDate = new JLabel("日期"); 75 | labDate.setFont(new Font("宋体", Font.PLAIN, 15)); 76 | labDate.setBounds(421, 303, 54, 18); 77 | add(labDate); 78 | 79 | JLabel labIn_Out = new JLabel("出/入"); 80 | labIn_Out.setFont(new Font("宋体", Font.PLAIN, 15)); 81 | labIn_Out.setBounds(421, 363, 54, 18); 82 | add(labIn_Out); 83 | 84 | txtRecordNum = new JTextField(); 85 | txtRecordNum.setBounds(184, 177, 214, 21); 86 | add(txtRecordNum); 87 | txtRecordNum.setColumns(10); 88 | 89 | txtStuID = new JTextField(); 90 | txtStuID.setColumns(10); 91 | txtStuID.setBounds(184, 242, 214, 21); 92 | add(txtStuID); 93 | 94 | txtStuName = new JTextField(); 95 | txtStuName.setColumns(10); 96 | txtStuName.setBounds(184, 302, 214, 21); 97 | add(txtStuName); 98 | 99 | txtDormId = new JTextField(); 100 | txtDormId.setColumns(10); 101 | txtDormId.setBounds(184, 362, 214, 21); 102 | add(txtDormId); 103 | 104 | textField_4 = new JTextField(); 105 | textField_4.setColumns(10); 106 | textField_4.setBounds(184, 419, 515, 21); 107 | add(textField_4); 108 | 109 | txtRoomId = new JTextField(); 110 | txtRoomId.setColumns(10); 111 | txtRoomId.setBounds(485, 177, 214, 21); 112 | add(txtRoomId); 113 | 114 | txtBedId = new JTextField(); 115 | txtBedId.setColumns(10); 116 | txtBedId.setBounds(485, 242, 214, 21); 117 | add(txtBedId); 118 | 119 | textField_7 = new JTextField(); 120 | textField_7.setColumns(10); 121 | textField_7.setBounds(485, 302, 214, 21); 122 | add(textField_7); 123 | 124 | JButton butCancel = new JButton("取消"); 125 | butCancel.setFont(new Font("宋体", Font.PLAIN, 15)); 126 | butCancel.setBounds(606, 480, 93, 23); 127 | add(butCancel); 128 | 129 | JButton butOk = new JButton("确认"); 130 | butOk.setFont(new Font("宋体", Font.PLAIN, 15)); 131 | butOk.setBounds(503, 480, 93, 23); 132 | add(butOk); 133 | 134 | JRadioButton rbIn = new JRadioButton("入住"); 135 | rbIn.setFont(new Font("宋体", Font.PLAIN, 15)); 136 | rbIn.setBounds(507, 361, 60, 23); 137 | add(rbIn); 138 | 139 | JRadioButton rbOut = new JRadioButton("退宿"); 140 | rbOut.setFont(new Font("宋体", Font.PLAIN, 15)); 141 | rbOut.setBounds(610, 361, 60, 23); 142 | add(rbOut); 143 | 144 | 145 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 146 | labImage = new JLabel(image); 147 | labImage.setBounds(0, 0, 800, 600); 148 | add(labImage); 149 | this.setOpaque(false); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/StuOut.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | 4 | import javax.swing.JPanel; 5 | import javax.swing.JLabel; 6 | import java.awt.Font; 7 | 8 | import javax.swing.ImageIcon; 9 | import javax.swing.JFrame; 10 | import javax.swing.JTextField; 11 | import javax.swing.JButton; 12 | import javax.swing.JRadioButton; 13 | 14 | import com.zhbit.entity.Manager; 15 | import javax.swing.JScrollPane; 16 | import javax.swing.JTable; 17 | import javax.swing.table.DefaultTableModel; 18 | 19 | 20 | public class StuOut extends JPanel{ 21 | public StuOut() { 22 | setLayout(null); 23 | 24 | JLabel label = new JLabel("学生退宿登记"); 25 | label.setFont(new Font("微软雅黑", Font.BOLD, 25)); 26 | label.setBounds(105, 79, 164, 34); 27 | add(label); 28 | 29 | JLabel label_1 = new JLabel("学号"); 30 | label_1.setBounds(105, 238, 37, 15); 31 | add(label_1); 32 | 33 | textField = new JTextField(); 34 | textField.setBounds(143, 235, 126, 21); 35 | add(textField); 36 | textField.setColumns(10); 37 | 38 | JButton button = new JButton("查询"); 39 | button.setBounds(293, 234, 57, 23); 40 | add(button); 41 | 42 | JScrollPane scrollPane = new JScrollPane(); 43 | scrollPane.setBounds(23, 138, 509, 60); 44 | add(scrollPane); 45 | 46 | table = new JTable(); 47 | table.setModel(new DefaultTableModel( 48 | new Object[][] { 49 | {null, null, null, null, null, null, null, null}, 50 | {null, null, null, null, null, null, null, null}, 51 | }, 52 | new String[] { 53 | "New column", "New column", "New column", "New column", "New column", "New column", "New column", "New column" 54 | } 55 | )); 56 | scrollPane.setViewportView(table); 57 | } 58 | private JTextField txtRecordNum; 59 | private JTextField txtStuID; 60 | private JTextField txtStuName; 61 | private JTextField txtDormId; 62 | private JTextField textField_4; 63 | private JTextField txtRoomId; 64 | private JTextField txtBedId; 65 | private JTextField textField_7; 66 | 67 | private String STUDENT_ID; 68 | private JLabel labImage; 69 | private ImageIcon image; 70 | /** 71 | * Create the panel. 72 | */ 73 | private Manager manager; 74 | private JFrame jframe; 75 | private JTextField textField; 76 | private JTable table; 77 | 78 | public StuOut(JFrame jf, Manager m){ 79 | this.jframe = jf; 80 | this.manager = m; 81 | 82 | setSize(800,600); 83 | setLayout(null); 84 | 85 | 86 | 87 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 88 | labImage = new JLabel(image); 89 | labImage.setBounds(0, 0, 800, 600); 90 | add(labImage); 91 | this.setOpaque(false); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/View_Student_College.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import javax.swing.ImageIcon; 4 | import javax.swing.JFrame; 5 | import javax.swing.JPanel; 6 | import javax.swing.JLabel; 7 | import javax.swing.JButton; 8 | import javax.swing.JTextField; 9 | import javax.swing.RowFilter; 10 | import javax.swing.ScrollPaneConstants; 11 | 12 | import java.awt.Font; 13 | import java.util.Vector; 14 | 15 | import javax.swing.JTable; 16 | import javax.swing.table.DefaultTableModel; 17 | import javax.swing.table.TableModel; 18 | import javax.swing.table.TableRowSorter; 19 | import javax.swing.JScrollPane; 20 | 21 | import com.zhbit.entity.Manager; 22 | import com.zhbit.excetion.DataBaseException; 23 | import com.zhbit.excetion.QueryResultIsNullException; 24 | import java.awt.event.ActionListener; 25 | import java.awt.event.ActionEvent; 26 | 27 | 28 | 29 | public class View_Student_College extends JPanel { 30 | private JTable tableStu_College; 31 | private JTextField jtfFilter; 32 | 33 | private JLabel labImage; 34 | private ImageIcon image; 35 | private String MANAGER_ID; 36 | 37 | private DefaultTableModel defaultTableModel; 38 | private Vector headvector; 39 | private TableRowSorter sorter; 40 | 41 | 42 | private JFrame jframe; 43 | private Manager manager; 44 | 45 | /** 46 | * Create the panel. 47 | */ 48 | public View_Student_College(JFrame jf, Manager m ) { 49 | this.jframe = jf; 50 | 51 | this.manager = m; 52 | 53 | setSize(800,600); 54 | setLayout(null); 55 | 56 | 57 | 58 | JScrollPane scrollPane = new JScrollPane(); 59 | 60 | scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); 61 | // scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); 62 | 63 | scrollPane.setBounds(60, 130, 667, 300); 64 | add(scrollPane); 65 | 66 | tableStu_College = new JTable(); 67 | 68 | scrollPane.setViewportView(tableStu_College); 69 | 70 | 71 | defaultTableModel = new DefaultTableModel(); 72 | defaultTableModel.setColumnCount(9); 73 | defaultTableModel.setRowCount(10); 74 | defaultTableModel.setValueAt(123, 1, 1); 75 | 76 | //头部信息 77 | headvector = new Vector(); 78 | headvector.add("学号"); 79 | headvector.add("姓名"); 80 | headvector.add("性别"); 81 | headvector.add("入学时间"); 82 | headvector.add("学院"); 83 | headvector.add("专业"); 84 | headvector.add("班级"); 85 | headvector.add("籍贯"); 86 | headvector.add("联系电话"); 87 | 88 | defaultTableModel.setDataVector(null,headvector ); 89 | 90 | 91 | tableStu_College.setModel(defaultTableModel); 92 | tableStu_College.setFont(new Font("宋体", Font.PLAIN, 15)); 93 | 94 | tableStu_College.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); 95 | 96 | sorter = new TableRowSorter(tableStu_College.getModel()); 97 | tableStu_College.setRowSorter(sorter); 98 | 99 | 100 | 101 | JLabel labView_Stu_College = new JLabel("学生信息"); 102 | labView_Stu_College.setFont(new Font("微软雅黑", Font.BOLD, 25)); 103 | labView_Stu_College.setBounds(60, 78, 113, 34); 104 | add(labView_Stu_College); 105 | 106 | jtfFilter = new JTextField(); 107 | jtfFilter.addActionListener(new ActionListener() { 108 | public void actionPerformed(ActionEvent e) { 109 | 110 | String text = jtfFilter.getText(); 111 | if(text.trim().length()==0) 112 | sorter.setRowFilter(null); 113 | else 114 | sorter.setRowFilter(RowFilter.regexFilter(text)); 115 | } 116 | }); 117 | jtfFilter.setBounds(85, 452, 127, 21); 118 | add(jtfFilter); 119 | jtfFilter.setColumns(10); 120 | 121 | JButton butSelect = new JButton("查询"); 122 | butSelect.addActionListener(new ActionListener() { 123 | public void actionPerformed(ActionEvent e) { 124 | 125 | String text = jtfFilter.getText(); 126 | if(text.trim().length()==0) 127 | sorter.setRowFilter(null); 128 | else 129 | sorter.setRowFilter(RowFilter.regexFilter(text)); 130 | 131 | } 132 | }); 133 | butSelect.setFont(new Font("宋体", Font.PLAIN, 15)); 134 | butSelect.setBounds(222, 451, 93, 23); 135 | add(butSelect); 136 | 137 | 138 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 139 | labImage = new JLabel(image); 140 | labImage.setBounds(0, 0, 800, 600); 141 | add(labImage); 142 | this.setOpaque(false); 143 | } 144 | 145 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 146 | 147 | Vector vector = manager.getAllStudentInfo(manager.getDormId()); 148 | //System.out.println(vector); 149 | defaultTableModel.setDataVector(vector, headvector); 150 | } 151 | 152 | 153 | } 154 | -------------------------------------------------------------------------------- /src/com/zhbit/managerUI/mhelpText.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.managerUI; 2 | 3 | import javax.swing.ImageIcon; 4 | import javax.swing.JPanel; 5 | import javax.swing.JLabel; 6 | 7 | public class mhelpText extends JPanel { 8 | 9 | private JLabel labImage; 10 | private ImageIcon image; 11 | 12 | /** 13 | * Create the panel. 14 | */ 15 | public mhelpText() { 16 | setSize(800,600); 17 | setLayout(null); 18 | 19 | JLabel label = new JLabel("一、用户管理"); 20 | label.setBounds(69, 72, 536, 29); 21 | add(label); 22 | 23 | JLabel label_1 = new JLabel("点击“修改”按钮,就可以修改自己的电话号码"); 24 | label_1.setBounds(112, 125, 536, 29); 25 | add(label_1); 26 | 27 | JLabel label_2 = new JLabel("2、密码修改"); 28 | label_2.setBounds(89, 152, 536, 29); 29 | add(label_2); 30 | 31 | JLabel label_3 = new JLabel("1、个人信息"); 32 | label_3.setBounds(89, 97, 536, 29); 33 | add(label_3); 34 | 35 | JLabel label_4 = new JLabel("输入新旧密码确认,若输入的旧密码和旧密码相等,则修改成功,否则失败。"); 36 | label_4.setBounds(112, 178, 536, 29); 37 | add(label_4); 38 | 39 | JLabel label_5 = new JLabel("二、寝室管理"); 40 | label_5.setBounds(69, 205, 536, 29); 41 | add(label_5); 42 | 43 | JLabel label_6 = new JLabel("1、宿舍楼信息"); 44 | label_6.setBounds(89, 232, 536, 29); 45 | add(label_6); 46 | 47 | JLabel label_7 = new JLabel("点击便可看到用户所管宿舍楼的信息"); 48 | label_7.setBounds(112, 257, 536, 29); 49 | add(label_7); 50 | 51 | JLabel label_8 = new JLabel("2、宿舍分配信息"); 52 | label_8.setBounds(89, 285, 536, 29); 53 | add(label_8); 54 | 55 | JLabel label_9 = new JLabel("在宿舍那里选择舍长或者宿舍员,填写学号入住日期,点击学生入住便可。在查查"); 56 | label_9.setBounds(112, 311, 536, 29); 57 | add(label_9); 58 | 59 | JLabel label_10 = new JLabel("询旁边的文本框填写随机列的字段,点击查询便可。其他类似。"); 60 | label_10.setBounds(99, 337, 536, 29); 61 | add(label_10); 62 | 63 | JLabel label_11 = new JLabel("三、信息查询"); 64 | label_11.setBounds(69, 362, 536, 29); 65 | add(label_11); 66 | 67 | JLabel label_12 = new JLabel("1、学生信息查询"); 68 | label_12.setBounds(89, 387, 536, 29); 69 | add(label_12); 70 | 71 | JLabel label_13 = new JLabel("在查询按钮旁边的文本框写随机列的字段,便可显示相应的消息。"); 72 | label_13.setBounds(112, 411, 536, 29); 73 | add(label_13); 74 | 75 | JLabel label_14 = new JLabel("2、夜归信息"); 76 | label_14.setBounds(89, 438, 536, 29); 77 | add(label_14); 78 | 79 | JLabel label_15 = new JLabel("添加夜归记录:在下面的文本框填写相应的信息,点击“添加夜归记录”即可。"); 80 | label_15.setBounds(112, 461, 536, 29); 81 | add(label_15); 82 | 83 | JLabel label_16 = new JLabel("查询:与上一样。"); 84 | label_16.setBounds(112, 488, 536, 29); 85 | add(label_16); 86 | 87 | JLabel label_17 = new JLabel("其他界面类似。"); 88 | label_17.setBounds(89, 516, 536, 29); 89 | add(label_17); 90 | 91 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 92 | labImage = new JLabel(image); 93 | labImage.setBounds(0, 0, 800, 600); 94 | add(labImage); 95 | this.setOpaque(false); 96 | 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/com/zhbit/queryResult/AllDormitoryInfo.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.queryResult; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.SQLException; 5 | import java.sql.Statement; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import java.util.Vector; 9 | 10 | import com.zhbit.Util.DB; 11 | import com.zhbit.excetion.DataBaseException; 12 | import com.zhbit.excetion.QueryResultIsNullException; 13 | 14 | /** 15 | * 查询本栋楼所有宿舍信息 16 | * 17 | * @author chenyueling 18 | * 19 | */ 20 | public class AllDormitoryInfo { 21 | //private List dormitoryInfos = new ArrayList(); 22 | 23 | private Vector dormitoryInfos = new Vector(); 24 | 25 | public Vector getdormitoryInfos(){ 26 | return dormitoryInfos; 27 | } 28 | 29 | 30 | 31 | public Vector getDormitoryInfos() { 32 | return dormitoryInfos; 33 | } 34 | 35 | 36 | 37 | public void setDormitoryInfos(Vector dormitoryInfos) { 38 | this.dormitoryInfos = dormitoryInfos; 39 | } 40 | 41 | 42 | 43 | public void getAllDormitoryInfo(String DormId) throws DataBaseException, 44 | QueryResultIsNullException { 45 | 46 | Statement stmt = DB.CreateStatement(); 47 | Statement stmt2 = DB.CreateStatement(); 48 | 49 | String sql = "select * from DormitoryInfo where DormId="+DormId; 50 | //System.out.println(sql); 51 | //DormitoryInfo dormitoryInfo = new DormitoryInfo(); 52 | ResultSet rs = null; 53 | try { 54 | rs = stmt.executeQuery(sql); 55 | 56 | if (rs != null && !rs.next()) { 57 | throw new QueryResultIsNullException(); 58 | } 59 | 60 | 61 | ResultSet rs2 = null; 62 | 63 | String s, s1, sql2; 64 | 65 | s = rs.getString(1); 66 | s1 = rs.getString(2); 67 | sql2 = "select * from Stu_DormInfo('" + s + "','" + s1 + "')"; 68 | 69 | //System.out.println(sql2); 70 | 71 | rs2 = stmt2.executeQuery(sql2); 72 | 73 | if (rs2 != null && !rs2.next()) { 74 | throw new QueryResultIsNullException(); 75 | } 76 | 77 | Vector line = new Vector(); 78 | for(int i=1; i<=8; i++){ 79 | String string = rs2.getString(i); 80 | if(string==null){ 81 | line.add("空"); 82 | }else{ 83 | line.add(string); 84 | } 85 | } 86 | dormitoryInfos.add(line); 87 | 88 | //System.out.println(line); 89 | 90 | while(rs.next()){ 91 | 92 | //System.out.println(line); 93 | 94 | 95 | s = rs.getString(1); 96 | //System.out.println(s); 97 | s1 = rs.getString(2); 98 | sql2 = "select * from Stu_DormInfo('" + s + "','" + s1 + "')"; 99 | //System.out.println(line); 100 | rs2 = stmt2.executeQuery(sql2); 101 | 102 | if (rs2 != null && !rs2.next()) { 103 | throw new QueryResultIsNullException(); 104 | } 105 | 106 | line = new Vector(); 107 | for(int i=1; i<=8; i++){ 108 | String string = rs2.getString(i); 109 | if(string==null){ 110 | line.add("空"); 111 | }else{ 112 | line.add(string); 113 | } 114 | } 115 | dormitoryInfos.add(line); 116 | 117 | //System.out.println(line); 118 | 119 | } 120 | 121 | } catch (SQLException e) { 122 | // e.printStackTrace(); 123 | throw new DataBaseException(); 124 | } 125 | } 126 | 127 | 128 | } 129 | -------------------------------------------------------------------------------- /src/com/zhbit/queryResult/AllMaintanceRecord.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.queryResult; 2 | 3 | import java.sql.CallableStatement; 4 | import java.sql.Connection; 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | import java.sql.Statement; 8 | import java.util.Vector; 9 | 10 | import com.zhbit.Util.DB; 11 | import com.zhbit.excetion.DataBaseException; 12 | import com.zhbit.excetion.QueryResultIsNullException; 13 | 14 | /** 15 | * 本栋楼所有维修记录信息 16 | * @author chenyueling 17 | * 18 | */ 19 | public class AllMaintanceRecord { 20 | 21 | private Connection connection; 22 | private Vector allMaintanceRecord = new Vector(); 23 | 24 | public AllMaintanceRecord() throws DataBaseException{ 25 | connection = DB.getConnection(); 26 | } 27 | 28 | public Vector getAllMaintanceRecord() { 29 | return allMaintanceRecord; 30 | } 31 | 32 | 33 | public void setAllMaintanceRecord(Vector allMaintanceRecord) { 34 | this.allMaintanceRecord = allMaintanceRecord; 35 | } 36 | 37 | public boolean updateMaintanceRecord(int Record,String MainId,String Data){ 38 | 39 | try { 40 | CallableStatement cst = connection.prepareCall("{call proc_MaintenanceRecord_Service(?,?,?)}"); 41 | cst.setInt(1, Record); 42 | cst.setString(2, Data); 43 | cst.setString(3, MainId); 44 | int r = cst.executeUpdate(); 45 | cst.close(); 46 | if(r >0 ){ 47 | return true; 48 | }else{ 49 | return false; 50 | } 51 | 52 | } catch (SQLException e) { 53 | // TODO Auto-generated catch block 54 | e.printStackTrace(); 55 | return false; 56 | } 57 | 58 | } 59 | 60 | public void getAllMaintanceRecord(String dormId) throws DataBaseException, QueryResultIsNullException{ 61 | //Connection connection = DB.getConnection(); 62 | String sql ="select * from View_MR_Stu_It where DormId="+dormId; 63 | Statement stmt = DB.CreateStatement(); 64 | ResultSet rs = null; 65 | try { 66 | rs = stmt.executeQuery(sql); 67 | if(rs!=null&&!rs.next()){ 68 | throw new QueryResultIsNullException(); 69 | } 70 | 71 | Vector line = new Vector(); 72 | 73 | /*line.add(rs.getString("RecordNum")); 74 | line.add(rs.getString("StuId")); 75 | line.add(rs.getString("StuName")); 76 | line.add(rs.getString("DormId")); 77 | line.add(rs.getString("roomId")); 78 | line.add(rs.getString("ItName")); 79 | line.add(rs.getString("RepaireDate")); 80 | line.add(rs.getString("ServiceDate")); 81 | line.add(rs.getString("isReplace")); 82 | line.add(rs.getString("MaId")); 83 | line.add(rs.getString("Remark")); 84 | */ 85 | 86 | for(int i=1; i<=13; i++){ 87 | String string = rs.getString(i); 88 | if(string==null){ 89 | line.add("空"); 90 | }else{ 91 | line.add(string); 92 | } 93 | } 94 | 95 | allMaintanceRecord.add(line); 96 | while(rs.next()){ 97 | line = new Vector(); 98 | 99 | /*line.add(rs.getString("RecordNum")); 100 | line.add(rs.getString("StuId")); 101 | line.add(rs.getString("StuName")); 102 | line.add(rs.getString("DormId")); 103 | line.add(rs.getString("roomId")); 104 | line.add(rs.getString("ItName")); 105 | line.add(rs.getString("RepaireDate")); 106 | line.add(rs.getString("ServiceDate")); 107 | line.add(rs.getString("isReplace")); 108 | line.add(rs.getString("MaId")); 109 | line.add(rs.getString("Remark")); 110 | 111 | */ 112 | for(int i=1; i<=13; i++){ 113 | String string = rs.getString(i); 114 | if(string==null){ 115 | line.add("空"); 116 | }else{ 117 | line.add(string); 118 | } 119 | } 120 | allMaintanceRecord.add(line); 121 | } 122 | 123 | } catch (SQLException e) { 124 | e.printStackTrace(); 125 | throw new DataBaseException(); 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/com/zhbit/queryResult/AllStudentInfo.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.queryResult; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.SQLException; 5 | import java.sql.Statement; 6 | import java.util.ArrayList; 7 | 8 | import com.zhbit.Util.DB; 9 | import com.zhbit.excetion.DataBaseException; 10 | import com.zhbit.excetion.QueryResultIsNullException; 11 | 12 | /** 13 | * 所有学生的结果集 14 | * @author chenyueling 15 | * 16 | */ 17 | public class AllStudentInfo { 18 | 19 | private ArrayList allStudentInfo = new ArrayList(); 20 | 21 | public ArrayList getAllStudentList() { 22 | return allStudentInfo; 23 | } 24 | 25 | public void setAllStudentList(ArrayList allStudentInfo) { 26 | this.allStudentInfo = allStudentInfo; 27 | } 28 | 29 | @SuppressWarnings("unused") 30 | public void getAllStudentInfo() throws QueryResultIsNullException, DataBaseException{ 31 | StudentInfo studentInfo = new StudentInfo(); 32 | ArrayList list = getAllStudentList(); 33 | Statement stmt = DB.CreateStatement(); 34 | String sql = null; 35 | try { 36 | ResultSet rs = null; 37 | //stmt.executeQuery(sql); 38 | if (rs==null && !rs.next()) { 39 | throw new QueryResultIsNullException(); 40 | } 41 | while(rs.next()){ 42 | studentInfo.setName(rs.getString("name")); 43 | studentInfo.setId(rs.getString("id")); 44 | studentInfo.setRoomId(rs.getString("roomId")); 45 | studentInfo.setDormId(rs.getString("dormId")); 46 | studentInfo.setBedNum(rs.getString("bedNum")); 47 | studentInfo.setInOutDate(rs.getString("inOutDate")); 48 | //TODO 还有方法没写完.等视图出来再写 49 | list.add(studentInfo); 50 | } 51 | } catch (SQLException e) { 52 | // TODO 自动生成的 catch 块 53 | e.printStackTrace(); 54 | throw new DataBaseException(); 55 | 56 | } 57 | } 58 | 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/com/zhbit/queryResult/DormitoryBuildingInfo.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.queryResult; 2 | 3 | import java.util.Date; 4 | 5 | 6 | /** 7 | * 宿舍楼信息查询结果类 8 | * @author chenyueling 9 | * 10 | */ 11 | public class DormitoryBuildingInfo { 12 | 13 | private String DormId; //宿舍楼ID 14 | private String DMID; //舍管ID 15 | private String StuSex; //学生性别 16 | private String College; //所住学生所属学院 17 | private String Etime; //所住学生入学年份 18 | private String LiveNum; 19 | private String ConNum; 20 | 21 | 22 | public String getLiveNum() { 23 | return LiveNum; 24 | } 25 | public void setLiveNum(String liveNum) { 26 | LiveNum = liveNum; 27 | } 28 | public String getConNum() { 29 | return ConNum; 30 | } 31 | public void setConNum(String conNum) { 32 | ConNum = conNum; 33 | } 34 | public String getDormId() { 35 | return DormId; 36 | } 37 | public void setDormId(String dormId) { 38 | DormId = dormId; 39 | } 40 | public String getDMID() { 41 | return DMID; 42 | } 43 | public void setDMID(String dMID) { 44 | DMID = dMID; 45 | } 46 | public String getStuSex() { 47 | return StuSex; 48 | } 49 | public void setStuSex(String stuSex) { 50 | StuSex = stuSex; 51 | } 52 | public String getCollege() { 53 | return College; 54 | } 55 | public void setCollege(String college) { 56 | College = college; 57 | } 58 | public String getEtime() { 59 | return Etime; 60 | } 61 | public void setEtime(String string) { 62 | Etime = string; 63 | 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/com/zhbit/queryResult/MaintanceRecord.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.queryResult; 2 | /** 3 | * 维修记录 4 | * @author chenyueling 5 | * 6 | */ 7 | public class MaintanceRecord { 8 | private String recordNum; //维修号 9 | private String stuId; //报修学生id 10 | private String stuName; //报修学生信息 11 | private String dormId; //宿舍楼栋 12 | private String RoomId; //报修房间号 13 | //private String bedId; 14 | private String itId; //报修物品id 15 | private String itName; //报修物品名称 16 | private String repaireDate; //报修时间 17 | private String serviceDate; //维修时间 18 | private String isReplace; //是否维修 19 | private String maId; //维修员号码 20 | private String remark; //备注 21 | 22 | public String getRecordNum() { 23 | return recordNum; 24 | } 25 | public void setRecordNum(String recordNum) { 26 | this.recordNum = recordNum; 27 | } 28 | public String getStuId() { 29 | return stuId; 30 | } 31 | public void setStuId(String stuId) { 32 | this.stuId = stuId; 33 | } 34 | public String getStuName() { 35 | return stuName; 36 | } 37 | public void setStuName(String stuName) { 38 | this.stuName = stuName; 39 | } 40 | public String getDormId() { 41 | return dormId; 42 | } 43 | public void setDormId(String dormId) { 44 | this.dormId = dormId; 45 | } 46 | public String getRoomId() { 47 | return RoomId; 48 | } 49 | public void setRoomId(String roomId) { 50 | RoomId = roomId; 51 | } 52 | public String getItId() { 53 | return itId; 54 | } 55 | public void setItId(String itId) { 56 | this.itId = itId; 57 | } 58 | public String getItName() { 59 | return itName; 60 | } 61 | public void setItName(String itName) { 62 | this.itName = itName; 63 | } 64 | public String getRepaireDate() { 65 | return repaireDate; 66 | } 67 | public void setRepaireDate(String repaireDate) { 68 | this.repaireDate = repaireDate; 69 | } 70 | public String getServiceDate() { 71 | return serviceDate; 72 | } 73 | public void setServiceDate(String serviceDate) { 74 | this.serviceDate = serviceDate; 75 | } 76 | public String getIsReplace() { 77 | return isReplace; 78 | } 79 | public void setIsReplace(String isReplace) { 80 | this.isReplace = isReplace; 81 | } 82 | public String getMaId() { 83 | return maId; 84 | } 85 | public void setMaId(String maId) { 86 | this.maId = maId; 87 | } 88 | public String getRemark() { 89 | return remark; 90 | } 91 | public void setRemark(String remark) { 92 | this.remark = remark; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/com/zhbit/queryResult/ManagerInfo.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.queryResult; 2 | 3 | public class ManagerInfo { 4 | private String id; 5 | private String name; 6 | private String phone; 7 | private String sex; 8 | 9 | public String getId() { 10 | return id; 11 | } 12 | public String getName() { 13 | return name; 14 | } 15 | public String getPhone() { 16 | return phone; 17 | } 18 | public String getSex() { 19 | return sex; 20 | } 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | public void setName(String name) { 25 | this.name = name; 26 | } 27 | public void setPhone(String phone) { 28 | this.phone = phone; 29 | } 30 | public void setSex(String sex) { 31 | this.sex = sex; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/com/zhbit/queryResult/StudentInfo.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.queryResult; 2 | 3 | import java.sql.ResultSet; 4 | import java.sql.SQLException; 5 | import java.sql.Statement; 6 | 7 | import com.zhbit.Util.DB; 8 | import com.zhbit.excetion.DataBaseException; 9 | import com.zhbit.excetion.QueryResultIsNullException; 10 | 11 | /** 12 | * 学生信息类 13 | * @author chenyueling 14 | * 15 | */ 16 | public class StudentInfo { 17 | 18 | 19 | private String bedNum; 20 | private String college; 21 | private String dormId; 22 | private String Home; 23 | private String id; 24 | private String inOutDate; 25 | private String major; 26 | private String name; 27 | private String phone; 28 | private String roomId; 29 | private String sex; 30 | private String stuClass; 31 | private String StuEtime; 32 | 33 | 34 | public String getBedNum() { 35 | return bedNum; 36 | } 37 | public String getCollege() { 38 | return college; 39 | } 40 | public String getDormId() { 41 | return dormId; 42 | } 43 | public String getHome() { 44 | return Home; 45 | } 46 | public String getId() { 47 | return id; 48 | } 49 | public String getInOutDate() { 50 | return inOutDate; 51 | } 52 | public String getMajor() { 53 | return major; 54 | } 55 | public String getName() { 56 | return name; 57 | } 58 | public String getPhone() { 59 | return phone; 60 | } 61 | public String getRoomId() { 62 | return roomId; 63 | } 64 | public String getSex() { 65 | return sex; 66 | } 67 | public String getStuClass() { 68 | return stuClass; 69 | } 70 | public String getStuEtime() { 71 | return StuEtime; 72 | } 73 | public void setBedNum(String bedNum) { 74 | this.bedNum = bedNum; 75 | } 76 | public void setCollege(String college) { 77 | this.college = college; 78 | } 79 | public void setDormId(String dormId) { 80 | this.dormId = dormId; 81 | } 82 | public void setHome(String home) { 83 | Home = home; 84 | } 85 | public void setId(String id) { 86 | this.id = id; 87 | } 88 | public void setInOutDate(String inOutDate) { 89 | this.inOutDate = inOutDate; 90 | } 91 | public void setMajor(String major) { 92 | this.major = major; 93 | } 94 | public void setName(String name) { 95 | this.name = name; 96 | } 97 | public void setPhone(String phone) { 98 | this.phone = phone; 99 | } 100 | public void setRoomId(String roomId) { 101 | this.roomId = roomId; 102 | } 103 | public void setSex(String sex) { 104 | this.sex = sex; 105 | } 106 | public void setStuClass(String stuClass) { 107 | this.stuClass = stuClass; 108 | } 109 | public void setStuEtime(String stuEtime) { 110 | StuEtime = stuEtime; 111 | } 112 | 113 | public void getStudentInfo() throws QueryResultIsNullException, DataBaseException{ 114 | 115 | String sql = null; 116 | try { 117 | Statement stmt = DB.CreateStatement(); 118 | ResultSet rs = stmt.executeQuery(sql); 119 | if(rs==null){ 120 | throw new QueryResultIsNullException(); 121 | } 122 | rs.next(); 123 | //studentInfo.setrs.getString() 124 | //TODO .............. 125 | } catch (SQLException e) { 126 | // TODO 自动生成的 catch 块 127 | e.printStackTrace(); 128 | } 129 | } 130 | 131 | 132 | 133 | } 134 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/About.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import javax.swing.JPanel; 4 | import javax.swing.JLabel; 5 | import javax.swing.ImageIcon; 6 | import java.awt.Color; 7 | import java.awt.Font; 8 | 9 | public class About extends JPanel { 10 | 11 | 12 | private JLabel labImage; 13 | private ImageIcon image; 14 | /** 15 | * Create the panel. 16 | */ 17 | public About() { 18 | setBackground(new Color(255, 255, 255)); 19 | setSize(800,600); 20 | setLayout(null); 21 | 22 | JLabel lblNewLabel = new JLabel(""); 23 | lblNewLabel.setIcon(new ImageIcon(About.class.getResource("/bigImage/图标.png"))); 24 | lblNewLabel.setBounds(110, 206, 200, 232); 25 | add(lblNewLabel); 26 | 27 | JLabel label = new JLabel("关于宿舍管理系统"); 28 | label.setFont(new Font("宋体", Font.BOLD, 31)); 29 | label.setBounds(248, 58, 305, 72); 30 | add(label); 31 | 32 | JLabel lblNewLabel_1 = new JLabel("宿舍管理系统5.0正式版"); 33 | lblNewLabel_1.setFont(new Font("楷体", Font.BOLD, 28)); 34 | lblNewLabel_1.setBounds(352, 207, 376, 59); 35 | add(lblNewLabel_1); 36 | 37 | JLabel lblNewLabel_2 = new JLabel("制作人:廖瑞华 陈岳凌"); 38 | lblNewLabel_2.setFont(new Font("楷体", Font.BOLD, 28)); 39 | lblNewLabel_2.setBounds(352, 281, 386, 72); 40 | add(lblNewLabel_2); 41 | 42 | JLabel label_1 = new JLabel("洪惜玉 尧莉菁 鲜璐"); 43 | label_1.setFont(new Font("楷体", Font.BOLD, 28)); 44 | label_1.setBounds(433, 366, 295, 72); 45 | add(label_1); 46 | 47 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 48 | labImage = new JLabel(image); 49 | labImage.setBounds(0, 0, 800, 600); 50 | add(labImage); 51 | this.setOpaque(false); 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/ChangPWD.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import java.awt.Font; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.awt.event.KeyAdapter; 7 | import java.awt.event.KeyEvent; 8 | 9 | import javax.swing.ImageIcon; 10 | import javax.swing.JButton; 11 | import javax.swing.JLabel; 12 | import javax.swing.JOptionPane; 13 | import javax.swing.JPanel; 14 | import javax.swing.JPasswordField; 15 | 16 | import com.zhbit.entity.Manager; 17 | import com.zhbit.entity.Student; 18 | import com.zhbit.excetion.DataBaseException; 19 | import com.zhbit.excetion.PasswordNotMatchException; 20 | import com.zhbit.excetion.UpdateSuccessException; 21 | import com.zhbit.form.UpdatePassWordForm; 22 | 23 | 24 | public class ChangPWD extends JPanel { 25 | private JPasswordField txtOldPWD; 26 | private JPasswordField txtNewPWD; 27 | private JPasswordField txtCheckNewPWD; 28 | private JButton butOk; 29 | private JLabel labImage; 30 | private ImageIcon image; 31 | private Student student; 32 | /** 33 | * Create the panel. 34 | */ 35 | 36 | 37 | 38 | public ChangPWD(Student stu) { 39 | this.student = stu; 40 | setSize(800,600); 41 | setLayout(null); 42 | 43 | JLabel labOldPWD = new JLabel("旧密码"); 44 | labOldPWD.setFont(new Font("宋体", Font.PLAIN, 15)); 45 | labOldPWD.setBounds(245, 190, 54, 15); 46 | add(labOldPWD); 47 | 48 | JLabel labNewPWD = new JLabel("新密码"); 49 | labNewPWD.setFont(new Font("宋体", Font.PLAIN, 15)); 50 | labNewPWD.setBounds(245, 257, 54, 15); 51 | add(labNewPWD); 52 | 53 | JLabel labCheckNewPWD = new JLabel("确认新密码"); 54 | labCheckNewPWD.setFont(new Font("宋体", Font.PLAIN, 15)); 55 | labCheckNewPWD.setBounds(245, 315, 93, 20); 56 | add(labCheckNewPWD); 57 | 58 | butOk = new JButton("确认"); 59 | butOk.addActionListener(new ActionListener() { 60 | public void actionPerformed(ActionEvent arg0) { 61 | UpdatePassWordForm updatePassWordForm = new UpdatePassWordForm(); 62 | updatePassWordForm.setOldPassword(txtOldPWD.getText().trim()); 63 | updatePassWordForm.setNewassword(txtNewPWD.getText().trim()); 64 | updatePassWordForm.setNewPassword1(txtCheckNewPWD.getText().trim()); 65 | if(updatePassWordForm.getNewassword().equals(updatePassWordForm.getNewPassword1())){ 66 | try { 67 | student.PasswordUpdate(updatePassWordForm); 68 | } catch (PasswordNotMatchException e) { 69 | JOptionPane.showMessageDialog(null, "旧密码错误,修改失败!", "系统信息", JOptionPane.WARNING_MESSAGE); 70 | //e.printStackTrace(); 71 | } catch (DataBaseException e) { 72 | // TODO 自动生成的 catch 块 73 | //e.printStackTrace(); 74 | JOptionPane.showMessageDialog(null, "数据库错误,修改失败!", "系统信息", JOptionPane.WARNING_MESSAGE); 75 | } catch (UpdateSuccessException e) { 76 | JOptionPane.showMessageDialog(null, "密码修改成功,请牢记密码", "系统信息", JOptionPane.WARNING_MESSAGE); 77 | } 78 | }else{ 79 | JOptionPane.showMessageDialog(null, "新密码输入不一致", "系统信息", JOptionPane.WARNING_MESSAGE); 80 | } 81 | } 82 | }); 83 | butOk.setFont(new Font("宋体", Font.PLAIN, 15)); 84 | butOk.setBounds(267, 415, 93, 23); 85 | add(butOk); 86 | 87 | JButton butCancel = new JButton("取消"); 88 | butCancel.setFont(new Font("宋体", Font.PLAIN, 15)); 89 | butCancel.setBounds(448, 415, 93, 23); 90 | add(butCancel); 91 | 92 | txtOldPWD = new JPasswordField(); 93 | txtOldPWD.setBounds(356, 186, 185, 23); 94 | add(txtOldPWD); 95 | 96 | txtNewPWD = new JPasswordField(); 97 | txtNewPWD.setBounds(356, 253, 185, 23); 98 | add(txtNewPWD); 99 | 100 | txtCheckNewPWD = new JPasswordField(); 101 | txtCheckNewPWD.addKeyListener(new KeyAdapter() { 102 | @Override 103 | public void keyPressed(KeyEvent e) { 104 | if(e.getKeyCode()==KeyEvent.VK_ENTER){ 105 | butOk.doClick(); 106 | } 107 | } 108 | }); 109 | txtCheckNewPWD.setBounds(356, 314, 185, 23); 110 | add(txtCheckNewPWD); 111 | 112 | JLabel lblNewLabel_4 = new JLabel("修改密码"); 113 | lblNewLabel_4.setFont(new Font("微软雅黑", Font.PLAIN, 25)); 114 | lblNewLabel_4.setBounds(245, 121, 115, 34); 115 | add(lblNewLabel_4); 116 | 117 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 118 | labImage = new JLabel(image); 119 | labImage.setBounds(0, 0, 800, 600); 120 | add(labImage); 121 | this.setOpaque(false); 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/First.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import javax.swing.ImageIcon; 4 | import javax.swing.JLabel; 5 | import javax.swing.JPanel; 6 | import java.awt.Font; 7 | 8 | public class First extends JPanel { 9 | 10 | private JLabel labImage; 11 | private ImageIcon image; 12 | /** 13 | * Create the panel. 14 | */ 15 | public First() { 16 | setSize(800,600); 17 | setLayout(null); 18 | 19 | image = new ImageIcon("src\\bigImage\\欢迎界面.jpg"); 20 | labImage = new JLabel(image); 21 | labImage.setBounds(0, 0, 800, 600); 22 | add(labImage); 23 | this.setOpaque(false); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/SCurfew.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import javax.swing.ImageIcon; 4 | import javax.swing.JPanel; 5 | import javax.swing.JScrollPane; 6 | import javax.swing.JTable; 7 | import javax.swing.table.DefaultTableModel; 8 | import javax.swing.JLabel; 9 | 10 | import com.zhbit.entity.Student; 11 | import com.zhbit.excetion.DataBaseException; 12 | import com.zhbit.excetion.QueryResultIsNullException; 13 | 14 | import java.awt.Font; 15 | import java.util.Vector; 16 | 17 | public class SCurfew extends JPanel { 18 | private JTable table; 19 | private Student student; 20 | private JLabel labImage; 21 | private ImageIcon image; 22 | private DefaultTableModel defaultTableModel; 23 | private Vector headVector; 24 | /** 25 | * Create the panel. 26 | */ 27 | public SCurfew() { 28 | 29 | } 30 | public SCurfew(Student student) { 31 | // TODO Auto-generated constructor stub 32 | this.student = student; 33 | setSize(800,600); 34 | setLayout(null); 35 | 36 | JScrollPane scrollPane = new JScrollPane(); 37 | scrollPane.setBounds(108, 153, 558, 298); 38 | add(scrollPane); 39 | 40 | table = new JTable(); 41 | defaultTableModel = new DefaultTableModel(); 42 | defaultTableModel.setColumnCount(20); 43 | defaultTableModel.setRowCount(6); 44 | defaultTableModel.setValueAt(123, 1, 1); 45 | headVector = new Vector(); 46 | headVector.add("记录号"); 47 | headVector.add("夜归时间"); 48 | headVector.add("第几次夜归"); 49 | headVector.add("夜归原因"); 50 | headVector.add("值班宿管"); 51 | defaultTableModel.setDataVector(null,headVector); 52 | table.setModel(defaultTableModel); 53 | 54 | scrollPane.setViewportView(table); 55 | 56 | 57 | JLabel lblNewLabel = new JLabel("夜归记录"); 58 | lblNewLabel.setFont(new Font("微软雅黑", Font.BOLD, 25)); 59 | lblNewLabel.setBounds(109, 79, 168, 39); 60 | add(lblNewLabel); 61 | 62 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 63 | labImage = new JLabel(image); 64 | labImage.setBounds(0, 0, 800, 600); 65 | add(labImage); 66 | this.setOpaque(false); 67 | } 68 | 69 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 70 | defaultTableModel.setDataVector(student.getPersonalCurfewInfo(), headVector); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/SKuaidi.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import javax.swing.ImageIcon; 4 | import javax.swing.JFrame; 5 | import javax.swing.JOptionPane; 6 | import javax.swing.JPanel; 7 | import javax.swing.JScrollPane; 8 | import javax.swing.JTable; 9 | import javax.swing.RowFilter; 10 | import javax.swing.table.DefaultTableModel; 11 | import javax.swing.table.TableModel; 12 | import javax.swing.table.TableRowSorter; 13 | import javax.swing.text.BadLocationException; 14 | import javax.swing.JLabel; 15 | import java.awt.Font; 16 | import java.awt.HeadlessException; 17 | import java.util.Vector; 18 | 19 | import javax.swing.JRadioButton; 20 | import javax.swing.JTextField; 21 | import javax.swing.JButton; 22 | 23 | import com.zhbit.entity.Student; 24 | import com.zhbit.excetion.DataBaseException; 25 | import com.zhbit.excetion.QueryResultIsNullException; 26 | import java.awt.event.ActionListener; 27 | import java.awt.event.ActionEvent; 28 | import javax.swing.ButtonGroup; 29 | 30 | 31 | public class SKuaidi extends JPanel { 32 | private JTable tableSKuaidi; 33 | private JTextField textField; 34 | private JLabel labImage; 35 | private ImageIcon image; 36 | private Student student; 37 | private DefaultTableModel defaultTableModel; 38 | private Vector headVector; 39 | private JFrame jframe; 40 | private JRadioButton radioButton; 41 | 42 | private TableRowSorter sorter; 43 | private final ButtonGroup buttonGroup = new ButtonGroup(); 44 | private JTextField textField_1; 45 | 46 | /** 47 | * Create the panel. 48 | */ 49 | public SKuaidi(JFrame jf, Student student) { 50 | this.student = student; 51 | this.jframe = jf; 52 | setSize(800,600); 53 | setLayout(null); 54 | 55 | JScrollPane scrollPane = new JScrollPane(); 56 | scrollPane.setBounds(64, 140, 670, 288); 57 | add(scrollPane); 58 | 59 | 60 | tableSKuaidi = new JTable(); 61 | defaultTableModel = new DefaultTableModel(); 62 | defaultTableModel.setColumnCount(15); 63 | defaultTableModel.setRowCount(6); 64 | defaultTableModel.setValueAt(123, 1, 1); 65 | /* headVector.add("记录号"); 66 | headVector.add("公司名"); 67 | headVector.add("是否领取"); 68 | headVector.add("到件日期"); 69 | headVector.add("领取日期"); 70 | headVector.add("备注");*/ 71 | headVector = new Vector(); 72 | headVector.add("\u8BB0\u5F55\u53F7"); 73 | headVector.add("\u516C\u53F8\u540D"); 74 | headVector.add("\u5BBF\u820D\u697C"); 75 | headVector.add("\u623F\u95F4"); 76 | headVector.add("\u5B66\u53F7"); 77 | headVector.add("\u5B66\u751F\u59D3\u540D"); 78 | headVector.add("\u8054\u7CFB\u7535\u8BDD"); 79 | headVector.add( "\u662F\u5426\u9886\u53D6"); 80 | headVector.add("\u5230\u4EF6\u65E5\u671F"); 81 | headVector.add("\u9886\u53D6\u65E5\u671F"); 82 | headVector.add("\u5907\u6CE8"); 83 | defaultTableModel.setDataVector(null,headVector); 84 | tableSKuaidi.setModel(defaultTableModel); 85 | scrollPane.setViewportView(tableSKuaidi); 86 | 87 | tableSKuaidi.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); 88 | tableSKuaidi.setFont(new Font("宋体", Font.PLAIN, 15)); 89 | 90 | sorter = new TableRowSorter(tableSKuaidi.getModel()); 91 | tableSKuaidi.setRowSorter(sorter); 92 | 93 | JLabel label = new JLabel("快递信息"); 94 | label.setFont(new Font("微软雅黑", Font.BOLD, 25)); 95 | label.setBounds(99, 50, 107, 40); 96 | add(label); 97 | 98 | radioButton = new JRadioButton("只显示未领取快递"); 99 | radioButton.addActionListener(new ActionListener() { 100 | public void actionPerformed(ActionEvent e) { 101 | String text = "否"; 102 | if(radioButton.isSelected()==false){ 103 | sorter.setRowFilter(null); 104 | } 105 | else{ 106 | sorter.setRowFilter(RowFilter.regexFilter(text)); 107 | } 108 | 109 | } 110 | }); 111 | radioButton.setOpaque(false); 112 | radioButton.setBounds(587, 456, 121, 23); 113 | add(radioButton); 114 | 115 | textField = new JTextField(); 116 | textField.setFont(new Font("宋体", Font.PLAIN, 11)); 117 | textField.addActionListener(new ActionListener() { 118 | public void actionPerformed(ActionEvent e) { 119 | 120 | String text = textField.getText(); 121 | if(text.trim().length()==0) 122 | sorter.setRowFilter(null); 123 | else 124 | sorter.setRowFilter(RowFilter.regexFilter(text)); 125 | 126 | } 127 | }); 128 | textField.setBounds(102, 500, 121, 21); 129 | add(textField); 130 | textField.setColumns(10); 131 | 132 | 133 | final JRadioButton rdbtnNewRadioButton = new JRadioButton("快递公司"); 134 | buttonGroup.add(rdbtnNewRadioButton); 135 | rdbtnNewRadioButton.setBounds(235, 499, 73, 23); 136 | add(rdbtnNewRadioButton); 137 | 138 | final JRadioButton radioButton_1 = new JRadioButton("日期"); 139 | buttonGroup.add(radioButton_1); 140 | radioButton_1.setBounds(312, 499, 57, 23); 141 | add(radioButton_1); 142 | 143 | final JRadioButton radioButton_2 = new JRadioButton("记录号"); 144 | buttonGroup.add(radioButton_2); 145 | radioButton_2.setBounds(368, 499, 61, 23); 146 | add(radioButton_2); 147 | 148 | JButton button = new JButton("查 询"); 149 | button.addActionListener(new ActionListener() { 150 | public void actionPerformed(ActionEvent e) { 151 | 152 | String text = textField.getText(); 153 | if(text.trim().length()==0) 154 | sorter.setRowFilter(null); 155 | else{ 156 | 157 | if( rdbtnNewRadioButton.isSelected() == true){ 158 | sorter.setRowFilter(RowFilter.regexFilter(text, 1)); 159 | }else if(radioButton_1.isSelected() == true){ 160 | sorter.setRowFilter(RowFilter.regexFilter(text)); 161 | }else if(radioButton_2.isSelected()== true){ 162 | sorter.setRowFilter(RowFilter.regexFilter(text, 0)); 163 | }else { 164 | JOptionPane.showMessageDialog(jframe, "请选中查询方式" , "系统信息", JOptionPane.WARNING_MESSAGE); 165 | } 166 | } 167 | 168 | } 169 | }); 170 | button.setBounds(235, 535, 182, 23); 171 | add(button); 172 | 173 | 174 | JButton button_1 = new JButton("签收"); 175 | button_1.addActionListener(new ActionListener() { 176 | public void actionPerformed(ActionEvent e) { 177 | 178 | if(tableSKuaidi.getValueAt( tableSKuaidi.getSelectedRow(), 7).equals("是") || tableSKuaidi.getValueAt( tableSKuaidi.getSelectedRow(), 7).equals("是")) 179 | JOptionPane.showMessageDialog(jframe, "此快递已经领取" , "系统信息", JOptionPane.WARNING_MESSAGE); 180 | else if(textField.getText().length() < 10 ){ 181 | JOptionPane.showMessageDialog(jframe, "请填写日期。(2013-06-01)" , "系统信息", JOptionPane.WARNING_MESSAGE); 182 | } 183 | else{ 184 | try { 185 | if(updateRecord() == true){ 186 | //System.out.println(textField.getText()); 187 | 188 | String s = "是"; 189 | tableSKuaidi.setValueAt(textField_1.getText(), tableSKuaidi.getSelectedRow(), 9); 190 | tableSKuaidi.setValueAt(s, tableSKuaidi.getSelectedRow(), 7); 191 | 192 | JOptionPane.showMessageDialog(jframe, "修改成功" , "系统信息", JOptionPane.WARNING_MESSAGE); 193 | } 194 | } catch (HeadlessException | DataBaseException e1) { 195 | // TODO Auto-generated catch block 196 | //e1.printStackTrace(); 197 | JOptionPane.showMessageDialog(jframe, "修改成失败" , "系统信息", JOptionPane.WARNING_MESSAGE); 198 | } 199 | } 200 | }}); 201 | button_1.setBounds(470, 456, 93, 23); 202 | add(button_1); 203 | 204 | textField_1 = new JTextField(); 205 | textField_1.setFont(new Font("宋体", Font.PLAIN, 11)); 206 | textField_1.setBounds(339, 457, 121, 21); 207 | add(textField_1); 208 | textField_1.setColumns(10); 209 | 210 | JLabel label_1 = new JLabel("日期"); 211 | label_1.setBounds(294, 460, 35, 15); 212 | add(label_1); 213 | 214 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 215 | labImage = new JLabel(image); 216 | labImage.setBounds(0, 0, 800, 600); 217 | add(labImage); 218 | this.setOpaque(false); 219 | } 220 | 221 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 222 | defaultTableModel.setDataVector(student.getPersonalExpressInfo(), headVector); 223 | } 224 | 225 | 226 | 227 | 228 | public boolean updateRecord() throws DataBaseException{ 229 | int Record; 230 | 231 | String Data = ""; 232 | 233 | Record = Integer.parseInt( textField.getText() ); 234 | 235 | 236 | Data = textField_1.getText(); 237 | 238 | 239 | 240 | return student.updateExpressTransceiver(Record, Data); 241 | 242 | } 243 | } 244 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/SMR.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import java.awt.Font; 4 | import java.awt.event.ActionEvent; 5 | import java.awt.event.ActionListener; 6 | import java.awt.event.ItemEvent; 7 | import java.awt.event.ItemListener; 8 | import java.util.Vector; 9 | 10 | import javax.swing.DefaultComboBoxModel; 11 | import javax.swing.ImageIcon; 12 | import javax.swing.JButton; 13 | import javax.swing.JComboBox; 14 | import javax.swing.JFrame; 15 | import javax.swing.JLabel; 16 | import javax.swing.JOptionPane; 17 | import javax.swing.JPanel; 18 | import javax.swing.JRadioButton; 19 | import javax.swing.JScrollPane; 20 | import javax.swing.JTable; 21 | import javax.swing.JTextField; 22 | import javax.swing.RowFilter; 23 | import javax.swing.ScrollPaneConstants; 24 | import javax.swing.table.DefaultTableModel; 25 | import javax.swing.table.TableModel; 26 | import javax.swing.table.TableRowSorter; 27 | 28 | import com.zhbit.entity.Student; 29 | import com.zhbit.excetion.DataBaseException; 30 | import com.zhbit.excetion.QueryResultIsNullException; 31 | 32 | public class SMR extends JPanel { 33 | private JTable tableSMR; 34 | private JTextField textField; 35 | private ImageIcon image; 36 | private Student student; 37 | private DefaultTableModel defaultTableModel; 38 | private Vector headVector; 39 | private JTextField textField_1; 40 | /** 41 | * Create the panel. 42 | */ 43 | 44 | private JLabel labImage; 45 | private JRadioButton radioButton; 46 | 47 | private TableRowSorter sorter; 48 | private JTextField textField_2; 49 | private JTextField textField_3; 50 | 51 | private JComboBox comboBox; 52 | private JButton button_2; 53 | private JFrame jframe; 54 | 55 | private Vector comv = null; 56 | 57 | public SMR(JFrame jf, Student stu) { 58 | this.student = stu; 59 | this.jframe = jf; 60 | setSize(800,600); 61 | setLayout(null); 62 | 63 | JLabel label = new JLabel("维修信息"); 64 | label.setFont(new Font("微软雅黑", Font.BOLD, 25)); 65 | label.setBounds(112, 53, 100, 34); 66 | add(label); 67 | 68 | JScrollPane scrollPane = new JScrollPane(); 69 | scrollPane.setBounds(64, 113, 673, 308); 70 | add(scrollPane); 71 | 72 | tableSMR = new JTable(); 73 | scrollPane.setViewportView(tableSMR); 74 | defaultTableModel = new DefaultTableModel(); 75 | defaultTableModel.setColumnCount(15); 76 | defaultTableModel.setRowCount(11); 77 | defaultTableModel.setValueAt(123, 1, 1); 78 | headVector = new Vector(); 79 | headVector.add("记录号"); 80 | headVector.add("学号"); 81 | headVector.add("姓名"); 82 | headVector.add("宿舍楼号"); 83 | headVector.add("宿舍号"); 84 | headVector.add("床号"); 85 | headVector.add("物品号"); 86 | headVector.add("物品名称"); 87 | headVector.add("报修日期"); 88 | headVector.add("维修日期"); 89 | headVector.add("是否维修"); 90 | headVector.add("维修员"); 91 | headVector.add("备注"); 92 | defaultTableModel.setDataVector(null, headVector); 93 | tableSMR.setModel(defaultTableModel); 94 | 95 | tableSMR.setAutoResizeMode(tableSMR.AUTO_RESIZE_OFF); //自动调整表格列的宽度,不更改其他列的大小,而是更改整个表格的大小 96 | scrollPane.setViewportView(tableSMR); 97 | scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); 98 | scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); 99 | 100 | sorter = new TableRowSorter(tableSMR.getModel()); 101 | 102 | tableSMR.setRowSorter(sorter); 103 | 104 | 105 | radioButton = new JRadioButton("只显示未维修"); 106 | radioButton.addActionListener(new ActionListener() { 107 | public void actionPerformed(ActionEvent e) { 108 | String text = "否"; 109 | if(radioButton.isSelected()==false){ 110 | sorter.setRowFilter(null); 111 | } 112 | else{ 113 | sorter.setRowFilter(RowFilter.regexFilter(text)); 114 | } 115 | } 116 | }); 117 | 118 | radioButton.setOpaque(false); 119 | 120 | radioButton.setBounds(430, 467, 100, 23); 121 | add(radioButton); 122 | 123 | textField_1 = new JTextField(); 124 | textField_1.addActionListener(new ActionListener() { 125 | public void actionPerformed(ActionEvent e) { 126 | 127 | String text = textField_1.getText(); 128 | if(text.trim().length()==0) 129 | sorter.setRowFilter(null); 130 | else 131 | sorter.setRowFilter(RowFilter.regexFilter(text)); 132 | 133 | } 134 | }); 135 | textField_1.setBounds(112, 468, 100, 21); 136 | add(textField_1); 137 | textField_1.setColumns(10); 138 | /* 139 | JRadioButton radioButton_1 = new JRadioButton("维修物品"); 140 | radioButton_1.setBounds(300, 468, 81, 23); 141 | add(radioButton_1); 142 | */ 143 | 144 | /* 145 | JRadioButton radioButton_2 = new JRadioButton("维修日期"); 146 | radioButton_2.setBounds(381, 468, 81, 23); 147 | add(radioButton_2); 148 | */ 149 | JButton button = new JButton("查询"); 150 | button.addActionListener(new ActionListener() { 151 | public void actionPerformed(ActionEvent e) { 152 | 153 | String text = textField_1.getText(); 154 | if(text.trim().length()==0) 155 | sorter.setRowFilter(null); 156 | else 157 | sorter.setRowFilter(RowFilter.regexFilter(text)); 158 | 159 | } 160 | }); 161 | button.setBounds(222, 467, 57, 23); 162 | add(button); 163 | 164 | 165 | 166 | 167 | textField_2 = new JTextField(); 168 | textField_2.setBounds(289, 526, 131, 21); 169 | add(textField_2); 170 | textField_2.setColumns(10); 171 | 172 | 173 | Vector v = new Vector(); 174 | 175 | 176 | try { 177 | comv = getItem(); 178 | 179 | for(int i=1; i <= comv.size(); i++){ 180 | v.add(i); 181 | } 182 | 183 | // System.out.println(comv); 184 | 185 | comboBox = new JComboBox(); 186 | //comboBox.add(comboBox, 1); 187 | comboBox.setModel(new DefaultComboBoxModel(v)); 188 | comboBox.setBounds(222, 526, 57, 21); 189 | add(comboBox); 190 | 191 | comboBox.addItemListener(new ItemListener() { 192 | public void itemStateChanged(ItemEvent e) { 193 | 194 | textField_2.setText(comv.get((int) comboBox.getSelectedItem()-1).toString()); 195 | 196 | } 197 | }); 198 | 199 | 200 | 201 | } catch (DataBaseException e1) { 202 | // TODO Auto-generated catch block 203 | e1.printStackTrace(); 204 | } 205 | 206 | String s; 207 | s = comboBox.getSelectedItem().toString(); 208 | textField_2.setText(comv.get(0).toString()); 209 | 210 | JLabel label_1 = new JLabel("备注"); 211 | label_1.setBounds(430, 529, 54, 15); 212 | add(label_1); 213 | 214 | textField_3 = new JTextField(); 215 | textField_3.setBounds(466, 526, 174, 21); 216 | add(textField_3); 217 | textField_3.setColumns(10); 218 | 219 | JButton button_1 = new JButton("添加报修"); 220 | button_1.addActionListener(new ActionListener() { 221 | public void actionPerformed(ActionEvent e) { 222 | 223 | try { 224 | insetItemMa(); 225 | } catch (DataBaseException e1) { 226 | // TODO Auto-generated catch block 227 | //e1.printStackTrace(); 228 | JOptionPane.showMessageDialog(jframe, "添加失败" , "系统信息", JOptionPane.WARNING_MESSAGE); 229 | } 230 | JOptionPane.showMessageDialog(jframe,"添加成功" , "系统信息", JOptionPane.WARNING_MESSAGE); 231 | 232 | } 233 | }); 234 | button_1.setBounds(119, 525, 93, 23); 235 | add(button_1); 236 | 237 | 238 | 239 | button_2 = new JButton("刷新"); 240 | button_2.addActionListener(new ActionListener() { 241 | public void actionPerformed(ActionEvent e) { 242 | 243 | try { 244 | showInfo(); 245 | } catch (DataBaseException | QueryResultIsNullException e1) { 246 | // TODO Auto-generated catch block 247 | //e1.printStackTrace(); 248 | JOptionPane.showMessageDialog(jframe, "刷新失败" , "系统信息", JOptionPane.WARNING_MESSAGE); 249 | } 250 | } 251 | }); 252 | button_2.setBounds(571, 467, 93, 23); 253 | add(button_2); 254 | 255 | 256 | ImageIcon image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 257 | labImage = new JLabel(image); 258 | labImage.setBounds(0, 0, 800, 600); 259 | add(labImage); 260 | this.setOpaque(false); 261 | 262 | } 263 | 264 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 265 | // System.out.println(student.getMaintenanceRecord()); 266 | defaultTableModel.setDataVector(student.getMaintenanceRecord(), headVector); 267 | } 268 | 269 | 270 | public Vector getItem() throws DataBaseException{ 271 | 272 | return student.getItem(); 273 | } 274 | 275 | public boolean insetItemMa() throws DataBaseException{ 276 | String item, rmark, bedNum, dormId, id, roomId; 277 | id = student.getId(); 278 | dormId = student.getDormID(); 279 | roomId = student.getRoomID(); 280 | bedNum = student.getBedNum(); 281 | rmark = textField_3.getText(); 282 | String itemId; 283 | 284 | itemId = comboBox.getSelectedItem().toString(); 285 | 286 | if(itemId.compareTo("9") <= 0 ){ 287 | itemId = "0"+itemId; 288 | } 289 | //System.out.println(itemId); 290 | 291 | //System.out.println(itemId); 292 | 293 | return student.insertItemMa(id, dormId, roomId, bedNum, itemId, rmark); 294 | } 295 | 296 | } 297 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/StuInfo.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import javax.swing.JOptionPane; 4 | import javax.swing.JPanel; 5 | import javax.swing.JLabel; 6 | import javax.swing.JTextField; 7 | import javax.swing.JButton; 8 | import javax.swing.JRadioButton; 9 | import java.awt.Font; 10 | import javax.swing.*; 11 | import com.zhbit.entity.*; 12 | import java.awt.Color; 13 | import com.zhbit.excetion.*; 14 | import com.zhbit.form.UpdatePersonalInfoForm; 15 | 16 | import java.awt.event.ActionListener; 17 | import java.awt.event.ActionEvent; 18 | 19 | public class StuInfo extends JPanel { 20 | private JTextField txtSID; 21 | private JTextField txtHome; 22 | private JTextField txtMajor; 23 | private JTextField txtSDorm; 24 | private JTextField txtCollege; 25 | private JTextField txtClass; 26 | private JTextField txtSPhone; 27 | private JTextField txtETime; 28 | private JTextField txtSName; 29 | private JRadioButton radWoman; 30 | private JRadioButton radMan; 31 | private JButton butAlter; 32 | private JButton butSava; 33 | private JLabel labImage; 34 | private ImageIcon image; 35 | private String STUDENT_ID; 36 | private Student student = null; 37 | private final ButtonGroup butGroup_Sex = new ButtonGroup(); 38 | /** 39 | * Create the panel. 40 | */ 41 | // public StuInfo (){ 42 | // 43 | // } 44 | 45 | public StuInfo(Student s) { 46 | this.student = s; 47 | setLayout(null); 48 | setSize(800,600); 49 | 50 | JLabel labSID = new JLabel("学 号"); 51 | labSID.setFont(new Font("宋体", Font.PLAIN, 14)); 52 | labSID.setBounds(139, 89, 62, 34); 53 | add(labSID); 54 | 55 | txtSID = new JTextField(); 56 | txtSID.setFont(new Font("宋体", Font.PLAIN, 14)); 57 | txtSID.setBounds(205, 95, 121, 23); 58 | add(txtSID); 59 | txtSID.setColumns(10); 60 | 61 | JLabel labSName = new JLabel("姓 名"); 62 | labSName.setFont(new Font("宋体", Font.PLAIN, 14)); 63 | labSName.setBounds(456, 89, 54, 34); 64 | add(labSName); 65 | 66 | txtSName = new JTextField(); 67 | txtSName.setFont(new Font("宋体", Font.PLAIN, 14)); 68 | txtSName.setBounds(520, 96, 121, 23); 69 | add(txtSName); 70 | txtSName.setColumns(10); 71 | 72 | JLabel labSex = new JLabel("性 别"); 73 | labSex.setFont(new Font("宋体", Font.PLAIN, 14)); 74 | labSex.setBounds(139, 157, 54, 15); 75 | add(labSex); 76 | 77 | radWoman = new JRadioButton("女"); 78 | butGroup_Sex.add(radWoman); 79 | radWoman.setFont(new Font("宋体", Font.PLAIN, 14)); 80 | radWoman.setBounds(265, 153, 47, 23); 81 | add(radWoman); 82 | 83 | radMan = new JRadioButton("男"); 84 | butGroup_Sex.add(radMan); 85 | radMan.setFont(new Font("宋体", Font.PLAIN, 14)); 86 | radMan.setBounds(216, 153, 47, 23); 87 | add(radMan); 88 | 89 | JLabel labSDorm = new JLabel("宿 舍 号"); 90 | labSDorm.setFont(new Font("宋体", Font.PLAIN, 14)); 91 | labSDorm.setBounds(454, 389, 56, 15); 92 | add(labSDorm); 93 | 94 | txtSDorm = new JTextField(); 95 | txtSDorm.setFont(new Font("宋体", Font.PLAIN, 14)); 96 | txtSDorm.setBounds(520, 385, 121, 23); 97 | add(txtSDorm); 98 | txtSDorm.setColumns(10); 99 | 100 | JLabel labCollege = new JLabel("学 院"); 101 | labCollege.setFont(new Font("宋体", Font.PLAIN, 14)); 102 | labCollege.setBounds(139, 329, 62, 15); 103 | add(labCollege); 104 | 105 | txtCollege = new JTextField(); 106 | txtCollege.setFont(new Font("宋体", Font.PLAIN, 14)); 107 | txtCollege.setBounds(205, 325, 121, 23); 108 | add(txtCollege); 109 | txtCollege.setColumns(10); 110 | 111 | JLabel labClass = new JLabel("班 级"); 112 | labClass.setFont(new Font("宋体", Font.PLAIN, 14)); 113 | labClass.setBounds(139, 391, 62, 15); 114 | add(labClass); 115 | 116 | txtClass = new JTextField(); 117 | txtClass.setFont(new Font("宋体", Font.PLAIN, 14)); 118 | txtClass.setBounds(205, 385, 121, 23); 119 | add(txtClass); 120 | txtClass.setColumns(10); 121 | 122 | JLabel labPhone = new JLabel("电 话"); 123 | labPhone.setFont(new Font("宋体", Font.PLAIN, 14)); 124 | labPhone.setBounds(139, 214, 54, 15); 125 | add(labPhone); 126 | 127 | txtSPhone = new JTextField(); 128 | txtSPhone.setFont(new Font("宋体", Font.PLAIN, 14)); 129 | txtSPhone.setBounds(205, 210, 121, 23); 130 | add(txtSPhone); 131 | txtSPhone.setColumns(10); 132 | 133 | JLabel labHome = new JLabel("籍 贯"); 134 | labHome.setForeground(Color.BLACK); 135 | labHome.setFont(new Font("宋体", Font.PLAIN, 14)); 136 | labHome.setBounds(456, 163, 54, 15); 137 | add(labHome); 138 | 139 | txtHome = new JTextField(); 140 | txtHome.setFont(new Font("宋体", Font.PLAIN, 14)); 141 | txtHome.setBounds(520, 159, 121, 23); 142 | add(txtHome); 143 | txtHome.setColumns(10); 144 | 145 | JLabel labMajor = new JLabel("专 业"); 146 | labMajor.setFont(new Font("宋体", Font.PLAIN, 14)); 147 | labMajor.setBounds(456, 325, 62, 15); 148 | add(labMajor); 149 | 150 | txtMajor = new JTextField(); 151 | txtMajor.setFont(new Font("宋体", Font.PLAIN, 14)); 152 | txtMajor.setBounds(520, 321, 121, 23); 153 | add(txtMajor); 154 | txtMajor.setColumns(10); 155 | 156 | JLabel labETime = new JLabel("入校日期"); 157 | labETime.setFont(new Font("宋体", Font.PLAIN, 14)); 158 | labETime.setBounds(139, 444, 62, 18); 159 | add(labETime); 160 | 161 | txtETime = new JTextField(); 162 | txtETime.setFont(new Font("宋体", Font.PLAIN, 14)); 163 | txtETime.setBounds(205, 442, 121, 23); 164 | add(txtETime); 165 | txtETime.setColumns(10); 166 | 167 | JLabel labjiben = new JLabel("基本信息:"); 168 | labjiben.setFont(new Font("宋体", Font.PLAIN, 16)); 169 | labjiben.setBounds(95, 38, 88, 15); 170 | add(labjiben); 171 | 172 | JLabel labxueye = new JLabel("学业信息:"); 173 | labxueye.setFont(new Font("宋体", Font.PLAIN, 16)); 174 | labxueye.setBounds(95, 272, 88, 15); 175 | add(labxueye); 176 | 177 | 178 | butAlter = new JButton("修改"); 179 | butAlter.addActionListener(new ActionListener() { 180 | public void actionPerformed(ActionEvent e) { 181 | Editable(true); 182 | } 183 | }); 184 | butAlter.setFont(new Font("华文楷体", Font.PLAIN, 15)); 185 | butAlter.setBounds(490, 493, 70, 34); 186 | add(butAlter); 187 | 188 | butSava = new JButton("保存"); 189 | butSava.addActionListener(new ActionListener() { 190 | public void actionPerformed(ActionEvent e) { 191 | UpdatePersonalInfoForm studentPersonalForm = new UpdatePersonalInfoForm(); 192 | if((!student.getHome().equals(txtHome.getText().trim()))&&!(student.getPhone().equals(txtHome.getText().trim()))){ 193 | try { 194 | studentPersonalForm.setHome(txtHome.getText()); 195 | studentPersonalForm.setPhone(txtSPhone.getText()); 196 | student.UpdatePersonalInfo(studentPersonalForm); 197 | } catch (UpdateDataException e1) { 198 | // TODO 自动生成的 catch 块 199 | //e1.printStackTrace(); 200 | JOptionPane.showMessageDialog(null,"数据库更新失败,修改失败", "系统信息", JOptionPane.WARNING_MESSAGE); 201 | } catch (DataBaseException e1) { 202 | // TODO 自动生成的 catch 块 203 | //e1.printStackTrace(); 204 | JOptionPane.showMessageDialog(null,"数据库错误,修改失败", "系统信息", JOptionPane.WARNING_MESSAGE); 205 | } 206 | 207 | JOptionPane.showMessageDialog(null,"修改成功", "系统信息", JOptionPane.WARNING_MESSAGE); 208 | Editable(false); 209 | }else{ 210 | JOptionPane.showMessageDialog(null,"您没有修改任何内容", "系统信息", JOptionPane.WARNING_MESSAGE); 211 | Editable(false); 212 | } 213 | } 214 | }); 215 | butSava.setFont(new Font("华文楷体", Font.PLAIN, 15)); 216 | butSava.setBounds(571, 493, 70, 34); 217 | add(butSava); 218 | 219 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 220 | labImage = new JLabel(image); 221 | labImage.setBounds(0, 0, 800, 600); 222 | add(labImage); 223 | 224 | this.setOpaque(false); 225 | } 226 | 227 | public void showInfo() throws DataBaseException, QueryResultIsNullException{ 228 | Editable(false); 229 | txtSID.setText(student.getId()); 230 | txtSName.setText(student.getName()); 231 | if(student.getSex().equals("女")){ 232 | radWoman.setSelected(true); 233 | }else { 234 | radMan.setSelected(true); 235 | } 236 | txtHome.setText(student.getHome()); 237 | txtSPhone.setText(student.getPhone()); 238 | 239 | txtCollege.setText(student.getCollege()); 240 | txtMajor.setText(student.getMajor()); 241 | txtClass.setText(student.getClassNumber()); 242 | txtETime.setText(student.getStuETime()); 243 | txtSDorm.setText(student.getDormID()+"-"+student.getRoomID()); 244 | } 245 | 246 | private void Editable(boolean statue){ 247 | butSava.setEnabled(statue); 248 | butAlter.setEnabled(!statue); 249 | radWoman.setEnabled(false); 250 | radMan.setEnabled(false); 251 | txtSID.setEditable(false); 252 | txtSName.setEditable(false); 253 | txtHome.setEditable(statue); 254 | txtSPhone.setEditable(statue); 255 | txtCollege.setEditable(false); 256 | txtMajor.setEditable(false); 257 | txtClass.setEditable(false); 258 | txtETime.setEditable(false); 259 | txtSDorm.setEditable(false); 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/StuPassword.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import javax.swing.ImageIcon; 4 | import javax.swing.JPanel; 5 | import javax.swing.JLabel; 6 | import javax.swing.JTextField; 7 | import javax.swing.JButton; 8 | import java.awt.Font; 9 | import java.awt.FlowLayout; 10 | import javax.swing.JPasswordField; 11 | import com.zhbit.entity.*; 12 | 13 | public class StuPassword extends JPanel { 14 | private JPasswordField passwordField; 15 | private JPasswordField passwordField_1; 16 | private JPasswordField passwordField_2; 17 | private JLabel labImage; 18 | private String STUDENT_ID; 19 | private ImageIcon image; 20 | private Student student; 21 | /** 22 | * Create the panel. 23 | */ 24 | public StuPassword() 25 | { 26 | } 27 | public StuPassword(Student s) { 28 | this.student = s; 29 | setSize(800,600); 30 | setLayout(null); 31 | 32 | JLabel labjiumima = new JLabel("旧 密 码"); 33 | labjiumima.setFont(new Font("宋体", Font.PLAIN, 16)); 34 | labjiumima.setBounds(168, 111, 87, 34); 35 | add(labjiumima); 36 | 37 | passwordField = new JPasswordField(); 38 | passwordField.setBounds(264, 111, 198, 29); 39 | add(passwordField); 40 | 41 | JLabel labxinmima = new JLabel("新 密 码"); 42 | labxinmima.setFont(new Font("宋体", Font.PLAIN, 16)); 43 | labxinmima.setBounds(168, 204, 80, 15); 44 | add(labxinmima); 45 | 46 | passwordField_1 = new JPasswordField(); 47 | passwordField_1.setBounds(265, 193, 198, 29); 48 | add(passwordField_1); 49 | 50 | JLabel labqueren = new JLabel("确定密码"); 51 | labqueren.setFont(new Font("宋体", Font.PLAIN, 16)); 52 | labqueren.setBounds(168, 289, 80, 15); 53 | add(labqueren); 54 | 55 | passwordField_2 = new JPasswordField(); 56 | passwordField_2.setBounds(264, 278, 198, 29); 57 | add(passwordField_2); 58 | 59 | JButton buttonqueding = new JButton("确定"); 60 | buttonqueding.setFont(new Font("宋体", Font.PLAIN, 15)); 61 | buttonqueding.setBounds(344, 488, 93, 34); 62 | add(buttonqueding); 63 | 64 | JButton buttonchongzhi = new JButton("重置"); 65 | buttonchongzhi.setFont(new Font("宋体", Font.PLAIN, 15)); 66 | buttonchongzhi.setBounds(493, 488, 93, 34); 67 | add(buttonchongzhi); 68 | 69 | image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 70 | labImage = new JLabel(image); 71 | labImage.setBounds(0, 0, 800, 600); 72 | add(labImage); 73 | 74 | this.setOpaque(false); 75 | 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/com/zhbit/stuUI/shelpText.java: -------------------------------------------------------------------------------- 1 | package com.zhbit.stuUI; 2 | 3 | import javax.swing.ImageIcon; 4 | import javax.swing.JPanel; 5 | import javax.swing.JScrollPane; 6 | import javax.swing.JTextField; 7 | import javax.swing.JTextArea; 8 | import javax.swing.JTextPane; 9 | import javax.swing.JEditorPane; 10 | import javax.swing.JLabel; 11 | 12 | public class shelpText extends JPanel { 13 | 14 | ImageIcon image; 15 | JLabel labImage; 16 | 17 | /** 18 | * Create the panel. 19 | */ 20 | public shelpText() { 21 | setSize(800,600); 22 | setLayout(null); 23 | 24 | JLabel lblNewLabel = new JLabel("一、用户管理"); 25 | lblNewLabel.setBounds(91, -27, 153, 27); 26 | add(lblNewLabel); 27 | 28 | JLabel label = new JLabel("1、学生信息管理"); 29 | label.setBounds(102, 97, 153, 27); 30 | add(label); 31 | 32 | JLabel label_1 = new JLabel("点击修改便可修改自己的手机号码和籍贯"); 33 | label_1.setBounds(111, 119, 216, 27); 34 | add(label_1); 35 | 36 | JLabel label_2 = new JLabel("2、修改密码"); 37 | label_2.setBounds(101, 145, 216, 27); 38 | add(label_2); 39 | 40 | JLabel label_3 = new JLabel("输入旧新密码便可修改"); 41 | label_3.setBounds(111, 170, 216, 27); 42 | add(label_3); 43 | 44 | JLabel label_4 = new JLabel("二、信息查询"); 45 | label_4.setBounds(91, 197, 216, 27); 46 | add(label_4); 47 | 48 | JLabel label_5 = new JLabel("1、维修信息"); 49 | label_5.setBounds(101, 223, 216, 27); 50 | add(label_5); 51 | 52 | JLabel label_6 = new JLabel("表格如果想看后面被挡住的信息,可以拉动下面的滚动条,也可以在用鼠标放在列与列"); 53 | label_6.setBounds(111, 250, 464, 27); 54 | add(label_6); 55 | 56 | JLabel label_7 = new JLabel("查询快件:点击“只显示未领取快递”便可仅仅显示未领取的快递消息;若查询快递公司,"); 57 | label_7.setBounds(111, 451, 484, 27); 58 | add(label_7); 59 | 60 | JLabel label_8 = new JLabel("之间调节列距。下面的文本框可以输入任何列的内容,点击查询按钮便可显示相应的消息。"); 61 | label_8.setBounds(91, 274, 488, 27); 62 | add(label_8); 63 | 64 | JLabel label_9 = new JLabel("“只显示未维修”便可仅仅显示未维修的消息。下面的下拉框是物品报修的物品,选择"); 65 | label_9.setBounds(111, 300, 488, 27); 66 | add(label_9); 67 | 68 | JLabel label_10 = new JLabel("要报修的物品,填写备注,点击“添加报修”按钮,点击“刷新”按钮,便可看到自己刚才"); 69 | label_10.setBounds(91, 326, 488, 27); 70 | add(label_10); 71 | 72 | JLabel label_11 = new JLabel("报修的信息。"); 73 | label_11.setBounds(91, 351, 488, 27); 74 | add(label_11); 75 | 76 | JLabel label_12 = new JLabel("表格的显示跟维修信息一样。"); 77 | label_12.setBounds(111, 401, 488, 27); 78 | add(label_12); 79 | 80 | JLabel label_13 = new JLabel("2、快递信息"); 81 | label_13.setBounds(101, 376, 216, 27); 82 | add(label_13); 83 | 84 | JLabel label_14 = new JLabel("签收快件:在日期旁边的文本框填上日期点击签收便可签收快件。"); 85 | label_14.setBounds(111, 427, 488, 27); 86 | add(label_14); 87 | 88 | JLabel label_15 = new JLabel("可以不写全名,后点击查询;若查询日期,需输入月-日的格式,后点击查询;若通过记录号,"); 89 | label_15.setBounds(91, 476, 504, 27); 90 | add(label_15); 91 | 92 | JLabel label_16 = new JLabel("则直接输入记录号后点击查询。"); 93 | label_16.setBounds(91, 502, 504, 27); 94 | add(label_16); 95 | 96 | JLabel label_17 = new JLabel("一、用户管理"); 97 | label_17.setBounds(91, 73, 216, 27); 98 | add(label_17); 99 | 100 | ImageIcon image = new ImageIcon("src\\bigImage\\背景界面.jpg"); 101 | labImage = new JLabel(image); 102 | labImage.setBounds(0, 0, 800, 600); 103 | add(labImage); 104 | 105 | 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/jdbc.properties: -------------------------------------------------------------------------------- 1 | #sql server JDBC properties 2 | #1433 port DatabaseName=Lib Lib 数据库名称 3 | jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver 4 | jdbc.url=jdbc:sqlserver://localhost:1433;DatabaseName=DMSystem 5 | jdbc.username=sa 6 | jdbc.password= --------------------------------------------------------------------------------