diff --git a/build/index.js b/build/index.js new file mode 100644 index 00000000..af5695c5 --- /dev/null +++ b/build/index.js @@ -0,0 +1,86 @@ +'use strict' +// Template version: 1.2.6 +// see http://vuejs-templates.github.io/webpack for documentation. + +const path = require('path') + +module.exports = { + dev: { + // Paths + assetsSubDirectory: 'static', + assetsPublicPath: '/', + proxyTable: {}, + + // Various Dev Server settings + host: 'localhost', // can be overwritten by process.env.HOST + port: 9528, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined + autoOpenBrowser: true, + errorOverlay: true, + notifyOnErrors: false, + poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- + + // Use Eslint Loader? + // If true, your code will be linted during bundling and + // linting errors and warnings will be shown in the console. + useEslint: true, + // If true, eslint errors and warnings will also be shown in the error overlay + // in the browser. + showEslintErrorsInOverlay: false, + + /** + * Source Maps + */ + + // https://webpack.js.org/configuration/devtool/#development + devtool: 'cheap-source-map', + + // CSS Sourcemaps off by default because relative paths are "buggy" + // with this option, according to the CSS-Loader README + // (https://github.com/webpack/css-loader#sourcemaps) + // In our experience, they generally work as expected, + // just be aware of this issue when enabling this option. + cssSourceMap: false + }, + + build: { + // Template for index.html + index: path.resolve(__dirname, '../dist/index.html'), + + // Paths + assetsRoot: path.resolve(__dirname, '../dist'), + assetsSubDirectory: 'static', + + /** + * You can set by youself according to actual condition + * You will need to set this if you plan to deploy your site under a sub path, + * for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/, + * then assetsPublicPath should be set to "/bar/". + * In most cases please use '/' !!! + */ + assetsPublicPath: '/report/', + + /** + * Source Maps + */ + + productionSourceMap: false, + // https://webpack.js.org/configuration/devtool/#production + devtool: 'source-map', + + // Gzip off by default as many popular static hosts such as + // Surge or Netlify already gzip all static assets for you. + // Before setting to `true`, make sure to: + // npm install --save-dev compression-webpack-plugin + productionGzip: false, + productionGzipExtensions: ['js', 'css'], + + // Run the build command with an extra argument to + // View the bundle analyzer report after build finishes: + // `npm run build --report` + // Set to `true` or `false` to always turn it on or off + bundleAnalyzerReport: process.env.npm_config_report || false, + + // `npm run build:prod --generate_report` + generateAnalyzerReport: process.env.npm_config_generate_report || false + } +} diff --git a/build/pom.xml b/build/pom.xml new file mode 100644 index 00000000..5bcc2a97 --- /dev/null +++ b/build/pom.xml @@ -0,0 +1,217 @@ + + + + + org.springframework.boot + spring-boot-starter-parent + 2.3.5.RELEASE + + + + 4.0.0 + + com.anji-plus.otwb + product-report-starter + 1.2.0-SNAPSHOT + + + UTF-8 + -Xdoclint:none + 1.8 + 1.8 + true + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.apache.logging.log4j + log4j-to-slf4j + + + + + + org.apache.logging.log4j + log4j-to-slf4j + 2.15.0 + + + + org.apache.logging.log4j + log4j-api + 2.15.0 + + + + + org.springframework.boot + spring-boot-starter-cache + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.cloud + spring-cloud-context + 2.2.6.RELEASE + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + com.anji-plus + spring-boot-gaea + 2.0.3.RELEASE + + + org.springframework.boot + spring-boot-starter-data-redis + + + + + + com.baomidou + mybatis-plus-boot-starter + 3.3.2 + + + + mysql + mysql-connector-java + + + com.alibaba + druid + 1.2.0 + + + org.flywaydb + flyway-core + 5.2.1 + + + + net.sf.ehcache + ehcache + 2.10.6 + + + + org.apache.httpcomponents + httpclient + 4.5.10 + + + + org.projectlombok + lombok + 1.18.10 + true + + + + com.itextpdf + itextpdf + 5.5.13.2 + + + com.itextpdf + itext-asian + 5.2.0 + + + + org.apache.poi + poi + 4.1.2 + + + org.apache.poi + poi-ooxml + 4.1.2 + + + org.apache.poi + poi-ooxml-schemas + 4.1.2 + + + + org.codehaus.groovy + groovy + 3.0.9 + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.8 + 1.8 + UTF-8 + + + + org.apache.maven.plugins + maven-resources-plugin + 2.4 + + UTF-8 + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.7 + + true + + + + + + + nexus-releases + http://10.108.10.53:8081/repository/maven-releases/ + + + nexus-snapshots + http://10.108.10.53:8081/repository/maven-snapshots/ + + + diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..9ed7aaed --- /dev/null +++ b/deploy.sh @@ -0,0 +1,34 @@ +#!/bin/bash +#该脚本为私有化脚本,打包成内含网页的product-report-starter放在内网私服 + +#判断node.js mvn是否存在 +command -v npm >/dev/null 2>&1 || { echo >&2 "I require node.js v14.16.0+ but it's not installed. Aborting."; sleep 5; exit 1; } +command -v mvn >/dev/null 2>&1 || { echo >&2 "I require maven 3.5 + but it's not installed. Aborting."; sleep 5; exit 1; } + +cd `dirname $0` +BuildDir=`pwd` #工程根目录 + +#重置pom和index.js +cat $BuildDir/build/index.js > $BuildDir/report-ui/config/index.js +cat $BuildDir/build/pom.xml > $BuildDir/report-core/pom.xml + +echo "build web" +cd $BuildDir/report-ui +rm -rf dist +npm install >/dev/null 2>&1 +npm run build:prod + +echo "publish web to springboot src/main/resources/static" +rm -rf $BuildDir/report-core/src/main/resources/db/migration +rm -rf $BuildDir/report-core/src/main/resources/static +mkdir -p $BuildDir/report-core/src/main/resources/static +mv $BuildDir/report-ui/dist/* $BuildDir/report-core/src/main/resources/static/ + + +echo "build springboot" +cd $BuildDir/report-core + +mvn clean deploy -DskipTests + +rm -rf $BuildDir/report-core/src/main/resources/static +git reset --hard \ No newline at end of file diff --git a/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java b/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java index e6595b68..5462a378 100644 --- a/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java +++ b/report-core/src/main/java/com/anjiplus/template/gaea/business/filter/TokenFilter.java @@ -14,7 +14,6 @@ import org.apache.http.entity.ContentType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.annotation.Order; -import org.springframework.http.HttpMethod; import org.springframework.stereotype.Component; import org.springframework.util.AntPathMatcher; import org.springframework.util.CollectionUtils; @@ -41,8 +40,9 @@ import static com.anji.plus.gaea.constant.GaeaConstant.URL_REPLACEMENT; public class TokenFilter implements Filter { private static final Pattern PATTERN = Pattern.compile(".*().*"); private static final String USER_GUEST = "guest"; - private static final String SLASH = "/"; - private AntPathMatcher antPathMatcher = new AntPathMatcher(); + + @Value("${server.servlet.context-path:'/'}") + private String SLASH = "/"; @Autowired private CacheHelper cacheHelper; @@ -54,6 +54,7 @@ public class TokenFilter implements Filter { private List skipAuthenticateUrls; private Pattern skipAuthenticatePattern; + private AntPathMatcher antPathMatcher = new AntPathMatcher(); @Override public void init(FilterConfig filterConfig) throws ServletException { @@ -74,8 +75,8 @@ public class TokenFilter implements Filter { return; } - if (SLASH.equals(uri)) { - response.sendRedirect("/index.html"); + if (SLASH.equals(uri) || SLASH.concat("/").equals(uri)) { + response.sendRedirect(SLASH + "/index.html"); return; } @@ -127,10 +128,11 @@ public class TokenFilter implements Filter { //判断接口权限 //请求路径 - String requestUrl = request.getRequestURI(); + //String requestUrl = request.getRequestURI(); requestUrl中可能会有contextpath,而底层扫描的controller是没有的 + String servletPath = request.getServletPath(); String methodValue = request.getMethod(); //请求方法+#+请求路径 - String urlKey = methodValue + GaeaConstant.URL_SPLIT + requestUrl; + String urlKey = methodValue + GaeaConstant.URL_SPLIT + servletPath; GaeaUserDto gaeaUserDto = JSONObject.parseObject(gaeaUserJsonStr, GaeaUserDto.class); List authorities = gaeaUserDto.getAuthorities(); @@ -165,9 +167,6 @@ public class TokenFilter implements Filter { return; } - - - // 延长有效期 cacheHelper.stringSetExpire(tokenKey, token, 3600); cacheHelper.stringSetExpire(userKey, gaeaUserJsonStr, 3600); diff --git a/report-ui/src/views/resultset/index.vue b/report-ui/src/views/resultset/index.vue index a4d14c11..256852df 100644 --- a/report-ui/src/views/resultset/index.vue +++ b/report-ui/src/views/resultset/index.vue @@ -4,7 +4,7 @@ * @Author: qianlishi * @Date: 2021-12-11 14:48:27 * @LastEditors: qianlishi - * @LastEditTime: 2022-03-09 09:49:23 + * @LastEditTime: 2022-04-14 18:48:24 -->