فهرست منبع

增加配置文件加密,前端vue集成打包

xusl 2 سال پیش
والد
کامیت
af60e2e033

+ 10 - 0
.idea/.gitignore

@@ -0,0 +1,10 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Zeppelin ignored files
+/ZeppelinRemoteNotebooks/

+ 11 - 0
.idea/aws.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="accountSettings">
+    <option name="activeRegion" value="us-east-1" />
+    <option name="recentlyUsedRegions">
+      <list>
+        <option value="us-east-1" />
+      </list>
+    </option>
+  </component>
+</project>

+ 21 - 0
.idea/compiler.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <annotationProcessing>
+      <profile default="true" name="Default" enabled="true" />
+      <profile name="Maven default annotation processors profile" enabled="true">
+        <sourceOutputDir name="target/generated-sources/annotations" />
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
+        <outputRelativeToContentRoot value="true" />
+        <module name="ui" />
+        <module name="backend" />
+      </profile>
+    </annotationProcessing>
+  </component>
+  <component name="JavacSettings">
+    <option name="ADDITIONAL_OPTIONS_OVERRIDE">
+      <module name="backend" options="-parameters" />
+      <module name="ssi" options="-parameters" />
+    </option>
+  </component>
+</project>

+ 6 - 0
.idea/encodings.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/backend/src/main/java" charset="UTF-8" />
+  </component>
+</project>

+ 36 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -0,0 +1,36 @@
+<component name="InspectionProjectProfileManager">
+  <profile version="1.0">
+    <option name="myName" value="Project Default" />
+    <inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
+      <option name="TOP_LEVEL_CLASS_OPTIONS">
+        <value>
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+          <option name="REQUIRED_TAGS" value="" />
+        </value>
+      </option>
+      <option name="INNER_CLASS_OPTIONS">
+        <value>
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+          <option name="REQUIRED_TAGS" value="" />
+        </value>
+      </option>
+      <option name="METHOD_OPTIONS">
+        <value>
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+          <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
+        </value>
+      </option>
+      <option name="FIELD_OPTIONS">
+        <value>
+          <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+          <option name="REQUIRED_TAGS" value="" />
+        </value>
+      </option>
+      <option name="IGNORE_DEPRECATED" value="false" />
+      <option name="IGNORE_JAVADOC_PERIOD" value="true" />
+      <option name="IGNORE_DUPLICATED_THROWS" value="false" />
+      <option name="IGNORE_POINT_TO_ITSELF" value="false" />
+      <option name="myAdditionalJavadocTags" value="date" />
+    </inspection_tool>
+  </profile>
+</component>

+ 20 - 0
.idea/jarRepositories.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RemoteRepositoriesConfiguration">
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Central Repository" />
+      <option name="url" value="https://repo.maven.apache.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="central" />
+      <option name="name" value="Maven Central repository" />
+      <option name="url" value="https://repo1.maven.org/maven2" />
+    </remote-repository>
+    <remote-repository>
+      <option name="id" value="jboss.community" />
+      <option name="name" value="JBoss Community repository" />
+      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
+    </remote-repository>
+  </component>
+</project>

+ 12 - 0
.idea/misc.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="MavenProjectsManager">
+    <option name="originalFiles">
+      <list>
+        <option value="$PROJECT_DIR$/pom.xml" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
+</project>

+ 10 - 0
.idea/runConfigurations.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="RunConfigurationProducerService">
+    <option name="ignoredProducers">
+      <set>
+        <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
+      </set>
+    </option>
+  </component>
+</project>

+ 124 - 0
.idea/uiDesigner.xml

@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Palette2">
+    <group name="Swing">
+      <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+      </item>
+      <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+        <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+        <initial-values>
+          <property name="text" value="Button" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="RadioButton" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="CheckBox" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+        <initial-values>
+          <property name="text" value="Label" />
+        </initial-values>
+      </item>
+      <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+          <preferred-size width="150" height="-1" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+          <preferred-size width="150" height="50" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+          <preferred-size width="200" height="200" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+      </item>
+      <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+      </item>
+      <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+          <preferred-size width="-1" height="20" />
+        </default-constraints>
+      </item>
+      <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+        <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+      </item>
+      <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+        <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+      </item>
+    </group>
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 130 - 32
backend/pom.xml

