当前位置: 首页 > wzjs >正文

网站怎么自适应屏幕大小淘宝客的优惠卷网站怎么做的

网站怎么自适应屏幕大小,淘宝客的优惠卷网站怎么做的,北京和隆优化招聘,怎么做网页长图JAVASQL办公自动化系统 一、系统概述 本办公自动化系统采用Java Swing开发桌面应用,结合SQL Server数据库实现文档管理、流程审批、日程安排等核心功能。系统采用MVC架构模式,实现了模块化开发与维护,支持多用户协同办公。 二、系统架构设…

JAVA+SQL办公自动化系统

一、系统概述

本办公自动化系统采用Java Swing开发桌面应用,结合SQL Server数据库实现文档管理、流程审批、日程安排等核心功能。系统采用MVC架构模式,实现了模块化开发与维护,支持多用户协同办公。

二、系统架构设计

1. 技术选型

  • 前端:Java Swing
  • 后端:Java SE
  • 数据库:SQL Server 2019
  • 数据访问:JDBC
  • 开发工具:IntelliJ IDEA

2. 系统架构

├── src
│   ├── main
│   │   ├── java
│   │   │   └── com
│   │   │       └── office
│   │   │           ├── controller (控制器层)
│   │   │           ├── model (模型层)
│   │   │           ├── view (视图层)
│   │   │           ├── dao (数据访问层)
│   │   │           └── utils (工具类)
│   │   └── resources
│   │       └── db.properties (数据库配置)

三、核心代码实现

1. 数据库连接工具类

// DBConnectionUtil.java
public class DBConnectionUtil {private static Connection connection;private static final String URL;private static final String USERNAME;private static final String PASSWORD;private static final String DRIVER;static {try {Properties properties = new Properties();InputStream inputStream = DBConnectionUtil.class.getClassLoader().getResourceAsStream("db.properties");properties.load(inputStream);URL = properties.getProperty("url");USERNAME = properties.getProperty("username");PASSWORD = properties.getProperty("password");DRIVER = properties.getProperty("driver");Class.forName(DRIVER);} catch (Exception e) {throw new ExceptionInInitializerError(e);}}public static Connection getConnection() throws SQLException {if (connection == null || connection.isClosed()) {connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);}return connection;}public static void close(Connection conn, Statement stmt, ResultSet rs) {try {if (rs != null) rs.close();if (stmt != null) stmt.close();if (conn != null) conn.close();} catch (SQLException e) {e.printStackTrace();}}
}

2. 用户管理模块

// User.java
public class User {private int id;private String username;private String password;private String realName;private String department;private String role;private Date createTime;// getters and setters
}// UserDAO.java
public class UserDAO {public User login(String username, String password) {User user = null;Connection conn = null;PreparedStatement stmt = null;ResultSet rs = null;try {conn = DBConnectionUtil.getConnection();String sql = "SELECT * FROM users WHERE username = ? AND password = ?";stmt = conn.prepareStatement(sql);stmt.setString(1, username);stmt.setString(2, password);rs = stmt.executeQuery();if (rs.next()) {user = new User();user.setId(rs.getInt("id"));user.setUsername(rs.getString("username"));user.setRealName(rs.getString("realName"));user.setDepartment(rs.getString("department"));user.setRole(rs.getString("role"));user.setCreateTime(rs.getDate("createTime"));}} catch (SQLException e) {e.printStackTrace();} finally {DBConnectionUtil.close(conn, stmt, rs);}return user;}public List<User> getAllUsers() {List<User> users = new ArrayList<>();Connection conn = null;Statement stmt = null;ResultSet rs = null;try {conn = DBConnectionUtil.getConnection();String sql = "SELECT * FROM users";stmt = conn.createStatement();rs = stmt.executeQuery(sql);while (rs.next()) {User user = new User();user.setId(rs.getInt("id"));user.setUsername(rs.getString("username"));user.setRealName(rs.getString("realName"));user.setDepartment(rs.getString("department"));user.setRole(rs.getString("role"));user.setCreateTime(rs.getDate("createTime"));users.add(user);}} catch (SQLException e) {e.printStackTrace();} finally {DBConnectionUtil.close(conn, stmt, rs);}return users;}
}

3. 文档管理模块

