Browse Source

基础框架发布: 8.2.25

1) Java 编译引擎支持内存编译

前端核心发布: 8.2.26
  1) 支持服务端验证和纯客户端 JWT token 认证
main
wangshaoping 2 months ago
parent
commit
f1dd083850
  1. 1
      app.platform/build.gradle
  2. 4
      cips.frontend/package.json
  3. 4
      cips.frontend/public/configure.js
  4. 4
      erm.frontend/package.json
  5. 4
      erm.frontend/public/configure.js
  6. 4
      gradle.properties
  7. 4
      io.sc.engine.mv.frontend/package.json
  8. 4
      io.sc.engine.mv.frontend/public/configure.js
  9. 2
      io.sc.engine.rule.client.spring/src/main/java/io/sc/engine/rule/client/spring/util/EngineSpringApplicationContextUtil.java
  10. 37
      io.sc.engine.rule.client/src/main/java/io/sc/engine/rule/client/runtime/impl/java/JavaEngineServiceImpl.java
  11. 32
      io.sc.engine.rule.client/src/main/resources/META-INF/platform/plugins/exportable-resources.json
  12. 2
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/DictionaryGenerator.java
  13. 4
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/IndicatorGenerator.java
  14. 4
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/ParameterGenerator.java
  15. 4
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/processor/ConditionRange.java
  16. 9
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/processor/NumberRange.java
  17. 2
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/util/ExpressionReplacer.java
  18. 1
      io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/java/template/import_render.tpl
  19. 1
      io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/template/import_render.tpl
  20. 4
      io.sc.engine.rule.frontend/package.json
  21. 4
      io.sc.engine.rule.frontend/public/configure.js
  22. 10303
      io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/application/irs/上海农商银行-内部评级(非零售)-模型.json
  23. 496
      io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/application/irs/上海农商银行-内部评级(非零售)-特征库.json
  24. 43
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/common/initializer/UserFunctionInitializer.java
  25. 3
      io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/model/converter/ParameterEntityConverter.java
  26. 4
      io.sc.engine.st.frontend/package.json
  27. 4
      io.sc.engine.st.frontend/public/configure.js
  28. 4
      io.sc.platform.ai.frontend/package.json
  29. 4
      io.sc.platform.ai.frontend/public/configure.js
  30. 2
      io.sc.platform.core.frontend/package.json
  31. 4
      io.sc.platform.core.frontend/public/configure.js
  32. 6
      io.sc.platform.core.frontend/src/platform/layout/sub-layout/Topper.vue
  33. 37
      io.sc.platform.core.frontend/src/platform/plugin/axios.ts
  34. 7
      io.sc.platform.core.frontend/src/platform/plugin/manager/ApplicationInitializer.ts
  35. 4
      io.sc.platform.core.frontend/src/platform/plugin/manager/AuthenticationManager.ts
  36. 17
      io.sc.platform.core.frontend/src/platform/plugin/router.ts
  37. 1
      io.sc.platform.core.frontend/src/platform/types/ConfigureType.ts
  38. 4
      io.sc.platform.core.frontend/template-project/package.json
  39. 4
      io.sc.platform.core.frontend/template-project/public/configure.js
  40. 4
      io.sc.platform.developer.doc/package.json
  41. 4
      io.sc.platform.developer.frontend/package.json
  42. 4
      io.sc.platform.developer.frontend/public/configure.js
  43. 4
      io.sc.platform.lcdp.frontend/package.json
  44. 4
      io.sc.platform.lcdp.frontend/public/configure.js
  45. 11
      io.sc.platform.lcdp/src/main/java/io/sc/platform/lcdp/configure/api/Setting.java
  46. 4
      io.sc.platform.lcdp/src/main/java/io/sc/platform/lcdp/configure/service/impl/ConfigureServiceImpl.java
  47. 4
      io.sc.platform.license.keygen.frontend/package.json
  48. 4
      io.sc.platform.license.keygen.frontend/public/configure.js
  49. 4
      io.sc.platform.mvc.frontend/package.json
  50. 4
      io.sc.platform.mvc.frontend/public/configure.js
  51. 4
      io.sc.platform.scheduler.manager.frontend/package.json
  52. 4
      io.sc.platform.scheduler.manager.frontend/public/configure.js
  53. 24
      io.sc.platform.security.loginform/src/main/java/io/sc/platform/security/loginform/autoconfigure/WebSecurityAutoConfiguration.java
  54. 6
      io.sc.platform.security.loginform/src/main/java/io/sc/platform/security/loginform/controller/LoginWebController.java
  55. 2
      io.sc.platform.security.loginform/src/main/resources/META-INF/platform/plugins/application-properties.json
  56. 132
      io.sc.platform.security.loginform/src/main/resources/templates/io/sc/platform/security/loginform/view/login.html
  57. 2
      io.sc.platform.security/src/main/java/io/sc/platform/security/controller/AuthenticationWebController.java
  58. 8
      io.sc.platform.security/src/main/java/io/sc/platform/security/service/impl/SystemParameterServiceImpl.java
  59. 3
      io.sc.platform.security/src/main/resources/META-INF/platform/plugins/application-properties.json
  60. 4
      io.sc.platform.system.frontend/package.json
  61. 4
      io.sc.platform.system.frontend/public/configure.js
  62. 64
      io.sc.platform.system/src/main/java/io/sc/platform/system/initializer/ParameterInitializer.java
  63. 47
      io.sc.platform.util/src/main/java/io/sc/platform/util/compiler/memory/MemoryJavaCompiler.java
  64. 13
      io.sc.platform.util/src/main/java/io/sc/platform/util/compiler/memory/MemoryJavaCompilerClassLoader.java
  65. 4
      io.sc.standard.frontend/package.json
  66. 4
      io.sc.standard.frontend/public/configure.js
  67. 4
      io.sc.website/package.json
  68. 4
      wra.report.frontend/package.json
  69. 4
      wra.report.frontend/public/configure.js

1
app.platform/build.gradle

@ -128,6 +128,7 @@ jib {
"java",
"-jar",
"/opt/" + project.name + "/" + project.name + "-" + project.version + ".war",
"--cp_config=true",
"--" + project.name + ".home.dir=" + "/opt/" + project.name
]
//entrypoint = "java -version"

4
cips.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "cips.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
cips.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

4
erm.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "erm.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
erm.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

4
gradle.properties

@ -37,9 +37,9 @@ application_version=1.0.0
# platform
###########################################################
platform_group=io.sc
platform_version=8.2.24
platform_version=8.2.25
platform_plugin_version=8.2.10
platform_core_frontend_version=8.2.84
platform_core_frontend_version=8.2.86
###########################################################
# dependencies version

4
io.sc.engine.mv.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.engine.mv.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.engine.mv.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

2
io.sc.engine.rule.client.spring/src/main/java/io/sc/engine/rule/client/spring/util/EngineSpringApplicationContextUtil.java