@@ -30,7 +30,7 @@
         <!--<mysql.connector.version>5.1.46</mysql.connector.version>-->
         <mysql.connector.version>8.0.18</mysql.connector.version>
         <hibernate.version>6.0.14.Final</hibernate.version>
-        <jasypt-boot.version>2.1.1</jasypt-boot.version>
+        <jasypt-boot.version>3.0.3</jasypt-boot.version>
         <commons-pool2.version>2.7.0</commons-pool2.version>
         <jedis.version>3.1.0</jedis.version>
         <quartz.version>2.3.1</quartz.version>
@@ -49,20 +49,19 @@
             <artifactId>spring-boot-dependencies</artifactId>
             <version>${spring-boot.version}</version>
             <type>pom</type>
-            <scope>import</scope>
         </dependency>
         <!--web 模块-->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
             <version>${spring-boot.version}</version>
-<!--            <exclusions>-->
-<!--                &lt;!&ndash;排除tomcat依赖&ndash;&gt;-->
-<!--                <exclusion>-->
-<!--                    <artifactId>spring-boot-starter-tomcat</artifactId>-->
-<!--                    <groupId>org.springframework.boot</groupId>-->
-<!--                </exclusion>-->
-<!--            </exclusions>-->
+            <exclusions>
+                <!--排除tomcat依赖-->
+                <exclusion>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                    <groupId>org.springframework.boot</groupId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <!--mysql 驱动-->
         <dependency>
@@ -131,10 +130,10 @@
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
         </dependency>
-<!--        <dependency>-->
-<!--            <groupId>org.springframework.boot</groupId>-->
-<!--            <artifactId>spring-boot-starter-undertow</artifactId>-->
-<!--        </dependency>-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-undertow</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
@@ -223,30 +222,129 @@
     </dependencies>
     <build>
         <plugins>
+            <!--跳过test类-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.21.0</version>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+            <!-- 插件maven-clean-plugin,用于在编译前,清除之前编译的文件、文件夹等,避免残留之前的内容 -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-clean-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <filesets>
+                        <fileset>
+                            <!-- 前端资源目录,即:存放前端包目录-->
+                            <directory>src/main/resources/static</directory>
+                        </fileset>
+                        <fileset>
+                            <!-- Vue项目打包自动生成的dist目录 -->
+                            <directory>../ui/dist</directory>
+                        </fileset>
+                    </filesets>
+                </configuration>
+            </plugin>
+
+            <!--frontend-maven-plugin为项目本地下载/安装Node和NPM,运行npm install命令-->
+            <plugin>
+                <groupId>com.github.eirslett</groupId>
+                <artifactId>frontend-maven-plugin</artifactId>
+                <version>1.6</version>
+                <configuration>
+                    <workingDirectory>../ui</workingDirectory>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>install node and npm</id>
+                        <goals>
+                            <goal>install-node-and-npm</goal>
+                        </goals>
+                        <configuration>
+                            <nodeVersion>v16.13.1</nodeVersion>
+                            <npmVersion>8.1.2</npmVersion>
+                        </configuration>
+                    </execution>
+                    <!-- Install all project dependencies -->
+                    <execution>
+                        <id>npm install</id>
+                        <goals>
+                            <goal>npm</goal>
+                        </goals>
+                        <phase>generate-resources</phase>
+                        <configuration>
+                            <arguments>install</arguments>
+                        </configuration>
+                    </execution>
+                    <!-- Build and minify static files -->
+                    <execution>
+                        <id>npm run build</id>
+                        <goals>
+                            <goal>npm</goal>
+                        </goals>
+                        <configuration>
+                            <arguments>run build:prod</arguments>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <!--资源插件,主要为了从前端项目里复制打包好的文件到springboot项目-->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>3.1.0</version>
+                <executions>
+                    <execution>
+                        <id>copy static</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <!-- 复制前端打包文件到这里 -->
+                            <outputDirectory>src/main/resources/static</outputDirectory>
+                            <overwrite>true</overwrite>
+                            <resources>
+                                <resource>
+                                    <!-- 从前端打包的目录dist进行指定文件、文件夹内容的复制-->
+                                    <directory>${project.parent.basedir}/ui/dist</directory>
+                                    <includes>
+                                        <!-- 具体根据实际前端代码、及目录结构进行配置-->
+                                        <include>assets/</include>
+                                        <include>favicon.ico</include>
+                                        <include>index.html</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
-                <version>2.2.1.RELEASE</version>
+                <version>2.1.7.RELEASE</version>
+                <configuration>
+                    <!--控制是否启用支持Linux下service方式运行-->
+                    <executable>true</executable>
+                    <!--打包后自动运行程序-->
+<!--                    <includeSystemScope>true</includeSystemScope>-->
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>build-info</goal>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
             </plugin>
         </plugins>
