diff --git a/lib/Dm7-18-Jdbc.jar b/lib/Dm7-18-Jdbc.jar
new file mode 100644
index 0000000..3b374d8
Binary files /dev/null and b/lib/Dm7-18-Jdbc.jar differ
diff --git a/lib/kingbase8-8.6.0.jar b/lib/kingbase8-8.6.0.jar
new file mode 100644
index 0000000..8c8ac4d
Binary files /dev/null and b/lib/kingbase8-8.6.0.jar differ
diff --git a/lib/oscarJDBC16.jar b/lib/oscarJDBC16.jar
new file mode 100644
index 0000000..a289a9f
Binary files /dev/null and b/lib/oscarJDBC16.jar differ
diff --git a/pom.xml b/pom.xml
index 3af1621..a6827a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -144,6 +144,43 @@
1.6.5.132
+
+
+ com.oracle
+ ojdbc6
+ 11.2.0.3
+
+
+ mysql
+ mysql-connector-java
+ 5.1.44
+
+
+ kingbase
+ jdbc4
+ 8.6.0
+ system
+ ${pom.basedir}/lib/kingbase8-8.6.0.jar
+
+
+ oscar
+ oscarJDBC
+ 16
+ system
+ ${pom.basedir}/lib/oscarJDBC16.jar
+
+
+ Dm7
+ Jdbc
+ 18
+ system
+ ${pom.basedir}/lib/Dm7-18-Jdbc.jar
+
+
+ cn.hutool
+ hutool-all
+ 5.1.0
+
diff --git a/src/main/java/com/insigma/HyToolApplication.java b/src/main/java/com/insigma/HyToolApplication.java
index 63a9b01..2027096 100644
--- a/src/main/java/com/insigma/HyToolApplication.java
+++ b/src/main/java/com/insigma/HyToolApplication.java
@@ -1,6 +1,9 @@
package com.insigma;
+import cn.hutool.db.Session;
+import com.insigma.config.AppCfg;
import com.insigma.demos.SwingSet2;
+import com.insigma.utils.DbUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -25,12 +28,22 @@ public class HyToolApplication {
Properties loadProperties = PropertiesLoaderUtils
.loadProperties(new EncodedResource(new ClassPathResource("application.properties"), "UTF-8"));
- String guiType = loadProperties.getProperty("swing.ui.type");
+ String url = loadProperties.getProperty("db.url");
+ String usr = loadProperties.getProperty("db.usr");
+ String pwd = loadProperties.getProperty("db.pwd");
+
+ AppCfg.DB = loadProperties.getProperty("hy.db");
+ AppCfg.MW = loadProperties.getProperty("hy.mw");
+ AppCfg.HZB = loadProperties.getProperty("hy.hzb");
+ AppCfg.BROWSER = loadProperties.getProperty("hy.browser");
SwingUtilities.invokeLater(() -> {
- log.info("正在启动GUI =======================>>> " + guiType );
+ log.info("正在启动GUI =======================>>> 成功!");
SwingSet2.main(args);
});
+ Session session = DbUtil.getSession(url, usr, pwd);
+ log.info("获取{}连接,进行操作!", session);
+ session.close();
} catch (Exception e) {
log.error("\n\t 启动GUI异常 >>>>>>>>>>>{},{}",e.getMessage(),e);
e.printStackTrace();
diff --git a/src/main/java/com/insigma/config/AppCfg.java b/src/main/java/com/insigma/config/AppCfg.java
new file mode 100644
index 0000000..ca4bbff
--- /dev/null
+++ b/src/main/java/com/insigma/config/AppCfg.java
@@ -0,0 +1,14 @@
+package com.insigma.config;
+
+/**
+ * (AppConfig 类)
+ *
+ * @author zhangxianwei
+ * @since 17:21 2022/4/18
+ */
+public class AppCfg {
+ public static String BROWSER;
+ public static String DB;
+ public static String MW;
+ public static String HZB;
+}
diff --git a/src/main/java/com/insigma/entry/IndexObj.java b/src/main/java/com/insigma/entry/IndexObj.java
index efbffb8..5d72d07 100644
--- a/src/main/java/com/insigma/entry/IndexObj.java
+++ b/src/main/java/com/insigma/entry/IndexObj.java
@@ -12,5 +12,6 @@ import lombok.Data;
public class IndexObj {
private String tab;
+ private String col;
private String idx;
}
diff --git a/src/main/java/com/insigma/entry/TabColObj.java b/src/main/java/com/insigma/entry/TabColObj.java
new file mode 100644
index 0000000..1e01907
--- /dev/null
+++ b/src/main/java/com/insigma/entry/TabColObj.java
@@ -0,0 +1,16 @@
+package com.insigma.entry;
+
+import lombok.Data;
+
+/**
+ * (IndexObj 类)
+ *
+ * @author zhangxianwei
+ * @since 21:29 2022/4/17
+ */
+@Data
+public class TabColObj {
+
+ private String tab;
+ private String col;
+}
diff --git a/src/main/java/com/insigma/service/Database.java b/src/main/java/com/insigma/service/Database.java
index 505f801..eff03eb 100644
--- a/src/main/java/com/insigma/service/Database.java
+++ b/src/main/java/com/insigma/service/Database.java
@@ -1,6 +1,7 @@
package com.insigma.service;
import com.insigma.entry.IndexObj;
+import com.insigma.entry.TabColObj;
import org.springframework.util.Assert;
import java.util.List;
@@ -36,7 +37,7 @@ public interface Database {
* 清除 应用 缓存
* @return
*/
- default boolean cleanDbCache() {
+ default boolean cleanDbCache(List sql, List tabColObjs) {
System.out.println("进行缓存清除,但是未检测到实现应用调用此方法!");
return false;
}
diff --git a/src/main/java/com/insigma/service/impl/WindowsTomcatMysql.java b/src/main/java/com/insigma/service/impl/WindowsTomcatMysql.java
index 15e0c4b..a32b09e 100644
--- a/src/main/java/com/insigma/service/impl/WindowsTomcatMysql.java
+++ b/src/main/java/com/insigma/service/impl/WindowsTomcatMysql.java
@@ -1,10 +1,18 @@
package com.insigma.service.impl;
+import cn.hutool.db.Session;
+import com.insigma.config.AppCfg;
import com.insigma.entry.IndexObj;
+import com.insigma.entry.TabColObj;
import com.insigma.service.Computer;
import com.insigma.service.*;
+import com.insigma.utils.DbUtil;
+import com.insigma.utils.FileUtil;
import com.insigma.utils.WinCommandUtil;
+import com.insigma.utils.ZipUtil;
+import lombok.extern.slf4j.Slf4j;
+import java.sql.SQLException;
import java.util.List;
@@ -14,6 +22,7 @@ import java.util.List;
* @author zhangxianwei
* @since 23:30 2022/4/17
*/
+@Slf4j
public class WindowsTomcatMysql extends Computer implements Database, Middleware {
@Override
@@ -28,26 +37,99 @@ public class WindowsTomcatMysql extends Computer implements Database, Middleware
@Override
public boolean rebuildIndex(List index) {
- return Database.super.rebuildIndex(index);
+ log.info("创建链接...");
+ final Session session = DbUtil.getSession(DbUtil.url, DbUtil.usr, DbUtil.pwd);
+ try {
+ for (IndexObj idx : index) {
+ session.execute("DROP INDEX ? ON ?", idx.getIdx(), idx.getTab());
+ session.execute("ALTER TABLE ? ADD INDEX ? (?) USING BTREE", idx.getTab(), idx.getIdx(), idx.getCol());
+ }
+ } catch (SQLException e) {
+ log.error("执行更新索引发生异常:{}", e.getMessage());
+ e.printStackTrace();
+ session.close();
+ return false;
+ }
+ session.close();
+ return true;
}
@Override
public boolean setDbSize(int size) {
+ log.info("停止 数据库 服务...");
+ runShell("sc stop " + AppCfg.DB);
+ log.info("设置 数据库 内存参数...");
+ FileUtil.replaceLine(AppCfg.HZB + "/mysql/my.ini",
+ "innodb_buffer_pool_size",
+ String.format("innodb_buffer_pool_size=%dM", size));
+ log.info("启动 数据库 服务...");
+ runShell("sc start " + AppCfg.DB);
return Database.super.setDbSize(size);
}
@Override
- public boolean cleanDbCache() {
- return Database.super.cleanDbCache();
+ public boolean cleanDbCache(List sql, List tabColObjs) {
+ log.info("创建链接...");
+ final Session session = DbUtil.getSession(DbUtil.url, DbUtil.usr, DbUtil.pwd);
+ try {
+ log.info("执行 预置 SQL 脚本...");
+ for (String s : sql) {
+ session.execute(s);
+ }
+ log.info("执行 清洗数据中特殊字符串 脚本...");
+ for (String lj : DbUtil.RUBBISH) {
+ for (TabColObj tab : tabColObjs) {
+ session.execute("update ? set ?=replace(?, '?', '') where ? is not null",
+ tab.getTab(), tab.getCol(), tab.getCol(), lj, tab.getCol());
+ }
+ }
+ } catch (SQLException e) {
+ log.error("执行 清洗数据中特殊字符串 发生异常:{}", e.getMessage());
+ e.printStackTrace();
+ session.close();
+ return false;
+ }
+ log.info("执行 清洗数据中特殊字符串 完成...");
+ session.close();
+ return true;
}
@Override
public boolean cleanMwCache() {
- return Middleware.super.cleanMwCache();
+ log.info("停止 中间件 服务...");
+ runShell("sc stop " + AppCfg.MW);
+ log.info("退出 浏览器...");
+ runShell("taskkill /f /im " + AppCfg.BROWSER);
+
+ log.info("删除 浏览器 历史文件...");
+ FileUtil.delAllFile(AppCfg.HZB + "/360se6/User Data");
+
+ log.info("解压 新浏览器 文件...");
+ ZipUtil.unZip7Z(AppCfg.HZB + "/tools/User Data.zip", AppCfg.HZB + "/360se6");
+
+ log.info("删除 应用 缓存文件...");
+ FileUtil.delAllFile(AppCfg.HZB + "/tomcat8/temp");
+ FileUtil.delAllFile(AppCfg.HZB + "/tomcat8/work/Catalina/localhost/qggwy");
+
+ log.info("启动 中间件 服务...");
+ runShell("sc start " + AppCfg.MW);
+ return true;
}
@Override
public boolean setMwSize(int size) {
- return Middleware.super.setMwSize(size);
+ log.info("停止 中间件 服务...");
+ runShell("sc stop " + AppCfg.MW);
+
+
+
+ log.info("启动 中间件 服务...");
+ runShell("sc start " + AppCfg.MW);
+ return true;
+ }
+
+ public void openServer(){
+ runShell("SERVICES.MSC");
+ log.info("打开本地服务完成!");
}
}
diff --git a/src/main/java/com/insigma/ui/SwingFrame.java b/src/main/java/com/insigma/ui/SwingFrame.java
index 60d6f01..5d4557b 100644
--- a/src/main/java/com/insigma/ui/SwingFrame.java
+++ b/src/main/java/com/insigma/ui/SwingFrame.java
@@ -1,4 +1,6 @@
-package com.qggwy;
+package com.insigma.ui;
+
+import lombok.extern.slf4j.Slf4j;
import java.awt.EventQueue;
@@ -34,10 +36,11 @@ import javax.swing.Timer;
import javax.swing.JTextPane;
import java.awt.Component;
+@Slf4j
public class SwingFrame extends JFrame implements ActionListener {
/**
- *
+ *
*/
private static final long serialVersionUID = 1L;
private JPanel contentPane;
@@ -48,329 +51,334 @@ public class SwingFrame extends JFrame implements ActionListener {
private JTextField textField_4;
private final int MIN_PROGRESS = 0;
private final int MAX_PROGRESS = 100;
- private int currentProgress = MIN_PROGRESS;
+ private int currentProgress = MIN_PROGRESS;
private JTextField textField_5;
- private JLabel lblNewLabel_6;
-
-
+ private JLabel lblNewLabel_6;
+
+
/**
* Launch the application.
*/
public static void main(String[] args) {
+
try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- }catch(Exception e) {
- System.out.println(e);
- }
+ for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
+ if ("Nimbus".equals(info.getName())) {
+ javax.swing.UIManager.setLookAndFeel(info.getClassName());
+ break;
+ }
+ }
+ }catch(Exception e) {
+ log.error("启动发生异常:", e);
+ }
EventQueue.invokeLater(new Runnable() {
+ @Override
public void run() {
try {
- SwingFrame frame = new SwingFrame();
- frame.setTitle("ϵͳ"); //ʾڱ
-// frame.setSize(1600,400);//ʾڴС
-// frame.getContentPane().setBackground(Color.blue);//ʾɫ
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //ôǷԹر
- frame.setBounds(100, 100, 773, 459);
+ SwingFrame frame = new SwingFrame();
+ frame.setTitle("系统工具"); //设置显示窗口标题
+// frame.setSize(1600,400);//设置显示窗口大小
+// frame.getContentPane().setBackground(Color.blue);//设置显示窗体颜色
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //设置窗口是否可以关闭
+ frame.setBounds(100, 100, 773, 459);
frame.setVisible(true);
- java.net.URL imgURL =SwingFrame.class.getResource("favicon.jpg");
- ImageIcon arrowIcon = null;
- if (imgURL != null) {
- arrowIcon = new ImageIcon(imgURL);
- frame.setIconImage(arrowIcon.getImage());
- } else {
- JOptionPane.showMessageDialog(frame, "Icon image not found.");
- }
+ java.net.URL imgURL =SwingFrame.class.getResource("favicon.jpg");
+ ImageIcon arrowIcon = null;
+ if (imgURL != null) {
+ arrowIcon = new ImageIcon(imgURL);
+ frame.setIconImage(arrowIcon.getImage());
+ } else {
+ JOptionPane.showMessageDialog(frame, "Icon image not found.");
+ }
} catch (Exception e) {
e.printStackTrace();
}
- }
+ }
});
}
/**
* Create the frame.
- * @throws IOException
+ * @throws IOException
*/
public SwingFrame() throws IOException {
-
+
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
-
+
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT);
tabbedPane.setBounds(5, 5, 745, 402);
tabbedPane.setBackground(Color.WHITE);
- tabbedPane.setFont(new Font("ź", Font.PLAIN, 15));
+ tabbedPane.setFont(new Font("微软雅黑", Font.PLAIN, 15));
contentPane.add(tabbedPane);
-
- JPanel memoryPanel = new JPanel();//ڴ
+
+ JPanel memoryPanel = new JPanel();//调整内存面板
memoryPanel.setBorder(UIManager.getBorder("Button.border"));
memoryPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
memoryPanel.setForeground(Color.GRAY);
memoryPanel.setBackground(new Color(220, 220, 220));
- tabbedPane.addTab("ڴ", null, memoryPanel, null);
+ tabbedPane.addTab("调整内存", null, memoryPanel, null);
memoryPanel.setLayout(null);
-
- JLabel lblNewLabel = new JLabel("ڴ");
+
+ JLabel lblNewLabel = new JLabel("调整内存");
lblNewLabel.setBounds(60, 31, 125, 34);
lblNewLabel.setForeground(Color.RED);
- lblNewLabel.setFont(new Font("ź", Font.PLAIN, 30));
+ lblNewLabel.setFont(new Font("微软雅黑", Font.PLAIN, 30));
memoryPanel.add(lblNewLabel);
-
- JLabel lblNewLabel_1 = new JLabel("ݾϵͳпӦݡݿݵĴС");
+
+ JLabel lblNewLabel_1 = new JLabel("根据具体系统运行可设置应用内容、数据库内容的大小。");
lblNewLabel_1.setBounds(60, 75, 375, 18);
- lblNewLabel_1.setFont(new Font("ź", Font.PLAIN, 15));
+ lblNewLabel_1.setFont(new Font("微软雅黑", Font.PLAIN, 15));
memoryPanel.add(lblNewLabel_1);
-
+
JSeparator separator = new JSeparator();
separator.setBackground(Color.LIGHT_GRAY);
separator.setBounds(60, 106, 531, 5);
memoryPanel.add(separator);
-
- JLabel lblNewLabel_2 = new JLabel("Ӧڴ");
+
+ JLabel lblNewLabel_2 = new JLabel("应用内存");
lblNewLabel_2.setBounds(60, 124, 80, 18);
- lblNewLabel_2.setFont(new Font("ź", Font.PLAIN, 20));
+ lblNewLabel_2.setFont(new Font("微软雅黑", Font.PLAIN, 20));
memoryPanel.add(lblNewLabel_2);
-
- JLabel lblNewLabel_3 = new JLabel("ǶʼڴС");
+
+ JLabel lblNewLabel_3 = new JLabel("非堆区初始内存分配大小");
lblNewLabel_3.setBackground(new Color(221, 160, 221));
lblNewLabel_3.setBounds(82, 165, 175, 18);
- lblNewLabel_3.setFont(new Font("ź", Font.PLAIN, 15));
+ lblNewLabel_3.setFont(new Font("微软雅黑", Font.PLAIN, 15));
memoryPanel.add(lblNewLabel_3);
-
- JLabel label = new JLabel("ڴ");
+
+ JLabel label = new JLabel("堆区最大内存分配上限");
label.setBounds(82, 196, 156, 18);
- label.setFont(new Font("ź", Font.PLAIN, 15));
+ label.setFont(new Font("微软雅黑", Font.PLAIN, 15));
memoryPanel.add(label);
-
- JLabel label_1 = new JLabel("ʼڴС");
+
+ JLabel label_1 = new JLabel("初始内存分配大小");
label_1.setBounds(82, 227, 156, 18);
- label_1.setFont(new Font("ź", Font.PLAIN, 15));
+ label_1.setFont(new Font("微软雅黑", Font.PLAIN, 15));
memoryPanel.add(label_1);
-
- JLabel label_2 = new JLabel("ڴ");
+
+ JLabel label_2 = new JLabel("最大内存分配上限");
label_2.setBounds(82, 258, 156, 18);
- label_2.setFont(new Font("ź", Font.PLAIN, 15));
+ label_2.setFont(new Font("微软雅黑", Font.PLAIN, 15));
memoryPanel.add(label_2);
-
+
textField = new JTextField();
textField.setBounds(255, 163, 86, 24);
memoryPanel.add(textField);
textField.setColumns(10);
-
+
textField_1 = new JTextField();
textField_1.setBounds(255, 196, 86, 24);
textField_1.setColumns(10);
memoryPanel.add(textField_1);
-
+
textField_2 = new JTextField();
textField_2.setBounds(255, 227, 86, 24);
textField_2.setColumns(10);
memoryPanel.add(textField_2);
-
+
textField_3 = new JTextField();
textField_3.setBounds(255, 256, 86, 24);
textField_3.setColumns(10);
memoryPanel.add(textField_3);
-
- JLabel lblNewLabel_4 = new JLabel("õ1024MB");
- lblNewLabel_4.setFont(new Font("ź", Font.PLAIN, 15));
+
+ JLabel lblNewLabel_4 = new JLabel("最大可设置到1024MB");
+ lblNewLabel_4.setFont(new Font("微软雅黑", Font.PLAIN, 15));
lblNewLabel_4.setBounds(355, 166, 163, 18);
memoryPanel.add(lblNewLabel_4);
-
- JLabel label_3 = new JLabel("ݿڴ");
- label_3.setFont(new Font("ź", Font.PLAIN, 20));
+
+ JLabel label_3 = new JLabel("数据库内存");
+ label_3.setFont(new Font("微软雅黑", Font.PLAIN, 20));
label_3.setBounds(60, 307, 100, 24);
memoryPanel.add(label_3);
-
- JLabel label_4 = new JLabel("ݿڴС");
- label_4.setFont(new Font("ź", Font.PLAIN, 15));
+
+ JLabel label_4 = new JLabel("数据库内存大小");
+ label_4.setFont(new Font("微软雅黑", Font.PLAIN, 15));
label_4.setBounds(82, 344, 156, 18);
memoryPanel.add(label_4);
-
+
textField_4 = new JTextField();
textField_4.setColumns(10);
textField_4.setBounds(255, 342, 86, 24);
memoryPanel.add(textField_4);
-
-
- JButton btnNewButton_1 = new JButton("");
+
+
+ JButton btnNewButton_1 = new JButton("保存");
btnNewButton_1.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
}
});
-// btnNewButton_1.setContentAreaFilled(false);//ťΪ
-// btnNewButton_1.setBorder(BorderFactory.createRaisedBevelBorder());//İť
-// btnNewButton_1.setBorder(BorderFactory.createLoweredBevelBorder()); //ðİť
-// btnNewButton_1.setBorderPainted(false);//ȥťı߿
+// btnNewButton_1.setContentAreaFilled(false);//按钮设置为透明
+// btnNewButton_1.setBorder(BorderFactory.createRaisedBevelBorder());//设置凸起来的按钮
+// btnNewButton_1.setBorder(BorderFactory.createLoweredBevelBorder()); //设置凹起来的按钮
+// btnNewButton_1.setBorderPainted(false);//去掉按钮的边框的设置
// String path = "C:\\Users\\86177\\Desktop\\www.png";
// File file = new File(path);
// Image image = ImageIO.read(file);
// btnNewButton_1.setIcon(new ImageIcon(image.getScaledInstance(50, 50, image.SCALE_DEFAULT)));
- btnNewButton_1.setFont(new Font("ź", Font.PLAIN, 20));
+ btnNewButton_1.setFont(new Font("微软雅黑", Font.PLAIN, 20));
btnNewButton_1.setBounds(500, 344, 113, 40);
memoryPanel.add(btnNewButton_1);
-
- JPanel repairPanel = new JPanel();//
+
+ JPanel repairPanel = new JPanel();//数据修复面板
repairPanel.setForeground(Color.GRAY);
repairPanel.setBackground(new Color(220, 220, 220));
- tabbedPane.addTab("", null, repairPanel, null);
+ tabbedPane.addTab("数据修复", null, repairPanel, null);
repairPanel.setLayout(null);
-
- JLabel label_5 = new JLabel("ϵͳ");
+
+ JLabel label_5 = new JLabel("系统修复");
label_5.setBounds(42, 35, 120, 40);
label_5.setForeground(Color.RED);
- label_5.setFont(new Font("ź", Font.PLAIN, 30));
+ label_5.setFont(new Font("微软雅黑", Font.PLAIN, 30));
repairPanel.add(label_5);
-
- JButton btnNewButton = new JButton("ʼ");
+
+ JButton btnNewButton = new JButton("开始修复");
btnNewButton.setBounds(504, 42, 113, 40);
repairPanel.add(btnNewButton);
-
- JLabel label_6 = new JLabel("ͨϴȲЧϵͳ쳣");
+
+ JLabel label_6 = new JLabel("通过数据清洗等操作可以有效解决系统功能异常问题");
label_6.setBounds(42, 76, 375, 18);
- label_6.setFont(new Font("ź", Font.PLAIN, 15));
+ label_6.setFont(new Font("微软雅黑", Font.PLAIN, 15));
repairPanel.add(label_6);
-
+
JSeparator separator_1 = new JSeparator();
separator_1.setBackground(Color.LIGHT_GRAY);
separator_1.setBounds(27, 100, 590, 5);
repairPanel.add(separator_1);
-
- JCheckBox chckbxNewCheckBox = new JCheckBox("ݿ");
+
+ JCheckBox chckbxNewCheckBox = new JCheckBox("修复数据库数据");
chckbxNewCheckBox.setBackground(new Color(220, 220, 220));
chckbxNewCheckBox.setBounds(53, 130, 162, 27);
- chckbxNewCheckBox.setFont(new Font("ź", Font.PLAIN, 18));
+ chckbxNewCheckBox.setFont(new Font("微软雅黑", Font.PLAIN, 18));
repairPanel.add(chckbxNewCheckBox);
-
- JLabel lblNewLabel_5 = new JLabel("ϢԱϢУˡϢϵͳѯȡ");
+
+ JLabel lblNewLabel_5 = new JLabel("机构信息管理、人员信息管理、数据校核、信息系统查询等。");
lblNewLabel_5.setBounds(77, 166, 405, 18);
- lblNewLabel_5.setFont(new Font("ź", Font.PLAIN, 15));
+ lblNewLabel_5.setFont(new Font("微软雅黑", Font.PLAIN, 15));
repairPanel.add(lblNewLabel_5);
-
- JCheckBox checkBox = new JCheckBox("ϵͳ");
+
+ JCheckBox checkBox = new JCheckBox("修复系统管理数据");
checkBox.setBackground(new Color(220, 220, 220));
checkBox.setBounds(53, 193, 173, 27);
- checkBox.setFont(new Font("ź", Font.PLAIN, 18));
+ checkBox.setFont(new Font("微软雅黑", Font.PLAIN, 18));
repairPanel.add(checkBox);
-
- JLabel label_7 = new JLabel("ɫû־ϵͳõȡ");
+
+ JLabel label_7 = new JLabel("角色管理、用户管理、日志管理、系统参数配置等。");
label_7.setBounds(77, 229, 345, 18);
- label_7.setFont(new Font("ź", Font.PLAIN, 15));
+ label_7.setFont(new Font("微软雅黑", Font.PLAIN, 15));
repairPanel.add(label_7);
-
- JCheckBox checkBox_1 = new JCheckBox("ͳרϢ");
+
+ JCheckBox checkBox_1 = new JCheckBox("修复统计专用信息管理数据");
checkBox_1.setBackground(new Color(220, 220, 220));
checkBox_1.setBounds(53, 256, 253, 27);
- checkBox_1.setFont(new Font("ź", Font.PLAIN, 18));
+ checkBox_1.setFont(new Font("微软雅黑", Font.PLAIN, 18));
repairPanel.add(checkBox_1);
-
- JLabel label_8 = new JLabel("ϢУˡʹԱԱȵȡ");
+
+ JLabel label_8 = new JLabel("信息表、校核、使用情况、人员对比等。");
label_8.setBounds(72, 290, 270, 18);
- label_8.setFont(new Font("ź", Font.PLAIN, 15));
+ label_8.setFont(new Font("微软雅黑", Font.PLAIN, 15));
repairPanel.add(label_8);
-
- JCheckBox checkBox_2 = new JCheckBox("걨ͳ");
+
+ JCheckBox checkBox_2 = new JCheckBox("修复年报统计数据");
checkBox_2.setBackground(new Color(220, 220, 220));
checkBox_2.setBounds(53, 331, 253, 27);
- checkBox_2.setFont(new Font("ź", Font.PLAIN, 18));
+ checkBox_2.setFont(new Font("微软雅黑", Font.PLAIN, 18));
repairPanel.add(checkBox_2);
-
- JLabel label_9 = new JLabel("ͳƱУˡ˵ȡ");
- label_9.setFont(new Font("ź", Font.PLAIN, 15));
+
+ JLabel label_9 = new JLabel("统计报表、校核、报表说明等。");
+ label_9.setFont(new Font("微软雅黑", Font.PLAIN, 15));
label_9.setBounds(72, 366, 270, 18);
repairPanel.add(label_9);
-
- Panel backupsPanel = new Panel();//ݿⱸ
+
+ Panel backupsPanel = new Panel();//数据库备份面板
backupsPanel.setBackground(new Color(220, 220, 220));
- tabbedPane.addTab("ݿⱸ", null, backupsPanel, null);
+ tabbedPane.addTab("数据库备份", null, backupsPanel, null);
backupsPanel.setLayout(null);
-
- JLabel lblNewLabel_12 = new JLabel("ݿⱸ");
+
+ JLabel lblNewLabel_12 = new JLabel("数据库备份");
lblNewLabel_12.setBounds(32, 13, 114, 28);
- lblNewLabel_12.setFont(new Font("ź", Font.PLAIN, 20));
+ lblNewLabel_12.setFont(new Font("微软雅黑", Font.PLAIN, 20));
backupsPanel.add(lblNewLabel_12);
-
- JLabel label_10 = new JLabel("ݿԭ");
+
+ JLabel label_10 = new JLabel("数据库还原");
label_10.setBounds(459, 13, 105, 28);
- label_10.setFont(new Font("ź", Font.PLAIN, 20));
+ label_10.setFont(new Font("微软雅黑", Font.PLAIN, 20));
backupsPanel.add(label_10);
-
- String strMsg1 = "ϵͳͻʱԽݱݣȷϵͳ쳣ݶʧ";
- String strMsg = "" + strMsg1 + "
";
+
+ String strMsg1 = "当系统因突发情况无法正常启动时,可以进行数据备份,确保因系统异常情况导致数据丢失。";
+ String strMsg = "" + strMsg1 + "
";
JLabel lblNewLabel_13 = new JLabel(strMsg);
lblNewLabel_13.setBounds(32, 39, 238, 107);
- lblNewLabel_13.setFont(new Font("ź", Font.PLAIN, 16));
+ lblNewLabel_13.setFont(new Font("微软雅黑", Font.PLAIN, 16));
backupsPanel.add(lblNewLabel_13);
-
- String strMsg3 = "ݿеݱװ·µdataļ";
+
+ String strMsg3 = "备份数据库中所有的数据表,即安装路径下的data文件";
String strMsg4 = "(D:\\hzb2021\\mysql\\data)";
String strMsgData = "" + strMsg3 + "
" + strMsg4 + "";
JLabel lblNewLabel_14 = new JLabel(strMsgData);
lblNewLabel_14.setBounds(32, 131, 238, 96);
- lblNewLabel_14.setFont(new Font("ź", Font.PLAIN, 16));
+ lblNewLabel_14.setFont(new Font("微软雅黑", Font.PLAIN, 16));
backupsPanel.add(lblNewLabel_14);
-
- String strMsg5 = "ݱĬ氲װ·£(D:\\hzb2021)ʽzipļ";
+
+ String strMsg5 = "数据备份默认至保存安装路径下,即(D:\\hzb2021),保存格式zip文件";
String strMsgData1 = "" + strMsg5 + "
";
JLabel lblNewLabel_15 = new JLabel(strMsgData1);
lblNewLabel_15.setBounds(32, 223, 228, 96);
- lblNewLabel_15.setFont(new Font("ź", Font.PLAIN, 16));
+ lblNewLabel_15.setFont(new Font("微软雅黑", Font.PLAIN, 16));
backupsPanel.add(lblNewLabel_15);
-
- JButton btnNewButton_3 = new JButton("ݿⱸ");
+
+ JButton btnNewButton_3 = new JButton("数据库备份");
btnNewButton_3.addActionListener(new ActionListener() {
+ @Override
public void actionPerformed(ActionEvent e) {
}
});
btnNewButton_3.setBounds(32, 316, 113, 27);
backupsPanel.add(btnNewButton_3);
-
- JLabel label_11 = new JLabel("ݿԭǵǰϵͳΪݣɻָ
");
+
+ JLabel label_11 = new JLabel("数据库还原将覆盖当前系统中所有人为产生的数据,不可恢复,需谨慎操作。
");
label_11.setBounds(382, 55, 238, 74);
- label_11.setFont(new Font("ź", Font.PLAIN, 16));
+ label_11.setFont(new Font("微软雅黑", Font.PLAIN, 16));
backupsPanel.add(label_11);
-
- JLabel label_12 = new JLabel("ΪȷǰϵͳİȫҪ뵱ǰϵͳԱſԽݿԭ
");
+
+ JLabel label_12 = new JLabel("为确保当前系统的安全,需要输入当前系统管理员密码才可以进行数据库还原。
");
label_12.setBounds(382, 149, 238, 74);
- label_12.setFont(new Font("ź", Font.PLAIN, 16));
+ label_12.setFont(new Font("微软雅黑", Font.PLAIN, 16));
backupsPanel.add(label_12);
-
- JButton button = new JButton("ݿԭ");
+
+ JButton button = new JButton("数据库还原");
button.setBounds(451, 316, 113, 27);
backupsPanel.add(button);
-
- JLabel lblNewLabel_16 = new JLabel("עϵͳ½ʱϵͳжؿɽݿⱸݣװ֮ݿԭ");
- lblNewLabel_16.setFont(new Font("ź", Font.PLAIN, 13));
+
+ JLabel lblNewLabel_16 = new JLabel("注:当系统遇到极端情况导致无法登陆时,系统卸载可进行数据库备份,重装或升级之后进行数据库还原。");
+ lblNewLabel_16.setFont(new Font("微软雅黑", Font.PLAIN, 13));
lblNewLabel_16.setBounds(14, 366, 620, 18);
backupsPanel.add(lblNewLabel_16);
-
- Panel upgradePanel = new Panel();//ϵͳ
+
+ Panel upgradePanel = new Panel();//系统升级面板
upgradePanel.setBackground(new Color(220, 220, 220));
- tabbedPane.addTab("ϵͳ", null, upgradePanel, null);
+ tabbedPane.addTab("系统升级", null, upgradePanel, null);
upgradePanel.setLayout(null);
-
- JLabel lblNewLabel_8 = new JLabel("װ/");
- lblNewLabel_8.setFont(new Font("ź", Font.PLAIN, 20));
+
+ JLabel lblNewLabel_8 = new JLabel("安装包/升级包下载");
+ lblNewLabel_8.setFont(new Font("微软雅黑", Font.PLAIN, 20));
lblNewLabel_8.setBounds(47, 47, 181, 28);
upgradePanel.add(lblNewLabel_8);
-
- final JLabel lblNewLabel_9 = new JLabel("صַhttps://www.12371.cn/zgrjxz/gwywx/");
- lblNewLabel_9.setFont(new Font("ź", Font.PLAIN, 18));
+
+ final JLabel lblNewLabel_9 = new JLabel("下载地址:https://www.12371.cn/zgrjxz/gwywx/");
+ lblNewLabel_9.setFont(new Font("微软雅黑", Font.PLAIN, 18));
lblNewLabel_9.setBounds(57, 88, 420, 18);
-
+
upgradePanel.addMouseListener(new MouseAdapter() {
- public void mouseClicked(MouseEvent e){ //¼
+ @Override
+ public void mouseClicked(MouseEvent e){ //鼠标点击事件
@SuppressWarnings("unused")
URI uri = null;
- try {
+ try {
try {
uri = new URI("https://www.12371.cn/zgrjxz/gwywx/");
} catch (URISyntaxException e1) {
@@ -387,186 +395,189 @@ public class SwingFrame extends JFrame implements ActionListener {
} catch (Exception e1) {
e1.printStackTrace();
}
-
- }
- public void mouseEntered(MouseEvent e) { //¼
- lblNewLabel_9.setForeground(Color.red);
- }
- public void mouseExited(MouseEvent e) { //Ƴ¼
- lblNewLabel_9.setForeground(Color.blue);
- }
-
+
+ }
+ @Override
+ public void mouseEntered(MouseEvent e) { //鼠标移入事件
+ lblNewLabel_9.setForeground(Color.red);
+ }
+ @Override
+ public void mouseExited(MouseEvent e) { //鼠标移出事件
+ lblNewLabel_9.setForeground(Color.blue);
+ }
+
});
- upgradePanel.add(lblNewLabel_9);
-
- JLabel lblNewLabel_10 = new JLabel("ͷ绰400-8600-797-1400-9608-590-5");
- lblNewLabel_10.setFont(new Font("ź", Font.PLAIN, 20));
+ upgradePanel.add(lblNewLabel_9);
+
+ JLabel lblNewLabel_10 = new JLabel("客服电话:400-8600-797-1、400-9608-590-5。");
+ lblNewLabel_10.setFont(new Font("微软雅黑", Font.PLAIN, 20));
lblNewLabel_10.setBounds(47, 161, 462, 28);
upgradePanel.add(lblNewLabel_10);
-
- JLabel lblNewLabel_11 = new JLabel("ҵѯǢ̸");
- lblNewLabel_11.setFont(new Font("", Font.PLAIN, 18));
+
+ JLabel lblNewLabel_11 = new JLabel("业务咨询、商务洽谈。");
+ lblNewLabel_11.setFont(new Font("宋体", Font.PLAIN, 18));
lblNewLabel_11.setBounds(57, 202, 278, 18);
upgradePanel.add(lblNewLabel_11);
-
- JPanel startRepairPanel = new JPanel();
+
+ JPanel startRepairPanel = new JPanel();
startRepairPanel.setBackground(new Color(220, 220, 220));
- tabbedPane.addTab("ʼ", null, startRepairPanel, null);
+ tabbedPane.addTab("开始修复界面", null, startRepairPanel, null);
startRepairPanel.setLayout(null);
-
- lblNewLabel_6 = new JLabel("ϵͳУ鲻Ҫֹͣ");
+
+ lblNewLabel_6 = new JLabel("系统正在数据修复中,建议不要随意随意停止!");
lblNewLabel_6.setBounds(57, 34, 378, 18);
lblNewLabel_6.setForeground(new Color(255, 0, 0));
- lblNewLabel_6.setFont(new Font("ź", Font.PLAIN, 18));
+ lblNewLabel_6.setFont(new Font("微软雅黑", Font.PLAIN, 18));
startRepairPanel.add(lblNewLabel_6);
-
-
- JButton btnNewButton_2 = new JButton("ֹͣ");
+
+
+ JButton btnNewButton_2 = new JButton("停止修复");
btnNewButton_2.setBounds(495, 65, 113, 27);
startRepairPanel.add(btnNewButton_2);
-
+
JProgressBar progressBar = new JProgressBar();
// MyJProgressBar progressBar = new MyJProgressBar();
progressBar.setBounds(57, 65, 412, 27);
- // ýȵ Сֵ ֵ
- progressBar.setMinimum(MIN_PROGRESS);
- progressBar.setMaximum(MAX_PROGRESS);
- // õǰֵ
- progressBar.setValue(currentProgress);
- // ưٷֱıмʾİٷ
- progressBar.setStringPainted(true);
- // ӽȸı֪ͨ
- progressBar.addChangeListener(new ChangeListener() {
- @Override
- public void stateChanged(ChangeEvent e) {
- System.out.println("ǰֵ: " + progressBar.getValue() + "; " +
- "Ȱٷֱ: " + progressBar.getPercentComplete());
- }
- });
- // ӵ
- startRepairPanel.add(progressBar);
-
- JSeparator separator_2 = new JSeparator();
- separator_2.setBounds(56, 105, 564, 5);
- separator_2.setBackground(Color.LIGHT_GRAY);
- startRepairPanel.add(separator_2);
-
- JLabel lblNewLabel_7 = new JLabel("");
- lblNewLabel_7.setFont(new Font("ź", Font.PLAIN, 18));
- lblNewLabel_7.setBounds(57, 121, 78, 18);
- startRepairPanel.add(lblNewLabel_7);
-
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.setBounds(57, 152, 539, 232);
- startRepairPanel.add(scrollPane);
-
- JTextPane textPane = new JTextPane();
- scrollPane.setViewportView(textPane);
-
- JPanel panel = new JPanel();
- panel.setBackground(new Color(220, 220, 220));
- tabbedPane.addTab("ݿⱸ", null, panel, null);
-
- JButton btnNewButton_4 = new JButton("");
- btnNewButton_4.setBounds(14, 13, 113, 27);
- btnNewButton_4.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- }
- });
- panel.setLayout(null);
- panel.add(btnNewButton_4);
-
- JLabel lblNewLabel_17 = new JLabel("ݿⱸ");
- lblNewLabel_17.setBounds(94, 60, 100, 27);
- lblNewLabel_17.setFont(new Font("ź", Font.PLAIN, 20));
- panel.add(lblNewLabel_17);
-
- JLabel lblNewLabel_18 = new JLabel("洢Ŀ¼");
- lblNewLabel_18.setBounds(71, 90, 85, 27);
- lblNewLabel_18.setFont(new Font("ź", Font.PLAIN, 15));
- panel.add(lblNewLabel_18);
-
-
- JButton btnNewButton_5 = new JButton("");
- btnNewButton_5.setBounds(414, 92, 113, 24);
- panel.add(btnNewButton_5);
-
- JLabel lblNewLabel_19 = new JLabel("ݿⱸݵĸʽΪzip");
- lblNewLabel_19.setBounds(170, 120, 186, 18);
- lblNewLabel_19.setFont(new Font("ź", Font.PLAIN, 15));
- panel.add(lblNewLabel_19);
-
- JLabel label_13 = new JLabel("ݣ");
- label_13.setFont(new Font("ź", Font.PLAIN, 15));
- label_13.setBounds(71, 140, 85, 27);
- panel.add(label_13);
-
- JLabel label_14 = new JLabel("");
- label_14.setFont(new Font("ź", Font.PLAIN, 20));
- label_14.setBounds(170, 140, 100, 27);
- panel.add(label_14);
-
- JLabel label_15 = new JLabel("ϢԱϢУˡϢϵͳѯȡ");
- label_15.setFont(new Font("ź", Font.PLAIN, 15));
- label_15.setBounds(170, 160, 412, 27);
- panel.add(label_15);
-
- JLabel label_16 = new JLabel("ϵͳ");
- label_16.setFont(new Font("ź", Font.PLAIN, 20));
- label_16.setBounds(170, 190, 100, 27);
- panel.add(label_16);
-
- JLabel label_17 = new JLabel("ɫû־ϵͳõȡ");
- label_17.setFont(new Font("ź", Font.PLAIN, 15));
- label_17.setBounds(170, 210, 412, 27);
- panel.add(label_17);
-
- JLabel label_18 = new JLabel("ͳרϢ");
- label_18.setFont(new Font("ź", Font.PLAIN, 20));
- label_18.setBounds(170, 240, 167, 27);
- panel.add(label_18);
-
- JLabel label_19 = new JLabel("ϢУˡʹԱԱȵȡ");
- label_19.setFont(new Font("ź", Font.PLAIN, 15));
- label_19.setBounds(170, 266, 412, 27);
- panel.add(label_19);
-
- JLabel label_20 = new JLabel("ͳ걨");
- label_20.setFont(new Font("ź", Font.PLAIN, 20));
- label_20.setBounds(170, 293, 100, 27);
- panel.add(label_20);
-
- JLabel label_21 = new JLabel("ͳƱУˡ˵ȡ");
- label_21.setFont(new Font("ź", Font.PLAIN, 15));
- label_21.setBounds(170, 318, 412, 27);
- panel.add(label_21);
-
- JButton btnNewButton_6 = new JButton("ʼ");
- btnNewButton_6.setBounds(206, 357, 113, 27);
- panel.add(btnNewButton_6);
-
- textField_5 = new JTextField("D:\\hzb2022");
- textField_5.setFont(new Font("ź", Font.PLAIN, 15));
- textField_5.setBounds(170, 92, 245, 24);
- panel.add(textField_5);
- textField_5.setColumns(10);
-
-
+ // 设置进度的 最小值 和 最大值
+ progressBar.setMinimum(MIN_PROGRESS);
+ progressBar.setMaximum(MAX_PROGRESS);
+ // 设置当前进度值
+ progressBar.setValue(currentProgress);
+ // 绘制百分比文本(进度条中间显示的百分数)
+ progressBar.setStringPainted(true);
+ // 添加进度改变通知
+ progressBar.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ log.info("当前进度值: " + progressBar.getValue() + "; " +
+ "进度百分比: " + progressBar.getPercentComplete());
+ }
+ });
+ // 添加到内容面板
+ startRepairPanel.add(progressBar);
+
+ JSeparator separator_2 = new JSeparator();
+ separator_2.setBounds(56, 105, 564, 5);
+ separator_2.setBackground(Color.LIGHT_GRAY);
+ startRepairPanel.add(separator_2);
+
+ JLabel lblNewLabel_7 = new JLabel("更新情况");
+ lblNewLabel_7.setFont(new Font("微软雅黑", Font.PLAIN, 18));
+ lblNewLabel_7.setBounds(57, 121, 78, 18);
+ startRepairPanel.add(lblNewLabel_7);
+
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.setBounds(57, 152, 539, 232);
+ startRepairPanel.add(scrollPane);
+
+ JTextPane textPane = new JTextPane();
+ scrollPane.setViewportView(textPane);
+
+ JPanel panel = new JPanel();
+ panel.setBackground(new Color(220, 220, 220));
+ tabbedPane.addTab("数据库备份", null, panel, null);
+
+ JButton btnNewButton_4 = new JButton("返回");
+ btnNewButton_4.setBounds(14, 13, 113, 27);
+ btnNewButton_4.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ }
+ });
+ panel.setLayout(null);
+ panel.add(btnNewButton_4);
+
+ JLabel lblNewLabel_17 = new JLabel("数据库备份");
+ lblNewLabel_17.setBounds(94, 60, 100, 27);
+ lblNewLabel_17.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ panel.add(lblNewLabel_17);
+
+ JLabel lblNewLabel_18 = new JLabel("存储目录:");
+ lblNewLabel_18.setBounds(71, 90, 85, 27);
+ lblNewLabel_18.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ panel.add(lblNewLabel_18);
+
+
+ JButton btnNewButton_5 = new JButton("更改");
+ btnNewButton_5.setBounds(414, 92, 113, 24);
+ panel.add(btnNewButton_5);
+
+ JLabel lblNewLabel_19 = new JLabel("数据库备份的格式为“zip”");
+ lblNewLabel_19.setBounds(170, 120, 186, 18);
+ lblNewLabel_19.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ panel.add(lblNewLabel_19);
+
+ JLabel label_13 = new JLabel("备份内容:");
+ label_13.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ label_13.setBounds(71, 140, 85, 27);
+ panel.add(label_13);
+
+ JLabel label_14 = new JLabel("基础库");
+ label_14.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ label_14.setBounds(170, 140, 100, 27);
+ panel.add(label_14);
+
+ JLabel label_15 = new JLabel("机构信息管理、人员信息管理、数据校核、信息系统查询等。");
+ label_15.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ label_15.setBounds(170, 160, 412, 27);
+ panel.add(label_15);
+
+ JLabel label_16 = new JLabel("系统管理");
+ label_16.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ label_16.setBounds(170, 190, 100, 27);
+ panel.add(label_16);
+
+ JLabel label_17 = new JLabel("角色管理、用户管理、日志管理、系统参数配置等。");
+ label_17.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ label_17.setBounds(170, 210, 412, 27);
+ panel.add(label_17);
+
+ JLabel label_18 = new JLabel("统计专用信息管理");
+ label_18.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ label_18.setBounds(170, 240, 167, 27);
+ panel.add(label_18);
+
+ JLabel label_19 = new JLabel("信息表、校核、使用情况、人员对比等。");
+ label_19.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ label_19.setBounds(170, 266, 412, 27);
+ panel.add(label_19);
+
+ JLabel label_20 = new JLabel("统计年报");
+ label_20.setFont(new Font("微软雅黑", Font.PLAIN, 20));
+ label_20.setBounds(170, 293, 100, 27);
+ panel.add(label_20);
+
+ JLabel label_21 = new JLabel("统计报表、校核、报表说明等。");
+ label_21.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ label_21.setBounds(170, 318, 412, 27);
+ panel.add(label_21);
+
+ JButton btnNewButton_6 = new JButton("开始备份");
+ btnNewButton_6.setBounds(206, 357, 113, 27);
+ panel.add(btnNewButton_6);
+
+ textField_5 = new JTextField("D:\\hzb2022");
+ textField_5.setFont(new Font("微软雅黑", Font.PLAIN, 15));
+ textField_5.setBounds(170, 92, 245, 24);
+ panel.add(textField_5);
+ textField_5.setColumns(10);
+
+
new Timer(500, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- currentProgress++;
- if (currentProgress > MAX_PROGRESS) {
- currentProgress = MIN_PROGRESS;
- }
- progressBar.setValue(currentProgress);
- progressBar.setForeground(Color.BLUE);
- }
- }).start();
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ currentProgress++;
+ if (currentProgress > MAX_PROGRESS) {
+ currentProgress = MIN_PROGRESS;
+ }
+ progressBar.setValue(currentProgress);
+ progressBar.setForeground(Color.BLUE);
+ }
+ }).start();
}
@Override
- public void actionPerformed(ActionEvent e) {
-
+ public void actionPerformed(ActionEvent e) {
+
}
}
diff --git a/src/main/java/com/insigma/utils/DbUtil.java b/src/main/java/com/insigma/utils/DbUtil.java
new file mode 100644
index 0000000..a92460d
--- /dev/null
+++ b/src/main/java/com/insigma/utils/DbUtil.java
@@ -0,0 +1,44 @@
+package com.insigma.utils;
+
+import cn.hutool.db.Session;
+import cn.hutool.db.ds.simple.SimpleDataSource;
+import org.springframework.util.StringUtils;
+
+import javax.sql.DataSource;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * (DbUtil 类)
+ *
+ * @author zhangxianwei
+ * @since 15:18 2022/4/18
+ */
+public class DbUtil {
+
+ private static DataSource ds;
+ public static String url;
+ public static String usr;
+ public static String pwd;
+
+ public static Session getSession(String url, String usr, String pwd) {
+ if(Objects.isNull(ds)){
+ DbUtil.url = url;
+ DbUtil.usr = url;
+ DbUtil.pwd = url;
+ ds = new SimpleDataSource(isDb(url), usr, pwd);
+ }
+ return Session.create(ds);
+ }
+
+ private static final String MYSQL = "jdbc:mysql";
+ private static String isDb(String url){
+ if(StringUtils.startsWithIgnoreCase(url, MYSQL)){
+ url += "?useUnicode=true&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
+ }
+ return url;
+ }
+
+ public static final List RUBBISH = Arrays.asList("","","","","");
+}
diff --git a/src/main/java/com/insigma/utils/FileUtil.java b/src/main/java/com/insigma/utils/FileUtil.java
new file mode 100644
index 0000000..93a2ba3
--- /dev/null
+++ b/src/main/java/com/insigma/utils/FileUtil.java
@@ -0,0 +1,78 @@
+package com.insigma.utils;
+
+import java.io.*;
+
+/**
+ * (FileUtil 类)
+ *
+ * @author zhangxianwei
+ * @since 16:23 2022/4/18
+ */
+public class FileUtil {
+
+ public static void replaceLine(String path, String keyword, String replaceToStr) {
+ String temp;
+ try {
+ File file = new File(path);
+ FileInputStream fis = new FileInputStream(file);
+ InputStreamReader isr = new InputStreamReader(fis);
+ BufferedReader br = new BufferedReader(isr);
+ StringBuffer buf = new StringBuffer();
+
+ // 保存该行前面的内容
+ while ((temp = br.readLine()) != null) {
+ if (temp.trim().startsWith(keyword)) {
+ buf = buf.append(replaceToStr);
+ } else {
+ buf = buf.append(temp);
+ }
+ buf = buf.append(System.getProperty("line.separator"));
+ }
+
+ br.close();
+ FileOutputStream fos = new FileOutputStream(file);
+ PrintWriter pw = new PrintWriter(fos);
+ pw.write(buf.toString().toCharArray());
+ pw.flush();
+ pw.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
+
+ /**
+ * 删除整个文件夹里的内容
+ *
+ * @param path
+ * @throws Exception
+ */
+ public static void delAllFile(String path) {
+ File file = new File(path);
+ if (!file.exists()) {
+ return;
+ }
+ if (!file.isDirectory()) {
+ return;
+ }
+ String[] tempList = file.list();
+ File temp = null;
+ for (int i = 0; i < tempList.length; i++) {
+ if (path.endsWith(File.separator)) {
+ temp = new File(path + tempList[i]);
+ } else {
+ temp = new File(path + File.separator + tempList[i]);
+ }
+ if (temp.isFile()) {
+ temp.delete();
+ }
+ if (temp.isDirectory()) {
+ delAllFile(path + File.separatorChar + tempList[i]);// 先删除文件夹里面的文件
+ File folderPath = new File(path + File.separatorChar + tempList[i]); // 再删除空文件夹
+ folderPath.delete();
+ }
+ }
+ file.delete(); //删除自身文件夹
+ }
+}
diff --git a/src/main/java/com/insigma/utils/LinuxCommandUtil.java b/src/main/java/com/insigma/utils/LinuxCommandUtil.java
new file mode 100644
index 0000000..ce974d7
--- /dev/null
+++ b/src/main/java/com/insigma/utils/LinuxCommandUtil.java
@@ -0,0 +1,71 @@
+package com.insigma.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.util.StringUtils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+/**
+ * CommandImpUtil
+ *
+ * @author admin
+ */
+@Slf4j
+public class LinuxCommandUtil implements Runnable {
+ private String command;
+
+ public LinuxCommandUtil(String command) {
+ this.command = command;
+ }
+
+ @Override
+ public void run() {
+ Process process;
+ int exitVal = 0;
+ try {
+ log.debug("准备执行命令:{}",command);
+ process = Runtime.getRuntime().exec(command);
+ // Runtime.exec()创建的子进程公用父进程的流,不同平台上,父进程的stream buffer可能被打满导致子进程阻塞,从而永远无法返回。
+ //针对这种情况,我们只需要将子进程的stream重定向出来即可。
+ new RunCmdStreamThread(process.getInputStream(), "INFO").start();
+ new RunCmdStreamThread(process.getErrorStream(), "ERR").start();
+
+ exitVal = process.waitFor();
+ } catch (IOException | InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ if (exitVal != 0) {
+ log.error("执行命令发生异常:{}", exitVal);
+ throw new RuntimeException("shell任务执行失败");
+ }
+ }
+
+ static class RunCmdStreamThread extends Thread {
+ InputStream is;
+ String printType;
+
+ RunCmdStreamThread(InputStream is, String printType) {
+ this.is = is;
+ this.printType = printType;
+ }
+
+ @Override
+ public void run() {
+ try {
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr);
+ String line;
+ while ((line = br.readLine()) != null) {
+ log.debug("输出:{}>{}", printType, line);
+ }
+
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/insigma/utils/RegisterUtil.java b/src/main/java/com/insigma/utils/RegisterUtil.java
new file mode 100644
index 0000000..a83992a
--- /dev/null
+++ b/src/main/java/com/insigma/utils/RegisterUtil.java
@@ -0,0 +1,12 @@
+package com.insigma.utils;
+
+/**
+ * (RegisterUtil 类)
+ *
+ * @author zhangxianwei
+ * @since 18:02 2022/4/18
+ */
+public class RegisterUtil {
+
+
+}
diff --git a/src/main/java/com/insigma/utils/WinCommandUtil.java b/src/main/java/com/insigma/utils/WinCommandUtil.java
index cdb8584..08f7ef0 100644
--- a/src/main/java/com/insigma/utils/WinCommandUtil.java
+++ b/src/main/java/com/insigma/utils/WinCommandUtil.java
@@ -1,6 +1,8 @@
package com.insigma.utils;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.util.StringUtils;
+
import java.io.*;
/**
@@ -12,8 +14,14 @@ import java.io.*;
public class WinCommandUtil implements Runnable {
private String command;
+ private final String CMD = "cmd";
+ private final String EXE = "cmd.exe /c ";
public WinCommandUtil(String command) {
- this.command = command;
+ if(StringUtils.startsWithIgnoreCase(command, CMD)){
+ this.command = command;
+ }else{
+ this.command = EXE + command;
+ }
}
@Override
diff --git a/src/main/java/com/insigma/utils/ZipUtil.java b/src/main/java/com/insigma/utils/ZipUtil.java
new file mode 100644
index 0000000..7e83f0c
--- /dev/null
+++ b/src/main/java/com/insigma/utils/ZipUtil.java
@@ -0,0 +1,69 @@
+package com.insigma.utils;
+
+import com.insigma.config.AppCfg;
+
+import java.io.File;
+
+/**
+ * (ZipUtil 类)
+ *
+ * @author zhangxianwei
+ * @since 17:34 2022/4/18
+ */
+public class ZipUtil {
+ private static final String SX = "/";
+ private static final String XX = "\\";
+ public static void zip7Z(String dirName, String zipFileName) {
+ if (XX.equals(File.separator)) {
+ String cmd7z = getRootPath() + "7-Zip/7z.exe";
+ try {
+ String cmd = "cmd.exe /c " + cmd7z.trim().replace(" ", "\" \"") + " a -tzip \"" + zipFileName + "\" \"" + dirName + "\\*\"";
+ new WinCommandUtil(cmd).run();
+ } catch (Exception ie) {
+ ie.printStackTrace();
+ }
+ } else if (SX.equals(File.separator)) {
+ try {
+ String cmd777 = "chmod -R 777 "+dirName;
+ new LinuxCommandUtil(cmd777).run();
+
+ int index = cmd777.lastIndexOf(File.separator);
+ String cmd777Short = cmd777.substring(0,index);
+ new LinuxCommandUtil(cmd777Short).run();
+
+ String cmd = "7z a "+zipFileName+" "+dirName+" ";
+ new LinuxCommandUtil(cmd).run();
+ } catch (Exception ie) {
+ ie.printStackTrace();
+ }
+ }
+ }
+ public static void unZip7Z(String filepath, String destinationDir) {
+ if (XX.equals(File.separator)) {
+ String cmd7z = getRootPath() + "7-Zip/7z.exe";
+ try {
+ String cmd = "cmd.exe /c " + cmd7z.trim().replace(" ", "\" \"") + " x \"" + filepath + "\" -o\"" + destinationDir + "\" " + " -y ";
+ new WinCommandUtil(cmd).run();
+ } catch (Exception ie) {
+ ie.printStackTrace();
+ }
+ } else if (SX.equals(File.separator)) {
+ try {
+
+ String cmd777 ="chmod -R 777 "+filepath+File.separator;
+ new WinCommandUtil(cmd777).run();
+
+ String cmd = "unzip -o "+filepath+" -d "+destinationDir+"";
+ new WinCommandUtil(cmd).run();
+
+ new WinCommandUtil(cmd777).run();
+ } catch (Exception ie) {
+ ie.printStackTrace();
+ }
+ }
+ }
+
+ public static String getRootPath() {
+ return AppCfg.HZB + "/tomcat8/webapps/qggwy/WEB-INF/classes/static/softTools/";
+ }
+}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index db7609b..b8e512d 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -9,7 +9,8 @@ spring:
basename: language/swingset
logging:
- level: debug
+ level:
+ com.insigma: debug
file:
path: output/log
name: D:/ouput/logs/SwingDemoLog.log
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 02bd051..4d08c6c 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -3,3 +3,12 @@
spring.profiles.active=dev
swing.ui.testCN=测试
+
+db.url=jdbc:mysql://127.0.0.1:35017/hy_qggwy
+db.usr=root
+db.pwd=admin
+
+hy.db=GWY20_Mysql
+hy.mw=GWY20_Tomcat
+hy.hzb=D:/hzb2021
+hy.browser=360se.exe