// Document.java
public class Document {private int id;private String title;private String content;private String author;private Date createTime;private String category;private String status;// getters and setters
}// DocumentDAO.java
public class DocumentDAO {public boolean addDocument(Document document) {Connection conn = null;PreparedStatement stmt = null;try {conn = DBConnectionUtil.getConnection();String sql = "INSERT INTO documents (title, content, author, createTime, category, status) " +"VALUES (?, ?, ?, ?, ?, ?)";stmt = conn.prepareStatement(sql);stmt.setString(1, document.getTitle());stmt.setString(2, document.getContent());stmt.setString(3, document.getAuthor());stmt.setTimestamp(4, new Timestamp(document.getCreateTime().getTime()));stmt.setString(5, document.getCategory());stmt.setString(6, document.getStatus());int rows = stmt.executeUpdate();return rows > 0;} catch (SQLException e) {e.printStackTrace();return false;} finally {DBConnectionUtil.close(conn, stmt, null);}}public List<Document> searchDocuments(String keyword) {List<Document> documents = new ArrayList<>();Connection conn = null;PreparedStatement stmt = null;ResultSet rs = null;try {conn = DBConnectionUtil.getConnection();String sql = "SELECT * FROM documents WHERE title LIKE ? OR content LIKE ?";stmt = conn.prepareStatement(sql);stmt.setString(1, "%" + keyword + "%");stmt.setString(2, "%" + keyword + "%");rs = stmt.executeQuery();while (rs.next()) {Document document = new Document();document.setId(rs.getInt("id"));document.setTitle(rs.getString("title"));document.setContent(rs.getString("content"));document.setAuthor(rs.getString("author"));document.setCreateTime(rs.getTimestamp("createTime"));document.setCategory(rs.getString("category"));document.setStatus(rs.getString("status"));documents.add(document);}} catch (SQLException e) {e.printStackTrace();} finally {DBConnectionUtil.close(conn, stmt, rs);}return documents;}
}

4. 流程审批模块