-<!--        <resources>-->
-<!--            <resource>-->
-<!--                <directory>src/main/java</directory>-->
-<!--                <includes>-->
-<!--                    <include>**/*.properties</include>-->
-<!--                    <include>**/*.xml</include>-->
-<!--                </includes>-->
-<!--                <filtering>false</filtering>-->
-<!--            </resource>-->
-<!--            <resource>-->
-<!--                <directory>src/main/resources</directory>-->
-<!--                <includes>-->
-<!--                    <include>**/*.properties</include>-->
-<!--                    <include>**/*.xml</include>-->
-<!--                </includes>-->
-<!--                <filtering>false</filtering>-->
-<!--            </resource>-->
-<!--        </resources>-->
     </build>
     <!--上传配置 必须 -->
     <distributionManagement>

+ 2 - 0
backend/src/main/java/com/jiayue/ssi/SsiApplication.java

@@ -1,5 +1,6 @@
 package com.jiayue.ssi;
 
+import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -12,6 +13,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
  */
 @SpringBootApplication
 @MapperScan("com.jiayue.ssi.mapper")
+@EnableEncryptableProperties
 public class SsiApplication {
     public static void main(String[] args) {
         SpringApplication.run(SsiApplication.class, args);

+ 29 - 0
backend/src/main/java/com/jiayue/ssi/config/EncryptorConfig.java

@@ -0,0 +1,29 @@
+package com.jiayue.ssi.config;
+
+import org.jasypt.encryption.StringEncryptor;
+import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
+import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+* jasypt配置类
+*
+* @author xsl
+* @since 2023/04/25
+*/
+@Configuration
+public class EncryptorConfig {
+    @Bean("jasyptStringEncryptor")
+    public StringEncryptor jasyptStringEncryptor() {
+        PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
+        SimpleStringPBEConfig config = new SimpleStringPBEConfig();
+        config.setPassword("atpingan");
+        // 注释部分为配置默认
+        config.setAlgorithm("PBEWithMD5AndDES");
+        config.setIvGeneratorClassName("org.jasypt.iv.NoIvGenerator");
+        config.setPoolSize("1");
+        encryptor.setConfig(config);
+        return encryptor;
+    }
+}

+ 1 - 1
backend/src/main/java/com/jiayue/ssi/config/WebSecurityConfig.java

@@ -97,6 +97,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     @Override
     public void configure(WebSecurity web) throws Exception {
         /*super.configure(web);*/
-        web.ignoring().antMatchers("/static/**", "/assets/**","/getVerifyCode","/getMailCode","/sysParameterController/getUseSendMail");
+        web.ignoring().antMatchers("/static/**", "/assets/**","/getVerifyCode","/getMailCode","/sysParameterController/getUseSendMail", "/");
     }
 }

+ 8 - 6
backend/src/main/java/com/jiayue/ssi/interceptor/TokenStatusInterceptor.java

@@ -27,12 +27,14 @@ public class TokenStatusInterceptor implements HandlerInterceptor {
         String token = request.getHeader("Authorization");
         JwtTokenUtil jwtTokenUtil = new JwtTokenUtil();
         Claims claims = jwtTokenUtil.getClaimsFromToken(token);
-        // 获取失效时间
-        long expirationTime = claims.getExpiration().getTime();
-        if (System.currentTimeMillis()>(expirationTime-(1000*60*4))){
-            // 刷新token
-            ResponseInfo.doResponse(response,"token即将失效,需要刷新!",409);
-            return false;
+        if (claims!=null){
+            // 获取失效时间
+            long expirationTime = claims.getExpiration().getTime();
+            if (System.currentTimeMillis()>(expirationTime-(1000*60*4))){
+                // 刷新token
+                ResponseInfo.doResponse(response,"token即将失效,需要刷新!",409);
+                return false;
+            }
         }
         return true;
     }

+ 0 - 1
backend/src/main/java/com/jiayue/ssi/util/DateUtils.java

@@ -7,7 +7,6 @@ import java.time.*;
 import java.util.Calendar;
 import java.util.Date;
 
-import com.sun.istack.internal.NotNull;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 /**

+ 56 - 0
backend/src/main/java/com/jiayue/ssi/util/JasyptStringEncryptorDemo.java

@@ -0,0 +1,56 @@
+package com.jiayue.ssi.util;
+
+import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
+import org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig;
+import org.jasypt.util.text.BasicTextEncryptor;
+
+/**
+ * @author xsl
+ * @since 2023/04/25
+ */
+public class JasyptStringEncryptorDemo {
+    public static void main(String[] args) {
+        BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
+        textEncryptor.setPassword("atpingan");
+        System.out.println("==========ssl配置==========");
+        // key-store-password
+        String keyStorePassword = textEncryptor.encrypt("s37d1gxm");
+        System.out.println("keyStorePassword===>"+keyStorePassword);
+        // mysql:url
+        System.out.println("==========mysql配置==========");
+        String mysqlURL = textEncryptor.encrypt("jdbc:mysql://192.168.1.205:3306/ssi?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai");
+        System.out.println("mysqlURL===>"+mysqlURL);
+        String mysqlUserName = textEncryptor.encrypt("root");
+        System.out.println("mysqlUserName===>"+mysqlUserName);
+        String mysqlPassWord = textEncryptor.encrypt("!QAZ2root");
+        System.out.println("mysqlPassWord===>"+mysqlPassWord);
+        // mail
+        System.out.println("==========mail配置==========");
+        String mailUserName = textEncryptor.encrypt("xushilong@jiayuepowertech.com");
+        System.out.println("mailUserName===>"+mailUserName);
+        String mailPassWord = textEncryptor.encrypt("jiayue123456");
+        System.out.println("mailPassWord===>"+mailPassWord);
+    }
+
+    /**
+     * Jasypt 加密
+     *
+     * @param encryptor 加解密工具
+     * @param plaintext 需要加密的字符串
+     **/
+    public static void encryption(StandardPBEStringEncryptor encryptor, String plaintext) {
+        String ciphertext = encryptor.encrypt(plaintext);
+        System.out.println(plaintext + " : " + ciphertext);
+    }
+
+    /**
+     * Jasypt 解密
+     *
+     * @param encryptor  加解密工具
+     * @param ciphertext 需要解密的字符串
+     **/
+    public static void decrypt(StandardPBEStringEncryptor encryptor, String ciphertext) {
+        String plaintext = encryptor.decrypt(ciphertext);
+        System.out.println(ciphertext + " : " + plaintext);
+    }
+}

BIN
backend/src/main/resources/9564748_api.jiayuepowertech.com.pfx


+ 12 - 8
backend/src/main/resources/application.yml

@@ -1,7 +1,12 @@
 server:
   port: 8888
-  tomcat:
-    max-connections: 1000
+  ssl:
+    key-store: classpath:9564748_api.jiayuepowertech.com.pfx
+    key-store-type: PKCS12
+    key-store-password: ENC(6daOBtvpihAkIU2Kh8iRK3KqYgI4E0/s)
+#  tomcat:
+#    max-connections: 1000
+
 #设置提供的服务名
 spring:
   application:
@@ -10,9 +15,9 @@ spring:
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
     type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:mysql://192.168.1.205:3306/ssi?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true&rewriteBatchedStatements=true&serverTimezone=Asia/Shanghai
-    username: root
-    password: "!QAZ2root"
+    url: ENC(QXx1EZuk8U3oLrOT3z852/12vlm8mMS9T3KJFM1kp2X/mAk1aqT+IbxsYjWB2zKQmdlEL5/gYdsKnl8vKwIuEd/jBMuY+Iy2hd7YE3ugmvDiW+NCYqy3Q5X+fq6pP7xkGsHW4mS9KQ1E6YwANjofjujAtL6xOQeaxDl7HA1oS+vaUkWvftdkZEnHPOJJAaPonfMq+2u9HzB+jNVUBYclmo2ztStt24nV9slX46jn5xJ1EAiC5WfUnJ8kEfQenuzY)
+    username: ENC(UN5TVXHQJt2DbXQiX/GRsw==)
+    password: ENC(r9wV3VlMJEcxqJ6hYeG7BLRdUMXsPQHQ)
 
   #邮箱基本配置
   mail:
@@ -23,9 +28,9 @@ spring:
     # 163     smtp.163.com       端口号465或994
     host: smtp.263.net
     #发送者邮箱
-    username: xushilong@jiayuepowertech.com
+    username: ENC(4hsAvmDn50R1rxcYN5UdnSd69rFpv0dNp+6UOkHNTVz4go5lUgGvZw==)
     #配置密码,注意不是真正的密码,而是刚刚申请到的授权码
-    password: jiayue123456
+    password: ENC(g8kj0/rxGdJ5qiETb0BsbWqYFf+/0gvk)
     #端口号465或587
     port: 465
     #默认的邮件编码为UTF-8
@@ -42,7 +47,6 @@ spring:
           #开启debug模式,这样邮件发送过程的日志会在控制台打印出来,方便排查错误
         debug: true
 
-
 #mybatis plus
 #mybatis-plus:
 #  #指明mapper.xml扫描位置(classpath* 代表编译后类文件根目录)

+ 26 - 0
pom.xml

@@ -18,4 +18,30 @@
         <module>ui</module>
         <module>backend</module>
     </modules>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.1.RELEASE</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.7.0</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>

+ 7 - 7
ui/package.json

@@ -23,14 +23,19 @@
     "echarts": "5.4.0",
     "element-ui": "2.15.12",
     "file-saver": "2.0.5",
+    "font-awesome": "^4.7.0",
     "fuse.js": "6.4.3",
     "highlight.js": "9.18.5",
     "js-beautify": "1.13.0",
     "js-cookie": "3.0.1",
     "jsencrypt": "3.0.0-rc.1",
+    "lodash": "^4.17.21",
+    "moment": "^2.24.0",
+    "normalize.css": "7.0.0",
     "nprogress": "0.2.0",
     "quill": "1.3.7",
     "screenfull": "5.0.2",
+    "sm-crypto": "^0.3.12",
     "sortablejs": "1.10.2",
     "vue": "2.6.12",
     "vue-count-to": "1.0.13",
@@ -39,14 +44,9 @@
     "vue-router": "3.4.9",
     "vuedraggable": "2.24.3",
     "vuex": "3.6.0",
+    "vuex-persistedstate": "^4.1.0",
     "vxe-table": "^2.9.18",
-    "xe-utils": "^2.7.5",
-    "sm-crypto": "^0.3.12",
-    "moment": "^2.24.0",
-    "normalize.css": "7.0.0",
-    "lodash": "^4.17.21",
-    "font-awesome": "^4.7.0",
-    "vuex-persistedstate": "^4.1.0"
+    "xe-utils": "^2.7.5"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "4.4.6",

+ 13 - 15
ui/pom.xml

@@ -10,7 +10,8 @@
   <properties>
     <build.node.version>v14.16.0</build.node.version>
     <build.npm.version>7.6.0</build.npm.version>
-    <build.yarn.version>v1.22.10</build.yarn.version>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
   </properties>
 
   <build>
@@ -19,16 +20,23 @@
         <groupId>com.github.eirslett</groupId>
         <artifactId>frontend-maven-plugin</artifactId>
         <version>1.6</version>
+        <configuration>
+          <workingDirectory>.</workingDirectory>
+        </configuration>
         <executions>
           <execution>
             <id>install node and npm</id>
             <goals>
               <goal>install-node-and-npm</goal>
             </goals>
-            <phase>generate-resources</phase>
+            <configuration>
+              <nodeVersion>v16.13.1</nodeVersion>
+              <npmVersion>8.1.2</npmVersion>
+            </configuration>
           </execution>
+          <!-- Install all project dependencies -->
           <execution>
-            <id>yarn install</id>
+            <id>npm install</id>
             <goals>
               <goal>npm</goal>
             </goals>
@@ -37,27 +45,17 @@
               <arguments>install</arguments>
             </configuration>
           </execution>
+          <!-- Build and minify static files -->
           <execution>
             <id>npm run build</id>
             <goals>
               <goal>npm</goal>
             </goals>
-            <phase>compile</phase>
             <configuration>
-              <arguments>run build</arguments>
+              <arguments>run build:prod</arguments>
             </configuration>
           </execution>
         </executions>
-        <configuration>
-          <nodeVersion>${build.node.version}</nodeVersion>
-          <npmVersion>${build.npm.version}</npmVersion>
-          <yarnVersion>${build.yarn.version}</yarnVersion>
-
-          <!-- 国内淘宝镜像-->
-          <nodeDownloadRoot>https://npm.taobao.org/mirrors/node/</nodeDownloadRoot>
-          <npmDownloadRoot>https://registry.npm.taobao.org/npm/-/</npmDownloadRoot>
-          <yarnDownloadRoot>https://npm.taobao.org/mirrors/yarn/</yarnDownloadRoot>
-        </configuration>
       </plugin>
     </plugins>
   </build>

+ 0 - 2
ui/src/main.js

@@ -13,7 +13,6 @@ import App from './App'
 import store from './store'
 import router, {resetRouter} from './router'
 
-import echarts from 'echarts'
 import '@/icons' // icon
 import '@/permission' // permission control
 // import axios from 'axios'
@@ -24,7 +23,6 @@ import {removeToken} from './utils/auth'
 // import { resetForm} from "@/utils/index"
 import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"
 Vue.prototype.$moment = moment
-Vue.prototype.$echarts = echarts
 Vue.prototype.$axios = service
 Vue.use(VXETable)
 Vue.use(plugins)

+ 1 - 0
ui/src/utils/request.js

@@ -84,6 +84,7 @@ service.interceptors.response.use(
    * You can also judge the status by HTTP Status Code
    */
   response => {
+    console.log("===================")
     const res = response.data
     let returnStr = res.split("&")
     let returnData = returnStr[0].split("=")[1]

+ 32 - 20
ui/vue.config.js

@@ -50,7 +50,8 @@ module.exports = {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // target: `http://127.0.0.1:${port}/mock`,
-        target: 'http://localhost:8888',
+        // target: 'http://localhost:8888',
+        target: 'https://localhost:8888',
         changeOrigin: true,
         pathRewrite: {
           ['^' + process.env.VUE_APP_BASE_API]: ''
@@ -59,6 +60,17 @@ module.exports = {
     }
   },
   configureWebpack: {
+    performance: {
+      hints:'warning',
+      //入口起点的最大体积 整数类型(以字节为单位)
+      maxEntrypointSize: 50000000,
+      //生成文件的最大体积 整数类型(以字节为单位 300k)
+      maxAssetSize: 30000000,
+      //只给出 js 文件的性能提示
+      assetFilter: function(assetFilename) {
+        return assetFilename.endsWith('.js');
+      }
+    },
     devtool: 'source-map',
     // provide the app's title in webpack's name field, so that
     // it can be accessed in index.html to inject the correct title.
@@ -68,12 +80,12 @@ module.exports = {
         '@': resolve('src')
       }
     },
-    output: { // 输出重构  打包编译后的 文件名称  【模块名称.版本号.时间戳】
-      // filename: utils.assetsPath('js/[name].[chunkhash].'+Version+'js'),
-      // chunkFilename: utils.assetsPath('js/[id].[chunkhash].'+Version+'js')
-      filename: 'static/js/[name].${Version}.js',         // js打包文件,添加时间戳
-      chunkFilename: 'static/js/[name].${Version}.js'
-    }
+    // output: { // 输出重构  打包编译后的 文件名称  【模块名称.版本号.时间戳】
+    //   // filename: utils.assetsPath('js/[name].[chunkhash].'+Version+'js'),
+    //   // chunkFilename: utils.assetsPath('js/[id].[chunkhash].'+Version+'js')
+    //   filename: 'static/js/[name].${Version}.js',         // js打包文件,添加时间戳
+    //   chunkFilename: 'static/js/[name].${Version}.js'
+    // }
   },
   chainWebpack(config) {
     config.plugins.delete('preload') // TODO: need test
@@ -107,19 +119,19 @@ module.exports = {
       })
       .end()
 // img的文件名修改   // img打包文件,添加时间戳
-    config.module
-      .rule('images')
-      .use('url-loader')
-      .tap(options => {
-        options.name = `static/img/[name].${Version}.[ext]`
-        options.fallback = {
-          loader: 'file-loader',
-          options: {
-            name: `static/img/[name].${Version}.[ext]`
-          }
-        }
-        return options
-      })
+//     config.module
+//       .rule('images')
+//       .use('url-loader')
+//       .tap(options => {
+//         options.name = `static/img/[name].${Version}.[ext]`
+//         options.fallback = {
+//           loader: 'file-loader',
+//           options: {
+//             name: `static/img/[name].${Version}.[ext]`
+//           }
+//         }
+//         return options
+//       })
 
     config
       // https://webpack.js.org/configuration/devtool/#development