@ -57,7 +57,7 @@ public class EngineSpringApplicationContextUtil {
* @throws BeansException 违例
* @param <T> 泛型
*/
public static <T> T getBean(Class<T> requiredType) throws BeansException{
public static <T> T getBean(Class<T> requiredType) throws Exception {
return applicationContext.getBean(requiredType);
}
}

37
io.sc.engine.rule.client/src/main/java/io/sc/engine/rule/client/runtime/impl/java/JavaEngineServiceImpl.java

@ -2,29 +2,22 @@ package io.sc.engine.rule.client.runtime.impl.java;
import io.sc.engine.rule.core.code.SourceCode;
import io.sc.platform.core.DirectoryManager;
import io.sc.platform.util.FileUtil;
import io.sc.platform.util.compiler.file.FileJavaCompiler;
import io.sc.platform.util.compiler.memory.JavaCompileException;
import io.sc.platform.util.compiler.memory.MemoryJavaCompiler;
import org.springframework.util.ConcurrentReferenceHashMap;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class JavaEngineServiceImpl implements JavaEngineService {
private static final String targetDir =DirectoryManager.getInstance().getByName("dir.engine.rule.compiler");
private static final String classPathDir =DirectoryManager.getInstance().getByName("dir.engine.rule.classpath");
private Map<String, URLClassLoader> classLoaderMap =new ConcurrentHashMap<>();
private Map<String, MemoryJavaCompiler> compilers =new ConcurrentReferenceHashMap<>(16,ConcurrentReferenceHashMap.ReferenceType.SOFT);
@Override
public boolean validate(SourceCode sourceCode) throws Exception {
MemoryJavaCompiler engine = new MemoryJavaCompiler();
MemoryJavaCompiler engine = new MemoryJavaCompiler(classPathDir);
engine.compile(sourceCode.getQualifiedClassName(), sourceCode.getSource());
return true;
}
@ -45,22 +38,18 @@ public class JavaEngineServiceImpl implements JavaEngineService {
}
private Method getMethod(SourceCode sourceCode) throws Exception {
URLClassLoader classLoader =classLoaderMap.get(sourceCode.getSource());
//if(classLoader==null){
classLoader =compile(sourceCode);
classLoaderMap.put(sourceCode.getSource(),classLoader);
//}
Class<?> clazz =classLoader.loadClass(sourceCode.getQualifiedClassName());
MemoryJavaCompiler compiler =getCompiler(sourceCode);
Class<?> clazz =compiler.forName(sourceCode.getQualifiedClassName());
return clazz.getDeclaredMethod("execute",Map.class);
}
private URLClassLoader compile(SourceCode sourceCode) throws JavaCompileException, IOException {
String outputDir =targetDir + "/" + sourceCode.getClassName() + "/";
FileUtil.deldirs(outputDir);
new File(outputDir).mkdirs();
FileJavaCompiler fileJavaCompiler =new FileJavaCompiler(classPathDir);
fileJavaCompiler.compile(sourceCode.getQualifiedClassName(),sourceCode.getSource(),outputDir);
return new URLClassLoader(new URL[]{ new URL("file",null,outputDir) },this.getClass().getClassLoader());
private MemoryJavaCompiler getCompiler(SourceCode sourceCode) throws JavaCompileException {
MemoryJavaCompiler compiler =compilers.get(sourceCode.getSource());
if(compiler==null){
compiler =new MemoryJavaCompiler(classPathDir);
compiler.compile(sourceCode.getQualifiedClassName(),sourceCode.getSource());
compilers.put(sourceCode.getSource(),compiler);
}
return compiler;
}
}

32
io.sc.engine.rule.client/src/main/resources/META-INF/platform/plugins/exportable-resources.json

@ -29,31 +29,31 @@
},
{
"type" :"file",
"name" :"io.sc.engine.rule.core-8.2.23.jar",
"description" :"io.sc.engine.rule.core-8.2.23.jar",
"sources" :["classpath:/io/sc/engine/rule/client/jars/io.sc.engine.rule.core-8.2.23.jar"],
"target" :"${dir.engine.rule.classpath}/io.sc.engine.rule.core-8.2.23.jar"
"name" :"io.sc.engine.rule.core-8.2.24.jar",
"description" :"io.sc.engine.rule.core-8.2.24.jar",
"sources" :["classpath:/io/sc/engine/rule/client/jars/io.sc.engine.rule.core-8.2.24.jar"],
"target" :"${dir.engine.rule.classpath}/io.sc.engine.rule.core-8.2.24.jar"
},
{
"type" :"file",
"name" :"io.sc.platform.util-8.2.23.jar",
"description" :"io.sc.platform.util-8.2.23.jar",
"sources" :["classpath:/io/sc/engine/rule/client/jars/io.sc.platform.util-8.2.23.jar"],
"target" :"${dir.engine.rule.classpath}/io.sc.platform.util-8.2.23.jar"
"name" :"io.sc.platform.util-8.2.24.jar",
"description" :"io.sc.platform.util-8.2.24.jar",
"sources" :["classpath:/io/sc/engine/rule/client/jars/io.sc.platform.util-8.2.24.jar"],
"target" :"${dir.engine.rule.classpath}/io.sc.platform.util-8.2.24.jar"
},
{
"type" :"file",
"name" :"io.sc.creditreport.core-8.2.23.jar",
"description" :"io.sc.creditreport.core-8.2.23.jar",
"sources" :["classpath:/io/sc/engine/rule/client/jars/io.sc.creditreport.core-8.2.23.jar"],
"target" :"${dir.engine.rule.classpath}/io.sc.creditreport.core-8.2.23.jar"
"name" :"io.sc.creditreport.core-8.2.24.jar",
"description" :"io.sc.creditreport.core-8.2.24.jar",
"sources" :["classpath:/io/sc/engine/rule/client/jars/io.sc.creditreport.core-8.2.24.jar"],
"target" :"${dir.engine.rule.classpath}/io.sc.creditreport.core-8.2.24.jar"
},
{
"type" :"file",
"name" :"io.sc.engine.rule.client.spring-8.2.23.jar",
"description" :"io.sc.engine.rule.client.spring-8.2.23.jar",
"sources" :["classpath:/io/sc/engine/rule/client/jars/io.sc.engine.rule.client.spring-8.2.23.jar"],
"target" :"${dir.engine.rule.classpath}/io.sc.engine.rule.client.spring-8.2.23.jar"
"name" :"io.sc.engine.rule.client.spring-8.2.24.jar",
"description" :"io.sc.engine.rule.client.spring-8.2.24.jar",
"sources" :["classpath:/io/sc/engine/rule/client/jars/io.sc.engine.rule.client.spring-8.2.24.jar"],
"target" :"${dir.engine.rule.classpath}/io.sc.engine.rule.client.spring-8.2.24.jar"
},
{

2
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/DictionaryGenerator.java

@ -63,7 +63,7 @@ public class DictionaryGenerator {
String tpl ="Double ${fieldName} =new Double(${defaultValue}); //${name}";
sb.append(StringUtil.format(tpl,variables)).append("\n");
}else if (ValueTypeUtil.isString(valueType)) { // 字符串
String tpl ="String ${fieldName} =\"\"\"${defaultValue}\"\"\"; //${name}";
String tpl ="String ${fieldName} =\"${defaultValue}\"; //${name}";
sb.append(StringUtil.format(tpl,variables)).append("\n");
} else { // 非字符串
variables.put("className", IdReplacer.className(valueType, valueTypeVersion));

4
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/IndicatorGenerator.java

@ -41,7 +41,7 @@ public class IndicatorGenerator {
if(StringUtils.hasText(defaultValue)) { // 有默认值
if (valueTypeIsList != null && valueTypeIsList) { //列表
variables.put("className", IdReplacer.className(valueType, valueTypeVersion));
String tpl = "List<${className}> ${fieldName} =ObjectMapperUtil.json().readValue(\"\"\"${defaultValue}\"\"\",new TypeReference<List<${className}>>(){}); //${name}";
String tpl = "List<${className}> ${fieldName} =ObjectMapperUtil.json().readValue(\"${defaultValue}\",new TypeReference<List<${className}>>(){}); //${name}";
sb.append(StringUtil.format(tpl, variables)).append("\n");
} else { //非列表
if (ValueTypeUtil.isBase(valueType)) { // 基本类型
@ -61,7 +61,7 @@ public class IndicatorGenerator {
}
} else { // 非基本类型
variables.put("className", IdReplacer.className(valueType, valueTypeVersion));
String tpl = "${className} ${fieldName} =ObjectMapperUtil.json().readValue(\"\"\"${defaultValue}\"\"\",${className}.class); //${name}";
String tpl = "${className} ${fieldName} =ObjectMapperUtil.json().readValue(\"${defaultValue}\",${className}.class); //${name}";
sb.append(StringUtil.format(tpl, variables)).append("\n");
}
}

4
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/ParameterGenerator.java

@ -43,7 +43,7 @@ public class ParameterGenerator {
} else { //非列表
if (ValueTypeUtil.isBase(valueType)) { // 基本类型
if (ValueTypeUtil.isString(valueType)) { // 字符串
String tpl ="String ${fieldName} =\"\"\"${defaultValue}\"\"\"; //${name}";
String tpl ="String ${fieldName} =\"${defaultValue}\"; //${name}";
sb.append(StringUtil.format(tpl,variables)).append("\n");
}else if(ValueTypeUtil.isLong(valueType)){
String tpl ="Long ${fieldName} =new Long(${defaultValue}); //${name}";
@ -64,7 +64,7 @@ public class ParameterGenerator {
}
} else { // 非基本类型
variables.put("className", IdReplacer.className(valueType, valueTypeVersion));
String tpl = "${className} ${fieldName} =ObjectMapperUtil.json().readValue(\"\"\"${defaultValue}\"\"\",${className}.class); //${name}";
String tpl = "${className} ${fieldName} =ObjectMapperUtil.json().readValue(\"${defaultValue}\",${className}.class); //${name}";
sb.append(StringUtil.format(tpl, variables)).append("\n");
}
}

4
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/processor/ConditionRange.java

@ -71,9 +71,9 @@ public class ConditionRange {
sb.append("\t").append(GroovyExpressionReplacer.ARGUMENT_NAME).append(".").append(IdReplacer.fieldName(code)).append(" =null;\n");
}else {
if(ValueTypeUtil.isLong(valueType)){
sb.append("\t").append(GroovyExpressionReplacer.ARGUMENT_NAME).append(".").append(IdReplacer.fieldName(code)).append(" =Long.valueOf(").append(GroovyExpressionReplacer.groovy(conditionRange.value, valueType)).append(");\n");
sb.append("\t").append(GroovyExpressionReplacer.ARGUMENT_NAME).append(".").append(IdReplacer.fieldName(code)).append(" =").append(GroovyExpressionReplacer.groovy(conditionRange.value, valueType)).append(";\n");
}else if(ValueTypeUtil.isDecimal(valueType)){
sb.append("\t").append(GroovyExpressionReplacer.ARGUMENT_NAME).append(".").append(IdReplacer.fieldName(code)).append(" =new Double(").append(GroovyExpressionReplacer.groovy(conditionRange.value, valueType)).append(");\n");
sb.append("\t").append(GroovyExpressionReplacer.ARGUMENT_NAME).append(".").append(IdReplacer.fieldName(code)).append(" =").append(GroovyExpressionReplacer.groovy(conditionRange.value, valueType)).append(";\n");
}else {
sb.append("\t").append(GroovyExpressionReplacer.ARGUMENT_NAME).append(".").append(IdReplacer.fieldName(code)).append(" =").append(GroovyExpressionReplacer.groovy(conditionRange.value, valueType)).append(";\n");
}

9
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/processor/NumberRange.java

@ -77,13 +77,14 @@ public class NumberRange {
sb.append(GroovyExpressionReplacer.groovy(var)).append("==null");
} else if (numberRange.min != null) {
if (numberRange.minIncluded != null && numberRange.minIncluded) {
if(numberRange.min.doubleValue()<Integer.MIN_VALUE || numberRange.min.doubleValue()>Integer.MIN_VALUE){
System.out.println(numberRange.min.doubleValue());
if(numberRange.min.doubleValue()<Integer.MIN_VALUE || numberRange.min.doubleValue()>Integer.MAX_VALUE){
sb.append(GroovyExpressionReplacer.groovy(var)).append(">=").append(new DecimalFormat("0.0").format(numberRange.min.doubleValue()));
}else {
sb.append(GroovyExpressionReplacer.groovy(var)).append(">=").append(numberRange.min);
}
} else {
if(numberRange.min.doubleValue()<Integer.MIN_VALUE || numberRange.min.doubleValue()>Integer.MIN_VALUE) {
if(numberRange.min.doubleValue()<Integer.MIN_VALUE || numberRange.min.doubleValue()>Integer.MAX_VALUE) {
sb.append(GroovyExpressionReplacer.groovy(var)).append(">").append(new DecimalFormat("0.0").format(numberRange.min.doubleValue()));
}else {
sb.append(GroovyExpressionReplacer.groovy(var)).append(">").append(numberRange.min);
@ -96,13 +97,13 @@ public class NumberRange {
}
if (numberRange.max != null) {
if (numberRange.maxIncluded != null && numberRange.maxIncluded) {
if(numberRange.max.doubleValue()<Integer.MIN_VALUE || numberRange.max.doubleValue()>Integer.MIN_VALUE){
if(numberRange.max.doubleValue()<Integer.MIN_VALUE || numberRange.max.doubleValue()>Integer.MAX_VALUE){
sb.append(GroovyExpressionReplacer.groovy(var)).append("<=").append(new DecimalFormat("0.0").format(numberRange.max.doubleValue()));
}else {
sb.append(GroovyExpressionReplacer.groovy(var)).append("<=").append(numberRange.max);
}
} else {
if(numberRange.max.doubleValue()<Integer.MIN_VALUE || numberRange.max.doubleValue()>Integer.MIN_VALUE){
if(numberRange.max.doubleValue()<Integer.MIN_VALUE || numberRange.max.doubleValue()>Integer.MAX_VALUE){
sb.append(GroovyExpressionReplacer.groovy(var)).append("<").append(new DecimalFormat("0.0").format(numberRange.max.doubleValue()));
}else {
sb.append(GroovyExpressionReplacer.groovy(var)).append("<").append(numberRange.max);

2
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/util/ExpressionReplacer.java

@ -121,7 +121,7 @@ public class ExpressionReplacer {
result =result.replace(placeholder, "${" + _expression + "}");
}
}
return "\"\"\"" + result + "\"\"\"";
return "\"" + result + "\"";
}else {
return replaceHolder(expression,null,null);
}

1
io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/java/template/import_render.tpl

@ -100,4 +100,5 @@ import static java.lang.Math.tan;
import static java.lang.Math.tanh;
import static java.lang.Math.toDegrees;
import static java.lang.Math.toRadians;
import static io.sc.platform.util.ObjectUtil.equal;
#end

1
io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/template/import_render.tpl

@ -101,4 +101,5 @@ import static java.lang.Math.tan;
import static java.lang.Math.tanh;
import static java.lang.Math.toDegrees;
import static java.lang.Math.toRadians;
import static io.sc.platform.util.ObjectUtil.equal;
#end

4
io.sc.engine.rule.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.engine.rule.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.engine.rule.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

10303
io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/application/irs/上海农商银行-内部评级(非零售)-模型.json

File diff suppressed because it is too large

496
io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/application/irs/上海农商银行-内部评级(非零售)-特征库.json

File diff suppressed because one or more lines are too long

43
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/common/initializer/UserFunctionInitializer.java

@ -40,49 +40,6 @@ public class UserFunctionInitializer implements ApplicationInitializer{
isInitialized =true;
}
return isInitialized;
/*
// 插件定义的函数
List<FunctionItem> functionItems =PluginManager.getInstance().getFunctionItemEntries();
Map<String,FunctionItem> cache =new HashMap<>();
List<String> names =new ArrayList<>();
for(FunctionItem item : functionItems){
cache.put(item.getName(),item);
names.add(item.getName());
}
// 系统存在的函数
List<FunctionEntity> functionEntities =functionService.getRepository().findByNameIn(names);
List<String> existsNames =new ArrayList<>();
for(FunctionEntity entity : functionEntities){
existsNames.add(entity.getName());
}
// 需要添加到系统中的函数名
List<String> needAddedFunctionNames =new ArrayList<>();
for(String name : names){
boolean needAdd =true;
for(String existsName : existsNames){
if(name.equals(existsName)){
needAdd =false;
break;
}
}
if(needAdd){
needAddedFunctionNames.add(name);
}
}
// 需要添加到系统中的函数
for(String name : needAddedFunctionNames) {
this.needAddedFunctions.add(cache.get(name));
}
if(!this.needAddedFunctions.isEmpty()){
isInitialized =false;
}else {
isInitialized = true;
}
return isInitialized;
*/
}
@Override

3
io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/model/converter/ParameterEntityConverter.java

@ -135,6 +135,7 @@ public class ParameterEntityConverter {
entity.setId(po.getId());
entity.setCode(po.getCode());
entity.setName(po.getName());
entity.setAlias(po.getAlias());
entity.setDescription(po.getDescription());
entity.setValueType(po.getValueType());
entity.setValueTypeVersion(po.getValueTypeVersion());
@ -143,6 +144,8 @@ public class ParameterEntityConverter {
entity.setValueTypeIsList(po.getValueTypeIsList());
entity.setDefaultValue(po.getDefaultValue());
entity.setOrder(po.getOrder());
entity.setPersistentAsIndicator(po.getPersistentAsIndicator());
entity.setProperties(po.getProperties());
List<ParameterValidatorEntity> validators =ParameterValidatorEntityConverter.fromPo(po.getValidators());
if(validators!=null && validators.size()>0) {

4
io.sc.engine.st.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.engine.st.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.engine.st.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

4
io.sc.platform.ai.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.ai.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.ai.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

2
io.sc.platform.core.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "platform-core",
"version": "8.2.84",
"version": "8.2.86",
"description": "前端核心包,用于快速构建前端的脚手架",
"//main": "库的主文件",
"main": "dist/platform-core.js",

4
io.sc.platform.core.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

6
io.sc.platform.core.frontend/src/platform/layout/sub-layout/Topper.vue

@ -303,7 +303,11 @@ const changeRole = () => {
};
const openLoginDialog = () => {
loginDialog.value.open();
if (AuthenticationManager.isOauth2()) {
loginDialog.value.open();
} else {
window.location.href = Environment.apiContextPath('/login');
}
};
const logout = () => {

37
io.sc.platform.core.frontend/src/platform/plugin/axios.ts

@ -12,9 +12,11 @@ const gc = Environment.getConfigure();
// 请求拦截器
const requestInterceptor = (config: any) => {
// 监测会话是否过期
if (SessionManager.isTimeout()) {
AuthenticationManager.removeLocalAccessToken();
if (AuthenticationManager.isOauth2()) {
// 监测会话是否过期
if (SessionManager.isTimeout()) {
AuthenticationManager.removeLocalAccessToken();
}
}
// 设置区域
@ -26,8 +28,14 @@ const requestInterceptor = (config: any) => {
}
}
const result = config;
if (AuthenticationManager.getLocalAccessToken()) {
result.headers.Authorization = 'Bearer ' + AuthenticationManager.getLocalAccessToken();
if (AuthenticationManager.isOauth2()) {
if (AuthenticationManager.getLocalAccessToken()) {
result.headers.Authorization = 'Bearer ' + AuthenticationManager.getLocalAccessToken();
}
}
if (gc.axios?.basicAuth?.username && gc.axios?.basicAuth?.password) {
result.headers.Authorization = 'Basic ' + window.btoa(gc.axios.basicAuth.username + ':' + gc.axios.basicAuth.password);
}
// 如果请求时传入 { loading: true } 属性, 则自动显示 "正在处理..., 请等待" 模态对话框
@ -60,11 +68,12 @@ const getResponseErrorInterceptor = (handleError: boolean) => {
QuasarTools.getQuasar()?.loading?.hide();
const errorWrapper = ServerExceptionHandler.getError(error);
console.log(errorWrapper.status);
if (errorWrapper.status === 401) {
if (error.request.responseURL.endsWith('/api/system/user/session')) {
return Promise.resolve({});
} else {
Environment.executeAction('openLoginDialog');
//Environment.executeAction('openLoginDialog');
return Promise.reject(errorWrapper);
}
} else {
@ -79,7 +88,7 @@ const getResponseErrorInterceptor = (handleError: boolean) => {
// 普通 axios
const axios = Axios.create({
baseURL: gc.axios?.baseURL || '',
timeout: gc.axios?.timeout || 1000 * 60,
timeout: gc.axios?.timeout || 1000 * 60 * 5,
});
axios.interceptors.request.use(requestInterceptor, requestErrorInterceptor);
axios.interceptors.response.use(responseInterceptor, getResponseErrorInterceptor(true));
@ -106,9 +115,11 @@ blobAxios.interceptors.response.use((response: any) => {
class Fetch {
public static buildHeaders() {
const gc = Environment.getConfigure();
// 监测会话是否过期
if (SessionManager.isTimeout()) {
AuthenticationManager.removeLocalAccessToken();
if (AuthenticationManager.isOauth2()) {
// 监测会话是否过期
if (SessionManager.isTimeout()) {
AuthenticationManager.removeLocalAccessToken();
}
}
// 请求头
@ -116,8 +127,10 @@ class Fetch {
locale: gc.setting.i18n.locale,
'Content-Type': 'application/json; charset=UTF-8',
};
if (AuthenticationManager.getLocalAccessToken()) {
headers['Authorization'] = 'Bearer ' + AuthenticationManager.getLocalAccessToken() + '';
if (AuthenticationManager.isOauth2()) {
if (AuthenticationManager.getLocalAccessToken()) {
headers['Authorization'] = 'Bearer ' + AuthenticationManager.getLocalAccessToken() + '';
}
}
return headers;
}

7
io.sc.platform.core.frontend/src/platform/plugin/manager/ApplicationInitializer.ts

@ -3,6 +3,7 @@ import { toRaw } from 'vue';
import { PConst } from '@/platform/PConst';
import { Environment } from '@/platform/plugin/environment';
import {
AuthenticationManager,
ComponentManager,
ConfigureManager,
I18nMessageManager,
@ -70,7 +71,11 @@ class ApplicationInitializer {
// 加载远程入口
RemoteEntryManager.loadRemoteEntries(() => {
parameter.callback();
router.push({ name: 'login' });
if (AuthenticationManager.isOauth2()) {
router.push({ name: 'login' });
} else {
window.location.href = Environment.apiContextPath('/login');
}
});
}
}

4
io.sc.platform.core.frontend/src/platform/plugin/manager/AuthenticationManager.ts

@ -2,6 +2,10 @@ import { PConst, Environment } from '@/platform';
import { axios } from '@/platform/plugin';
class AuthenticationManager {
public static isOauth2() {
return 'OAUTH2' === Environment.getConfigure().setting.authenticationMode;
}
public static async isAuthenticated() {
try {
const response = await axios.get(Environment.apiContextPath(PConst.API_AUTHENTICATION_URL));

17
io.sc.platform.core.frontend/src/platform/plugin/router.ts

@ -65,15 +65,22 @@ router.beforeEach(async (to: any, from: any, next: any) => {
next();
}
} else {
if (AuthenticationManager.getLocalAccessToken()) {
// 已登录
if (AuthenticationManager.isOauth2()) {
if (AuthenticationManager.getLocalAccessToken()) {
// 已登录
// 显示进度条
LoadingBar.start();
TagViewManager.handleTagViewAndBreadcrumbsAndKeepAlive(to);
next();
} else {
//导航到登录页面
Environment.executeAction('openLoginDialog');
}
} else {
// 显示进度条
LoadingBar.start();
TagViewManager.handleTagViewAndBreadcrumbsAndKeepAlive(to);
next();
} else {
//导航到登录页面
Environment.executeAction('openLoginDialog');
}
}
});

1
io.sc.platform.core.frontend/src/platform/types/ConfigureType.ts

@ -64,6 +64,7 @@ export type ConfigureType = {
};
isMultiCorporationMode: boolean; //是否多法人模式
isPrimaryCorporation: boolean; //是否是主法人(主法人可以管理其他法人)
authenticationMode: string; //认证模式
};
// ---------------------------------------------

4
io.sc.platform.core.frontend/template-project/package.json

@ -1,6 +1,6 @@
{
"name": "platform-core",
"version": "8.2.84",
"version": "8.2.86",
"description": "前端核心包,用于快速构建前端的脚手架",
"private": false,
"keywords": [],
@ -111,7 +111,7 @@
"mockjs": "1.1.0",
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.core.frontend/template-project/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

4
io.sc.platform.developer.doc/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.developer.doc",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"main": "index.js",
"scripts": {
@ -28,7 +28,7 @@
"vuepress": "2.0.0-rc.15"
},
"dependencies": {
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"vue": "3.5.13",
"vue-i18n": "11.0.1"

4
io.sc.platform.developer.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.developer.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.developer.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

4
io.sc.platform.lcdp.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.lcdp.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.lcdp.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

11
io.sc.platform.lcdp/src/main/java/io/sc/platform/lcdp/configure/api/Setting.java

@ -1,11 +1,14 @@
package io.sc.platform.lcdp.configure.api;
import io.sc.platform.security.AuthenticationMode;
public class Setting {
private long sessionTimeout =30 * 60; // 会话过期时间(单位:秒)
private String homePage ="/home"; // 首页路由 path
private String notifierTaskNavigateFrontendRoutePath;//顶部通知栏任务导航前端路由路径
private I18n i18n =new I18n(); // 多语言国际化
private boolean isMultiCorporationMode =false; // 是否是多法人模式
private AuthenticationMode authenticationMode =AuthenticationMode.OAUTH2; // 认证模式
public long getSessionTimeout() {
return sessionTimeout;
@ -46,4 +49,12 @@ public class Setting {
public void setIsMultiCorporationMode(boolean multiCorporationMode) {
isMultiCorporationMode = multiCorporationMode;
}
public AuthenticationMode getAuthenticationMode() {
return authenticationMode;
}
public void setAuthenticationMode(AuthenticationMode authenticationMode) {
this.authenticationMode = authenticationMode;
}
}

4
io.sc.platform.lcdp/src/main/java/io/sc/platform/lcdp/configure/service/impl/ConfigureServiceImpl.java

@ -9,6 +9,7 @@ import io.sc.platform.lcdp.configure.jpa.repository.ConfigureRepository;
import io.sc.platform.lcdp.configure.service.ConfigureService;
import io.sc.platform.mvc.service.SystemParameterService;
import io.sc.platform.orm.service.impl.DaoServiceImpl;
import io.sc.platform.security.AuthenticationMode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.session.SessionProperties;
import org.springframework.core.env.Environment;
@ -68,6 +69,9 @@ public class ConfigureServiceImpl extends DaoServiceImpl<ConfigureEntity, String
configure.getSetting().setNotifierTaskNavigateFrontendRoutePath(notifierTaskNavigateFrontendRoutePath);
}
AuthenticationMode authenticationMode =environment.getProperty("application.authentication.mode",AuthenticationMode.class);
configure.getSetting().setAuthenticationMode(authenticationMode);
configure.getSetting().setIsMultiCorporationMode(io.sc.platform.core.Environment.getInstance().isMultiCorportationMode());
return configure;
}

4
io.sc.platform.license.keygen.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.license.keygen.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.license.keygen.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

4
io.sc.platform.mvc.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.mvc.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.mvc.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

4
io.sc.platform.scheduler.manager.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.scheduler.manager.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.scheduler.manager.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

24
io.sc.platform.security.loginform/src/main/java/io/sc/platform/security/loginform/autoconfigure/WebSecurityAutoConfiguration.java

@ -13,6 +13,7 @@ import com.nimbusds.jwt.proc.ConfigurableJWTProcessor;
import com.nimbusds.jwt.proc.DefaultJWTProcessor;
import io.sc.platform.core.service.AuditLogPersistenterManager;
import io.sc.platform.core.service.RuntimeService;
import io.sc.platform.security.AuthenticationMode;
import io.sc.platform.security.SecurityProperties;
import io.sc.platform.security.handler.*;
import io.sc.platform.security.loginform.filter.JwtUsernamePasswordAuthenticationFilter;
@ -60,6 +61,7 @@ import java.util.Set;
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE + 1000)
@EnableConfigurationProperties(SecurityProperties.class)
public class WebSecurityAutoConfiguration {
private static final String AUTHENTICATION_MODE_KEY ="application.authentication.mode";
@Autowired private ApplicationContext applicationContext;
@Autowired private SecurityProperties securityProperties;
@Autowired private RuntimeService runtimeService;
@ -78,19 +80,29 @@ public class WebSecurityAutoConfiguration {
csrfConfigurer.disable();
}).build();
}
// 获取系统参数配置的认证模式
final AuthenticationMode authenticationMode =applicationContext.getEnvironment().getProperty(AUTHENTICATION_MODE_KEY,AuthenticationMode.class);
http.authorizeRequests(authorizeRequests -> {
authorizeRequests.antMatchers(securityConfigureService.getIgnoredUrls()).permitAll();
authorizeRequests.anyRequest().authenticated();
});
http.csrf(csrf -> csrf.disable());
http.cors(cors-> cors.configurationSource(securityConfigureService.getCorsConfigurationSource()));
http.authenticationProvider(authenticationProvider);
http.httpBasic();
http.formLogin(formLogin -> {
formLogin.loginPage(securityProperties.getFormLogin().getLoginPage());
if(AuthenticationMode.OAUTH2.equals(authenticationMode)){
formLogin.loginPage("/");
}else {
formLogin.loginPage(securityProperties.getFormLogin().getLoginPage());
}
formLogin.loginProcessingUrl(securityProperties.getFormLogin().getLoginProcessingUrl());
formLogin.failureUrl(securityProperties.getFormLogin().getFailureUrl());
formLogin.successHandler(authenticationSuccessHandler());
formLogin.failureHandler(authenticationFailureHandler());
formLogin.permitAll();
});
http.logout(logout -> {
logout.logoutUrl(securityProperties.getLogout().getLogoutUrl());
@ -102,10 +114,12 @@ public class WebSecurityAutoConfiguration {
.authenticationEntryPoint(authenticationEntryPoint())
.accessDeniedHandler(accessDeniedHandler());
// 在用户名密码认证过滤器前添加 jwt 认证过滤器
JwtUsernamePasswordAuthenticationFilter jwtUsernamePasswordAuthenticationFilter =new JwtUsernamePasswordAuthenticationFilter(jwtDecoder,securityConfigureService.getIgnoredUrlMatchers());
http.addFilterBefore(jwtUsernamePasswordAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
if(AuthenticationMode.OAUTH2.equals(authenticationMode)){
// 在用户名密码认证过滤器前添加 jwt 认证过滤器
JwtUsernamePasswordAuthenticationFilter jwtUsernamePasswordAuthenticationFilter =new JwtUsernamePasswordAuthenticationFilter(jwtDecoder,securityConfigureService.getIgnoredUrlMatchers());
http.addFilterBefore(jwtUsernamePasswordAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
}
return http.build();
}

6
io.sc.platform.security.loginform/src/main/java/io/sc/platform/security/loginform/controller/LoginWebController.java

@ -15,8 +15,8 @@ import java.security.Principal;
@Controller("io.sc.platform.security.loginform.controller.LoginWebController")
public class LoginWebController {
private static final String SPRING_THYMELEAF_PREFIX ="spring.thymeleaf.prefix";
private static final String DEFAULT_LOGIN_TEMPLATE ="io.sc.platform.security.frontend.html";
private static final String DEFAULT_LOGIN_ERROR_TEMPLATE ="io.sc.platform.security.frontend.html";
private static final String DEFAULT_LOGIN_TEMPLATE ="io/sc/platform/security/loginform/view/login.html";
private static final String DEFAULT_LOGIN_ERROR_TEMPLATE ="io/sc/platform/security/loginform/view/login.html";
@Autowired ConfigurableEnvironment env;
@RequestMapping(value="/login",method=RequestMethod.GET)
@ -26,6 +26,7 @@ public class LoginWebController {
}
String loginPagetemplate =getLoginPageTemplate();
ModelAndView mv =new ModelAndView(loginPagetemplate);
mv.addObject("loginProcessingUrl",env.getProperty("spring.security.formLogin.loginProcessingUrl"));
return mv;
}
@ -36,6 +37,7 @@ public class LoginWebController {
}
String loginPagetemplate =getLoginPageTemplate();
ModelAndView mv =new ModelAndView(loginPagetemplate);
mv.addObject("loginProcessingUrl",env.getProperty("spring.security.formLogin.loginProcessingUrl"));
mv.addObject("error",true);
return mv;
}

2
io.sc.platform.security.loginform/src/main/resources/META-INF/platform/plugins/application-properties.json

@ -8,7 +8,7 @@
"spring.security.jwt.rsa.public-key-location = file://${dir.config.jwt}/public-key.txt",
"spring.security.jwt.rsa.private-key-location = file://${dir.config.jwt}/private-key.txt",
"",
"spring.security.formLogin.loginPage = /",
"spring.security.formLogin.loginPage = /login",
"spring.security.formLogin.loginProcessingUrl = /login",
"spring.security.formLogin.failureUrl = /login-error",
"spring.security.logout.logoutUrl = /logout",

132
io.sc.platform.security.loginform/src/main/resources/templates/io/sc/platform/security/loginform/view/login.html

@ -1,65 +1,103 @@
<!DOCTYPE html>
<html>
<head>
<title th:text="#{security.login.title}">系统 | 登录</title>
<meta http-equiv="Content-Type" content="text/html charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" th:href="@{/io.sc.platform.security.jpa/bootstrap-5.2.3-dist/css/bootstrap.min.css}">
<title th:utext="#{application.title}"></title>
<link rel="icon" th:href="@{/favicon.svg}">
<meta http-equiv="Content-Type" content="text/html charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
<link rel="stylesheet" type="text/css" th:href="@{/bootstrap/css/bootstrap.min.css}"/>
<style>
body{
height: 100vh;
background-image: url([[@{|/${@environment.getProperty('application.name')}/images/background.svg|}]]);
background-size: 100% 100%;
}
body{
height: 100vh;
background-color: #EEE;
background-size: 100% 100%;
}
.text-primary {
color: #14234a !important;
}
.bg-primary {
background-color: #14234a !important;
}
.nav-pills .nav-link.active {
background-color: #14234a;
}
.btn-primary {
background-color: #14234a;
border-color: #14234a;
}
.form-check-input:checked {
background-color: #14234a;
border-color: #14234a;
}
.btn-outline-primary {
--bs-btn-color: #14234a;
--bs-btn-border-color: #14234a;
--bs-btn-hover-color: #fff;
--bs-btn-hover-bg: #14234a;
--bs-btn-hover-border-color: #14234a;
--bs-btn-focus-shadow-rgb: 13, 110, 253;
--bs-btn-active-color: #fff;
--bs-btn-active-bg: #14234a;
--bs-btn-active-border-color: #14234a;
--bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
--bs-btn-disabled-color: #14234a;
--bs-btn-disabled-bg: transparent;
--bs-btn-disabled-border-color: #14234a;
--bs-gradient: none;
}
.progress-bar {
background-color: #14234a;
}
</style>
<script type="text/javascript" th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
<script th:inline="javascript">
if(window.parent!=window){
window.parent.location.href ='[(@{/})]';
}
</script>
</head>
<body>
<nav class="navbar bg-light">
<div class="container-fluid">
<a class="navbar-brand text-muted" href="#">
<img th:src="@{|/${@environment.getProperty('application.name')}/images/logo.svg|}" alt="Logo" width="24" height="24" class="d-inline-block align-text-top">
[(#{application.title})]
</a>
</div>
</nav>
<body style="min-height: 782px; min-width: 600px; background-image: url(login-bg.jpg); background-position: center center; background-repeat: no-repeat; background-size: cover; background-attachment: fixed;">
<nav class="navbar bg-primary" style="padding:5px">
<div class="container-fluid">
<a class="navbar-brand" href="#" style="color:white;">
<img th:src="@{|/logo.svg?t=${#dates.createNow().getTime()}|}" alt="Logo" width="24" height="24" class="d-inline-block align-text-top">
<span style="padding-left:10px;color:white;" th:text="#{application.title}"></span>
</a>
</div>
</nav>
<div style="height:100px"></div>
<div style="height:100px"></div>
<div class="container">
<div class="row">
<div class="col-md-4 col-xl-6"></div>
<div class="col-md-7 col-xl-5">
<div class="shadow-sm p-3 mb-5 bg-light rounded-3 border">
<div th:if="${isLoginError}" class="alert alert-danger" role="alert">
<span th:text="#{security.login.message.error}">认证失败!</span>
<div class="container">
<div class="row">
<div class="col-md-6 col-xl-7"></div>
<div class="col-md-6 col-xl-5">
<div class="shadow-sm p-3 mb-5 bg-light rounded-3 border">
<div th:if="${error}" class="alert alert-danger" role="alert">
<span th:text="#{security.login.message.error}">认证失败!</span>
</div>
<form class="row g-3" th:action="@{${loginProcessingUrl}}" method="post">
<div class="col-12">
<label for="username" class="form-label" th:text="#{loginName}">用户名</label>
<input type="text" class="form-control" name="username" th:placeholder="#{security.login.username.placeholder}" autofocus>
</div>
<form class="row g-3" th:action="@{${loginProcessingUrl}}" method="post">
<div class="col-12">
<label for="username" class="form-label" th:text="#{username}">用户名</label>
<input type="text" class="form-control" name="username" th:placeholder="#{security.login.username.placeholder}" autofocus>
</div>
<div class="col-12">
<label for="password" class="form-label" th:text="#{password}">密码</label>
<input type="password" class="form-control" name="password" th:placeholder="#{security.login.password.placeholder}">
</div>
<div class="form-group">
<div class="text-end">
<button type="reset" class="ms-2 btn btn-outline-secondary" th:text="#{reset}">重置</button>
<button type="submit" class="ms-2 btn btn-outline-primary" th:text="#{login}">登录</button>
</div>
<div class="col-12">
<label for="password" class="form-label" th:text="#{password}">密码</label>
<input type="password" class="form-control" name="password" th:placeholder="#{security.login.password.placeholder}">
</div>
<div class="form-group">
<div class="text-end">
<button type="submit" class="ms-2 btn btn-outline-primary" th:text="#{login}">登录</button>
<button type="reset" class="ms-2 btn btn-outline-secondary" th:text="#{reset}">重置</button>
</div>
</form>
</div>
</div>
</form>
</div>
<div class="col-md-1"></div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
</script>
</html>

2
io.sc.platform.security/src/main/java/io/sc/platform/security/controller/AuthenticationWebController.java

@ -15,6 +15,4 @@ public class AuthenticationWebController {
public void isAuthenticated(){
}
}

8
io.sc.platform.security/src/main/java/io/sc/platform/security/service/impl/SystemParameterServiceImpl.java

@ -30,19 +30,19 @@ public class SystemParameterServiceImpl implements SystemParameterService {
List<Map<String, Object>> resultSet = null;
try {
resultSet = namedParameterJdbcTemplate.queryForList("select _CODE,_VALUE from SYS_PARAMETER where _CODE in (:codes)",params);
resultSet = namedParameterJdbcTemplate.queryForList("select CODE_,VALUE_ from SYS_PARAMETER where CODE_ in (:codes)",params);
if(resultSet==null || resultSet.isEmpty()){
return withDefaultValueParameters;
}
Map<String,String> result =new HashMap<String,String>();
for(Map<String,Object> map : resultSet){
String code =map.get("_CODE").toString();
String value =map.get("_VALUE")==null?"":map.get("_VALUE").toString();
String code =map.get("CODE_").toString();
String value =map.get("VALUE_")==null?"":map.get("VALUE_").toString();
result.put(code,value);
}
return result;
} catch (DataAccessException e) {
log.error(e.getMessage());
log.error("",e);
return withDefaultValueParameters;
}
}

3
io.sc.platform.security/src/main/resources/META-INF/platform/plugins/application-properties.json

@ -5,6 +5,9 @@
"description" : "",
"properties": [
"# - io.sc.platform.security",
"# authentication mode",
"application.authentication.mode = OAUTH2",
"#application.authentication.mode = LOGIN_FORM",
"# the default password, apply to reset password",
"application.password.default = password",

4
io.sc.platform.system.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.platform.system.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -111,7 +111,7 @@
"mockjs": "1.1.0",
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.platform.system.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

64
io.sc.platform.system/src/main/java/io/sc/platform/system/initializer/ParameterInitializer.java

@ -3,12 +3,14 @@ package io.sc.platform.system.initializer;
import io.sc.platform.core.initializer.ApplicationInitializer;
import io.sc.platform.core.initializer.ApplicationInitializerExecuteException;
import io.sc.platform.jdbc.sql.builder.InsertIntoSqlBuilder;
import io.sc.platform.mvc.plugins.PluginManager;
import io.sc.platform.mvc.plugins.item.Parameter;
import io.sc.platform.system.parameter.jpa.entity.ParameterEntity;
import io.sc.platform.system.parameter.service.ParameterService;
import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.Date;
import java.util.UUID;
import java.util.*;
public class ParameterInitializer implements ApplicationInitializer {
private Boolean isInitialized =null;
@ -26,10 +28,8 @@ public class ParameterInitializer implements ApplicationInitializer {
@Override
public synchronized boolean isInitialized() {
if(isInitialized!=null) {
return isInitialized;
}
if(parameterService.getRepository().count()<=0){
List<Parameter> needAddedParameters =getneedAddedParameters();
if(!needAddedParameters.isEmpty()){
isInitialized =false;
}else {
isInitialized = true;
@ -39,10 +39,60 @@ public class ParameterInitializer implements ApplicationInitializer {
@Override
public void execute() throws ApplicationInitializerExecuteException {
List<ParameterEntity> entities =parameterService.getRepository().findAll();
Map<String,ParameterEntity> cache =new HashMap<>();
for(ParameterEntity entity : entities){
cache.put(entity.getCode(),entity);
}
List<Parameter> needAddedParameters =getneedAddedParameters();
try {
parameterService.init();
for(Parameter item : needAddedParameters){
ParameterEntity entity =new ParameterEntity();
entity.setCode(item.getCode());
entity.setValue(item.getDefaultValue());
entity.setOrder(item.getOrder());
entity.setParent(cache.get(item.getParentId()));
parameterService.add(entity);
}
} catch (Exception e) {
throw new ApplicationInitializerExecuteException(e);
}
}
private List<Parameter> getneedAddedParameters() {
// 插件定义的参数
List<Parameter> plugins =PluginManager.getInstance().getParameters();
Map<String,Parameter> cache =new HashMap<>();
List<String> ids =new ArrayList<>();
for(Parameter plugin : plugins){
cache.put(plugin.getId(),plugin);
ids.add(plugin.getId());
}
// 系统存在的参数
List<ParameterEntity> entities =parameterService.getRepository().findAll();
List<String> existsCodes =new ArrayList<>();
for(ParameterEntity entity : entities){
existsCodes.add(entity.getCode());
}
// 需要添加的参数代码
List<String> needAddedParameterIds =new ArrayList<>();
for(String id : ids){
boolean needAdd =true;
for(String existsCode : existsCodes){
if(id.equals(existsCode)){
needAdd =false;
break;
}
}
if(needAdd){
needAddedParameterIds.add(id);
}
}
// 需要添加的参数
List<Parameter> result =new ArrayList<>();
for(String id : needAddedParameterIds) {
result.add(cache.get(id));
}
return result;
}
}

47
io.sc.platform.util/src/main/java/io/sc/platform/util/compiler/memory/MemoryJavaCompiler.java

@ -1,8 +1,15 @@
package io.sc.platform.util.compiler.memory;
import io.sc.platform.util.OsUtil;
import io.sc.platform.util.compiler.file.StringJavaFileObject;
import org.springframework.util.StringUtils;
import javax.tools.*;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
@ -14,23 +21,36 @@ public class MemoryJavaCompiler {
private JavaCompiler compiler;
private StandardJavaFileManager standardFileManager;
private MemoryJavaCompilerClassLoader classLoader;
private String classpathJarFileDir;
public MemoryJavaCompiler() {
public MemoryJavaCompiler(String classpathJarFileDir) {
this.compiler = ToolProvider.getSystemJavaCompiler();
this.standardFileManager = compiler.getStandardFileManager(null, null, null);
this.classLoader =new MemoryJavaCompilerClassLoader(null);
this.classpathJarFileDir =classpathJarFileDir;
}
/**
* 编译.
* @param className 类全路径名
* @param source 源代码
* @param sourceCode 源代码
* @throws JavaCompileException 编译违例
*/
public void compile(String className, String source) throws JavaCompileException {
public void compile(String className, String sourceCode) throws JavaCompileException {
String classpath =getClassPath();
// 编译选项
List<String> options =new ArrayList<>();
if(StringUtils.hasText(classpath)){
options.add("-cp");
options.add(classpath);
}
// 编译部件
List<JavaFileObject> units =new ArrayList<>();
units.add(new MemoryJavaFileObject(className,sourceCode));
MemoryJavaFileManager manager = new MemoryJavaFileManager(standardFileManager);
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, diagnostics, null, null, Arrays.asList(new MemoryJavaFileObject(className, source)));
JavaCompiler.CompilationTask task = compiler.getTask(null, manager, diagnostics, options, null, units);
Boolean result = task.call();
if (result == null || !result.booleanValue()) {
StringBuilder sb =new StringBuilder();
@ -72,4 +92,23 @@ public class MemoryJavaCompiler {
throw new NewInstanceException(className + "is not instanceof " + targetClass.getName());
}
}
private String getClassPath(){
File dir =new File(classpathJarFileDir);
if(dir.exists() && dir.isDirectory()) {
File[] jars = dir.listFiles();
if(jars!=null && jars.length>0) {
List<String> paths =new ArrayList<>(jars.length);
for(File jar : jars){
paths.add(jar.getAbsolutePath());
}
if(OsUtil.isWindows()) {
return String.join(";", paths);
}else{
return String.join(":", paths);
}
}
}
return null;
}
}

13
io.sc.platform.util/src/main/java/io/sc/platform/util/compiler/memory/MemoryJavaCompilerClassLoader.java

@ -7,6 +7,7 @@ import java.util.Map;
public class MemoryJavaCompilerClassLoader extends URLClassLoader {
private Map<String, byte[]> classBytes = new HashMap<>();
private Map<String,Class<?>> classMap =new HashMap<>();
public MemoryJavaCompilerClassLoader(Map<String, byte[]> classBytes) {
super(new URL[0], MemoryJavaCompilerClassLoader.class.getClassLoader());
@ -27,12 +28,10 @@ public class MemoryJavaCompilerClassLoader extends URLClassLoader {
if (buffer == null) {
return super.findClass(className);
}
classBytes.remove(className);
return defineClass(className, buffer, 0, buffer.length);
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
return super.loadClass(name);
Class<?> clazz =classMap.get(className);
if(clazz!=null) { return clazz; }
clazz =defineClass(className, buffer, 0, buffer.length);
classMap.put(className,clazz);
return clazz;
}
}

4
io.sc.standard.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.standard.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -112,7 +112,7 @@
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"pinia-undo": "0.2.4",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
io.sc.standard.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

4
io.sc.website/package.json

@ -1,6 +1,6 @@
{
"name": "io.sc.website",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"main": "index.js",
"scripts": {
@ -28,6 +28,6 @@
},
"dependencies": {
"vue": "3.5.13",
"platform-core": "8.2.84"
"platform-core": "8.2.86"
}
}

4
wra.report.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "wra.report.frontend",
"version": "8.2.23",
"version": "8.2.24",
"description": "",
"private": false,
"keywords": [],
@ -111,7 +111,7 @@
"mockjs": "1.1.0",
"node-sql-parser": "5.3.6",
"pinia": "2.3.0",
"platform-core": "8.2.84",
"platform-core": "8.2.86",
"quasar": "2.17.6",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.7",

4
wra.report.frontend/public/configure.js

@ -39,5 +39,9 @@ window.APP.configure = {
baseURL: '',
timeout: 1000 * 60,
crossdomain: true,
basicAuth: {
username: 'admin',
password: 'admin',
},
},
};

Loading…
Cancel
Save