// ApprovalFlow.java
public class ApprovalFlow {private int id;private String flowName;private String applicant;private Date applyTime;private String status;private String content;private String currentApprover;// getters and setters
}// ApprovalFlowDAO.java
public class ApprovalFlowDAO {public List<ApprovalFlow> getPendingApprovals(String approver) {List<ApprovalFlow> flows = new ArrayList<>();Connection conn = null;PreparedStatement stmt = null;ResultSet rs = null;try {conn = DBConnectionUtil.getConnection();String sql = "SELECT * FROM approval_flows WHERE currentApprover = ? AND status = 'pending'";stmt = conn.prepareStatement(sql);stmt.setString(1, approver);rs = stmt.executeQuery();while (rs.next()) {ApprovalFlow flow = new ApprovalFlow();flow.setId(rs.getInt("id"));flow.setFlowName(rs.getString("flowName"));flow.setApplicant(rs.getString("applicant"));flow.setApplyTime(rs.getDate("applyTime"));flow.setStatus(rs.getString("status"));flow.setContent(rs.getString("content"));flow.setCurrentApprover(rs.getString("currentApprover"));flows.add(flow);}} catch (SQLException e) {e.printStackTrace();} finally {DBConnectionUtil.close(conn, stmt, rs);}return flows;}public boolean approveFlow(int flowId, String approver, boolean approved, String comments) {Connection conn = null;PreparedStatement stmt = null;try {conn = DBConnectionUtil.getConnection();conn.setAutoCommit(false);// 更新流程状态String updateSql = "UPDATE approval_flows SET status = ?, comments = ?, currentApprover = ?, updateTime = GETDATE() " +"WHERE id = ? AND currentApprover = ?";stmt = conn.prepareStatement(updateSql);stmt.setString(1, approved ? "approved" : "rejected");stmt.setString(2, comments);stmt.setString(3, "");stmt.setInt(4, flowId);stmt.setString(5, approver);int rows = stmt.executeUpdate();if (rows > 0) {// 记录审批历史String historySql = "INSERT INTO approval_history (flowId, approver, approvalTime, status, comments) " +"VALUES (?, ?, GETDATE(), ?, ?)";stmt = conn.prepareStatement(historySql);stmt.setInt(1, flowId);stmt.setString(2, approver);stmt.setString(3, approved ? "approved" : "rejected");stmt.setString(4, comments);stmt.executeUpdate();conn.commit();return true;} else {conn.rollback();return false;}} catch (SQLException e) {e.printStackTrace();try {conn.rollback();} catch (SQLException ex) {ex.printStackTrace();}return false;} finally {try {conn.setAutoCommit(true);} catch (SQLException e) {e.printStackTrace();}DBConnectionUtil.close(conn, stmt, null);}}
}

四、系统界面设计

1. 登录界面

// LoginFrame.java
public class LoginFrame extends JFrame {private JTextField usernameField;private JPasswordField passwordField;private UserDAO userDAO = new UserDAO();public LoginFrame() {setTitle("办公自动化系统 - 登录");setSize(400, 300);setDefaultCloseOperation(EXIT_ON_CLOSE);setLocationRelativeTo(null);JPanel panel = new JPanel();panel.setLayout(new GridLayout(4, 2, 10, 10));add(panel, BorderLayout.CENTER);JLabel usernameLabel = new JLabel("用户名:");usernameField = new JTextField();JLabel passwordLabel = new JLabel("密码:");passwordField = new JPasswordField();JButton loginButton = new JButton("登录");loginButton.addActionListener(e -> login());JButton resetButton = new JButton("重置");resetButton.addActionListener(e -> {usernameField.setText("");passwordField.setText("");});panel.add(usernameLabel);panel.add(usernameField);panel.add(passwordLabel);panel.add(passwordField);panel.add(new JLabel()); // 占位panel.add(new JLabel()); // 占位panel.add(loginButton);panel.add(resetButton);}private void login() {String username = usernameField.getText();String password = new String(passwordField.getPassword());User user = userDAO.login(username, password);if (user != null) {JOptionPane.showMessageDialog(this, "登录成功");dispose();new MainFrame(user).setVisible(true);} else {JOptionPane.showMessageDialog(this, "用户名或密码错误", "登录失败", JOptionPane.ERROR_MESSAGE);}}public static void main(String[] args) {SwingUtilities.invokeLater(() -> new LoginFrame().setVisible(true));}
}

2. 主界面

// MainFrame.java
public class MainFrame extends JFrame {private User currentUser;private JTabbedPane tabbedPane;public MainFrame(User user) {this.currentUser = user;setTitle("办公自动化系统 - " + user.getRealName());setSize(1000, 700);setDefaultCloseOperation(EXIT_ON_CLOSE);setLocationRelativeTo(null);initComponents();}private void initComponents() {// 菜单栏JMenuBar menuBar = new JMenuBar();JMenu systemMenu = new JMenu("系统");JMenuItem logoutItem = new JMenuItem("退出登录");logoutItem.addActionListener(e -> logout());systemMenu.add(logoutItem);JMenu documentMenu = new JMenu("文档管理");JMenuItem addDocItem = new JMenuItem("新建文档");JMenuItem manageDocItem = new JMenuItem("文档列表");documentMenu.add(addDocItem);documentMenu.add(manageDocItem);JMenu approvalMenu = new JMenu("流程审批");JMenuItem submitFlowItem = new JMenuItem("提交申请");JMenuItem pendingApprovalsItem = new JMenuItem("待审批");JMenuItem approvalHistoryItem = new JMenuItem("审批历史");approvalMenu.add(submitFlowItem);approvalMenu.add(pendingApprovalsItem);approvalMenu.add(approvalHistoryItem);menuBar.add(systemMenu);menuBar.add(documentMenu);menuBar.add(approvalMenu);setJMenuBar(menuBar);// 标签页tabbedPane = new JTabbedPane();add(tabbedPane, BorderLayout.CENTER);// 根据用户角色显示不同的初始页面if ("admin".equals(currentUser.getRole())) {tabbedPane.addTab("用户管理", new UserManagementPanel());}tabbedPane.addTab("文档管理", new DocumentManagementPanel());tabbedPane.addTab("我的申请", new MyApplicationsPanel(currentUser.getUsername()));tabbedPane.addTab("待我审批", new PendingApprovalsPanel(currentUser.getUsername()));}private void logout() {if (JOptionPane.showConfirmDialog(this, "确定要退出登录吗?", "确认", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {dispose();new LoginFrame().setVisible(true);}}
}

五、系统部署与测试

1. 环境要求

  • JDK 1.8+
  • SQL Server 2017+
  • JDBC驱动:mssql-jdbc-10.2.1.jre8.jar

2. 部署步骤

