Browse Source

发布 8.2.3

1. 修复默认安装时缺失 protocol 属性的 bug。
2. 前端更新到 8.2.17。
3. 规则引擎支持参数类型为特征的输入参数。
main
wangshaoping 2 months ago
parent
commit
5688c8500f
  1. 2
      erm.frontend/package.json
  2. 2
      gradle.properties
  3. 2
      io.sc.engine.mv.frontend/package.json
  4. 9
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/generator/impl/IndicatorGenerator.java
  5. 2
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/template/impl/lib.tpl
  6. 8
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/template/import_render.tpl
  7. 2
      io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/template/lib_render.tpl
  8. 2
      io.sc.engine.rule.frontend/package.json
  9. 36
      io.sc.engine.rule.frontend/src/views/shared/TestcaseParameterGrid.vue
  10. 4
      io.sc.engine.rule.frontend/src/views/shared/processors/GroovyScript.ts
  11. 2
      io.sc.engine.st.frontend/package.json
  12. 2
      io.sc.platform.core.frontend/package.json
  13. 4
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/Toolbar.vue
  14. 37
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/Collection.vue
  15. 4
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/Date.vue
  16. 44
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/collection/hasElements.vue
  17. 16
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/Now.vue
  18. 122
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/Between.vue
  19. 52
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/DaysBetween.vue
  20. 52
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/HoursBetween.vue
  21. 52
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/MinutesBetween.vue
  22. 52
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/MonthsBetween.vue
  23. 52
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/SecondsBetween.vue
  24. 52
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/WeeksBetween.vue
  25. 52
      io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/YearsBetween.vue
  26. 12
      io.sc.platform.core.frontend/src/platform/i18n/messages.json
  27. 10
      io.sc.platform.core.frontend/src/platform/i18n/messages_tw_CN.json
  28. 10
      io.sc.platform.core.frontend/src/platform/i18n/messages_zh_CN.json
  29. 4
      io.sc.platform.core.frontend/template-project/package.json
  30. 2
      io.sc.platform.developer.doc/package.json
  31. 2
      io.sc.platform.developer.frontend/package.json
  32. 2
      io.sc.platform.lcdp.frontend/package.json
  33. 2
      io.sc.platform.license.keygen.frontend/package.json
  34. 2
      io.sc.platform.mvc.frontend/package.json
  35. 2
      io.sc.platform.scheduler.manager.frontend/package.json
  36. 2
      io.sc.platform.system.frontend/package.json
  37. 221
      io.sc.platform.util/src/main/java/io/sc/platform/util/DateUtil.java
  38. 2
      io.sc.standard.frontend/package.json
  39. 2
      io.sc.website/package.json

2
erm.frontend/package.json

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

2
gradle.properties

@ -38,7 +38,7 @@ application_version=1.0.0
platform_group=io.sc
platform_version=8.2.3
platform_plugin_version=8.2.3
platform_core_frontend_version=8.2.15
platform_core_frontend_version=8.2.17
###########################################################
# dependencies version

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

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

