From 766fba20ce6ff48230c32295aec056d6d481ee2a Mon Sep 17 00:00:00 2001 From: wangshaoping Date: Fri, 19 Jul 2024 16:00:44 +0800 Subject: [PATCH] update --- .../main/java/app/platform/Application.java | 14 + erm.frontend/package.json | 2 +- gradle.properties | 2 +- io.sc.engine.mv.frontend/package.json | 2 +- .../impl/support/processor/MathFormula.java | 184 +++++++++- .../core/function/ArithmeticFunction.java | 4 + .../core/function/SpecialValueFunction.java | 62 ++++ .../io/sc/engine/rule/core/math/MathType.java | 330 ++++++++++++++++++ .../engine/rule/core/math/ObjectFactory.java | 60 ++++ .../engine/rule/core/math/package-info.java | 9 + .../rule/core/po/lib/IndicatorProcessor.java | 12 +- .../rule/core/code/template/groovy/groovy.ftl | 5 + io.sc.engine.rule.frontend/package.json | 2 +- .../src/views/lib/IndicatorGrid.vue | 2 + .../src/views/lib/ProcessorGrid.vue | 60 +++- .../src/views/lib/TestCaseParameter.vue | 2 +- .../src/views/resources/Resources.vue | 3 + .../src/views/resources/designer/Option.vue | 6 + .../views/resources/designer/Processor.vue | 55 ++- .../resources/designer/TestCaseParameter.vue | 2 +- .../src/views/resources/designer/Testcase.vue | 4 +- .../views/shared/SelectIndicatorDialog.vue | 1 + .../plugins/rule-engine-sample-resource.json | 9 + .../rule/sample/i18n/messages.properties | 2 + .../sample/i18n/messages_tw_CN.properties | 2 + .../sample/i18n/messages_zh_CN.properties | 2 + io.sc.engine.rule.server/build.gradle | 6 +- .../service/impl/DictionaryServiceImpl.java | 5 - .../IndicatorProcessorWebController.java | 8 + .../controller/IndicatorWebController.java | 2 +- .../service/IndicatorProcessorService.java | 3 + .../impl/IndicatorProcessorServiceImpl.java | 26 ++ .../service/impl/IndicatorServiceImpl.java | 4 - .../impl/ParameterProcessorServiceImpl.java | 2 - .../service/impl/ParameterServiceImpl.java | 10 - .../service/impl/TestCaseServiceImpl.java | 69 +++- io.sc.engine.st.frontend/package.json | 2 +- io.sc.platform.core.frontend/package.json | 2 +- .../components/expression/WExpression.vue | 22 +- .../editor/{Editor.vue => ConstEditor.vue} | 0 .../expression/editor/VariableEditor.vue | 58 +++ .../components/expression/toolbar/Toolbar.vue | 7 +- .../expression/toolbar/base/Comma.vue | 4 +- .../{math/Extracting.vue => base/Const.vue} | 16 +- .../expression/toolbar/base/Division.vue | 12 +- .../toolbar/base/LeftParenthesis.vue | 2 +- .../toolbar/base/RightParenthesis.vue | 2 +- .../expression/toolbar/base/Variable.vue | 2 +- .../toolbar/functions/SpecialValue.vue | 54 ++- .../toolbar/functions/number/Abs.vue | 12 +- .../functions/specialValue/IsInfinite.vue | 46 +++ .../toolbar/functions/specialValue/IsNaN.vue | 46 +++ .../toolbar/functions/specialValue/IsNil.vue | 46 +++ .../toolbar/functions/specialValue/IsZero.vue | 46 +++ .../trigonometric/hyperbolic/Csch.vue | 2 +- .../trigonometric/hyperbolic/Sech.vue | 2 +- .../expression/toolbar/math/Exp.vue | 8 +- .../expression/toolbar/math/Power.vue | 8 +- .../expression/toolbar/math/Power2.vue | 8 +- .../expression/toolbar/math/Root.vue | 35 ++ .../expression/toolbar/math/Sqrt.vue | 14 +- .../components/form/elements/WCodeMirror.vue | 8 +- .../src/platform/i18n/messages.json | 11 +- .../src/platform/i18n/messages_tw_CN.json | 7 +- .../src/platform/i18n/messages_zh_CN.json | 7 +- .../sub-layout/ChangePasswordDialog.vue | 114 +++--- .../code-mirror/AutoCompletionManager.ts | 17 +- .../code-mirror/AutoCompletionManager2.ts | 190 ++++++++++ .../testcase/code-mirror/code-mirror.vue | 28 +- .../src/views/testcase/math/MathEditor.vue | 2 + .../template-project/package.json | 4 +- .../code-mirror/AutoCompletionManager.ts | 17 +- .../code-mirror/AutoCompletionManager2.ts | 190 ++++++++++ .../testcase/code-mirror/code-mirror.vue | 28 +- .../src/views/testcase/math/MathEditor.vue | 2 + .../exception/PasswordStrengthException.java | 10 + .../core/response/ValidateException.java | 6 + .../platform/core/service/Desensitizer.java | 8 + .../support/DesensitizerProperties.java | 30 ++ .../io/sc/platform/core/util/JaxbUtil.java | 122 +++++++ .../platform/core/i18n/exception.properties | 2 +- .../core/i18n/exception_tw_CN.properties | 2 +- .../core/i18n/exception_zh_CN.properties | 2 +- .../package.json | 2 +- .../java/app/platform/Application.java.txt | 21 +- .../templates/pgp/setup/gradle.properties | 3 +- io.sc.platform.lcdp.frontend/package.json | 2 +- io.sc.platform.mvc.frontend/package.json | 2 +- .../support/AuditLogAspectorBean.java | 7 +- .../orm/annotation/Desensitizeable.java | 4 + .../DesensitizeAndEncodeStringCoverter.java | 33 ++ .../converter/DesensitizeStringCoverter.java | 31 ++ ...verter.java => EncodeStringConverter.java} | 2 +- .../support/DesensitizeConvertWrapper.java | 39 +++ .../orm/desensitizer/DefaultDesensitizer.java | 36 ++ .../io/sc/platform/orm/entity/BaseEntity.java | 4 - .../platform/orm/plugins/PluginManager.java | 30 ++ .../orm/repository/DaoRepository.java | 3 +- .../repository/impl/DaoRepositoryImpl.java | 4 +- .../DesensitizerAuthorizerService.java | 5 + .../service/DesensitizerManagerService.java | 8 + .../orm/service/impl/DaoServiceImpl.java | 14 +- .../impl/DesensitizerManagerServiceImpl.java | 38 ++ .../orm/service/support/Desensitizer.java | 10 + .../service/support/EmailDesensitizer.java | 19 + .../service/support/GeneralDesensitizer.java | 20 ++ .../service/support/MobileDesensitizer.java | 18 + .../service/support/UserNameDesensitizer.java | 20 ++ .../io/sc/platform/orm/util/EntityVoUtil.java | 9 - .../META-INF/platform/plugins/components.json | 3 +- io.sc.platform.security.frontend/package.json | 2 +- io.sc.platform.security.frontend/src/App.vue | 2 +- .../PasswordValidatorAutoConfiguration.java | 48 +++ .../security/service/PasswordValidator.java | 20 ++ .../support/DefaultPasswordValidator.java | 107 ++++++ .../support/PasswordValidatorProperties.java | 69 ++++ .../plugins/application-properties.json | 12 +- .../main/resources/META-INF/spring.factories | 3 +- .../api/desensitizer/DesensitizeFieldVo.java | 33 ++ io.sc.platform.system.frontend/package.json | 2 +- .../src/components/index.ts | 2 + .../src/i18n/messages.json | 3 + .../src/i18n/messages_tw_CN.json | 5 +- .../src/i18n/messages_zh_CN.json | 3 + .../src/menus/menus.json | 12 +- .../src/routes/routes.json | 15 + .../src/views/desensitizer/Desensitizer.vue | 145 ++++++++ .../src/views/user/SetPasswordDialog.vue | 23 +- .../DesensitizeFieldWebController.java | 64 ++++ .../jpa/entity/DesensitizeFieldEntity.java | 89 +++++ .../DesensitizeFieldRepository.java | 8 + .../service/DesensitizeFieldService.java | 17 + .../impl/DesensitizeFieldServiceImpl.java | 177 ++++++++++ .../initializer/DesensitizerInitializer.java | 34 ++ .../role/controller/RoleWebController.java | 34 +- .../system/role/jpa/entity/RoleEntity.java | 59 +++- .../system/role/service/RoleService.java | 18 + .../role/service/impl/RoleServiceImpl.java | 37 ++ .../user/controller/UserWebController.java | 43 ++- ...ailDesensitizeAndEncodeStringCoverter.java | 22 ++ ...ileDesensitizeAndEncodeStringCoverter.java | 22 ++ ...oneDesensitizeAndEncodeStringCoverter.java | 22 ++ .../QqDesensitizeAndEncodeStringCoverter.java | 22 ++ ...xinDesensitizeAndEncodeStringCoverter.java | 22 ++ .../system/user/jpa/entity/UserEntity.java | 36 +- .../user/service/impl/UserServiceImpl.java | 2 +- .../META-INF/platform/plugins/components.json | 3 + .../platform/plugins/desensitizer.json | 3 + .../META-INF/platform/plugins/messages.json | 3 +- .../platform/plugins/repositories.json | 3 + ...rm.core.initializer.ApplicationInitializer | 1 + .../system/i18n/desensitizer.properties | 6 + .../system/i18n/desensitizer_tw_CN.properties | 6 + .../system/i18n/desensitizer_zh_CN.properties | 6 + .../system/i18n/initializer.properties | 3 + .../system/i18n/initializer_tw_CN.properties | 3 + .../system/i18n/initializer_zh_CN.properties | 3 + ...0_20220606__System Database Schema DDL.xml | 40 +++ .../sc/platform/ws/plugins/PluginManager.java | 2 +- .../META-INF/platform/plugins/components.json | 2 +- .../main/resources/META-INF/spring.factories | 4 + io.sc.standard.frontend/package.json | 2 +- settings.gradle | 2 +- 163 files changed, 3650 insertions(+), 299 deletions(-) create mode 100644 io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/MathType.java create mode 100644 io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/ObjectFactory.java create mode 100644 io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/package-info.java rename io.sc.platform.core.frontend/src/platform/components/expression/editor/{Editor.vue => ConstEditor.vue} (100%) create mode 100644 io.sc.platform.core.frontend/src/platform/components/expression/editor/VariableEditor.vue rename io.sc.platform.core.frontend/src/platform/components/expression/toolbar/{math/Extracting.vue => base/Const.vue} (64%) create mode 100644 io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsInfinite.vue create mode 100644 io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsNaN.vue create mode 100644 io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsNil.vue create mode 100644 io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsZero.vue create mode 100644 io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Root.vue create mode 100644 io.sc.platform.core.frontend/src/views/testcase/code-mirror/AutoCompletionManager2.ts create mode 100644 io.sc.platform.core.frontend/template-project/src/views/testcase/code-mirror/AutoCompletionManager2.ts create mode 100644 io.sc.platform.core/src/main/java/io/sc/platform/core/exception/PasswordStrengthException.java create mode 100644 io.sc.platform.core/src/main/java/io/sc/platform/core/service/Desensitizer.java create mode 100644 io.sc.platform.core/src/main/java/io/sc/platform/core/service/support/DesensitizerProperties.java create mode 100644 io.sc.platform.core/src/main/java/io/sc/platform/core/util/JaxbUtil.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/annotation/Desensitizeable.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/converter/DesensitizeAndEncodeStringCoverter.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/converter/DesensitizeStringCoverter.java rename io.sc.platform.orm/src/main/java/io/sc/platform/orm/converter/{EncoderStringConverter.java => EncodeStringConverter.java} (83%) create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/converter/support/DesensitizeConvertWrapper.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/desensitizer/DefaultDesensitizer.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/service/DesensitizerAuthorizerService.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/service/DesensitizerManagerService.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/service/impl/DesensitizerManagerServiceImpl.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/service/support/Desensitizer.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/service/support/EmailDesensitizer.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/service/support/GeneralDesensitizer.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/service/support/MobileDesensitizer.java create mode 100644 io.sc.platform.orm/src/main/java/io/sc/platform/orm/service/support/UserNameDesensitizer.java create mode 100644 io.sc.platform.security/src/main/java/io/sc/platform/security/autoconfigure/PasswordValidatorAutoConfiguration.java create mode 100644 io.sc.platform.security/src/main/java/io/sc/platform/security/service/PasswordValidator.java create mode 100644 io.sc.platform.security/src/main/java/io/sc/platform/security/service/support/DefaultPasswordValidator.java create mode 100644 io.sc.platform.security/src/main/java/io/sc/platform/security/service/support/PasswordValidatorProperties.java create mode 100644 io.sc.platform.system.api/src/main/java/io/sc/platform/system/api/desensitizer/DesensitizeFieldVo.java create mode 100644 io.sc.platform.system.frontend/src/views/desensitizer/Desensitizer.vue create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/desensitizer/controller/DesensitizeFieldWebController.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/desensitizer/jpa/entity/DesensitizeFieldEntity.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/desensitizer/jpa/repository/DesensitizeFieldRepository.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/desensitizer/service/DesensitizeFieldService.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/desensitizer/service/impl/DesensitizeFieldServiceImpl.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/initializer/DesensitizerInitializer.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/user/convert/EmailDesensitizeAndEncodeStringCoverter.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/user/convert/MobileDesensitizeAndEncodeStringCoverter.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/user/convert/PhoneDesensitizeAndEncodeStringCoverter.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/user/convert/QqDesensitizeAndEncodeStringCoverter.java create mode 100644 io.sc.platform.system/src/main/java/io/sc/platform/system/user/convert/WeixinDesensitizeAndEncodeStringCoverter.java create mode 100644 io.sc.platform.system/src/main/resources/META-INF/platform/plugins/desensitizer.json create mode 100644 io.sc.platform.system/src/main/resources/io/sc/platform/system/i18n/desensitizer.properties create mode 100644 io.sc.platform.system/src/main/resources/io/sc/platform/system/i18n/desensitizer_tw_CN.properties create mode 100644 io.sc.platform.system/src/main/resources/io/sc/platform/system/i18n/desensitizer_zh_CN.properties diff --git a/app.platform/src/main/java/app/platform/Application.java b/app.platform/src/main/java/app/platform/Application.java index e8a7f8e9..b6d116f0 100644 --- a/app.platform/src/main/java/app/platform/Application.java +++ b/app.platform/src/main/java/app/platform/Application.java @@ -2,9 +2,16 @@ package app.platform; import io.sc.platform.core.ApplicationLauncher; import io.sc.platform.core.PlatformSpringBootServletInitializer; +import io.sc.platform.orm.entity.BaseEntity; +import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; +import org.springframework.core.type.filter.AssignableTypeFilter; import org.springframework.web.WebApplicationInitializer; +import java.util.Locale; +import java.util.Set; + /** * 应用程序入口 */ @@ -12,5 +19,12 @@ import org.springframework.web.WebApplicationInitializer; public class Application extends PlatformSpringBootServletInitializer implements WebApplicationInitializer { public static void main(String[] args) throws Exception { ApplicationLauncher.run(Application.class,args); +// ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); +// provider.addIncludeFilter(new AssignableTypeFilter(BaseEntity.class)); +// Set components = provider.findCandidateComponents("io.sc"); +// for (BeanDefinition component : components) +// { +// System.out.println(component.getBeanClassName()); +// } } } diff --git a/erm.frontend/package.json b/erm.frontend/package.json index bfdf3d64..fcf1b14a 100644 --- a/erm.frontend/package.json +++ b/erm.frontend/package.json @@ -92,7 +92,7 @@ "luckyexcel": "1.0.1", "mockjs": "1.1.0", "pinia": "2.1.7", - "platform-core": "8.1.272", + "platform-core": "8.1.275", "quasar": "2.15.4", "tailwindcss": "3.4.4", "vue": "3.4.31", diff --git a/gradle.properties b/gradle.properties index 6d27c50a..18133c30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,7 +38,7 @@ application_version=1.0.0 platform_group=io.sc platform_version=8.1.44 platform_plugin_version=8.1.44 -platform_core_frontend_version=8.1.273 +platform_core_frontend_version=8.1.275 ########################################################### # dependencies version diff --git a/io.sc.engine.mv.frontend/package.json b/io.sc.engine.mv.frontend/package.json index 06d45874..3e366386 100644 --- a/io.sc.engine.mv.frontend/package.json +++ b/io.sc.engine.mv.frontend/package.json @@ -92,7 +92,7 @@ "luckyexcel": "1.0.1", "mockjs": "1.1.0", "pinia": "2.1.7", - "platform-core": "8.1.273", + "platform-core": "8.1.275", "quasar": "2.15.4", "tailwindcss": "3.4.4", "vue": "3.4.31", diff --git a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/impl/support/processor/MathFormula.java b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/impl/support/processor/MathFormula.java index 0543bb5f..6bb99a8e 100644 --- a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/impl/support/processor/MathFormula.java +++ b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/impl/support/processor/MathFormula.java @@ -1,23 +1,195 @@ package io.sc.engine.rule.core.code.impl.support.processor; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.core.type.TypeReference; +import io.sc.engine.rule.core.math.MathType; +import io.sc.engine.rule.core.po.lib.Indicator; +import io.sc.engine.rule.core.po.lib.processor.MathFormulaIndicatorProcessor; import io.sc.engine.rule.core.po.model.Parameter; import io.sc.engine.rule.core.po.model.processor.MathFormulaParameterProcessor; -import io.sc.engine.rule.core.util.JacksonObjectMapper; +import org.springframework.util.StringUtils; -import java.util.List; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.Unmarshaller; +import javax.xml.stream.XMLEventReader; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.events.Characters; +import javax.xml.stream.events.EndElement; +import javax.xml.stream.events.StartElement; +import javax.xml.stream.events.XMLEvent; +import java.io.Reader; +import java.io.StringReader; +import java.util.ArrayDeque; @JsonIgnoreProperties(ignoreUnknown=true) public class MathFormula { - public static List parse(String json) throws Exception { - return JacksonObjectMapper.getDefaultObjectMapper().readValue(json, new TypeReference>(){}); + public static MathType parse(String xml) throws Exception { + if(!StringUtils.hasText(xml)){ + return null; + } + Reader reader = new StringReader(xml); + XMLInputFactory factory = XMLInputFactory.newInstance(); // Or newFactory() + XMLStreamReader xmlReader = factory.createXMLStreamReader(reader); + + JAXBContext decodeJAXBContext =JAXBContext.newInstance(MathType.class); + Unmarshaller unmarshaller =decodeJAXBContext.createUnmarshaller(); + JAXBElement obj =unmarshaller.unmarshal(xmlReader,MathType.class); + return obj.getValue(); + } + + public static String generateGroovyCode(Indicator indicator, MathFormulaIndicatorProcessor processor) throws Exception { + if (indicator == null || processor == null) { + return null; + } + String xml =processor.getMathFormula(); + if(!StringUtils.hasText(xml)){ + return null; + } + Reader reader = new StringReader(xml); + XMLInputFactory xmlInputFactory =XMLInputFactory.newFactory(); + XMLEventReader xmlEventReader =xmlInputFactory.createXMLEventReader(reader); + StringBuilder sb =new StringBuilder(); + while(xmlEventReader.hasNext()){ + XMLEvent xmlEvent = xmlEventReader.nextEvent(); + if (xmlEvent.isStartElement()){ + StartElement startElement = xmlEvent.asStartElement(); + if("mi".equalsIgnoreCase(startElement.getName().getLocalPart())){ + + } + } else if(xmlEvent.isCharacters()){ + Characters characters = xmlEvent.asCharacters(); + sb.append(characters.getData()); + } else if(xmlEvent.isEndElement()){ + EndElement endElement =xmlEvent.asEndElement(); + if("mi".equalsIgnoreCase(endElement.getName().getLocalPart())) { + + } + } + } + return sb.toString(); } public static String generateGroovyCode(Parameter parameter, MathFormulaParameterProcessor processor) throws Exception{ - if(parameter==null || processor==null){ + if (parameter == null || processor == null) { + return null; + } + MathType math =parse(processor.getMathFormula()); + if(math==null){ return null; } + return null; } + + public static void main(String[] args)throws Exception { + String xml ="\n" + + " \n" + + " x\n" + + " \n" + + " +\n" + + " \n" + + " c\n" + + " \n" + + ""; + Reader reader = new StringReader(xml); + XMLInputFactory xmlInputFactory =XMLInputFactory.newFactory(); + XMLEventReader xmlEventReader =xmlInputFactory.createXMLEventReader(reader); + StringBuilder sb =new StringBuilder(); + ArrayDeque deque =new ArrayDeque<>(); + ArrayDeque twoPartDeque =new ArrayDeque<>(); + while(xmlEventReader.hasNext()){ + XMLEvent xmlEvent = xmlEventReader.nextEvent(); + if (xmlEvent.isStartElement()){ + StartElement startElement = xmlEvent.asStartElement(); + deque.push(startElement.getName().getLocalPart()); + String tagName =deque.peek(); + switch (tagName){ + case "mspace": + break; + case "mrow": + sb.append("("); + break; + case "mfrac": + twoPartDeque.push(true); + break; + case "msqrt": + sb.append("sqrt("); + break; + case "mroot": + twoPartDeque.push(true); + sb.append("root("); + break; + case "msup": + twoPartDeque.push(true); + sb.append("pow("); + break; + } + } else if(xmlEvent.isCharacters()){ + String tagName =deque.peek(); + Characters characters = xmlEvent.asCharacters(); + String text =characters.getData().trim(); + switch (tagName){ + case "mi": + sb.append("${").append(text); + break; + case "mo": + switch (text){ + case "×": + sb.append("*"); + break; + case "≥": + sb.append(">="); + break; + case "≤": + sb.append("<="); + break; + case "=": + sb.append("=="); + break; + default: + sb.append(text); + } + break; + case "mn": + sb.append(text); + break; + } + } else if(xmlEvent.isEndElement()) { + EndElement endElement = xmlEvent.asEndElement(); + String tagName = deque.peek(); + deque.pop(); + switch (tagName) { + case "mi": + sb.append("}"); + break; + case "mspace": + break; + case "mrow": + sb.append(")"); + if (twoPartDeque.peek()!=null && twoPartDeque.peek() && deque.peek()!=null) { + switch (deque.peek()){ + case "mfrac": + sb.append("/"); + break; + case "mroot": + case "msup": + sb.append(","); + break; + } + twoPartDeque.pop(); + } + break; + case "mfrac": + break; + case "msqrt": + case "mroot": + case "msup": + sb.append(")"); + break; + } + } + } + System.out.println(sb.toString()); + } } diff --git a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/function/ArithmeticFunction.java b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/function/ArithmeticFunction.java index ed080046..87bd4340 100644 --- a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/function/ArithmeticFunction.java +++ b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/function/ArithmeticFunction.java @@ -140,4 +140,8 @@ public class ArithmeticFunction { public static Double ln(Double x){ return Math.log(x); } + + public static Double root(Double x,Double y){ + return Math.pow(x,1/y); + } } diff --git a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/function/SpecialValueFunction.java b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/function/SpecialValueFunction.java index c3e8b026..121adc97 100644 --- a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/function/SpecialValueFunction.java +++ b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/function/SpecialValueFunction.java @@ -12,6 +12,68 @@ import java.util.Random; * */ public class SpecialValueFunction { + /** + * 是否为 null 或空字符串 + * @param value 值 + * @return 是否为 null 或空字符串 + */ + public static boolean isNil(Object value){ + if(value==null) return true; + if(value instanceof String) { + return !StringUtils.hasText((String)value); + } + return false; + } + + /** + * 是否非数字 + * @param value 值 + * @return 是否非数字 + */ + public static boolean isNan(Object value){ + if(value instanceof Float){ + if(Float.isNaN((float)value)){ + return true; + } + }else if(value instanceof Double){ + if(Double.isNaN((double)value)){ + return true; + } + } + return false; + } + + /** + * 是否无穷 + * @param value 值 + * @return 是否无穷 + */ + public static boolean isInfinite(Object value){ + if(value instanceof Float){ + if(Float.isInfinite((float)value)){ + return true; + } + }else if(value instanceof Double){ + if(Double.isInfinite((double)value)){ + return true; + } + } + return false; + } + + /** + * 是否等于0 + * @param value 值 + * @return 是否等于0 + */ + public static boolean isZero(Object value){ + if((value instanceof Number) && new BigDecimal(value.toString()).equals(BigDecimal.valueOf(0))){ + return true; + } + return false; + } + + /** * 空值处理函数, 如果值为 null 或空字符串, 返回 nullValue, 否则返回 value * @param value 值 diff --git a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/MathType.java b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/MathType.java new file mode 100644 index 00000000..60a151f1 --- /dev/null +++ b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/MathType.java @@ -0,0 +1,330 @@ +// +// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 +// 请访问 http://java.sun.com/xml/jaxb +// 在重新编译源模式时, 对此文件的所有修改都将丢失。 +// 生成时间: 2024.07.16 时间 03:39:28 PM CST +// + + +package io.sc.engine.rule.core.math; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

mathType complex type的 Java 类。 + * + *

以下模式片段指定包含在此类中的预期内容。 + * + *

+ * <complexType name="mathType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="mi" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="mn" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="mo" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="mspace" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="msqrt" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="mroot" type="{http://www.sc.io/engine/rule/core/math}mathType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="mrow" type="{http://www.sc.io/engine/rule/core/math}mathType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="msup" type="{http://www.sc.io/engine/rule/core/math}mathType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="mfrac" type="{http://www.sc.io/engine/rule/core/math}mathType" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "mathType", propOrder = { + "mi", + "mn", + "mo", + "mspace", + "msqrt", + "mroot", + "mrow", + "msup", + "mfrac" +}) +public class MathType { + + protected List mi; + protected List mn; + protected List mo; + protected List mspace; + protected List msqrt; + protected List mroot; + protected List mrow; + protected List msup; + protected List mfrac; + + /** + * Gets the value of the mi property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the mi property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMi().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getMi() { + if (mi == null) { + mi = new ArrayList(); + } + return this.mi; + } + + /** + * Gets the value of the mn property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the mn property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getMn() { + if (mn == null) { + mn = new ArrayList(); + } + return this.mn; + } + + /** + * Gets the value of the mo property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the mo property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMo().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getMo() { + if (mo == null) { + mo = new ArrayList(); + } + return this.mo; + } + + /** + * Gets the value of the mspace property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the mspace property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMspace().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getMspace() { + if (mspace == null) { + mspace = new ArrayList(); + } + return this.mspace; + } + + /** + * Gets the value of the msqrt property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the msqrt property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMsqrt().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getMsqrt() { + if (msqrt == null) { + msqrt = new ArrayList(); + } + return this.msqrt; + } + + /** + * Gets the value of the mroot property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the mroot property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMroot().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link MathType } + * + * + */ + public List getMroot() { + if (mroot == null) { + mroot = new ArrayList(); + } + return this.mroot; + } + + /** + * Gets the value of the mrow property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the mrow property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMrow().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link MathType } + * + * + */ + public List getMrow() { + if (mrow == null) { + mrow = new ArrayList(); + } + return this.mrow; + } + + /** + * Gets the value of the msup property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the msup property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMsup().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link MathType } + * + * + */ + public List getMsup() { + if (msup == null) { + msup = new ArrayList(); + } + return this.msup; + } + + /** + * Gets the value of the mfrac property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the mfrac property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getMfrac().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link MathType } + * + * + */ + public List getMfrac() { + if (mfrac == null) { + mfrac = new ArrayList(); + } + return this.mfrac; + } + +} diff --git a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/ObjectFactory.java b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/ObjectFactory.java new file mode 100644 index 00000000..fffbd901 --- /dev/null +++ b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/ObjectFactory.java @@ -0,0 +1,60 @@ +// +// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 +// 请访问 http://java.sun.com/xml/jaxb +// 在重新编译源模式时, 对此文件的所有修改都将丢失。 +// 生成时间: 2024.07.16 时间 03:39:28 PM CST +// + + +package io.sc.engine.rule.core.math; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the io.sc.engine.rule.core.math package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _Math_QNAME = new QName("http://www.sc.io/engine/rule/core/math", "math"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: io.sc.engine.rule.core.math + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link MathType } + * + */ + public MathType createMathType() { + return new MathType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link MathType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.sc.io/engine/rule/core/math", name = "math") + public JAXBElement createMath(MathType value) { + return new JAXBElement(_Math_QNAME, MathType.class, null, value); + } + +} diff --git a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/package-info.java b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/package-info.java new file mode 100644 index 00000000..ebb4bc9a --- /dev/null +++ b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/math/package-info.java @@ -0,0 +1,9 @@ +// +// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 +// 请访问 http://java.sun.com/xml/jaxb +// 在重新编译源模式时, 对此文件的所有修改都将丢失。 +// 生成时间: 2024.07.16 时间 03:39:28 PM CST +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.sc.io/engine/rule/core/math") +package io.sc.engine.rule.core.math; diff --git a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/po/lib/IndicatorProcessor.java b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/po/lib/IndicatorProcessor.java index 42a1d44f..6afaad81 100644 --- a/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/po/lib/IndicatorProcessor.java +++ b/io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/po/lib/IndicatorProcessor.java @@ -1,15 +1,7 @@ package io.sc.engine.rule.core.po.lib; import io.sc.engine.rule.core.enums.ProcessorType; -import io.sc.engine.rule.core.po.lib.processor.ArithmeticIndicatorProcessor; -import io.sc.engine.rule.core.po.lib.processor.ConditionRangeIndicatorProcessor; -import io.sc.engine.rule.core.po.lib.processor.EmptyIndicatorProcessor; -import io.sc.engine.rule.core.po.lib.processor.GroovyScriptIndicatorProcessor; -import io.sc.engine.rule.core.po.lib.processor.HttpRequestIndicatorProcessor; -import io.sc.engine.rule.core.po.lib.processor.NumberRangeIndicatorProcessor; -import io.sc.engine.rule.core.po.lib.processor.SqlIndicatorProcessor; -import io.sc.engine.rule.core.po.lib.processor.TernaryIndicatorProcessor; -import io.sc.engine.rule.core.po.lib.processor.WhenThenIndicatorProcessor; +import io.sc.engine.rule.core.po.lib.processor.*; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonSubTypes; @@ -23,6 +15,8 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; @JsonTypeInfo(use=JsonTypeInfo.Id.NAME, include=JsonTypeInfo.As.PROPERTY, property="type",defaultImpl=EmptyIndicatorProcessor.class) @JsonSubTypes({ @JsonSubTypes.Type(value=EmptyIndicatorProcessor.class), //空处理器 + @JsonSubTypes.Type(value=ObjectPropertiesIndicatorProcessor.class), //对象属性 + @JsonSubTypes.Type(value=MathFormulaIndicatorProcessor.class), //数学公式 @JsonSubTypes.Type(value=TernaryIndicatorProcessor.class), //三元操作处理器 @JsonSubTypes.Type(value=ArithmeticIndicatorProcessor.class), //算数操作处理器 @JsonSubTypes.Type(value=WhenThenIndicatorProcessor.class), //When-Then 操作处理器 diff --git a/io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/template/groovy/groovy.ftl b/io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/template/groovy/groovy.ftl index b9a85184..e1695d17 100644 --- a/io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/template/groovy/groovy.ftl +++ b/io.sc.engine.rule.core/src/main/resources/io/sc/engine/rule/core/code/template/groovy/groovy.ftl @@ -72,6 +72,7 @@ import static io.sc.engine.rule.core.function.ArithmeticFunction.sum; import static io.sc.engine.rule.core.function.ArithmeticFunction.log; import static io.sc.engine.rule.core.function.ArithmeticFunction.ln; import static io.sc.engine.rule.core.function.ArithmeticFunction.lg; +import static io.sc.engine.rule.core.function.ArithmeticFunction.root; import static io.sc.engine.rule.core.function.ArithmeticFunction.transformSequencing; import static io.sc.engine.rule.core.function.DateFunction.now; @@ -88,6 +89,10 @@ import static io.sc.engine.rule.core.function.StringFunction.join; import static io.sc.engine.rule.core.function.NormalDistributionFunction.G; import static io.sc.engine.rule.core.function.NormalDistributionFunction.iG; +import static io.sc.engine.rule.core.function.SpecialValueFunction.isNil; +import static io.sc.engine.rule.core.function.SpecialValueFunction.isZero; +import static io.sc.engine.rule.core.function.SpecialValueFunction.isNan; +import static io.sc.engine.rule.core.function.SpecialValueFunction.isInfinite; import static io.sc.engine.rule.core.function.SpecialValueFunction.nil; import static io.sc.engine.rule.core.function.SpecialValueFunction.zero; import static io.sc.engine.rule.core.function.SpecialValueFunction.nan; diff --git a/io.sc.engine.rule.frontend/package.json b/io.sc.engine.rule.frontend/package.json index c9ce7f87..09081d13 100644 --- a/io.sc.engine.rule.frontend/package.json +++ b/io.sc.engine.rule.frontend/package.json @@ -92,7 +92,7 @@ "luckyexcel": "1.0.1", "mockjs": "1.1.0", "pinia": "2.1.7", - "platform-core": "8.1.273", + "platform-core": "8.1.275", "quasar": "2.15.4", "tailwindcss": "3.4.4", "vue": "3.4.31", diff --git a/io.sc.engine.rule.frontend/src/views/lib/IndicatorGrid.vue b/io.sc.engine.rule.frontend/src/views/lib/IndicatorGrid.vue index c52c6086..f3e7cae5 100644 --- a/io.sc.engine.rule.frontend/src/views/lib/IndicatorGrid.vue +++ b/io.sc.engine.rule.frontend/src/views/lib/IndicatorGrid.vue @@ -189,6 +189,7 @@ name: 'valueScale', label: $t('re.resources.designer.parameter.grid.entity.valueScale'), type: 'number', + defaultValue: 6, showIf: (arg) => { const valueType = arg.form.getFieldValue('valueType'); const type = arg.form.getFieldValue('type'); @@ -203,6 +204,7 @@ label: $t('re.resources.designer.parameter.grid.entity.valueRoundingMode'), type: 'select', options: Options.enum(Enums.RoundingMode), + defaultValue: 'HALF_UP', showIf: (arg) => { const valueType = arg.form.getFieldValue('valueType'); const type = arg.form.getFieldValue('type'); diff --git a/io.sc.engine.rule.frontend/src/views/lib/ProcessorGrid.vue b/io.sc.engine.rule.frontend/src/views/lib/ProcessorGrid.vue index 83986080..0c3386df 100644 --- a/io.sc.engine.rule.frontend/src/views/lib/ProcessorGrid.vue +++ b/io.sc.engine.rule.frontend/src/views/lib/ProcessorGrid.vue @@ -279,6 +279,17 @@ return ''; } else if ('GROOVY_SCRIPT' === type) { return transfromContent(row.groovyScript); + } else if ('SQL' === type) { + return { + componentType: 'w-code-mirror', + attrs: { + lang: 'sql', + rows: 4, + editable: false, + modelValue: row.sql, + placeholder: true, + }, + }; } }, }, @@ -346,7 +357,37 @@ objectPropertiesMatcherDialogRef.open(objectProperties); }, }, + 'separator', 'edit', + { + extend: 'remove', + click: (arg) => { + const grid = gridRef.getEditorForm().getFieldComponent('objectProperties'); + const selecteds = arg.selecteds; + for (const selected of selecteds) { + selected.expression = ''; + grid.replaceRow(selected); + } + }, + }, + 'separator', + { + extend: 'remove', + name: 'removeAll', + label: $t('removeAll'), + icon: 'bi-trash3', + enableIf: () => { + return true; + }, + click: (arg) => { + const grid = gridRef.getEditorForm().getFieldComponent('objectProperties'); + const rows = grid.getLocalData(); + for (const row of rows) { + row.expression = ''; + } + grid.setLocalData(rows); + }, + }, ], primaryKey: 'code', columns: [ @@ -928,12 +969,10 @@ icon: 'bi-caret-right', click: (arg) => { const sql = gridRef.getEditorForm().getFieldValue('sql'); - let sqlParameterValues = gridRef.getEditorForm().getFieldValue('sqlParameterValues'); - if (sqlParameterValues) { - sqlParameterValues = Tools.json2Object(sqlParameterValues); - } + const grid = gridRef.getEditorForm().getFieldComponent('sqlParameterValues'); + const sqlParameterValues = grid?.getLocalData(); axios - .post(Environment.apiContextPath('/api/re/model/parameter/processor/executeSql'), { + .post(Environment.apiContextPath('/api/re/indicator/processor/executeSql'), { sql: sql, sqlParameterValues: sqlParameterValues, }) @@ -1032,7 +1071,7 @@ name: 'parameter', label: $t('parameterName'), type: 'select', - options: autoCompletionOptionsRef, + options: indicatorOptionsRef, }, ], }, @@ -1183,6 +1222,14 @@ grid?.setLocalData(properties); }); } + //获取所有指标列表 + axios.get(Environment.apiContextPath('api/re/indicator/findIndicatorsByIndicatorId?indicatorId=' + indicator.id)).then((response) => { + const options = []; + for (const indicator of response.data) { + options.push({ label: indicator.name, value: '${' + indicator.name + '}' }); + } + indicatorOptionsRef = options; + }); const type = gridRef.getEditorForm().getFieldValue('type'); if ('NUMBER_RANGE' === type) { @@ -1233,6 +1280,7 @@ const gridRef = ref(); const objectPropertiesMatcherDialogRef = ref(); const dsOptionsRef = ref([]); const sqlQueryResultFieldsRef = ref([]); +const indicatorOptionsRef = ref(); const autoCompletionManager = new AutoCompletionManager(); const autoCompletion = (context) => { diff --git a/io.sc.engine.rule.frontend/src/views/lib/TestCaseParameter.vue b/io.sc.engine.rule.frontend/src/views/lib/TestCaseParameter.vue index ad4d4ea4..0a9ca308 100644 --- a/io.sc.engine.rule.frontend/src/views/lib/TestCaseParameter.vue +++ b/io.sc.engine.rule.frontend/src/views/lib/TestCaseParameter.vue @@ -35,7 +35,7 @@ label: $t('execute'), icon: 'bi-caret-right', click: () => { - axios.post(Environment.apiContextPath('/api/re/testCase/executeTestCase/' + testCase.id)).then(() => { + axios.post(Environment.apiContextPath('/api/re/testCase/executeTestCase/' + testCase.id), {}, { loading: true }).then(() => { gridRef?.refresh(); }); }, diff --git a/io.sc.engine.rule.frontend/src/views/resources/Resources.vue b/io.sc.engine.rule.frontend/src/views/resources/Resources.vue index 68c80bcd..dd50ebd0 100644 --- a/io.sc.engine.rule.frontend/src/views/resources/Resources.vue +++ b/io.sc.engine.rule.frontend/src/views/resources/Resources.vue @@ -307,6 +307,9 @@ label: $t('re.resources.grid.entity.imports'), type: 'code-mirror', lang: 'java', + lineWrap: true, + lineBreak: false, + toolbar: false, showIf: (arg) => { const type = arg.form.getFieldValue('type'); return type === 'MODEL' || type === 'SCORE_CARD'; diff --git a/io.sc.engine.rule.frontend/src/views/resources/designer/Option.vue b/io.sc.engine.rule.frontend/src/views/resources/designer/Option.vue index 3094345c..ff24a48f 100644 --- a/io.sc.engine.rule.frontend/src/views/resources/designer/Option.vue +++ b/io.sc.engine.rule.frontend/src/views/resources/designer/Option.vue @@ -22,6 +22,12 @@ return !readOnly; }, }, + { + extend: 'clone', + enableIf: (arg) => { + return !readOnly && arg.selected; + }, + }, { extend: 'edit', enableIf: (arg) => { diff --git a/io.sc.engine.rule.frontend/src/views/resources/designer/Processor.vue b/io.sc.engine.rule.frontend/src/views/resources/designer/Processor.vue index 17203bda..7372e216 100644 --- a/io.sc.engine.rule.frontend/src/views/resources/designer/Processor.vue +++ b/io.sc.engine.rule.frontend/src/views/resources/designer/Processor.vue @@ -491,6 +491,35 @@ }, }, 'edit', + { + extend: 'remove', + click: (arg) => { + const grid = gridRef.getEditorForm().getFieldComponent('objectProperties'); + const selecteds = arg.selecteds; + for (const selected of selecteds) { + selected.expression = ''; + grid.replaceRow(selected); + } + }, + }, + 'separator', + { + extend: 'remove', + name: 'removeAll', + label: $t('removeAll'), + icon: 'bi-trash3', + enableIf: () => { + return true; + }, + click: (arg) => { + const grid = gridRef.getEditorForm().getFieldComponent('objectProperties'); + const rows = grid.getLocalData(); + for (const row of rows) { + row.expression = ''; + } + grid.setLocalData(rows); + }, + }, ], primaryKey: 'code', columns: [ @@ -757,7 +786,7 @@ sortable: false, format: (value) => { if (value) { - return '['; + return ']'; } else { return ')'; } @@ -970,6 +999,10 @@ rows: 20, lineNumber: true, lang: 'java', + lineWrap: false, + lineBreak: true, + placeholder: true, + autoCompletion: autoCompletion, showIf: (arg) => { return 'GROOVY_SCRIPT' === arg.form.getFieldValue('type'); }, @@ -1138,10 +1171,8 @@ icon: 'bi-caret-right', click: (arg) => { const sql = gridRef.getEditorForm().getFieldValue('sql'); - let sqlParameterValues = gridRef.getEditorForm().getFieldValue('sqlParameterValues'); - if (sqlParameterValues) { - sqlParameterValues = Tools.json2Object(sqlParameterValues); - } + const grid = gridRef.getEditorForm().getFieldComponent('sqlParameterValues'); + const sqlParameterValues = grid?.getLocalData(); axios .post(Environment.apiContextPath('/api/re/model/parameter/processor/executeSql'), { sql: sql, @@ -1242,7 +1273,7 @@ name: 'parameter', label: $t('parameterName'), type: 'select', - options: autoCompletionOptionsRef, + options: parameterOptionsRef, }, ], }, @@ -1407,6 +1438,15 @@ }); } + //获取所有参数列表 + axios.get(Environment.apiContextPath('api/re/model/parameter/findParametersByParameterId?parameterId=' + parameter.id)).then((response) => { + const options = []; + for (const indicator of response.data) { + options.push({ label: indicator.name, value: '${' + indicator.name + '}' }); + } + parameterOptionsRef = options; + }); + const type = gridRef.getEditorForm().getFieldValue('type'); if ('OPTION_VALUE' === type) { editorDialogWidthRef = '40%'; @@ -1472,7 +1512,6 @@ import { ref, onMounted, computed, toValue } from 'vue'; import { axios, Environment, Formater, Tools, EnumTools, Options } from 'platform-core'; import { PlaceHolder } from '@/utils/PlaceHolder'; -import GroovyFunctions from './GroovyFunctions'; import DecisionTreeDialog from './DecisionTreeDialog.vue'; import ExecutionFlowDialog from './ExecutionFlowDialog.vue'; import ObjectPropertiesMatcherDialog from './ObjectPropertiesMatcherDialog.vue'; @@ -1491,10 +1530,10 @@ const emit = defineEmits<{ }>(); const gridRef = ref(); -const autoCompletionOptionsRef = ref([]); const optionOptionsRef = ref([]); const dsOptionsRef = ref([]); const sqlQueryResultFieldsRef = ref([]); +const parameterOptionsRef = ref(); const editorDialogWidthRef = ref('50%'); const decisionTreeDialogRef = ref(); const executionFlowDialogRef = ref(); diff --git a/io.sc.engine.rule.frontend/src/views/resources/designer/TestCaseParameter.vue b/io.sc.engine.rule.frontend/src/views/resources/designer/TestCaseParameter.vue index f75bd7af..e866094a 100644 --- a/io.sc.engine.rule.frontend/src/views/resources/designer/TestCaseParameter.vue +++ b/io.sc.engine.rule.frontend/src/views/resources/designer/TestCaseParameter.vue @@ -41,7 +41,7 @@ label: $t('execute'), icon: 'bi-caret-right', click: () => { - axios.post(Environment.apiContextPath('/api/re/testCase/executeTestCase/' + testCase.id)).then(() => { + axios.post(Environment.apiContextPath('/api/re/testCase/executeTestCase/' + testCase.id), {}, { loading: true }).then(() => { gridRef?.refresh(); }); }, diff --git a/io.sc.engine.rule.frontend/src/views/resources/designer/Testcase.vue b/io.sc.engine.rule.frontend/src/views/resources/designer/Testcase.vue index be8e8685..f1419e40 100644 --- a/io.sc.engine.rule.frontend/src/views/resources/designer/Testcase.vue +++ b/io.sc.engine.rule.frontend/src/views/resources/designer/Testcase.vue @@ -36,7 +36,7 @@ label: $t('execute'), icon: 'bi-caret-right', click: (arg) => { - axios.post(Environment.apiContextPath('/api/re/testCase/executeTestCase/' + arg.selected.id)).then((response) => { + axios.post(Environment.apiContextPath('/api/re/testCase/executeTestCase/' + arg.selected.id), {}, { loading: true }).then((response) => { gridRef.refresh(); }); }, @@ -46,7 +46,7 @@ label: $t('executeAll'), icon: 'bi-fast-forward', click: (arg) => { - axios.post(Environment.apiContextPath('/api/re/testCase/executeAllTestCase/' + model.resource), { loading: true }).then((response) => { + axios.post(Environment.apiContextPath('/api/re/testCase/executeAllTestCase/' + model.resource), {}, { loading: true }).then((response) => { gridRef.refresh(); }); }, diff --git a/io.sc.engine.rule.frontend/src/views/shared/SelectIndicatorDialog.vue b/io.sc.engine.rule.frontend/src/views/shared/SelectIndicatorDialog.vue index b34a072b..4b8d18c4 100644 --- a/io.sc.engine.rule.frontend/src/views/shared/SelectIndicatorDialog.vue +++ b/io.sc.engine.rule.frontend/src/views/shared/SelectIndicatorDialog.vue @@ -158,6 +158,7 @@ const indicatorGridRef = ref(); const open = () => { dialogRef.value.show(); + libTreeGridRef.value?.refresh(); }; const close = () => { diff --git a/io.sc.engine.rule.sample/src/main/resources/META-INF/platform/plugins/rule-engine-sample-resource.json b/io.sc.engine.rule.sample/src/main/resources/META-INF/platform/plugins/rule-engine-sample-resource.json index dab0894d..e5d12507 100644 --- a/io.sc.engine.rule.sample/src/main/resources/META-INF/platform/plugins/rule-engine-sample-resource.json +++ b/io.sc.engine.rule.sample/src/main/resources/META-INF/platform/plugins/rule-engine-sample-resource.json @@ -19,6 +19,15 @@ "dictionary":"classpath:/io/sc/engine/rule/sample/app/irs/whns/WHNS非零售内评(元数据).json", "lib" :"classpath:/io/sc/engine/rule/sample/app/irs/whns/WHNS非零售内评(特征库).json" }, + //应用示例/非零售内评/SHNS-内部评级模型(非零售) + { + "order" :300, + "parentId" :"re.engine.sample.resource.app.irs", + "id" :"re.engine.sample.resource.app.irs.shns", + "file" :"classpath:/io/sc/engine/rule/sample/app/irs/shns/SHNS非零售内评(模型).json", + "dictionary":"classpath:/io/sc/engine/rule/sample/app/irs/shns/SHNS非零售内评(元数据).json", + "lib" :"classpath:/io/sc/engine/rule/sample/app/irs/shns/SHNS非零售内评(特征库).json" + }, //应用示例/零售内评 {"id":"re.engine.sample.resource.app.rirs","parentId":"re.engine.sample.resource.app","order":200}, //应用示例/零售内评/汉口银行-内部评级模型(零售) diff --git a/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages.properties b/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages.properties index 7543268b..9667cbe5 100644 --- a/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages.properties +++ b/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages.properties @@ -8,6 +8,8 @@ re.engine.sample.resource.app.irs.hankou=Not Retail Rate Model for HANKOU re.engine.sample.resource.app.irs.hankou.description=Not Retail Rate Model re.engine.sample.resource.app.irs.whns=Not Retail Rate Model for WHNS re.engine.sample.resource.app.irs.whns.description=Not Retail Rate Model +re.engine.sample.resource.app.irs.shns=Not Retail Rate Model for SHNS +re.engine.sample.resource.app.irs.shns.description=Not Retail Rate Model # \u96F6\u552E\u5185\u8BC4 re.engine.sample.resource.app.rirs=RIRS Model Sample diff --git a/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages_tw_CN.properties b/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages_tw_CN.properties index c425b871..4038abc5 100644 --- a/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages_tw_CN.properties +++ b/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages_tw_CN.properties @@ -8,6 +8,8 @@ re.engine.sample.resource.app.irs.hankou=HANKOU\u5167\u90E8\u8A55\u7D1A\u6A21\u5 re.engine.sample.resource.app.irs.hankou.description=\u975E\u96F6\u552E\u5167\u8A55\u6A21\u578B(\u91D1\u878D\u6A5F\u69CB\u3001\u767C\u50B5\u4F01\u696D\u3001\u4E00\u822C\u4F01\u696D) re.engine.sample.resource.app.irs.whns=WHNS\u5167\u90E8\u8A55\u7D1A\u6A21\u578B(\u975E\u96F6\u552E) re.engine.sample.resource.app.irs.whns.description=\u975E\u96F6\u552E\u5167\u8A55\u6A21\u578B(\u91D1\u878D\u6A5F\u69CB\u3001\u767C\u50B5\u4F01\u696D\u3001\u4E00\u822C\u4F01\u696D) +re.engine.sample.resource.app.irs.shns=SHNS\u5167\u90E8\u8A55\u7D1A\u6A21\u578B(\u975E\u96F6\u552E) +re.engine.sample.resource.app.irs.shns.description=\u975E\u96F6\u552E\u5167\u8A55\u6A21\u578B(A,B,K\u8A55\u5206\u5361,\u7070\u5EA6\u8A55\u5206\u5361) # \u96F6\u552E\u5185\u8BC4 re.engine.sample.resource.app.rirs=\u96F6\u552E\u5167\u8A55 diff --git a/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages_zh_CN.properties b/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages_zh_CN.properties index f14e022e..4258274b 100644 --- a/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages_zh_CN.properties +++ b/io.sc.engine.rule.sample/src/main/resources/io/sc/engine/rule/sample/i18n/messages_zh_CN.properties @@ -8,6 +8,8 @@ re.engine.sample.resource.app.irs.hankou=HANKOU\u5185\u90E8\u8BC4\u7EA7\u6A21\u5 re.engine.sample.resource.app.irs.hankou.description=\u975E\u96F6\u552E\u5185\u8BC4\u6A21\u578B(\u91D1\u878D\u673A\u6784\u3001\u53D1\u503A\u4F01\u4E1A\u3001\u4E00\u822C\u4F01\u4E1A) re.engine.sample.resource.app.irs.whns=WHNS\u5185\u90E8\u8BC4\u7EA7\u6A21\u578B(\u975E\u96F6\u552E) re.engine.sample.resource.app.irs.whns.description=\u975E\u96F6\u552E\u5185\u8BC4\u6A21\u578B(\u91D1\u878D\u673A\u6784\u3001\u53D1\u503A\u4F01\u4E1A\u3001\u4E00\u822C\u4F01\u4E1A) +re.engine.sample.resource.app.irs.shns=SHNS\u5185\u90E8\u8BC4\u7EA7\u6A21\u578B(\u975E\u96F6\u552E) +re.engine.sample.resource.app.irs.shns.description=\u975E\u96F6\u552E\u5185\u8BC4\u6A21\u578B(A,B,K\u8BC4\u5206\u5361,\u7070\u5EA6\u8BC4\u5206\u5361) # \u96F6\u552E\u5185\u8BC4 re.engine.sample.resource.app.rirs=\u96F6\u552E\u5185\u8BC4 diff --git a/io.sc.engine.rule.server/build.gradle b/io.sc.engine.rule.server/build.gradle index 4f1444fa..ea39cd5f 100644 --- a/io.sc.engine.rule.server/build.gradle +++ b/io.sc.engine.rule.server/build.gradle @@ -13,9 +13,9 @@ dependencies { project(":io.sc.engine.rule.client.spring"), project(":io.sc.engine.rule.frontend"), - project(":org.webjars.codemirror-5.37.0"), - project(":org.webjars.mxgraph-3.9.12"), - project(":org.webjars.jquery-1.12.4"), + "org.webjars:org.webjars.codemirror:5.37.0", + "org.webjars:org.webjars.mxgraph:3.9.12", + "org.webjars:org.webjars.jquery:1.12.4", ) } diff --git a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/dictionary/service/impl/DictionaryServiceImpl.java b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/dictionary/service/impl/DictionaryServiceImpl.java index 865d0ad7..5b553ea9 100644 --- a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/dictionary/service/impl/DictionaryServiceImpl.java +++ b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/dictionary/service/impl/DictionaryServiceImpl.java @@ -306,8 +306,6 @@ public class DictionaryServiceImpl extends DaoServiceImpl autoMatch(@RequestBody AutoMatchObjectProperties autoMatchObjectProperties) throws Exception { return service.autoMatch(autoMatchObjectProperties); } + + @RequestMapping(value="executeSql",method=RequestMethod.POST) + @ResponseBody + public SqlQueryResult executeSql(@RequestBody SqlQueryRequest request) throws Exception{ + return service.executeSql(request); + } } diff --git a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/controller/IndicatorWebController.java b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/controller/IndicatorWebController.java index 21434e13..b689e83f 100644 --- a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/controller/IndicatorWebController.java +++ b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/controller/IndicatorWebController.java @@ -32,7 +32,7 @@ public class IndicatorWebController extends RestCrudController findIndicatorsByIndicatorId(@RequestParam(name="indicatorId",required = false)String indicatorId) throws Exception { + public List findIndicatorsByIndicatorId(@RequestParam(name="indicatorId",required = false)String indicatorId) throws Exception { return EntityVoUtil.toVo(service.findIndicatorsByIndicatorId(indicatorId)); } diff --git a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/IndicatorProcessorService.java b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/IndicatorProcessorService.java index 92c9cf83..6b4b262e 100644 --- a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/IndicatorProcessorService.java +++ b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/IndicatorProcessorService.java @@ -4,6 +4,8 @@ import io.sc.engine.rule.server.lib.entity.IndicatorProcessorEntity; import io.sc.engine.rule.server.lib.repository.IndicatorProcessorRepository; import io.sc.engine.rule.server.model.service.support.AutoMatchObjectProperties; import io.sc.engine.rule.server.model.service.support.ObjectProperty; +import io.sc.engine.rule.server.model.support.processor.SqlQueryRequest; +import io.sc.engine.rule.server.model.support.processor.SqlQueryResult; import io.sc.platform.orm.service.DaoService; import java.util.List; @@ -14,4 +16,5 @@ import java.util.List; public interface IndicatorProcessorService extends DaoService{ public List listObejctPropertiesByProcessorId(String processorId) throws Exception; public List autoMatch(AutoMatchObjectProperties autoMatchObjectProperties) throws Exception; + public SqlQueryResult executeSql(SqlQueryRequest request); } diff --git a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/impl/IndicatorProcessorServiceImpl.java b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/impl/IndicatorProcessorServiceImpl.java index bc537e52..41f6cfad 100644 --- a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/impl/IndicatorProcessorServiceImpl.java +++ b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/impl/IndicatorProcessorServiceImpl.java @@ -2,6 +2,7 @@ package io.sc.engine.rule.server.lib.service.impl; import com.fasterxml.jackson.core.type.TypeReference; import io.sc.engine.rule.core.po.lib.processor.ObjectPropertiesIndicatorProcessor; +import io.sc.engine.rule.core.util.ExpressionReplacer; import io.sc.engine.rule.server.dictionary.entity.DictionaryEntity; import io.sc.engine.rule.server.dictionary.entity.ReleasableDictionaryEntity; import io.sc.engine.rule.server.dictionary.entity.UserDefinedJavaClassDictionaryEntity; @@ -18,6 +19,8 @@ import io.sc.engine.rule.server.lib.vo.processor.ObjectPropertiesIndicatorProces import io.sc.engine.rule.server.model.entity.ParameterEntity; import io.sc.engine.rule.server.model.service.support.AutoMatchObjectProperties; import io.sc.engine.rule.server.model.service.support.ObjectProperty; +import io.sc.engine.rule.server.model.support.processor.SqlQueryRequest; +import io.sc.engine.rule.server.model.support.processor.SqlQueryResult; import io.sc.engine.rule.server.model.vo.ParameterProcessorVo; import io.sc.engine.rule.server.model.vo.processor.ObjectPropertiesParameterProcessorVo; import io.sc.engine.rule.server.util.CodeAndNameMapping; @@ -27,9 +30,14 @@ import io.sc.platform.orm.entity.support.EntityChangedEventType; import io.sc.platform.orm.service.impl.DaoServiceImpl; import org.apache.commons.text.similarity.LongestCommonSubsequenceDistance; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; +import java.sql.ResultSet; +import java.sql.SQLException; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -39,6 +47,7 @@ import java.util.Map; public class IndicatorProcessorServiceImpl extends DaoServiceImpl implements IndicatorProcessorService{ @Autowired private IndicatorService indicatorService; @Autowired private DictionaryService dictionaryService; + @Autowired private JdbcTemplate jdbcTemplate; @Override public String[] getDefaultSortBy() { @@ -259,4 +268,21 @@ public class IndicatorProcessorServiceImpl extends DaoServiceImpl mapping =request.getSqlParameterValueMap(); + String replacedSql = ExpressionReplacer.replace(sql, mapping); + return jdbcTemplate.query(replacedSql, new Object[] {}, new ResultSetExtractor() { + @Override + public SqlQueryResult extractData(ResultSet rs) throws SQLException, DataAccessException { + return SqlQueryResult.from(rs); + } + }); + } + } + return null; + } } diff --git a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/impl/IndicatorServiceImpl.java b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/impl/IndicatorServiceImpl.java index 360a2472..916581f0 100644 --- a/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/impl/IndicatorServiceImpl.java +++ b/io.sc.engine.rule.server/src/main/java/io/sc/engine/rule/server/lib/service/impl/IndicatorServiceImpl.java @@ -340,8 +340,6 @@ public class IndicatorServiceImpl extends DaoServiceImpl findByOwnerId(String ownerId,QueryParameter queryParameter) throws Exception { @@ -278,7 +287,7 @@ public class TestCaseServiceImpl extends DaoServiceImpl inputs =new ArrayList(); @@ -458,7 +467,12 @@ public class TestCaseServiceImpl extends DaoServiceImpl executeParameter =new HashMap(2); + executeParameter.put("executor", executor); + executeParameter.put("subModelCode", null); + executeParameter.put("argument", parameters); + ResourceResult result =(ResourceResult)groovyScriptEngineService.eval(groovySourceCode.getSource(),"INPUT_PARAMETER",executeParameter); if(result!=null){ for(int i =2;i tree, TestCaseParameterWrapper parentNode, ModelEntity modelEntity) { + if(tree!=null && modelEntity!=null) { + //添加模型 + TestCaseParameterWrapper modelNode =modelEntity.toTestCaseParameterWrapper(); + modelNode.setParent(parentNode==null?null:parentNode.getId()); + tree.add(modelNode); + //添加模型包含的子模型 + List children =modelEntity.getChildren(); + if(children!=null && children.size()>0) { + for(ModelEntity child : children) { + buildTestCaseParameterTree(tree,modelNode,child); + } + } + //添加模型包含的参数 + List parameters =modelEntity.getParameters(); + if(parameters!=null && parameters.size()>0) { + for(ParameterEntity parameter : parameters) { + TestCaseParameterWrapper wrapper =parameter.toTestCaseParameterWrapper(); + wrapper.setParent(modelNode==null?null:modelNode.getId()); + + if(parameter instanceof InOptionParameterEntity){ + InOptionParameterEntity inOptionParameterEntity =(InOptionParameterEntity)parameter; + List optionItemEntities =inOptionParameterEntity.getOptions(); + List

+ - - x - y - + c -
+ diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/Division.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/Division.vue index 9c4abbe8..2c58bcc4 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/Division.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/Division.vue @@ -2,8 +2,16 @@ - x - y + + + x + + + + + y + + diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/LeftParenthesis.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/LeftParenthesis.vue index 021b9c49..33ac56c6 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/LeftParenthesis.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/LeftParenthesis.vue @@ -1,7 +1,7 @@ diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/RightParenthesis.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/RightParenthesis.vue index 5bfa94e7..c0effdab 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/RightParenthesis.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/RightParenthesis.vue @@ -1,7 +1,7 @@ diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/Variable.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/Variable.vue index b95a66ce..ed331078 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/Variable.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/base/Variable.vue @@ -8,7 +8,7 @@ diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsNaN.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsNaN.vue new file mode 100644 index 00000000..c30c1786 --- /dev/null +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsNaN.vue @@ -0,0 +1,46 @@ + + diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsNil.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsNil.vue new file mode 100644 index 00000000..3b356529 --- /dev/null +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsNil.vue @@ -0,0 +1,46 @@ + + diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsZero.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsZero.vue new file mode 100644 index 00000000..a6e304a7 --- /dev/null +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/specialValue/IsZero.vue @@ -0,0 +1,46 @@ + + diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/trigonometric/hyperbolic/Csch.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/trigonometric/hyperbolic/Csch.vue index c9725a04..705b8832 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/trigonometric/hyperbolic/Csch.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/trigonometric/hyperbolic/Csch.vue @@ -35,7 +35,7 @@ const dragstart = (event) => { }; const append = () => { - props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('csch')); + props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('csch(x)')); modelValueRef.value = modelValueRef.value + xmlData.replace('', ''); }; diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/trigonometric/hyperbolic/Sech.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/trigonometric/hyperbolic/Sech.vue index bd7e7457..a9536755 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/trigonometric/hyperbolic/Sech.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/functions/trigonometric/hyperbolic/Sech.vue @@ -35,7 +35,7 @@ const dragstart = (event) => { }; const append = () => { - props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('sech')); + props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('sech(x)')); modelValueRef.value = modelValueRef.value + xmlData.replace('', ''); }; diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Exp.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Exp.vue index 7088b161..8ea0317f 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Exp.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Exp.vue @@ -2,8 +2,8 @@
- e - x + e + x
@@ -12,8 +12,8 @@ const xmlData = ` - e - x + e + x `; diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Power.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Power.vue index a996274b..5c25f670 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Power.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Power.vue @@ -2,8 +2,8 @@
- x - y + x + y
@@ -12,8 +12,8 @@ const xmlData = ` - x - y + x + y `; diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Power2.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Power2.vue index 5e6eff8d..bcadd450 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Power2.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Power2.vue @@ -2,8 +2,8 @@
- x - 2 + x + 2
@@ -12,8 +12,8 @@ const xmlData = ` - x - 2 + x + 2 `; diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Root.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Root.vue new file mode 100644 index 00000000..d54d2371 --- /dev/null +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Root.vue @@ -0,0 +1,35 @@ + + diff --git a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Sqrt.vue b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Sqrt.vue index 678f6df7..4e5908da 100644 --- a/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Sqrt.vue +++ b/io.sc.platform.core.frontend/src/platform/components/expression/toolbar/math/Sqrt.vue @@ -1,20 +1,18 @@ diff --git a/io.sc.platform.core.frontend/src/views/testcase/math/MathEditor.vue b/io.sc.platform.core.frontend/src/views/testcase/math/MathEditor.vue index 0664750a..c652f01d 100644 --- a/io.sc.platform.core.frontend/src/views/testcase/math/MathEditor.vue +++ b/io.sc.platform.core.frontend/src/views/testcase/math/MathEditor.vue @@ -5,6 +5,8 @@ diff --git a/io.sc.platform.core.frontend/template-project/src/views/testcase/math/MathEditor.vue b/io.sc.platform.core.frontend/template-project/src/views/testcase/math/MathEditor.vue index 0664750a..c652f01d 100644 --- a/io.sc.platform.core.frontend/template-project/src/views/testcase/math/MathEditor.vue +++ b/io.sc.platform.core.frontend/template-project/src/views/testcase/math/MathEditor.vue @@ -5,6 +5,8 @@ diff --git a/io.sc.platform.system.frontend/src/views/user/SetPasswordDialog.vue b/io.sc.platform.system.frontend/src/views/user/SetPasswordDialog.vue index 76da7c9f..1cdfdfd6 100644 --- a/io.sc.platform.system.frontend/src/views/user/SetPasswordDialog.vue +++ b/io.sc.platform.system.frontend/src/views/user/SetPasswordDialog.vue @@ -3,14 +3,13 @@ ref="setPasswordDialogRef" :title="$t('system.user.action.' + actionTypeRef)" width="500px" - height="230px" :can-maximize="false" :buttons="[ { label: $t('confirm'), noCaps: true, click: () => { - axios + noErrorAxios .post(Environment.apiContextPath('/api/system/user/' + actionTypeRef), { userIds: currentSelectedUserIds, password: setPasswordFormRef.getData().password, @@ -18,6 +17,24 @@ .then(() => { setPasswordDialogRef.hide(); NotifyManager.info($t('operationSuccess')); + }) + .catch((error) => { + const response = error?.response; + const status = response?.status; + const data = response?.data; + if (data?.code === 1001) { + // 验证错误 + if (error.response.data.data) { + setPasswordFormRef.setValidationErrors(error.response.data.data); + } + } else { + //其他错误 + if (status === 500) { + NotifyManager.error($t(data?.errorMessageI18nKey)); + } else { + NotifyManager.error($t(status)); + } + } }); }, }, @@ -46,7 +63,7 @@