  1. 创建SQL Server数据库并执行建表脚本
  2. 配置db.properties中的数据库连接信息
  3. 使用Maven或IDE打包项目
  4. 运行程序:java -jar office-automation.jar

3. 测试用例

// UserDAOTest.java
public class UserDAOTest {private UserDAO userDAO = new UserDAO();@Testpublic void testLogin() {User user = userDAO.login("admin", "admin123");assertNotNull(user);assertEquals("管理员", user.getRealName());}@Testpublic void testGetAllUsers() {List<User> users = userDAO.getAllUsers();assertTrue(users.size() > 0);}
}// DocumentDAOTest.java
public class DocumentDAOTest {private DocumentDAO documentDAO = new DocumentDAO();@Testpublic void testAddDocument() {Document document = new Document();document.setTitle("测试文档");document.setContent("这是一篇测试文档内容");document.setAuthor("testuser");document.setCreateTime(new Date());document.setCategory("技术文档");document.setStatus("active");boolean result = documentDAO.addDocument(document);assertTrue(result);}@Testpublic void testSearchDocuments() {List<Document> documents = documentDAO.searchDocuments("测试");assertTrue(documents.size() > 0);}
}

六、毕业设计文档框架

1. 论文框架

  1. 引言
  2. 相关技术综述
  3. 系统需求分析
  4. 系统设计
  5. 系统实现
  6. 系统测试
  7. 总结与展望

2. 外文翻译

  • 选择一篇与办公自动化系统相关的外文文献
  • 翻译内容包括:摘要、引言、核心技术部分、结论
  • 翻译字数建议在3000-5000字

七、总结

本系统实现了办公自动化的核心功能,采用Java+SQL Server技术栈,具有良好的可扩展性和维护性。系统提供了友好的用户界面和完善的功能模块,可满足中小型企业的日常办公需求。


文章转载自:

http://kSrZEmEo.yqpck.cn
http://DJqpFoyo.yqpck.cn
http://eoLDKMX8.yqpck.cn
http://is6g5qQ6.yqpck.cn
http://8b3EVqJ1.yqpck.cn
http://bSF4xJMy.yqpck.cn
http://grvQl4b1.yqpck.cn
http://GZNOUHlz.yqpck.cn
http://RA90Tpnh.yqpck.cn
http://1LBHfMSY.yqpck.cn
http://ts5CugFa.yqpck.cn
http://UCP5ANhE.yqpck.cn
http://dy9pFt3U.yqpck.cn
http://ewMKFzgg.yqpck.cn
http://W2m72vKl.yqpck.cn
http://8g215IZn.yqpck.cn
http://xrd7jpVt.yqpck.cn
http://lxKPy6sN.yqpck.cn
http://WZmKOS6S.yqpck.cn
http://yAnljSk1.yqpck.cn
http://ZlylddPT.yqpck.cn
http://XblRSk0E.yqpck.cn
http://sh5gaAtU.yqpck.cn
http://KQNjUKYy.yqpck.cn
http://kz6KcjxW.yqpck.cn
http://llxhIr4h.yqpck.cn
http://yNGX89Hl.yqpck.cn
http://21Fqc8W2.yqpck.cn
http://MBJnCd5m.yqpck.cn
http://KIyW5XB0.yqpck.cn
http://www.dtcms.com/wzjs/729763.html

相关文章:

  • 长春做网站外包免费简历制作app
  • 方一凡和磊儿做家教的网站安庆网络推广和竞价
  • vue做网站cms龙口网页定制
  • 翻页大图网站苏州软件定制开发
  • 山东省个人网站备案对网络营销的认识有哪些
  • 网站建设兼职工资微信应用平台开发
  • wordpress公众号获验证码seo初学教程
  • 医院网站建设计划简述网站开发的几个步骤
  • 网站建设费税率ftp备份网站
  • 建站公司网站社区中立建设集团有限公司网站
  • 优秀企业网站模板百度浏览器官网在线使用
  • 5 网站建设的基本步骤是网页qq无法使用快捷登录
  • 织梦网站怎样做防护win10 wordpress
  • 有关师德建设的网站团队建设网站
  • 做网站千篇一律百度查重免费
  • dede增加手机网站sae 网站模板
  • 东阳厂家高端网站设计网站建设条例
  • 东莞专业建网站网站代理浏览器一
  • 站长工具精品网站建设的目标用户是
  • 外贸网站设计注意事项商城网站建设方案电子版
  • 中英网站建设主机屋网站在那注册
  • 云脑网络科技网站建设开源的网站建设平台
  • 毕业网站设计天津做网站推广的网站
  • 做ic的电子网站有哪些七夕表白网站制作
  • 网站建设的公司资质一个备案可以做几个网站
  • 自己做的网站怎么接入数据库wordpress更改站点名称
  • 宿州网站制作网页专题设计
  • 哪个网站可以做一对一老师聊城网站制作
  • 西安网站建设设计公司招标网公告
  • 有什么网站可以免费搭建网址导视设计调研报告