diff --git a/app.irbs/build-common.gradle b/app.irbs/build-common.gradle index dc7beac..154a434 100644 --- a/app.irbs/build-common.gradle +++ b/app.irbs/build-common.gradle @@ -6,7 +6,7 @@ * 2. gradle bootwar -Dtarget=undertow # undertow, target=undertow * 3. gradle bootwar -Dtarget=jetty # jetty, target=jetty */ -def target =System.getProperty("target") ?: "tomcat"; +def target =System.getProperty("target") ?: "undertow"; System.setProperty('target',target); // 根据 targetRuntime 变量的值执行实际的 build.gradle diff --git a/build.gradle b/build.gradle index 0095fb5..b3c385a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,13 @@ import org.gradle.api.artifacts.DependencyResolveDetails +import java.util.zip.GZIPOutputStream + apply from: "build-version.gradle" +// 判断项目是否是普通前端项目 def isFrontendProject(currentDir){ - return file(currentDir.getAbsolutePath() + '/package.json').exists() && !file(currentDir.getAbsolutePath() + '/webpack.env.lib.cjs').exists(); + return file(currentDir.getAbsolutePath() + '/package.json').exists() + && !file(currentDir.getAbsolutePath() + '/webpack.env.lib.cjs').exists(); } /*********************************************************************** @@ -17,8 +21,9 @@ buildscript { } } dependencies { + classpath "com.gradleup.shadow:shadow-gradle-plugin:${shadow_gradle_plugin_version}" classpath "org.springframework.boot:org.springframework.boot.gradle.plugin:${spring_boot_version}" - classpath "io.sc:io.sc.platform.gradle:${platform_plugin_version}" + //classpath "io.sc:io.sc.platform.gradle:${platform_plugin_version}" classpath "org.asciidoctor:asciidoctor-gradle-jvm:${asciidoctor_version}" classpath "com.google.cloud.tools:jib-gradle-plugin:${jib_version}" } @@ -29,7 +34,7 @@ buildscript { **********************************************************************/ allprojects { apply plugin: 'idea' - apply plugin: 'io.sc.platform.gradle' + //apply plugin: 'io.sc.platform.gradle' } /*********************************************************************** @@ -42,78 +47,86 @@ subprojects { apply plugin: 'maven-publish' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' - apply plugin: "org.asciidoctor.jvm.convert" + apply plugin: 'org.asciidoctor.jvm.convert' - configurations.all { - //设置 gradle 拉取依赖包的缓存策略为不进行缓存,可保证每次拉取最新的依赖包 - //resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds' //动态版本: 1.1.+ - //resolutionStrategy.cacheChangingModulesFor 0, 'seconds' //静态版本: 1.1.2 + configurations.all { + //设置 gradle 拉取依赖包的缓存策略为不进行缓存,可保证每次拉取最新的依赖包 + //resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds' //动态版本: 1.1.+ + //resolutionStrategy.cacheChangingModulesFor 0, 'seconds' //静态版本: 1.1.2 //排除不需要的外部依赖 +// exclude group: "org.apache.logging.log4j", module: "log4j-api" +// exclude group: "org.apache.logging.log4j", module: "log4j-to-slf4j" +// exclude group: "org.slf4j", module: "slf4j-jdk14" exclude group: "org.slf4j", module: "slf4j-nop" - - resolutionStrategy.eachDependency { DependencyResolveDetails detail -> - def requested =detail.requested; - def groupAndName =requested.group + ":" + requested.name; - if(PlatformDependencyVersions[groupAndName]!=null){ - detail.useVersion(PlatformDependencyVersions[groupAndName]); + exclude group: "org.slf4j", module: "slf4j-reload4j" + //exclude group: "com.mysql", module: "mysql-connector-j" + + if(PlatformDependencyVersions!=null && PlatformDependencyVersions.size()>0) { + resolutionStrategy.eachDependency { DependencyResolveDetails detail -> + def requested = detail.requested; + def groupAndName = requested.group + ":" + requested.name; + String version = PlatformDependencyVersions[groupAndName]; + if (version != null) { + detail.useVersion(version); + } } } - } + } - dependencyManagement { - resolutionStrategy { - //设置 gradle 拉取依赖包的缓存策略为不进行缓存,可保证每次拉取最新的依赖包 - //cacheDynamicVersionsFor 0, 'seconds' //动态版本: 1.1.+ + dependencyManagement { + resolutionStrategy { + //设置 gradle 拉取依赖包的缓存策略为不进行缓存,可保证每次拉取最新的依赖包 + //cacheDynamicVersionsFor 0, 'seconds' //动态版本: 1.1.+ //cacheChangingModulesFor 0, 'seconds' //静态版本: 1.1.2 } - imports { - //mavenBom "org.springframework.cloud:spring-cloud-dependencies:${spring_cloud_version}" + imports { + //mavenBom "org.springframework.cloud:spring-cloud-dependencies:${spring_cloud_version}" mavenBom "com.alibaba.cloud:spring-cloud-alibaba-dependencies:${spring_cloud_alibaba_version}" mavenBom "org.springframework.statemachine:spring-statemachine-bom:${spring_statemachine_version}" - } - } + } + } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * 配置构建时所需依赖的仓库 url * 将仓库 url 都定位到 ${repository_url} 指定的本地私有仓库地址 *----------------------------------------------------------------*/ - repositories { - all { ArtifactRepository repo -> + repositories { + all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){ def url = repo.url.toString() if ( - url.startsWith('https://repo1.maven.org/maven2') - || url.startsWith('https://jcenter.bintray.com/') - || url.startsWith('https://maven.aliyun.com') + url.startsWith('https://repo1.maven.org/maven2') + || url.startsWith('https://jcenter.bintray.com/') + || url.startsWith('https://maven.aliyun.com') ) { remove repo } } } - maven { - allowInsecureProtocol = true - url "${repository_url}" - } - } + maven { + allowInsecureProtocol = true + url "${repository_url}" + } + } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * java 编译时选项 *----------------------------------------------------------------*/ sourceCompatibility ="${java_version}" - targetCompatibility ="${java_version}" - compileJava.options.encoding ="${java_encoding}" - compileTestJava.options.encoding ="${java_encoding}" + targetCompatibility ="${java_version}" + compileJava.options.encoding ="${java_encoding}" + compileTestJava.options.encoding ="${java_encoding}" - tasks.withType(JavaCompile) { - options.compilerArgs += ["-Xlint:deprecation","-Xlint:unchecked"] - } + tasks.withType(JavaCompile) { + options.compilerArgs += ["-Xlint:deprecation","-Xlint:unchecked"] + } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * 配置项目基本信息 *----------------------------------------------------------------*/ - group ="${application_group}" - version ="${application_version}" + group ="${application_group}" + version ="${application_version}" if(file('package.json').exists()){ mkdir 'java-src/main/java'; @@ -121,7 +134,7 @@ subprojects { mkdir 'dist'; sourceSets.main.java.srcDir 'java-src/main/java' sourceSets.main.resources.srcDir 'java-src/main/resources' - sourceSets.main.resources.srcDir 'dist' + sourceSets.main.resources.srcDir 'dist' } /*----------------------------------------------------------------- @@ -147,48 +160,51 @@ subprojects { } clean { - delete 'dist' //删除前端自动生成的资源目录 delete 'bin' //删除 eclipse 编译的 bin 目录 delete 'build' //删除 gradle 构建目录 + delete 'dist' //删除前端打包后的目录 + delete 'node_modules' //删除前端 node_modules 目录 + delete 'pnpm-lock.yaml' //删除前端 pnpm 文件 + delete 'package-lock.json' //删除前端 npm 文件 } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * 配置 eclipse 插件 *----------------------------------------------------------------*/ eclipse{ - jdt{ - sourceCompatibility ="${java_version}" - targetCompatibility ="${java_version}" - } - } + jdt{ + sourceCompatibility ="${java_version}" + targetCompatibility ="${java_version}" + } + } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * springboot 插件配置 *----------------------------------------------------------------*/ jar { - //可以生成普通的 jar - enabled = true - archiveClassifier.set("") - manifest { + //可以生成普通的 jar + enabled = true + archiveClassifier.set("") + manifest { attributes 'Manifest-Version' : '1.0', - 'Implementation-Title' : name, - 'Implementation-Vendor' : group, - 'Implementation-Version': archiveVersion + 'Implementation-Title' : name, + 'Implementation-Vendor' : group, + 'Implementation-Version': archiveVersion } } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * asciidoctor 插件配置,用于生成 asciidoc 文档,用于打包到 jar 中 *----------------------------------------------------------------*/ - asciidoctor { - baseDirFollowsSourceDir() - outputs.upToDateWhen { true } - - logDocuments = true - sourceDir = file('asciidoc') - sources { - include '*.adoc' - } + asciidoctor { + baseDirFollowsSourceDir() + outputs.upToDateWhen { true } + + logDocuments = true + sourceDir = file('asciidoc') + sources { + include '*.adoc' + } outputDir = file("dist/help/" + project.name) resources { from(sourceDir) { @@ -198,24 +214,24 @@ subprojects { } asciidoctorj { - modules { - diagram.use() - } - } + modules { + diagram.use() + } + } /*----------------------------------------------------------------- * 自定义任务,用于生成 asciidoc 文档到 web 服务器,以便实时查看效果 *----------------------------------------------------------------*/ task doc(type: org.asciidoctor.gradle.jvm.AsciidoctorTask){ - baseDirFollowsSourceDir() - outputs.upToDateWhen { true } + baseDirFollowsSourceDir() + outputs.upToDateWhen { true } - logDocuments = true - sourceDir = file('asciidoc') - sources { - include '*.adoc' - } - outputDir = file("$asciidoc_deploy_dir" + project.name) + logDocuments = true + sourceDir = file('asciidoc') + sources { + include '*.adoc' + } + outputDir = file("$asciidoc_deploy_dir" + project.name) // 拷贝 asciidoc 自定义资源 // 设置方式: 通过命令行 -D 传入目标环境参数 @@ -229,48 +245,48 @@ subprojects { } } } - } + } /*----------------------------------------------------------------- * 资源处理前执行 asciidoctor *----------------------------------------------------------------*/ processResources { - dependsOn asciidoctor - doLast{ - //打包时移除 jrebel 相关的文件 - delete "$buildDir/resources/main/rebel.xml" - } - } + dependsOn asciidoctor + doLast{ + //打包时移除 jrebel 相关的文件 + delete "$buildDir/resources/main/rebel.xml" + } + } /*----------------------------------------------------------------- * 用于自动生成 jrebel.xml 文件的自定义任务(eclipse) *----------------------------------------------------------------*/ - task jrebelEclipse() {} - tasks.jrebelEclipse.doLast { - File resourcesFile =file('src/main/resources') - if(resourcesFile!=null && resourcesFile.exists()){ - File rebelFile = file('src/main/resources/rebel.xml') - rebelFile.withWriter('UTF-8') { writer -> - writer.write('\n'); - writer.write('\n'); - writer.write('\t\n'); - if(file(project.name + '/src/main').exists()){ - writer.write('\t\t\n'); - } - if(file(project.name + '/src/generated').exists()){ - writer.write('\t\t\n'); - } - writer.write('\t\n'); - writer.write(''); - } - } - } + task jrebelEclipse() {} + tasks.jrebelEclipse.doLast { + File resourcesFile =file('src/main/resources') + if(resourcesFile!=null && resourcesFile.exists()){ + File rebelFile = file('src/main/resources/rebel.xml') + rebelFile.withWriter('UTF-8') { writer -> + writer.write('\n'); + writer.write('\n'); + writer.write('\t\n'); + if(file(project.name + '/src/main').exists()){ + writer.write('\t\t\n'); + } + if(file(project.name + '/src/generated').exists()){ + writer.write('\t\t\n'); + } + writer.write('\t\n'); + writer.write(''); + } + } + } /*----------------------------------------------------------------- * 用于自动生成 jrebel.xml 文件的自定义任务(idea) *----------------------------------------------------------------*/ - task jrebelIdea() {} - tasks.jrebelIdea.doLast { + task jrebelIdea() {} + tasks.jrebelIdea.doLast { if(isFrontendProject(file('.'))) { File resourcesFile = file('java-src/main/resources') if (resourcesFile != null && resourcesFile.exists()) { @@ -302,7 +318,7 @@ subprojects { } } } - } + } /*----------------------------------------------------------------- * maven publish 插件配置 @@ -310,12 +326,12 @@ subprojects { publishing { repositories { maven { - allowInsecureProtocol = true //允许采用 http 协议发布 + allowInsecureProtocol = true //允许采用 http 协议发布 url = version.contains('SNAPSHOT') ? "${repository_snapshot_url}" : "${repository_release_url}" credentials { username = (version.contains('SNAPSHOT') ? "${repository_snapshot_username}" : "${repository_release_username}") password = (version.contains('SNAPSHOT') ? "${repository_snapshot_password}" : "${repository_release_password}") - } + } } } publications{ @@ -324,18 +340,18 @@ subprojects { //artifact sourcesJar //artifact javadocJar versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } + usage('java-api') { + fromResolutionOf('runtimeClasspath') + } + usage('java-runtime') { + fromResolutionResult() + } + } } } } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * 更新前端模块的 package.json 文件,同步其中的 name 和 version *----------------------------------------------------------------*/ task frontendUpdatePackageJson(){} @@ -361,7 +377,7 @@ subprojects { } } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * pnpm install *----------------------------------------------------------------*/ task frontendNpmInstall(type:Exec){ @@ -411,7 +427,32 @@ subprojects { } } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- + * pnpm re install + *----------------------------------------------------------------*/ + task frontendNpmReInstall(type:Exec){ + if(isFrontendProject(file('.'))){ + workingDir '.' + if(org.gradle.internal.os.OperatingSystem.current().isWindows()){ + commandLine 'cmd', '/c', 'pnpm', 'install' + }else{ + commandLine 'pnpm', 'install' + } + }else{ + if(org.gradle.internal.os.OperatingSystem.current().isWindows()){ + commandLine 'cmd', '/c', 'cd', '.' + }else{ + commandLine 'cd', '.' + } + } + } + tasks.frontendNpmReInstall.doFirst { + if(isFrontendProject(file('.'))) { + println '开始执行 pnpm re install ......'; + } + } + + /*----------------------------------------------------------------- * pnpm run build *----------------------------------------------------------------*/ task frontendNpmBuild(type:Exec) { @@ -436,7 +477,7 @@ subprojects { } } - /*----------------------------------------------------------------- + /*----------------------------------------------------------------- * pnpm run prod *----------------------------------------------------------------*/ task frontendNpmProd(type:Exec) { @@ -475,6 +516,9 @@ subprojects { } tasks.frontendGenerateThymeleafTemplate.doLast { if(isFrontendProject(file('.'))) { + if(!file("dist/public/${project.name}/index.html").exists()){ + return; + } def content = file("dist/public/${project.name}/index.html").text; content = content.replace(' diff --git a/irbs.frontend/src/views/custRating/CustRating.ts b/irbs.frontend/src/views/custRating/CustRating.ts index fb7e9de..edabf36 100644 --- a/irbs.frontend/src/views/custRating/CustRating.ts +++ b/irbs.frontend/src/views/custRating/CustRating.ts @@ -2,21 +2,21 @@ * 评级等级下拉选项数组 */ export const RatingLevelOptions = [ - { label: 'AAA+', value: 'AAA+', numberValue: 15, color: 'green' }, - { label: 'AAA', value: 'AAA', numberValue: 14, color: 'green' }, - { label: 'AA+', value: 'AA+', numberValue: 13, color: 'green' }, - { label: 'AA', value: 'AA', numberValue: 12, color: 'green' }, - { label: 'AA-', value: 'AA-', numberValue: 11, color: 'green' }, - { label: 'A+', value: 'A+', numberValue: 10, color: 'green' }, - { label: 'A', value: 'A', numberValue: 9, color: 'green' }, - { label: 'A-', value: 'A-', numberValue: 8, color: 'green' }, - { label: 'BBB', value: 'BBB', numberValue: 7, color: 'green' }, - { label: 'BB', value: 'BB', numberValue: 6, color: 'red' }, - { label: 'B', value: 'B', numberValue: 5, color: 'red' }, - { label: 'CCC', value: 'CCC', numberValue: 4, color: 'red' }, - { label: 'CC', value: 'CC', numberValue: 3, color: 'red' }, - { label: 'C', value: 'C', numberValue: 2, color: 'red' }, - { label: 'D', value: 'D', numberValue: 1, color: 'red' }, + { label: 'AAA+', value: 'AAA+', numberValue: 15, color: 'green', denseLabel: false }, + { label: 'AAA', value: 'AAA', numberValue: 14, color: 'green', denseLabel: false }, + { label: 'AA+', value: 'AA+', numberValue: 13, color: 'green', denseLabel: false }, + { label: 'AA', value: 'AA', numberValue: 12, color: 'green', denseLabel: false }, + { label: 'AA-', value: 'AA-', numberValue: 11, color: 'green', denseLabel: false }, + { label: 'A+', value: 'A+', numberValue: 10, color: 'green', denseLabel: false }, + { label: 'A', value: 'A', numberValue: 9, color: 'green', denseLabel: false }, + { label: 'A-', value: 'A-', numberValue: 8, color: 'green', denseLabel: false }, + { label: 'BBB', value: 'BBB', numberValue: 7, color: 'green', denseLabel: false }, + { label: 'BB', value: 'BB', numberValue: 6, color: 'red', denseLabel: false }, + { label: 'B', value: 'B', numberValue: 5, color: 'red', denseLabel: false }, + { label: 'CCC', value: 'CCC', numberValue: 4, color: 'red', denseLabel: false }, + { label: 'CC', value: 'CC', numberValue: 3, color: 'red', denseLabel: false }, + { label: 'C', value: 'C', numberValue: 2, color: 'red', denseLabel: false }, + { label: 'D', value: 'D', numberValue: 1, color: 'red', denseLabel: false }, ]; /** diff --git a/irbs.frontend/src/views/custRating/CustRating.vue b/irbs.frontend/src/views/custRating/CustRating.vue index 808a01b..e3145d1 100644 --- a/irbs.frontend/src/views/custRating/CustRating.vue +++ b/irbs.frontend/src/views/custRating/CustRating.vue @@ -171,7 +171,7 @@ const companyRatingGrid = { columns: [ { name: 'id', label: '申请编号', align: 'center' }, { name: 'custNo', label: '客户号', align: 'center' }, - { name: 'custName', label: '客户名称' }, + { name: 'custName', label: '客户名称', width: 150 }, { name: 'industryTypeName', label: '行业类型' }, { name: 'modelScore', label: '模型得分' }, { name: 'modelLevel', label: '模型等级' }, diff --git a/irbs.frontend/src/views/custRating/RatingLevel.vue b/irbs.frontend/src/views/custRating/RatingLevel.vue index c4f9270..c36ce2a 100644 --- a/irbs.frontend/src/views/custRating/RatingLevel.vue +++ b/irbs.frontend/src/views/custRating/RatingLevel.vue @@ -1,6 +1,6 @@