@ -58,7 +58,7 @@ public class IndicatorGenerator {
return sb.toString();
}
public static String generateConvertorFromMap(List<Indicator> indicators) {
public static String generateConvertorFromMap(List<Indicator> indicators,String prefix) {
if (!CollectionUtil.hasElements(indicators)) {
return null;
}
@ -70,19 +70,20 @@ public class IndicatorGenerator {
Integer valueTypeVersion = indicator.getValueTypeVersion();
Map<String,Object> variables =new HashMap<>();
variables.put("prefix",prefix);
variables.put("code",code);
variables.put("name",name);
variables.put("fieldName",IdReplacer.fieldName(code));
variables.put("className",IdReplacer.className(valueType,valueTypeVersion));
if (indicator.getValueTypeIsList()) {
String tpl ="this.${fieldName} =TypeConvertor.getValue(map.get('${code}'),new TypeReference<List<${className}>>(){}); //${name}";
String tpl ="${prefix}.${fieldName} =TypeConvertor.getValue(map.get('${code}'),new TypeReference<List<${className}>>(){}); //${name}";
sb.append(StringUtil.format(tpl,variables)).append("\n");
} else {
String tpl ="this.${fieldName} =TypeConvertor.getValue(map.get('${code}'),${className}.class); //${name}";
String tpl ="${prefix}.${fieldName} =TypeConvertor.getValue(map.get('${code}'),${className}.class); //${name}";
sb.append(StringUtil.format(tpl,variables)).append("\n");
}
if (!ValueTypeUtil.isBase(valueType)) {
String tpl ="if(this.${fieldName}!=null) { this.${fieldName}.init(); }";
String tpl ="if(${prefix}.${fieldName}!=null) { ${prefix}.${fieldName}.init(); }";
sb.append(StringUtil.format(tpl,variables)).append("\n");
}
}

2
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/template/impl/lib.tpl

@ -135,7 +135,7 @@ class Argument {
public static Argument convertArgument(Map<String,Object> map){
if(map!=null){
Argument arg =new Argument();
#(tabs(IndicatorGenerator.generateConvertorFromMap(lib.indicators),3))
#(tabs(IndicatorGenerator.generateConvertorFromMap(lib.indicators,"arg"),3))
return arg;
}
return null;

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

@ -56,6 +56,14 @@ import static io.sc.engine.rule.core.function.StringFunction.lowerCase;
import static io.sc.engine.rule.core.function.StringFunction.startsWith;
import static io.sc.engine.rule.core.function.StringFunction.trim;
import static io.sc.engine.rule.core.function.StringFunction.upperCase;
import static io.sc.platform.util.CollectionUtil.hasElements;
import static io.sc.platform.util.DateUtil.yearBetween;
import static io.sc.platform.util.DateUtil.monthBetween;
import static io.sc.platform.util.DateUtil.weeksBetween;
import static io.sc.platform.util.DateUtil.dayBetween;
import static io.sc.platform.util.DateUtil.hoursBetween;
import static io.sc.platform.util.DateUtil.minutesBetween;
import static io.sc.platform.util.DateUtil.secondsBetween;
import static io.sc.platform.util.NumberUtil.comma;
import static io.sc.platform.util.NumberUtil.decimal;
import static io.sc.platform.util.NumberUtil.money;

2
io.sc.engine.rule.core/src/main/java/io/sc/engine/rule/core/code/template/lib_render.tpl

@ -6,7 +6,7 @@ class #(className(lib.code,lib.version)) {
//通过输入参数构建指标库对象
public void convertArgument(Map<String,Object> map){
#(tabs(IndicatorGenerator.generateConvertorFromMap(lib.indicators),2))
#(tabs(IndicatorGenerator.generateConvertorFromMap(lib.indicators,"this"),2))
}
public void convertArgument(String json){

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

36
io.sc.engine.rule.frontend/src/views/shared/TestcaseParameterGrid.vue

@ -77,7 +77,18 @@
},
},
...valueTypeManager.getColumns([], false),
{ width: 100, name: 'inputValue', label: $t('re.testCaseParameter.grid.entity.inputValue'), sortable: false },
{
width: 100,
name: 'inputValue',
label: $t('re.testCaseParameter.grid.entity.inputValue'),
sortable: false,
format: (value: any, row: any) => {
return Tools.escapeHtml(value);
},
title: (args: any) => {
return args.value;
},
},
{
width: 100,
name: 'inputValueValidateMessage',
@ -93,8 +104,27 @@
return args.value;
},
},
{ width: 100, name: 'expectValue', label: $t('re.testCaseParameter.grid.entity.expectValue'), sortable: false },
{ width: 100, name: 'resultValue', label: $t('re.testCaseParameter.grid.entity.resultValue'), sortable: false },
{
width: 100,
name: 'expectValue',
label: $t('re.testCaseParameter.grid.entity.expectValue'),
sortable: false,
format: (value: any, row: any) => {
return Tools.escapeHtml(value);
},
},
{
width: 100,
name: 'resultValue',
label: $t('re.testCaseParameter.grid.entity.resultValue'),
sortable: false,
format: (value: any, row: any) => {
return Tools.escapeHtml(value);
},
title: (args: any) => {
return args.value;
},
},
{
width: 70,
name: 'skipCheck',

4
io.sc.engine.rule.frontend/src/views/shared/processors/GroovyScript.ts

@ -5,7 +5,7 @@ class GroovyScript extends Processor {
constructor(targetType: string, context?: any) {
super(targetType, context);
this.PROCESSOR_TYPE = 'GROOVY_SCRIPT';
this.EDITOR_DIALOG_WIDTH = 800;
this.EDITOR_DIALOG_WIDTH = 1024;
}
public getToolbarAction(): any {
@ -39,6 +39,8 @@ class GroovyScript extends Processor {
label: $t('re.processor.grid.entity.groovyScript'),
type: 'w-code-mirror',
rows: 20,
lineHeight: '1.3rem',
fontSize: '0.75rem',
lineNumber: true,
lang: 'java',
lineWrap: false,

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

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

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

4
io.sc.platform.core.frontend/src/platform/components/math/toolbar/Toolbar.vue

@ -84,6 +84,9 @@
<q-separator inset spaced />
<!-- 格式化函数 -->
<Formater v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></Formater>
<q-separator inset spaced />
<!-- 集合函数 -->
<Collection v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></Collection>
</q-list>
</q-menu>
</q-btn>
@ -165,6 +168,7 @@ import Log from './functions/Log.vue';
import Trigonometric from './functions/Trigonometric.vue';
import Probability from './functions/Probability.vue';
import Formater from './functions/Formater.vue';
import Collection from './functions/Collection.vue';
const modelValueRef = defineModel({ type: String, default: '' });
const zoomModelValueRef = defineModel('zoom', { type: Number, default: ZoomLevels.defaultLevel });

37
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/Collection.vue

@ -0,0 +1,37 @@
<template>
<q-item clickable>
<q-item-section>
<q-item-label>{{ $t('math.toolbar.functions.collection') }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="keyboard_arrow_right" />
</q-item-section>
<q-menu anchor="top end" self="top start">
<q-list dense>
<q-item
v-close-popup
clickable
:title="$t('math.toolbar.functions.collection.hasElements')"
draggable="true"
@dragstart="hasElementsRef?.dragstart"
@click="hasElementsRef?.append"
>
<q-item-section>
<HasElements ref="hasElementsRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></HasElements>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-item>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import HasElements from './collection/HasElements.vue';
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const hasElementsRef = ref();
</script>

4
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/Date.vue

@ -7,10 +7,11 @@
<q-icon name="keyboard_arrow_right" />
</q-item-section>
<q-menu anchor="top end" self="top start">
<q-list>
<q-list dense>
<q-item v-close-popup clickable :title="$t('math.toolbar.functions.date.now')" draggable="true" @dragstart="nowRef?.dragstart" @click="nowRef?.append">
<q-item-section><Now ref="nowRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></Now></q-item-section>
</q-item>
<Between v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></Between>
</q-list>
</q-menu>
</q-item>
@ -18,6 +19,7 @@
<script setup lang="ts">
import { ref } from 'vue';
import Now from './date/Now.vue';
import Between from './date/between/Between.vue';
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({

44
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/collection/hasElements.vue

@ -0,0 +1,44 @@
<template>
<span>
<math display="inline">
<mrow>
<mo>hasElements</mo>
<mi>(</mi>
<mi>x</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `
<mspace></mspace>
<mrow>
<mo>hasElements</mo>
<mi>(</mi>
<mi>x</mi>
<mi>)</mi>
</mrow>
<mspace></mspace>
`;
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const dragstart = (event) => {
event.dataTransfer.setData('math', xmlData);
event.dataTransfer.setDragImage(event.srcElement, 0, 0);
};
const append = () => {
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('hasElements(x)'));
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', '');
};
defineExpose({
dragstart,
append,
});
</script>

16
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/Now.vue

@ -1,11 +1,13 @@
<template>
<math display="inline">
<mrow>
<mo>now</mo>
<mi>(</mi>
<mi>)</mi>
</mrow>
</math>
<span>
<math display="inline">
<mrow>
<mo>now</mo>
<mi>(</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `

122
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/Between.vue

@ -0,0 +1,122 @@
<template>
<q-item clickable>
<q-item-section>
<q-item-label>{{ $t('math.toolbar.functions.date.between') }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="keyboard_arrow_right" />
</q-item-section>
<q-menu anchor="top end" self="top start">
<q-list dense>
<q-item
v-close-popup
clickable
:title="$t('math.toolbar.functions.date.between.years')"
draggable="true"
@dragstart="yearsBetweenRef?.dragstart"
@click="yearsBetweenRef?.append"
>
<q-item-section>
<YearsBetween ref="yearsBetweenRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></YearsBetween>
</q-item-section>
</q-item>
<q-item
v-close-popup
clickable
:title="$t('math.toolbar.functions.date.between.months')"
draggable="true"
@dragstart="monthsBetweenRef?.dragstart"
@click="monthsBetweenRef?.append"
>
<q-item-section>
<MonthsBetween ref="monthsBetweenRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></MonthsBetween>
</q-item-section>
</q-item>
<q-item
v-close-popup
clickable
:title="$t('math.toolbar.functions.date.between.weeks')"
draggable="true"
@dragstart="weeksBetweenRef?.dragstart"
@click="weeksBetweenRef?.append"
>
<q-item-section>
<WeeksBetween ref="weeksBetweenRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></WeeksBetween>
</q-item-section>
</q-item>
<q-item
v-close-popup
clickable
:title="$t('math.toolbar.functions.date.between.days')"
draggable="true"
@dragstart="daysBetweenRef?.dragstart"
@click="daysBetweenRef?.append"
>
<q-item-section>
<DaysBetween ref="daysBetweenRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></DaysBetween>
</q-item-section>
</q-item>
<q-item
v-close-popup
clickable
:title="$t('math.toolbar.functions.date.between.hours')"
draggable="true"
@dragstart="hoursBetweenRef?.dragstart"
@click="hoursBetweenRef?.append"
>
<q-item-section>
<HoursBetween ref="hoursBetweenRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></HoursBetween>
</q-item-section>
</q-item>
<q-item
v-close-popup
clickable
:title="$t('math.toolbar.functions.date.between.minutes')"
draggable="true"
@dragstart="minutesBetweenRef?.dragstart"
@click="minutesBetweenRef?.append"
>
<q-item-section>
<MinutesBetween ref="minutesBetweenRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></MinutesBetween>
</q-item-section>
</q-item>
<q-item
v-close-popup
clickable
:title="$t('math.toolbar.functions.date.between.seconds')"
draggable="true"
@dragstart="secondsBetweenRef?.dragstart"
@click="secondsBetweenRef?.append"
>
<q-item-section>
<SecondsBetween ref="secondsBetweenRef" v-model="modelValueRef" :source-code-editor="sourceCodeEditor"></SecondsBetween>
</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-item>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import YearsBetween from './YearsBetween.vue';
import MonthsBetween from './MonthsBetween.vue';
import WeeksBetween from './WeeksBetween.vue';
import DaysBetween from './DaysBetween.vue';
import HoursBetween from './HoursBetween.vue';
import MinutesBetween from './MinutesBetween.vue';
import SecondsBetween from './SecondsBetween.vue';
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const yearsBetweenRef = ref();
const monthsBetweenRef = ref();
const weeksBetweenRef = ref();
const daysBetweenRef = ref();
const hoursBetweenRef = ref();
const minutesBetweenRef = ref();
const secondsBetweenRef = ref();
</script>

52
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/DaysBetween.vue

@ -0,0 +1,52 @@
<template>
<span>
<math display="inline">
<mrow>
<mo>daysBetween</mo>
<mi>(</mi>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `
<mspace></mspace>
<mrow>
<mo>daysBetween</mo>
<mi>(</mi>
<mspace></mspace>
<mi>x</mi>
<mspace></mspace>
<mo>,</mo>
<mspace></mspace>
<mi>y</mi>
<mspace></mspace>
<mi>)</mi>
</mrow>
<mspace></mspace>
`;
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const dragstart = (event) => {
event.dataTransfer.setData('math', xmlData);
event.dataTransfer.setDragImage(event.srcElement, 0, 0);
};
const append = () => {
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('daysBetween(d1,d2)'));
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', '');
};
defineExpose({
dragstart,
append,
});
</script>

52
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/HoursBetween.vue

@ -0,0 +1,52 @@
<template>
<span>
<math display="inline">
<mrow>
<mo>hoursBetween</mo>
<mi>(</mi>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `
<mspace></mspace>
<mrow>
<mo>hoursBetween</mo>
<mi>(</mi>
<mspace></mspace>
<mi>x</mi>
<mspace></mspace>
<mo>,</mo>
<mspace></mspace>
<mi>y</mi>
<mspace></mspace>
<mi>)</mi>
</mrow>
<mspace></mspace>
`;
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const dragstart = (event) => {
event.dataTransfer.setData('math', xmlData);
event.dataTransfer.setDragImage(event.srcElement, 0, 0);
};
const append = () => {
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('hoursBetween(d1,d2)'));
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', '');
};
defineExpose({
dragstart,
append,
});
</script>

52
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/MinutesBetween.vue

@ -0,0 +1,52 @@
<template>
<span>
<math display="inline">
<mrow>
<mo>minutesBetween</mo>
<mi>(</mi>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `
<mspace></mspace>
<mrow>
<mo>minutesBetween</mo>
<mi>(</mi>
<mspace></mspace>
<mi>x</mi>
<mspace></mspace>
<mo>,</mo>
<mspace></mspace>
<mi>y</mi>
<mspace></mspace>
<mi>)</mi>
</mrow>
<mspace></mspace>
`;
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const dragstart = (event) => {
event.dataTransfer.setData('math', xmlData);
event.dataTransfer.setDragImage(event.srcElement, 0, 0);
};
const append = () => {
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('minutesBetween(d1,d2)'));
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', '');
};
defineExpose({
dragstart,
append,
});
</script>

52
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/MonthsBetween.vue

@ -0,0 +1,52 @@
<template>
<span>
<math display="inline">
<mrow>
<mo>monthsBetween</mo>
<mi>(</mi>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `
<mspace></mspace>
<mrow>
<mo>monthsBetween</mo>
<mi>(</mi>
<mspace></mspace>
<mi>x</mi>
<mspace></mspace>
<mo>,</mo>
<mspace></mspace>
<mi>y</mi>
<mspace></mspace>
<mi>)</mi>
</mrow>
<mspace></mspace>
`;
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const dragstart = (event) => {
event.dataTransfer.setData('math', xmlData);
event.dataTransfer.setDragImage(event.srcElement, 0, 0);
};
const append = () => {
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('monthsBetween(d1,d2)'));
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', '');
};
defineExpose({
dragstart,
append,
});
</script>

52
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/SecondsBetween.vue

@ -0,0 +1,52 @@
<template>
<span>
<math display="inline">
<mrow>
<mo>secondsBetween</mo>
<mi>(</mi>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `
<mspace></mspace>
<mrow>
<mo>secondsBetween</mo>
<mi>(</mi>
<mspace></mspace>
<mi>x</mi>
<mspace></mspace>
<mo>,</mo>
<mspace></mspace>
<mi>y</mi>
<mspace></mspace>
<mi>)</mi>
</mrow>
<mspace></mspace>
`;
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const dragstart = (event) => {
event.dataTransfer.setData('math', xmlData);
event.dataTransfer.setDragImage(event.srcElement, 0, 0);
};
const append = () => {
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('secondsBetween(d1,d2)'));
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', '');
};
defineExpose({
dragstart,
append,
});
</script>

52
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/WeeksBetween.vue

@ -0,0 +1,52 @@
<template>
<span>
<math display="inline">
<mrow>
<mo>weeksBetween</mo>
<mi>(</mi>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `
<mspace></mspace>
<mrow>
<mo>weeksBetween</mo>
<mi>(</mi>
<mspace></mspace>
<mi>x</mi>
<mspace></mspace>
<mo>,</mo>
<mspace></mspace>
<mi>y</mi>
<mspace></mspace>
<mi>)</mi>
</mrow>
<mspace></mspace>
`;
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const dragstart = (event) => {
event.dataTransfer.setData('math', xmlData);
event.dataTransfer.setDragImage(event.srcElement, 0, 0);
};
const append = () => {
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('weeksBetween(d1,d2)'));
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', '');
};
defineExpose({
dragstart,
append,
});
</script>

52
io.sc.platform.core.frontend/src/platform/components/math/toolbar/functions/date/between/YearsBetween.vue

@ -0,0 +1,52 @@
<template>
<span>
<math display="inline">
<mrow>
<mo>yearBetween</mo>
<mi>(</mi>
<mi>x</mi>
<mo>,</mo>
<mi>y</mi>
<mi>)</mi>
</mrow>
</math>
</span>
</template>
<script setup lang="ts">
const xmlData = `
<mspace></mspace>
<mrow>
<mo>yearBetween</mo>
<mi>(</mi>
<mspace></mspace>
<mi>x</mi>
<mspace></mspace>
<mo>,</mo>
<mspace></mspace>
<mi>y</mi>
<mspace></mspace>
<mi>)</mi>
</mrow>
<mspace></mspace>
`;
const modelValueRef = defineModel({ type: String, default: '' });
const props = defineProps({
sourceCodeEditor: { type: Object, default: undefined },
});
const dragstart = (event) => {
event.dataTransfer.setData('math', xmlData);
event.dataTransfer.setDragImage(event.srcElement, 0, 0);
};
const append = () => {
props.sourceCodeEditor?.dispatch(props.sourceCodeEditor?.state?.replaceSelection('yearBetween(d1,d2)'));
modelValueRef.value = modelValueRef.value + xmlData.replace('<mspace></mspace>', '');
};
defineExpose({
dragstart,
append,
});
</script>

12
io.sc.platform.core.frontend/src/platform/i18n/messages.json

@ -223,6 +223,14 @@
"math.toolbar.functions.string.endsWith": "x end with y",
"math.toolbar.functions.date": "Date",
"math.toolbar.functions.date.now": "Now",
"math.toolbar.functions.date.between": "Between",
"math.toolbar.functions.date.between.years": "Years",
"math.toolbar.functions.date.between.months": "Months",
"math.toolbar.functions.date.between.weeks": "Weeks",
"math.toolbar.functions.date.between.days": "Days",
"math.toolbar.functions.date.between.hours": "Hours",
"math.toolbar.functions.date.between.minutes": "Minutes",
"math.toolbar.functions.date.between.seconds": "Seconds",
"math.toolbar.functions.date.log": "Logarithm",
"math.toolbar.functions.date.log.lg": "base 10 logarithm of x",
"math.toolbar.functions.date.log.ln": "base e logarithm of x",
@ -264,7 +272,9 @@
"math.toolbar.functions.formater": "Formater",
"math.toolbar.functions.formater.precision": "Leave the y digits after the x decimal point",
"math.toolbar.functions.formater.comma": "Thousandth place, leave the y digits after the x decimal point",
"math.toolbar.functions.formater.percent": "percentage, leave the y digits after the x decimal point",
"math.toolbar.functions.formater.percent": "Percentage, leave the y digits after the x decimal point",
"math.toolbar.functions.collection": "Collection",
"math.toolbar.functions.collection.hasElements": "Has Elements",
"math.toolbar.userDefinedFunction": "User Defined Function",

10
io.sc.platform.core.frontend/src/platform/i18n/messages_tw_CN.json

@ -223,6 +223,14 @@
"math.toolbar.functions.string.endsWith": "x 是否以 y 結尾",
"math.toolbar.functions.date": "日期函數",
"math.toolbar.functions.date.now": "當前日期",
"math.toolbar.functions.date.between": "日期間隔",
"math.toolbar.functions.date.between.years": "間隔年數",
"math.toolbar.functions.date.between.months": "間隔月數",
"math.toolbar.functions.date.between.weeks": "間隔周數",
"math.toolbar.functions.date.between.days": "間隔天數",
"math.toolbar.functions.date.between.hours": "間隔小時數",
"math.toolbar.functions.date.between.minutes": "間隔分鐘數",
"math.toolbar.functions.date.between.seconds": "間隔秒數",
"math.toolbar.functions.log": "對數",
"math.toolbar.functions.log.lg": "以 10 為底的對數",
"math.toolbar.functions.log.ln": "以自然對數 e 為底的對數",
@ -265,6 +273,8 @@
"math.toolbar.functions.formater.precision": "保留 x 小數點後 y 位",
"math.toolbar.functions.formater.comma": "千分位, 保留 x 小數點後 y 位",
"math.toolbar.functions.formater.percent": "百分數, 保留 x 小數點後 y 位",
"math.toolbar.functions.collection": "集合函數",
"math.toolbar.functions.collection.hasElements": "是否有元素",
"math.toolbar.userDefinedFunction": "自定義函數",

10
io.sc.platform.core.frontend/src/platform/i18n/messages_zh_CN.json

@ -223,6 +223,14 @@
"math.toolbar.functions.string.endsWith": "x 是否以 y 结尾",
"math.toolbar.functions.date": "日期函数",
"math.toolbar.functions.date.now": "当前日期",
"math.toolbar.functions.date.between": "日期间隔",
"math.toolbar.functions.date.between.years": "间隔年数",
"math.toolbar.functions.date.between.months": "间隔月数",
"math.toolbar.functions.date.between.weeks": "间隔周数",
"math.toolbar.functions.date.between.days": "间隔天数",
"math.toolbar.functions.date.between.hours": "间隔小时数",
"math.toolbar.functions.date.between.minutes": "间隔分钟数",
"math.toolbar.functions.date.between.seconds": "间隔秒数",
"math.toolbar.functions.log": "对数函数",
"math.toolbar.functions.log.lg": "以 10 为底的对数",
"math.toolbar.functions.log.ln": "以自然对数 e 为底的对数",
@ -265,6 +273,8 @@
"math.toolbar.functions.formater.precision": "保留 x 小数点后 y 位",
"math.toolbar.functions.formater.comma": "千分位, 保留 x 小数点后 y 位",
"math.toolbar.functions.formater.percent": "百分数, 保留 x 小数点后 y 位",
"math.toolbar.functions.collection": "集合函数",
"math.toolbar.functions.collection.hasElements": "是否有元素",
"math.toolbar.userDefinedFunction": "自定义函数",

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

@ -1,6 +1,6 @@
{
"name": "platform-core",
"version": "8.2.15",
"version": "8.2.17",
"description": "前端核心包,用于快速构建前端的脚手架",
"private": false,
"keywords": [],
@ -110,7 +110,7 @@
"mockjs": "1.1.0",
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

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

@ -28,7 +28,7 @@
"vuepress": "2.0.0-rc.15"
},
"dependencies": {
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"vue": "3.5.13",
"vue-i18n": "10.0.4"

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

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

@ -110,7 +110,7 @@
"mockjs": "1.1.0",
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

221
io.sc.platform.util/src/main/java/io/sc/platform/util/DateUtil.java

@ -8,6 +8,7 @@ import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
@ -311,11 +312,231 @@ public class DateUtil {
return new java.sql.Date(date.getTime());
}
/**
* Date 对象转换成 LocalDateTime 对象
* @param date 被转换的对象
* @return LocalDateTime 转换后的对象
*/
public static LocalDateTime toLocalDateTime(Date date){
return LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()),ZoneId.systemDefault());
}
/**
* LocalDateTime 对象转换成 Date 对象
* @param localDateTime 被转换的对象
* @return Date 转换后的对象
*/
public static Date fromLocalDateTime(LocalDateTime localDateTime){
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}
/**
* 计算两个日期相差的年数
* @param d1 日期1
* @param d2 日期2
* @return 两个日期相差的年数
*/
public static long yearBetween(Date d1,Date d2){
LocalDateTime ld1 =toLocalDateTime(d1);
LocalDateTime ld2 =toLocalDateTime(d2);
return ChronoUnit.YEARS.between(ld2,ld1);
}
/**
* 计算两个日期相差的年数
* @param d1Str 日期字符串1
* @param d2Str 日期字符串2
* @return 两个日期相差的年数
*/
public static long yearBetween(String d1Str,String d2Str){
try {
Date d1 = tryParseDate(d1Str);
Date d2 = tryParseDate(d2Str);
LocalDateTime ld1 = toLocalDateTime(d1);
LocalDateTime ld2 = toLocalDateTime(d2);
return ChronoUnit.YEARS.between(ld2, ld1);
}catch (Exception e){
throw new RuntimeException(e);
}
}
/**
* 计算两个日期相差的月数
* @param d1 日期1
* @param d2 日期2
* @return 两个日期相差的月数
*/
public static long monthBetween(Date d1,Date d2){
LocalDateTime ld1 =toLocalDateTime(d1);
LocalDateTime ld2 =toLocalDateTime(d2);
return ChronoUnit.MONTHS.between(ld2,ld1);
}
/**
* 计算两个日期相差的月数
* @param d1Str 日期字符串1
* @param d2Str 日期字符串2
* @return 两个日期相差的月数
*/
public static long monthBetween(String d1Str,String d2Str){
try {
Date d1 = tryParseDate(d1Str);
Date d2 = tryParseDate(d2Str);
LocalDateTime ld1 = toLocalDateTime(d1);
LocalDateTime ld2 = toLocalDateTime(d2);
return ChronoUnit.MONTHS.between(ld2, ld1);
}catch (Exception e){
throw new RuntimeException(e);
}
}
/**
* 计算两个日期相差的周数
* @param d1 日期1
* @param d2 日期2
* @return 两个日期相差的周数
*/
public static long weeksBetween(Date d1,Date d2){
LocalDateTime ld1 =toLocalDateTime(d1);
LocalDateTime ld2 =toLocalDateTime(d2);
return ChronoUnit.WEEKS.between(ld2,ld1);
}
/**
* 计算两个日期相差的周数
* @param d1Str 日期字符串1
* @param d2Str 日期字符串2
* @return 两个日期相差的周数
*/
public static long weeksBetween(String d1Str,String d2Str){
try {
Date d1 = tryParseDate(d1Str);
Date d2 = tryParseDate(d2Str);
LocalDateTime ld1 = toLocalDateTime(d1);
LocalDateTime ld2 = toLocalDateTime(d2);
return ChronoUnit.SECONDS.between(ld2, ld1);
}catch (Exception e){
throw new RuntimeException(e);
}
}
/**
* 计算两个日期相差的天数
* @param d1 日期1
* @param d2 日期2
* @return 两个日期相差的天数
*/
public static long dayBetween(Date d1,Date d2){
LocalDateTime ld1 =toLocalDateTime(d1);
LocalDateTime ld2 =toLocalDateTime(d2);
return ChronoUnit.DAYS.between(ld2,ld1);
}
/**
* 计算两个日期相差的天数
* @param d1Str 日期字符串1
* @param d2Str 日期字符串2
* @return 两个日期相差的天数
*/
public static long dayBetween(String d1Str,String d2Str){
try {
Date d1 = tryParseDate(d1Str);
Date d2 = tryParseDate(d2Str);
LocalDateTime ld1 = toLocalDateTime(d1);
LocalDateTime ld2 = toLocalDateTime(d2);
return ChronoUnit.DAYS.between(ld2, ld1);
}catch (Exception e){
throw new RuntimeException(e);
}
}
/**
* 计算两个日期相差的小时数
* @param d1 日期1
* @param d2 日期2
* @return 两个日期相差的小时数
*/
public static long hoursBetween(Date d1,Date d2){
LocalDateTime ld1 =toLocalDateTime(d1);
LocalDateTime ld2 =toLocalDateTime(d2);
return ChronoUnit.HOURS.between(ld2,ld1);
}
/**
* 计算两个日期相差的小时数
* @param d1Str 日期字符串1
* @param d2Str 日期字符串2
* @return 两个日期相差的小时数
*/
public static long hoursBetween(String d1Str,String d2Str){
try {
Date d1 = tryParseDate(d1Str);
Date d2 = tryParseDate(d2Str);
LocalDateTime ld1 = toLocalDateTime(d1);
LocalDateTime ld2 = toLocalDateTime(d2);
return ChronoUnit.HOURS.between(ld2, ld1);
}catch (Exception e){
throw new RuntimeException(e);
}
}
/**
* 计算两个日期相差的分钟数
* @param d1 日期1
* @param d2 日期2
* @return 两个日期相差的分钟数
*/
public static long minutesBetween(Date d1,Date d2){
LocalDateTime ld1 =toLocalDateTime(d1);
LocalDateTime ld2 =toLocalDateTime(d2);
return ChronoUnit.MINUTES.between(ld2,ld1);
}
/**
* 计算两个日期相差的分钟数
* @param d1Str 日期字符串1
* @param d2Str 日期字符串2
* @return 两个日期相差的分钟数
*/
public static long minutesBetween(String d1Str,String d2Str){
try {
Date d1 = tryParseDate(d1Str);
Date d2 = tryParseDate(d2Str);
LocalDateTime ld1 = toLocalDateTime(d1);
LocalDateTime ld2 = toLocalDateTime(d2);
return ChronoUnit.HOURS.between(ld2, ld1);
}catch (Exception e){
throw new RuntimeException(e);
}
}
/**
* 计算两个日期相差的秒数
* @param d1 日期1
* @param d2 日期2
* @return 两个日期相差的秒数
*/
public static long secondsBetween(Date d1,Date d2){
LocalDateTime ld1 =toLocalDateTime(d1);
LocalDateTime ld2 =toLocalDateTime(d2);
return ChronoUnit.SECONDS.between(ld2,ld1);
}
/**
* 计算两个日期相差的秒数
* @param d1Str 日期字符串1
* @param d2Str 日期字符串2
* @return 两个日期相差的秒数
*/
public static long secondsBetween(String d1Str,String d2Str){
try {
Date d1 = tryParseDate(d1Str);
Date d2 = tryParseDate(d2Str);
LocalDateTime ld1 = toLocalDateTime(d1);
LocalDateTime ld2 = toLocalDateTime(d2);
return ChronoUnit.SECONDS.between(ld2, ld1);
}catch (Exception e){
throw new RuntimeException(e);
}
}
}

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

@ -111,7 +111,7 @@
"node-sql-parser": "5.3.4",
"pinia": "2.2.6",
"pinia-undo": "0.2.4",
"platform-core": "8.2.15",
"platform-core": "8.2.17",
"quasar": "2.17.4",
"sort-array": "5.0.0",
"svg-path-commander": "2.1.5",

2
io.sc.website/package.json

@ -28,6 +28,6 @@
},
"dependencies": {
"vue": "3.5.13",
"platform-core": "8.2.15"
"platform-core": "8.2.17"
}
}
Loading…
Cancel
Save