Browse Source

update

main
wangshaoping 10 months ago
parent
commit
d90d7150df
  1. 60
      io.sc.engine.st.frontend/src/routes/routes.json
  2. 167
      io.sc.engine.st.frontend/src/views/Scenario.vue
  3. 74
      io.sc.engine.st.frontend/src/views/Scenario/PercentileDialog.vue
  4. 224
      io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactor.vue
  5. 220
      io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactorDefine.vue
  6. 211
      io.sc.engine.st.frontend/src/views/Target.vue
  7. 211
      io.sc.engine.st.frontend/src/views/TestCase.vue
  8. 103
      io.sc.engine.st.frontend/src/views/TestCase/TestCase.vue
  9. 15
      io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetIndicatorWebController.java
  10. 15
      io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetWebController.java
  11. 7
      io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TestCaseWebController.java
  12. 11
      io.sc.engine.st/src/main/java/io/sc/engine/st/enums/PeriodType.java
  13. 10
      io.sc.engine.st/src/main/java/io/sc/engine/st/enums/StatisticalPeriodType.java
  14. 118
      io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/FactorEntity.java
  15. 82
      io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetEntity.java
  16. 135
      io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetIndicatorEntity.java
  17. 63
      io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TestCaseEntity.java
  18. 10
      io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetIndicatorRepository.java
  19. 10
      io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetRepository.java
  20. 8
      io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetIndicatorService.java
  21. 8
      io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetService.java
  22. 2
      io.sc.engine.st/src/main/java/io/sc/engine/st/service/TestCaseService.java
  23. 12
      io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetIndicatorServiceImpl.java
  24. 12
      io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetServiceImpl.java
  25. 116
      io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TestCaseServiceImpl.java
  26. 88
      io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetIndicatorVo.java
  27. 43
      io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetVo.java
  28. 44
      io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TestCaseVo.java
  29. 1
      io.sc.engine.st/src/main/resources/META-INF/platform/plugins/repositories.json
  30. 18
      io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_economic_indicator.csv
  31. 8
      io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_target.csv
  32. 16
      io.sc.platform.core.frontend/src/routes/routes.json
  33. 4
      io.sc.platform.core.frontend/template-project/package.json
  34. 18
      io.sc.platform.core.frontend/template-project/src/routes/routes.json
  35. 2
      io.sc.platform.core/src/main/java/io/sc/platform/core/response/ResponseWrapper.java
  36. 8
      io.sc.platform.core/src/main/java/io/sc/platform/core/service/SpringExpressionParserService.java
  37. 37
      io.sc.platform.core/src/main/java/io/sc/platform/core/service/impl/SpringExpressionParserServiceImpl.java
  38. 26
      io.sc.platform.developer.doc/asciidoc/platform-extension/platform-extension.adoc
  39. 1
      settings.gradle

60
io.sc.engine.st.frontend/src/routes/routes.json

@ -1,46 +1,76 @@
[ [
{ {
"name": "route.engine.st.factorManager", "name": "route.engine.st.indepFactorManager",
"path": "st/factorManager", "path": "st/indepFactorManager",
"parent": "/", "parent": "/",
"priority": 0, "priority": 0,
"module": "io.sc.engine.st.frontend", "module": "io.sc.engine.st.frontend",
"component": "component.engine.st.factorManager", "component": "component.engine.st.indepFactorManager",
"componentPath": "@/views/FactorManager.vue", "componentPath": "@/views/IndepFactor/Manager.vue",
"redirect": null, "redirect": null,
"meta": { "meta": {
"permissions": [ "permissions": [
"/st/factorManager/**/*" "/st/indepFactorManager/**/*"
] ]
} }
}, },
{ {
"name": "route.engine.st.target", "name": "route.engine.st.depFactorManager",
"path": "st/target", "path": "st/depFactorManager",
"parent": "/", "parent": "/",
"priority": 0, "priority": 0,
"module": "io.sc.engine.st.frontend", "module": "io.sc.engine.st.frontend",
"component": "component.engine.st.target", "component": "component.engine.st.depFactorManager",
"componentPath": "@/views/Target.vue", "componentPath": "@/views/DepFactor/Manager.vue",
"redirect": null, "redirect": null,
"meta": { "meta": {
"permissions": [ "permissions": [
"/st/target/**/*" "/st/depFactorManager/**/*"
] ]
} }
}, },
{ {
"name": "route.engine.st.ead", "name": "route.engine.st.modelManager",
"path": "st/ead", "path": "st/modelManager",
"parent": "/", "parent": "/",
"priority": 0, "priority": 0,
"module": "io.sc.engine.st.frontend", "module": "io.sc.engine.st.frontend",
"component": "component.engine.st.ead", "component": "component.engine.st.modelManager",
"componentPath": "@/views/EAD.vue", "componentPath": "@/views/Model/Manager.vue",
"redirect": null, "redirect": null,
"meta": { "meta": {
"permissions": [ "permissions": [
"/st/ead/**/*" "/st/modelManager/**/*"
]
}
},
{
"name": "route.engine.st.scenarioFactorManager",
"path": "st/scenarioFactorManager",
"parent": "/",
"priority": 0,
"module": "io.sc.engine.st.frontend",
"component": "component.engine.st.scenarioFactorManager",
"componentPath": "@/views/Scenario/Manager.vue",
"redirect": null,
"meta": {
"permissions": [
"/st/scenarioFactorManager/**/*"
]
}
},
{
"name": "route.engine.st.testCaseManager",
"path": "st/testCaseManager",
"parent": "/",
"priority": 0,
"module": "io.sc.engine.st.frontend",
"component": "component.engine.st.testCaseManager",
"componentPath": "@/views/TestCase/Manager.vue",
"redirect": null,
"meta": {
"permissions": [
"/st/testCaseManager/**/*"
] ]
} }
} }

167
io.sc.engine.st.frontend/src/views/Scenario.vue

@ -1,167 +0,0 @@
<template>
<w-dialog ref="dialogRef" :title="$t('engine.st.scenario.dialog.title')" width="800px" :can-maximize="false">
<div class="px-2" style="height: 100%">
<w-grid
ref="gridRef"
:height="200"
:title="$t('engine.st.scenario.grid.title')"
dense
selection="multiple"
:pageable="false"
:full-screen-button="false"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="['query', 'separator', 'refresh', 'separator', 'add', 'edit', 'remove', 'separator']"
:query-form-fields="[]"
:auto-fetch-data="false"
:fetch-data-url="dataUrl + '?' + foreignKey + '=' + foreignValue"
:data-url="dataUrl"
:columns="[
{ width: 100, name: 'indicator', label: $t('engine.st.scenario.grid.entity.indicator') },
{ width: 100, name: 'lowGrade', label: $t('engine.st.scenario.grid.entity.lowGrade') },
{ width: 100, name: 'midGrade', label: $t('engine.st.scenario.grid.entity.midGrade') },
{ width: 100, name: 'highGrade', label: $t('engine.st.scenario.grid.entity.highGrade') },
]"
:editor="{
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'testCase',
label: $t('engine.st.scenario.grid.entity.testCase'),
type: 'text',
defaultValue: foreignValue,
},
{
name: 'indicator',
label: $t('engine.st.scenario.grid.entity.indicator'),
type: 'select',
options: indicatorOptionsRef,
},
{ width: 100, name: 'lowGrade', label: $t('engine.st.scenario.grid.entity.lowGrade'), type: 'number', precision: 6 },
{ width: 100, name: 'midGrade', label: $t('engine.st.scenario.grid.entity.midGrade'), type: 'number', precision: 6 },
{ width: 100, name: 'highGrade', label: $t('engine.st.scenario.grid.entity.highGrade'), type: 'number', precision: 6 },
],
},
}"
></w-grid>
<div id="echart" style="width: 100%; height: 300px"></div>
</div>
</w-dialog>
</template>
<script setup lang="ts">
import { ref, nextTick } from 'vue';
import { useI18n } from 'vue-i18n';
import * as echarts from 'echarts';
import { axios, Environment, Tools } from 'platform-core';
const { t } = useI18n();
const props = defineProps({
opener: { type: Object, default: undefined },
dataUrl: { type: String, default: '' },
foreignKey: { type: String, default: '' },
foreignValue: { type: String, default: '' },
});
const dialogRef = ref();
const foreignKeyRef = ref('');
const gridRef = ref();
let echart;
const indicatorOptionsRef = ref([
{ label: t('engine.st.economicIndicator.grid.entity.GDP'), value: 'GDP' },
{ label: t('engine.st.economicIndicator.grid.entity.M2'), value: 'M2' },
{ label: t('engine.st.economicIndicator.grid.entity.CPI'), value: 'CPI' },
{ label: t('engine.st.economicIndicator.grid.entity.HPI'), value: 'HPI' },
{ label: t('engine.st.economicIndicator.grid.entity.PMI'), value: 'PMI' },
{ label: t('engine.st.economicIndicator.grid.entity.BLR'), value: 'BLR' },
]);
const open = (foreignKey: string) => {
foreignKeyRef.value = foreignKey;
dialogRef.value.show();
nextTick(() => {
gridRef.value.refresh();
if (!echart) {
echart = echarts.init(document.getElementById('echart'), null, { width: 800, height: 300 });
} else {
echart.dispose();
echart = echarts.init(document.getElementById('echart'), null, { width: 800, height: 300 });
}
echart?.setOption({
animation: false,
title: {
text: 'KS 曲线',
left: 'center',
},
grid: {
show: true,
containLabel: true,
},
legend: {
top: 30,
data: ['正常样本占比', '违约样本占比'],
},
tooltip: {},
xAxis: {
gridIndex: 0,
name: '评分',
nameLocation: 'middle',
nameGap: 30,
smooth: true,
boundaryGap: false,
axisTick: {
interval: 0,
},
data: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100],
},
yAxis: {
gridIndex: 0,
name: '样本占比',
nameLocation: 'middle',
nameGap: 30,
smooth: false,
boundaryGap: false,
axisTick: {
interval: 0,
},
data: null,
},
series: [
{
name: '正常样本占比',
type: 'line',
barWidth: 0,
data: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.15, 0.28, 0.36, 0.43, 0.49, 0.57, 0.66, 0.77, 0.91, 1.0],
},
{
name: '违约样本占比',
type: 'line',
barWidth: 0,
data: [
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.037037, 0.08642, 0.609053, 0.662551, 0.707819, 0.720165, 0.769547, 0.814815, 0.855967, 0.897119,
0.962963, 1.0,
],
},
],
});
echart?.resize();
});
};
const close = () => {
dialogRef.value.hide();
if (echart) {
echart.dispose();
}
};
defineExpose({
open,
close,
});
</script>

74
io.sc.engine.st.frontend/src/views/Scenario/PercentileDialog.vue

@ -0,0 +1,74 @@
<template>
<w-dialog
ref="dialogRef"
:title="$t('engine.st.scenario.percentileDialog.title')"
width="400px"
:can-maximize="false"
:buttons="[
{
label: $t('confirm'),
click: () => {
emit('afterSetting', formRef.getData());
},
},
]"
>
<w-form
ref="formRef"
:cols-num="1"
:fields="[
{
name: 'precision',
label: $t('engine.st.scenario.percentileDialog.entity.precision'),
type: 'select',
options: [0, 1, 2, 3, 4, 5, 6],
defaultValue: 2,
},
{
name: 'low',
label: $t('engine.st.scenario.percentileDialog.entity.low'),
type: 'select',
options: [0.01, 0.05, 0.1, 0.9, 0.95, 0.99],
defaultValue: 0.1,
},
{
name: 'mid',
label: $t('engine.st.scenario.percentileDialog.entity.mid'),
type: 'select',
options: [0.01, 0.05, 0.1, 0.9, 0.95, 0.99],
defaultValue: 0.05,
},
{
name: 'high',
label: $t('engine.st.scenario.percentileDialog.entity.high'),
type: 'select',
options: [0.01, 0.05, 0.1, 0.9, 0.95, 0.99],
defaultValue: 0.01,
},
]"
></w-form>
</w-dialog>
</template>
<script setup lang="ts">
import { ref } from 'vue';
const emit = defineEmits<{
(e: 'afterSetting', settings: object, dialogComponent: any): void;
}>();
const dialogRef = ref();
const formRef = ref();
const open = () => {
dialogRef.value.show();
};
const close = () => {
dialogRef.value.hide();
};
defineExpose({
open,
close,
});
</script>

224
io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactor.vue

@ -0,0 +1,224 @@
<template>
<div style="height: 100%">
<w-grid
ref="gridRef"
:title="$t('data')"
dense
:checkbox-selection="true"
:fetch-data-url="Environment.apiContextPath('/api/st/scenarioFactor?defineId=' + factorDefine.id)"
:data-url="Environment.apiContextPath('/api/st/scenarioFactor')"
:pageable="false"
:sort-by="['year', 'quarter', 'month', 'day']"
:query-form-cols-num="4"
:query-form-fields="[]"
:toolbar-actions="[
'refresh',
'separator',
{
extend: 'add',
enableIf: () => {
return factorDefine.type === 'ORIGINAL';
},
},
{
name: 'fillWithPercentile',
label: $t('engine.st.scenario.scenarioFactor.grid.toolbar.fillWithPercentile'),
icon: 'bi-brush',
enableIf: (arg) => {
return arg.selected;
},
click: (arg) => {
if (arg.selected) {
dialogRef.open();
}
},
},
{
extend: 'clone',
enableIf: () => {
return factorDefine.type === 'ORIGINAL';
},
},
{
extend: 'edit',
enableIf: () => {
return factorDefine.type === 'ORIGINAL';
},
},
{
extend: 'remove',
enableIf: () => {
return factorDefine.type === 'ORIGINAL';
},
},
'separator',
'view',
'separator',
'export',
]"
:columns="[
{ width: 60, name: 'year', label: t('year'), align: 'right' },
{ width: 60, name: 'quarter', label: t('quarter'), align: 'right' },
{ width: 60, name: 'month', label: t('month'), align: 'right' },
{ width: 100, name: 'valueLow', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueLow') },
{ width: 100, name: 'valueMid', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueMid') },
{ width: 100, name: 'valueHigh', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueHigh') },
]"
:editor="{
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'define',
label: $t('define'),
type: 'text',
defaultValue: factorDefine.id,
hidden: true,
},
{ name: 'year', label: $t('year'), type: 'number', required: true },
{
name: 'quarter',
label: $t('quarter'),
type: 'number',
required: true,
showIf: () => {
return factorDefine.period === 'QUARTER';
},
},
{
name: 'month',
label: $t('month'),
type: 'number',
required: true,
showIf: () => {
return factorDefine.period === 'MONTH';
},
},
{
name: 'day',
label: $t('day'),
type: 'number',
required: true,
showIf: () => {
return factorDefine.period === 'DAY';
},
},
{ name: 'valueLow', label: $t('engine.st.scenario.scenarioFactor.grid.entity.valueLow'), type: 'text', required: true },
{ name: 'valueMid', label: $t('engine.st.scenario.scenarioFactor.grid.entity.valueMid'), type: 'text', required: true },
{ name: 'valueHigh', label: $t('engine.st.scenario.scenarioFactor.grid.entity.valueHigh'), type: 'text', required: true },
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'define', label: $t('engine.st.indepFactorDefine.grid.entity.factorDefine') },
{ name: 'year', label: $t('year') },
{ name: 'quarter', label: $t('quarter') },
{ name: 'month', label: $t('month') },
{ name: 'value', label: $t('value') },
{ name: 'dataComeFrom', label: $t('dataComeFrom') },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
{ name: 'corporationCode', label: $t('corporationCode') },
],
},
}"
@after-request-data="
() => {
const rows = gridRef.getRows();
const xAxisData = [];
const seriesData = [];
for (const row of rows) {
xAxisData.push(row.year + (row.month ? '-' + row.month : ''));
seriesData.push(row.valueLow);
}
echartsOptionRef = {
title: {
text: factorDefine.name,
left: 'center',
},
xAxis: {
type: 'category',
name: $t('period'),
data: xAxisData,
},
yAxis: {
type: 'value',
name: $t('value'),
},
series: [
{
data: seriesData,
type: 'line',
smooth: true,
},
],
};
}
"
></w-grid>
<PercentileDialog ref="dialogRef" @after-setting="fillWithPercentile"></PercentileDialog>
</div>
</template>
<script setup lang="ts">
import { ref, computed, onUpdated } from 'vue';
import { useI18n } from 'vue-i18n';
import { axios, Environment, Formater } from 'platform-core';
import PercentileDialog from './PercentileDialog.vue';
const props = defineProps({
factorDefine: {
type: Object,
default: () => {
return {};
},
},
});
const { t } = useI18n();
const gridRef = ref();
const echartsOptionRef = ref();
const dialogRef = ref();
const getFactorColumns = computed(() => {
let result = [{ width: 60, name: 'year', label: t('year'), align: 'right' }];
if (props.factorDefine.period === 'QUARTER') {
result.push({ width: 60, name: 'quarter', label: t('quarter'), align: 'right' });
} else if (props.factorDefine.period === 'MONTH') {
result.push({ width: 60, name: 'month', label: t('month'), align: 'right' });
}
result.push({ width: 100, name: 'valueLow', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueLow') });
result.push({ width: 100, name: 'valueMid', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueMid') });
result.push({ width: 100, name: 'valueHigh', label: t('engine.st.scenario.scenarioFactor.grid.entity.valueHigh') });
return result;
});
const fillWithPercentile = (settings) => {
axios
.post(Environment.apiContextPath('/api/st/scenarioFactor/fillWithPercentile?scenarioFactorId=' + gridRef.value.getSelectedRow().id), settings)
.then(() => {
refresh();
dialogRef.value.close();
});
};
const refresh = () => {
gridRef.value.refresh();
};
onUpdated(() => {
gridRef.value.refresh();
});
defineExpose({
refresh,
});
</script>

220
io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactorDefine.vue

@ -0,0 +1,220 @@
<template>
<w-grid
ref="treeGridRef"
:title="$t('engine.st.indepFactorDefine.grid.title')"
dense
:checkbox-selection="false"
:tree="true"
:tree-icon="
(row) => {
if (row.type === 'FOLDER') {
return { name: 'folder', color: 'amber' };
} else if (row.type === 'ORIGINAL') {
return { name: 'bi-file-earmark-text' };
} else if (row.type === 'EXTEND_ARITHMETIC') {
return { name: 'bi-file-earmark-text', color: 'green' };
} else if (row.type === 'EXTEND_DELAY') {
return { name: 'bi-file-earmark-text', color: 'blue' };
} else if (row.type === 'EXTEND_DIFFERENTIAL') {
return { name: 'bi-file-earmark-text', color: 'amber' };
} else {
return { name: 'bi-file-earmark-text' };
}
}
"
:data-url="Environment.apiContextPath('/api/st/scenarioFactorDefine')"
:pageable="false"
:sort-by="['order']"
:toolbar-actions="[
'refresh',
'separator',
'expand',
'separator',
{
name: 'synchronize',
label: $t('synchronize'),
icon: 'bi-repeat',
click: () => {},
},
'separator',
'view',
'separator',
'export',
]"
:columns="[
{ width: 160, name: 'name', label: $t('name') },
{ width: 150, name: 'code', label: $t('code') },
{
width: 100,
name: 'type',
label: $t('type'),
format: (value, row) => {
if (value === 'FOLDER') {
return '';
}
return Formater.enum(Enums.FactorDefineType)(value);
},
},
{ width: 60, name: 'period', label: $t('period'), format: Formater.enum(Enums.Period) },
{ width: 70, name: 'valueType', label: $t('valueType'), format: Formater.enum(Enums.ValueType) },
]"
:editor="{
dialog: {
width: '500px',
},
form: {
colsNum: 1,
fields: [
{
name: 'type',
label: $t('type'),
type: 'select',
required: true,
options: Options.enum(Enums.FactorDefineType),
onChange: (arg) => {
findAllWithoutById(arg.form.getFieldValue('id'));
},
},
{
name: 'code',
label: $t('code'),
type: 'text',
required: true,
showIf: (arg) => {
return arg.form.getFieldValue('type') !== 'FOLDER';
},
},
{ name: 'name', label: $t('name'), type: 'text', required: true },
{ name: 'description', label: $t('description'), type: 'text' },
{ name: 'order', label: $t('order'), type: 'number' },
{
name: 'period',
label: $t('period'),
required: true,
type: 'select',
options: Options.enum(Enums.Period),
showIf: (arg) => {
return arg.form.getFieldValue('type') !== 'FOLDER';
},
},
{
name: 'valueType',
label: $t('valueType'),
required: true,
type: 'select',
options: Options.enum(Enums.ValueType),
showIf: (arg) => {
return arg.form.getFieldValue('type') !== 'FOLDER';
},
},
{
name: 'formula',
label: $t('engine.st.indepFactorDefine.grid.entity.formula'),
type: 'code-mirror',
required: true,
showIf: (arg) => {
return arg.form.getFieldValue('type') === 'EXTEND_ARITHMETIC';
},
},
{
name: 'delayFactorDefine',
label: $t('engine.st.indepFactorDefine.grid.entity.delayFactorDefine'),
type: 'select',
options: factorDefineOptionsRef,
required: true,
showIf: (arg) => {
return arg.form.getFieldValue('type') === 'EXTEND_DELAY';
},
},
{
name: 'delayIssue',
label: $t('engine.st.indepFactorDefine.grid.entity.delayIssue'),
type: 'number',
required: true,
showIf: (arg) => {
return arg.form.getFieldValue('type') === 'EXTEND_DELAY';
},
},
{
name: 'differentialFactorDefine',
label: $t('engine.st.indepFactorDefine.grid.entity.differentialFactorDefine'),
type: 'select',
options: factorDefineOptionsRef,
required: true,
showIf: (arg) => {
return arg.form.getFieldValue('type') === 'EXTEND_DIFFERENTIAL';
},
},
{
name: 'differentialDegree',
label: $t('engine.st.indepFactorDefine.grid.entity.differentialDegree'),
type: 'number',
required: true,
showIf: (arg) => {
return arg.form.getFieldValue('type') === 'EXTEND_DIFFERENTIAL';
},
},
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'type', label: $t('type') },
{ name: 'period', label: $t('period') },
{ name: 'code', label: $t('code') },
{ name: 'name', label: $t('name') },
{ name: 'description', label: $t('description') },
{ name: 'order', label: $t('order') },
{ name: 'valueType', label: $t('valueType') },
{ name: 'formula', label: $t('engine.st.indepFactorDefine.grid.entity.formula') },
{ name: 'delayFactorDefine', label: $t('engine.st.indepFactorDefine.grid.entity.delayFactorDefine') },
{ name: 'delayIssue', label: $t('engine.st.indepFactorDefine.grid.entity.delayIssue') },
{ name: 'differentialFactorDefine', label: $t('engine.st.indepFactorDefine.grid.entity.differentialFactorDefine') },
{ name: 'differentialDegree', label: $t('engine.st.indepFactorDefine.grid.entity.differentialDegree') },
{ name: 'dataComeFrom', label: $t('dataComeFrom') },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
{ name: 'corporationCode', label: $t('corporationCode') },
],
},
}"
@after-editor-open="
(selected) => {
if (selected?.type === 'EXTEND_DELAY' || selected?.type === 'EXTEND_DIFFERENTIAL') {
findAllWithoutById(selected.id);
}
}
"
></w-grid>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Environment, Formater, Options, EnumTools, axios } from 'platform-core';
const treeGridRef = ref();
const factorDefineOptionsRef = ref([]);
const Enums = await EnumTools.fetch(['io.sc.engine.st.enums.FactorDefineType', 'io.sc.engine.st.enums.Period', 'io.sc.engine.st.enums.ValueType']);
const findAllWithoutById = (id) => {
axios.get(Environment.apiContextPath('/api/st/indepFactorDefine/findAllWithoutById?defineId=' + (id ? id : ''))).then((response) => {
const defines = response?.data;
if (defines) {
const options = [];
for (const define of defines) {
if (define.type !== 'FOLDER') {
options.push({ value: define.id, label: define.name });
}
}
console.log(factorDefineOptionsRef.value);
factorDefineOptionsRef.value = options;
}
});
};
</script>

211
io.sc.engine.st.frontend/src/views/Target.vue

@ -1,211 +0,0 @@
<template>
<q-splitter :model-value="40" class="w-full" style="height: 100%">
<template #before>
<div class="pr-1" style="height: 100%">
<w-grid
ref="targetGridRef"
:title="$t('engine.st.target.grid.title')"
:config-button="true"
selection="multiple"
:checkbox-selection="true"
:data-url="Environment.apiContextPath('/api/st/target')"
:pageable="false"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']"
:columns="[
{ name: 'code', label: $t('code') },
{ name: 'name', label: $t('name') },
{ width: 100, name: 'lastModifier', label: $t('lastModifier') },
{ width: 110, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() },
]"
:editor="{
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{ name: 'code', label: $t('code'), type: 'text', required: true },
{ name: 'name', label: $t('name'), type: 'text', required: true },
{ name: 'description', label: $t('description'), type: 'text' },
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'code', label: $t('code') },
{ name: 'name', label: $t('name') },
{ name: 'description', label: $t('description') },
{ name: 'dataComeFrom', label: $t('dataComeFrom'), format: Formater.none() },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
],
},
}"
@row-click="
(evt, row, index) => {
currentSelectedTarget = row.id;
targetIndicatorGridRef?.refresh();
}
"
@before-request-data="
() => {
currentSelectedTarget = '';
targetIndicatorGridRef?.refresh();
}
"
></w-grid>
</div>
</template>
<template #after>
<div class="pl-1" style="height: 100%">
<w-grid
ref="targetIndicatorGridRef"
:title="$t('engine.st.targetIndicator.grid.title')"
:checkbox-selection="true"
:fetch-data-url="Environment.apiContextPath('/api/st/targetIndicator?target=' + currentSelectedTarget)"
:data-url="Environment.apiContextPath('/api/st/targetIndicator')"
:pageable="false"
:sort-by="['year', 'month', 'quarter']"
:query-form-cols-num="4"
:query-form-fields="[
{
name: 'periodType',
label: $t('engine.st.targetIndicator.grid.entity.periodType'),
type: 'select',
options: Options.enum(StatisticalPeriodTypeEnums),
queryOperator: 'equals',
},
]"
:toolbar-actions="['query', 'separator', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']"
:columns="[
{ name: 'periodType', label: $t('engine.st.targetIndicator.grid.entity.periodType'), format: Formater.enum(StatisticalPeriodTypeEnums) },
{ name: 'year', label: $t('year') },
{ name: 'month', label: $t('month') },
{ name: 'quarter', label: $t('quarter') },
{
name: 'pd',
label: $t('engine.st.targetIndicator.grid.entity.PD'),
title: $t('engine.st.targetIndicator.grid.entity.PD.title'),
align: 'right',
format: Formater.percent(),
},
{
name: 'lgd',
label: $t('engine.st.targetIndicator.grid.entity.LGD'),
title: $t('engine.st.targetIndicator.grid.entity.LGD.title'),
align: 'right',
format: Formater.percent(),
},
{
name: 'ccf',
label: $t('engine.st.targetIndicator.grid.entity.CCF'),
title: $t('engine.st.targetIndicator.grid.entity.CCF.title'),
align: 'right',
format: Formater.percent(),
},
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() },
]"
:editor="{
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'target',
label: $t('engine.st.targetIndicator.grid.entity.target'),
type: 'text',
defaultValue: currentSelectedTarget,
hidden: true,
},
{
name: 'periodType',
label: $t('engine.st.targetIndicator.grid.entity.periodType'),
type: 'select',
options: Options.enum(StatisticalPeriodTypeEnums),
},
{
name: 'year',
label: $t('year'),
type: 'select',
options: yearOptionsRef,
showIf: (arg) => {
return arg.form.getFieldValue('periodType') === 'YEAR';
},
},
{
name: 'month',
label: $t('month'),
type: 'select',
options: monthOptionsRef,
showIf: (arg) => {
return arg.form.getFieldValue('periodType') === 'MONTH';
},
},
{
name: 'quarter',
label: $t('quarter'),
type: 'select',
options: quarterOptionsRef,
showIf: (arg) => {
return arg.form.getFieldValue('periodType') === 'QUARTER';
},
},
{ name: 'pd', label: $t('engine.st.targetIndicator.grid.entity.PD'), type: 'number', precision: 6 },
{ name: 'lgd', label: $t('engine.st.targetIndicator.grid.entity.LGD'), type: 'number', precision: 6 },
{ name: 'ccf', label: $t('engine.st.targetIndicator.grid.entity.CCF'), type: 'number', precision: 6 },
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'target', label: $t('engine.st.targetIndicator.grid.entity.target') },
{ name: 'periodType', label: $t('engine.st.targetIndicator.grid.entity.periodType') },
{ name: 'year', label: $t('year') },
{ name: 'month', label: $t('month') },
{ name: 'pd', label: $t('engine.st.targetIndicator.grid.entity.PD') },
{ name: 'lgd', label: $t('engine.st.targetIndicator.grid.entity.LGD') },
{ name: 'ccf', label: $t('engine.st.targetIndicator.grid.entity.CCF') },
{ name: 'dataComeFrom', label: $t('dataComeFrom') },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
{ name: 'corporationCode', label: $t('corporationCode') },
],
},
}"
></w-grid>
</div>
</template>
</q-splitter>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { axios, Environment, Formater, Options, EnumTools } from 'platform-core';
const targetGridRef = ref();
const targetIndicatorGridRef = ref();
const userGridRef = ref();
const currentSelectedTarget = ref('');
const years = [];
for (let i = 0; i < 30; i++) {
years.push(new Date().getFullYear() - i);
}
const yearOptionsRef = ref(years);
const monthOptionsRef = ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
const quarterOptionsRef = ref([1, 2, 3, 4]);
const StatisticalPeriodTypeEnums = await EnumTools.fetch('io.sc.engine.st.enums.StatisticalPeriodType');
</script>

211
io.sc.engine.st.frontend/src/views/TestCase.vue

@ -1,211 +0,0 @@
<template>
<q-splitter :model-value="40" class="w-full" style="height: 100%">
<template #before>
<div class="pr-1" style="height: 100%">
<w-grid
ref="testCaseGridRef"
:title="$t('engine.st.testCase.grid.title')"
:config-button="true"
selection="multiple"
:checkbox-selection="true"
:data-url="Environment.apiContextPath('/api/st/testCase')"
:pageable="false"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="['refresh', 'separator', 'add', 'edit', 'remove', 'separator', 'view', 'separator', 'export']"
:columns="[
{ name: 'code', label: $t('code') },
{ name: 'name', label: $t('name') },
{ width: 100, name: 'lastModifier', label: $t('lastModifier') },
{ width: 110, name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() },
]"
:editor="{
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{ name: 'code', label: $t('code'), type: 'text', required: true },
{ name: 'name', label: $t('name'), type: 'text', required: true },
{ name: 'description', label: $t('description'), type: 'text' },
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'code', label: $t('code') },
{ name: 'name', label: $t('name') },
{ name: 'description', label: $t('description') },
{ name: 'dataComeFrom', label: $t('dataComeFrom'), format: Formater.none() },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
],
},
}"
@row-click="
(evt, row, index) => {
currentSelectedTarget = row.id;
targetIndicatorGridRef?.refresh();
}
"
@before-request-data="
() => {
currentSelectedTarget = '';
targetIndicatorGridRef?.refresh();
}
"
></w-grid>
</div>
</template>
<template #after>
<div class="pl-1" style="height: 100%">
<w-grid
ref="targetIndicatorGridRef"
:title="$t('engine.st.targetIndicator.grid.title')"
:checkbox-selection="true"
:fetch-data-url="Environment.apiContextPath('/api/st/targetIndicator?target=' + currentSelectedTarget)"
:data-url="Environment.apiContextPath('/api/st/targetIndicator')"
:pageable="false"
:sort-by="['year', 'month', 'quarter']"
:query-form-cols-num="4"
:query-form-fields="[
{
name: 'periodType',
label: $t('engine.st.targetIndicator.grid.entity.periodType'),
type: 'select',
options: Options.enum(StatisticalPeriodTypeEnums),
queryOperator: 'equals',
},
]"
:toolbar-actions="['query', 'separator', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']"
:columns="[
{ name: 'periodType', label: $t('engine.st.targetIndicator.grid.entity.periodType'), format: Formater.enum(StatisticalPeriodTypeEnums) },
{ name: 'year', label: $t('year') },
{ name: 'month', label: $t('month') },
{ name: 'quarter', label: $t('quarter') },
{
name: 'pd',
label: $t('engine.st.targetIndicator.grid.entity.PD'),
title: $t('engine.st.targetIndicator.grid.entity.PD.title'),
align: 'right',
format: Formater.percent(),
},
{
name: 'lgd',
label: $t('engine.st.targetIndicator.grid.entity.LGD'),
title: $t('engine.st.targetIndicator.grid.entity.LGD.title'),
align: 'right',
format: Formater.percent(),
},
{
name: 'ccf',
label: $t('engine.st.targetIndicator.grid.entity.CCF'),
title: $t('engine.st.targetIndicator.grid.entity.CCF.title'),
align: 'right',
format: Formater.percent(),
},
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.dateOnly() },
]"
:editor="{
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{
name: 'target',
label: $t('engine.st.targetIndicator.grid.entity.target'),
type: 'text',
defaultValue: currentSelectedTarget,
hidden: true,
},
{
name: 'periodType',
label: $t('engine.st.targetIndicator.grid.entity.periodType'),
type: 'select',
options: Options.enum(StatisticalPeriodTypeEnums),
},
{
name: 'year',
label: $t('year'),
type: 'select',
options: yearOptionsRef,
showIf: (arg) => {
return arg.form.getFieldValue('periodType') === 'YEAR';
},
},
{
name: 'month',
label: $t('month'),
type: 'select',
options: monthOptionsRef,
showIf: (arg) => {
return arg.form.getFieldValue('periodType') === 'MONTH';
},
},
{
name: 'quarter',
label: $t('quarter'),
type: 'select',
options: quarterOptionsRef,
showIf: (arg) => {
return arg.form.getFieldValue('periodType') === 'QUARTER';
},
},
{ name: 'pd', label: $t('engine.st.targetIndicator.grid.entity.PD'), type: 'number', precision: 6 },
{ name: 'lgd', label: $t('engine.st.targetIndicator.grid.entity.LGD'), type: 'number', precision: 6 },
{ name: 'ccf', label: $t('engine.st.targetIndicator.grid.entity.CCF'), type: 'number', precision: 6 },
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'target', label: $t('engine.st.targetIndicator.grid.entity.target') },
{ name: 'periodType', label: $t('engine.st.targetIndicator.grid.entity.periodType') },
{ name: 'year', label: $t('year') },
{ name: 'month', label: $t('month') },
{ name: 'pd', label: $t('engine.st.targetIndicator.grid.entity.PD') },
{ name: 'lgd', label: $t('engine.st.targetIndicator.grid.entity.LGD') },
{ name: 'ccf', label: $t('engine.st.targetIndicator.grid.entity.CCF') },
{ name: 'dataComeFrom', label: $t('dataComeFrom') },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
{ name: 'corporationCode', label: $t('corporationCode') },
],
},
}"
></w-grid>
</div>
</template>
</q-splitter>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { axios, Environment, Formater, Options, EnumTools } from 'platform-core';
const testCaseGridRef = ref();
const targetIndicatorGridRef = ref();
const userGridRef = ref();
const currentSelectedTarget = ref('');
const years = [];
for (let i = 0; i < 30; i++) {
years.push(new Date().getFullYear() - i);
}
const yearOptionsRef = ref(years);
const monthOptionsRef = ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
const quarterOptionsRef = ref([1, 2, 3, 4]);
const StatisticalPeriodTypeEnums = await EnumTools.fetch('io.sc.engine.st.enums.StatisticalPeriodType');
</script>

103
io.sc.engine.st.frontend/src/views/TestCase/TestCase.vue

@ -0,0 +1,103 @@
<template>
<w-grid
ref="gridRef"
:title="$t('engine.st.testCase.grid.title')"
dense
:checkbox-selection="true"
:tree="false"
:data-url="Environment.apiContextPath('/api/st/testCase')"
:pageable="false"
:sort-by="['lastModifyDate']"
:toolbar-actions="[
'refresh',
'separator',
'add',
'clone',
'edit',
'remove',
'separator',
{
name: 'test',
label: $t('test'),
icon: 'bi-caret-right',
enableIf: (arg) => {
return arg.selected;
},
click: (arg) => {
if (arg.selected) {
axios.post(Environment.apiContextPath('/api/st/testCase/test?testCaseId=' + arg.selected.id)).then(() => {
NotifyManager.success();
emit('afterTest');
});
}
},
},
'view',
'separator',
'export',
]"
:columns="[
{ width: 160, name: 'name', label: $t('name') },
{
width: 150,
name: 'model',
label: $t('engine.st.testCase.grid.entity.model'),
format: (value, row) => {
return modelMap[value];
},
},
]"
:editor="{
dialog: {
width: '500px',
},
form: {
colsNum: 1,
fields: [
{ name: 'name', label: $t('name'), type: 'text', required: true },
{ name: 'model', label: $t('engine.st.testCase.grid.entity.model'), type: 'select', options: modelOptionsRef, required: true },
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'name', label: $t('name') },
{ name: 'model', label: $t('model') },
{ name: 'dataComeFrom', label: $t('dataComeFrom') },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
{ name: 'lastModifier', label: $t('lastModifier') },
{ name: 'lastModifyDate', label: $t('lastModifyDate'), format: Formater.none() },
{ name: 'corporationCode', label: $t('corporationCode') },
],
},
}"
></w-grid>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Environment, Formater, axios, NotifyManager } from 'platform-core';
const emit = defineEmits<{
(e: 'afterTest'): void;
}>();
const gridRef = ref();
const modelMap = {};
const modelOptionsRef = ref([]);
axios.get(Environment.apiContextPath('/api/st/model?pageable=false')).then((response) => {
const options = [];
for (const item of response.data.content) {
modelMap[item.id] = item.name;
options.push({
value: item.id,
label: item.name,
});
}
modelOptionsRef.value = options;
});
</script>

15
io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetIndicatorWebController.java

@ -1,15 +0,0 @@
package io.sc.engine.st.controller;
import io.sc.engine.st.jpa.entity.TargetIndicatorEntity;
import io.sc.engine.st.jpa.repository.TargetIndicatorRepository;
import io.sc.engine.st.service.TargetIndicatorService;
import io.sc.engine.st.vo.TargetIndicatorVo;
import io.sc.platform.mvc.controller.support.RestCrudController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("io.sc.engine.st.controller.TargetIndicatorWebController")
@RequestMapping("/api/st/targetIndicator")
public class TargetIndicatorWebController extends RestCrudController<TargetIndicatorVo, TargetIndicatorEntity,String, TargetIndicatorRepository, TargetIndicatorService> {
}

15
io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetWebController.java

@ -1,15 +0,0 @@
package io.sc.engine.st.controller;
import io.sc.engine.st.jpa.entity.TargetEntity;
import io.sc.engine.st.jpa.repository.TargetRepository;
import io.sc.engine.st.service.TargetService;
import io.sc.engine.st.vo.TargetVo;
import io.sc.platform.mvc.controller.support.RestCrudController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("io.sc.engine.st.controller.TargetWebController")
@RequestMapping("/api/st/target")
public class TargetWebController extends RestCrudController<TargetVo, TargetEntity,String, TargetRepository, TargetService> {
}

7
io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TestCaseWebController.java

@ -5,11 +5,16 @@ import io.sc.engine.st.jpa.repository.TestCaseRepository;
import io.sc.engine.st.service.TestCaseService; import io.sc.engine.st.service.TestCaseService;
import io.sc.engine.st.vo.TestCaseVo; import io.sc.engine.st.vo.TestCaseVo;
import io.sc.platform.mvc.controller.support.RestCrudController; import io.sc.platform.mvc.controller.support.RestCrudController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController("io.sc.engine.st.controller.TestCaseWebController") @RestController("io.sc.engine.st.controller.TestCaseWebController")
@RequestMapping("/api/st/testCase") @RequestMapping("/api/st/testCase")
public class TestCaseWebController extends RestCrudController<TestCaseVo, TestCaseEntity,String, TestCaseRepository, TestCaseService> { public class TestCaseWebController extends RestCrudController<TestCaseVo, TestCaseEntity,String, TestCaseRepository, TestCaseService> {
@PostMapping("test")
public void test(@RequestParam("testCaseId")String testCaseId) throws Exception {
service.test(testCaseId);
}
} }

11
io.sc.engine.st/src/main/java/io/sc/engine/st/enums/PeriodType.java

@ -1,11 +0,0 @@
package io.sc.engine.st.enums;
/**
* 周期枚举
*/
public enum PeriodType {
YEAR, //年
QUARTER, //季度
MONTH, //月
DAY; //日
}

10
io.sc.engine.st/src/main/java/io/sc/engine/st/enums/StatisticalPeriodType.java

@ -1,10 +0,0 @@
package io.sc.engine.st.enums;
/**
* 统计周期类型枚举
*/
public enum StatisticalPeriodType {
YEAR, //年
QUARTER, //季度
MONTH; //月
}

118
io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/FactorEntity.java

@ -1,118 +0,0 @@
package io.sc.engine.st.jpa.entity;
import io.sc.engine.st.enums.PeriodType;
import io.sc.engine.st.enums.ValueType;
import io.sc.engine.st.vo.FactorTypeVo;
import io.sc.engine.st.vo.FactorVo;
import io.sc.platform.orm.entity.CorporationAuditorEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Entity(name="io.sc.engine.st.jpa.entity.FactorEntity")
@Table(name="ST_FACTOR")
public class FactorEntity extends CorporationAuditorEntity<FactorVo> {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
@Column(name="ID_", length=36)
@Size(max=36)
protected String id;
@Column(name="YEAR_")
protected Integer year;
@Column(name="QUARTER_")
protected Integer quarter;
@Column(name="MONTH_")
protected Integer month;
@Column(name="DAY_")
protected Integer day;
@Column(name="VALUE_", length=255)
@Size(max=255)
protected String value;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="FACTOR_TYPE_ID_")
protected FactorTypeEntity factorType;
@Override
public FactorVo toVo() {
FactorVo vo =new FactorVo();
super.toVo(vo);
vo.setId(this.getId());
vo.setYear(this.getYear());
vo.setQuarter(this.getQuarter());
vo.setMonth(this.getMonth());
vo.setDay(this.getDay());
vo.setValue(this.getValue());
vo.setFactorType(this.getFactorType()==null?null:this.getFactorType().getId());
return vo;
}
public FactorEntity(){}
public FactorEntity(String id){
this.id =id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public Integer getQuarter() {
return quarter;
}
public void setQuarter(Integer quarter) {
this.quarter = quarter;
}
public Integer getMonth() {
return month;
}
public void setMonth(Integer month) {
this.month = month;
}
public Integer getDay() {
return day;
}
public void setDay(Integer day) {
this.day = day;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public FactorTypeEntity getFactorType() {
return factorType;
}
public void setFactorType(FactorTypeEntity factorType) {
this.factorType = factorType;
}
}

82
io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetEntity.java

@ -1,82 +0,0 @@
package io.sc.engine.st.jpa.entity;
import io.sc.engine.st.vo.TargetVo;
import io.sc.platform.orm.entity.CorporationAuditorEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Entity(name="io.sc.engine.st.jpa.entity.TargetEntity")
@Table(name="ST_TARGET")
public class TargetEntity extends CorporationAuditorEntity<TargetVo> {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
@Column(name="ID_", length=36)
@Size(max=36)
protected String id;
@Column(name="CODE_", length=255)
@NotBlank
@Size(max=255)
protected String code;
@Column(name="NAME_", length=255)
@NotBlank
@Size(max=255)
protected String name;
@Column(name="DESCRIPTION_", length=255)
@Size(max=255)
protected String description;
@Override
public TargetVo toVo() {
TargetVo vo =new TargetVo();
super.toVo(vo);
vo.setId(this.getId());
vo.setCode(this.getCode());
vo.setName(this.getName());
vo.setDescription(this.getDescription());
return vo;
}
public TargetEntity(){}
public TargetEntity(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

135
io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetIndicatorEntity.java

@ -1,135 +0,0 @@
package io.sc.engine.st.jpa.entity;
import io.sc.engine.st.enums.StatisticalPeriodType;
import io.sc.engine.st.vo.TargetIndicatorVo;
import io.sc.platform.orm.entity.CorporationAuditorEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
@Entity(name="io.sc.engine.st.jpa.entity.TargetIndicatorEntity")
@Table(name="ST_TARGET_INDICATOR")
public class TargetIndicatorEntity extends CorporationAuditorEntity<TargetIndicatorVo> {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
@Column(name="ID_", length=36)
@Size(max=36)
protected String id;
@Column(name="PERIOD_TYPE_")
@Enumerated(EnumType.STRING)
protected StatisticalPeriodType periodType;
@Column(name="YEAR_")
protected Integer year;
@Column(name="MONTH_")
protected Integer month;
@Column(name="QUARTER_")
protected Integer quarter;
@Column(name="PD_")
protected Double pd;
@Column(name="LGD_")
protected Double lgd;
@Column(name="CCF_")
protected Double ccf;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="TARGET_ID_")
protected TargetEntity target;
@Override
public TargetIndicatorVo toVo() {
TargetIndicatorVo vo =new TargetIndicatorVo();
super.toVo(vo);
vo.setId(this.getId());
vo.setPeriodType(this.getPeriodType());
vo.setYear(this.getYear());
vo.setMonth(this.getMonth());
vo.setQuarter(this.getQuarter());
vo.setPd(this.getPd());
vo.setLgd(this.getLgd());
vo.setCcf(this.getCcf());
vo.setTarget(this.getTarget()==null?null:this.getTarget().getId());
return vo;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public StatisticalPeriodType getPeriodType() {
return periodType;
}
public void setPeriodType(StatisticalPeriodType periodType) {
this.periodType = periodType;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public Integer getMonth() {
return month;
}
public void setMonth(Integer month) {
this.month = month;
}
public Integer getQuarter() {
return quarter;
}
public void setQuarter(Integer quarter) {
this.quarter = quarter;
}
public Double getPd() {
return pd;
}
public void setPd(Double pd) {
this.pd = pd;
}
public Double getLgd() {
return lgd;
}
public void setLgd(Double lgd) {
this.lgd = lgd;
}
public Double getCcf() {
return ccf;
}
public void setCcf(Double ccf) {
this.ccf = ccf;
}
public TargetEntity getTarget() {
return target;
}
public void setTarget(TargetEntity target) {
this.target = target;
}
}

63
io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TestCaseEntity.java

@ -1,6 +1,6 @@
package io.sc.engine.st.jpa.entity; package io.sc.engine.st.jpa.entity;
import io.sc.engine.st.enums.StatisticalPeriodType; import io.sc.engine.st.support.PeriodWrapper;
import io.sc.engine.st.vo.TestCaseVo; import io.sc.engine.st.vo.TestCaseVo;
import io.sc.platform.orm.entity.CorporationAuditorEntity; import io.sc.platform.orm.entity.CorporationAuditorEntity;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
@ -8,7 +8,6 @@ import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.Date;
@Entity(name="io.sc.engine.st.jpa.entity.TestCaseEntity") @Entity(name="io.sc.engine.st.jpa.entity.TestCaseEntity")
@Table(name="ST_TEST_CASE") @Table(name="ST_TEST_CASE")
@ -20,44 +19,28 @@ public class TestCaseEntity extends CorporationAuditorEntity<TestCaseVo> {
@Size(max=36) @Size(max=36)
protected String id; protected String id;
@Column(name="START_DATE_")
@Temporal(TemporalType.TIMESTAMP)
protected Date startDate;
@Column(name="END_DATE_")
@Temporal(TemporalType.TIMESTAMP)
protected Date endDate;
@Column(name="NAME_", length=255) @Column(name="NAME_", length=255)
@NotBlank @NotBlank
@Size(max=255) @Size(max=255)
protected String name; protected String name;
@Column(name="DESCRIPTION_", length=255) @ManyToOne(fetch = FetchType.LAZY)
@Size(max=255) @JoinColumn(name = "MODEL_ID_")
protected String description; protected ModelEntity model;
@Column(name="PERIOD_TYPE_")
@Enumerated(EnumType.STRING)
protected StatisticalPeriodType periodType;
@Override @Override
public TestCaseVo toVo() { public TestCaseVo toVo() {
TestCaseVo vo =new TestCaseVo(); TestCaseVo vo =new TestCaseVo();
super.toVo(vo); super.toVo(vo);
vo.setId(this.getId()); vo.setId(this.getId());
vo.setStartDate(this.getStartDate());
vo.setEndDate(this.getEndDate());
vo.setName(this.getName()); vo.setName(this.getName());
vo.setDescription(this.getDescription()); vo.setModel(this.getModel()==null?null:this.getModel().getId());
vo.setPeriodType(this.getPeriodType());
return vo; return vo;
} }
public TestCaseEntity(){} public TestCaseEntity(){}
public TestCaseEntity(String id){
public TestCaseEntity(String id) { this.id =id;
this.id = id;
} }
public String getId() { public String getId() {
@ -68,22 +51,6 @@ public class TestCaseEntity extends CorporationAuditorEntity<TestCaseVo> {
this.id = id; this.id = id;
} }
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getName() { public String getName() {
return name; return name;
} }
@ -92,19 +59,11 @@ public class TestCaseEntity extends CorporationAuditorEntity<TestCaseVo> {
this.name = name; this.name = name;
} }
public String getDescription() { public ModelEntity getModel() {
return description; return model;
}
public void setDescription(String description) {
this.description = description;
}
public StatisticalPeriodType getPeriodType() {
return periodType;
} }
public void setPeriodType(StatisticalPeriodType periodType) { public void setModel(ModelEntity model) {
this.periodType = periodType; this.model = model;
} }
} }

10
io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetIndicatorRepository.java

@ -1,10 +0,0 @@
package io.sc.engine.st.jpa.repository;
import io.sc.engine.st.jpa.entity.TargetIndicatorEntity;
import io.sc.platform.orm.repository.DaoRepository;
import org.springframework.stereotype.Service;
@Service("io.sc.engine.st.jpa.repository.TargetIndicatorRepository")
public interface TargetIndicatorRepository extends DaoRepository<TargetIndicatorEntity,String>{
}

10
io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetRepository.java

@ -1,10 +0,0 @@
package io.sc.engine.st.jpa.repository;
import io.sc.engine.st.jpa.entity.TargetEntity;
import io.sc.platform.orm.repository.DaoRepository;
import org.springframework.stereotype.Service;
@Service("io.sc.engine.st.jpa.repository.TargetRepository")
public interface TargetRepository extends DaoRepository<TargetEntity,String>{
}

8
io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetIndicatorService.java

@ -1,8 +0,0 @@
package io.sc.engine.st.service;
import io.sc.engine.st.jpa.entity.TargetIndicatorEntity;
import io.sc.engine.st.jpa.repository.TargetIndicatorRepository;
import io.sc.platform.orm.service.DaoService;
public interface TargetIndicatorService extends DaoService<TargetIndicatorEntity, String, TargetIndicatorRepository>{
}

8
io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetService.java

@ -1,8 +0,0 @@
package io.sc.engine.st.service;
import io.sc.engine.st.jpa.entity.TargetEntity;
import io.sc.engine.st.jpa.repository.TargetRepository;
import io.sc.platform.orm.service.DaoService;
public interface TargetService extends DaoService<TargetEntity, String, TargetRepository>{
}

2
io.sc.engine.st/src/main/java/io/sc/engine/st/service/TestCaseService.java

@ -3,6 +3,8 @@ package io.sc.engine.st.service;
import io.sc.engine.st.jpa.entity.TestCaseEntity; import io.sc.engine.st.jpa.entity.TestCaseEntity;
import io.sc.engine.st.jpa.repository.TestCaseRepository; import io.sc.engine.st.jpa.repository.TestCaseRepository;
import io.sc.platform.orm.service.DaoService; import io.sc.platform.orm.service.DaoService;
import org.springframework.web.bind.annotation.RequestParam;
public interface TestCaseService extends DaoService<TestCaseEntity, String, TestCaseRepository>{ public interface TestCaseService extends DaoService<TestCaseEntity, String, TestCaseRepository>{
public void test(String testCaseId) throws Exception;
} }

12
io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetIndicatorServiceImpl.java

@ -1,12 +0,0 @@
package io.sc.engine.st.service.impl;
import io.sc.engine.st.jpa.entity.TargetIndicatorEntity;
import io.sc.engine.st.jpa.repository.TargetIndicatorRepository;
import io.sc.engine.st.service.TargetIndicatorService;
import io.sc.platform.orm.service.impl.DaoServiceImpl;
import org.springframework.stereotype.Service;
@Service("io.sc.engine.st.service.impl.TargetIndicatorServiceImpl")
public class TargetIndicatorServiceImpl extends DaoServiceImpl<TargetIndicatorEntity, String, TargetIndicatorRepository> implements TargetIndicatorService {
}

12
io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetServiceImpl.java

@ -1,12 +0,0 @@
package io.sc.engine.st.service.impl;
import io.sc.engine.st.jpa.entity.TargetEntity;
import io.sc.engine.st.jpa.repository.TargetRepository;
import io.sc.engine.st.service.TargetService;
import io.sc.platform.orm.service.impl.DaoServiceImpl;
import org.springframework.stereotype.Service;
@Service("io.sc.engine.st.service.impl.TargetServiceImpl")
public class TargetServiceImpl extends DaoServiceImpl<TargetEntity, String, TargetRepository> implements TargetService {
}

116
io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TestCaseServiceImpl.java

@ -1,12 +1,126 @@
package io.sc.engine.st.service.impl; package io.sc.engine.st.service.impl;
import io.sc.engine.st.jpa.entity.TestCaseEntity; import io.sc.engine.st.jpa.entity.*;
import io.sc.engine.st.jpa.entity.sub.DepArithmeticFactorDefineEntity;
import io.sc.engine.st.jpa.repository.TestCaseRepository; import io.sc.engine.st.jpa.repository.TestCaseRepository;
import io.sc.engine.st.service.ScenarioFactorService;
import io.sc.engine.st.service.TestCaseService; import io.sc.engine.st.service.TestCaseService;
import io.sc.engine.st.service.TestResultService;
import io.sc.engine.st.support.PeriodWrapper;
import io.sc.engine.st.vo.DepFactorDefineVo;
import io.sc.engine.st.vo.ScenarioFactorVo;
import io.sc.engine.st.vo.sub.DepArithmeticFactorDefineVo;
import io.sc.platform.core.util.StringUtil;
import io.sc.platform.groovy.GroovyScriptExecutor;
import io.sc.platform.orm.service.impl.DaoServiceImpl; import io.sc.platform.orm.service.impl.DaoServiceImpl;
import io.sc.platform.orm.util.EntityVoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.*;
@Service("io.sc.engine.st.service.impl.TestCaseServiceImpl") @Service("io.sc.engine.st.service.impl.TestCaseServiceImpl")
public class TestCaseServiceImpl extends DaoServiceImpl<TestCaseEntity, String, TestCaseRepository> implements TestCaseService { public class TestCaseServiceImpl extends DaoServiceImpl<TestCaseEntity, String, TestCaseRepository> implements TestCaseService {
@Autowired private ScenarioFactorService scenarioFactorService;
@Autowired private TestResultService testResultService;
@Autowired private JdbcTemplate jdbcTemplate;
@Override
public void test(String testCaseId) throws Exception {
if(StringUtils.hasText(testCaseId)){
TestCaseEntity testCaseEntity =findById(testCaseId);
if(testCaseEntity!=null){
ModelEntity modelEntity =testCaseEntity.getModel();
if(modelEntity!=null) {
List<IndepFactorDefineEntity> factorDefineEntities = modelEntity.getIndepFactorDefines();
DepFactorDefineVo depFactorDefineVo = modelEntity.getDepFactorDefine().toVo();
if(factorDefineEntities!=null && !factorDefineEntities.isEmpty()){
Map<PeriodWrapper,Map<String,Object>> lowRecords =new TreeMap<>(PeriodWrapper.comparator);
Map<PeriodWrapper,Map<String,Object>> midRecords =new TreeMap<>(PeriodWrapper.comparator);
Map<PeriodWrapper,Map<String,Object>> highRecords =new TreeMap<>(PeriodWrapper.comparator);
for(IndepFactorDefineEntity entity : factorDefineEntities){
List<ScenarioFactorVo> vos =scenarioFactorService.findByFactorDefineId(entity.getId());
if(vos!=null && !vos.isEmpty()){
for(ScenarioFactorVo vo : vos){
Map<String,Object> lowRecord =lowRecords.get(vo.calUniqueKey());
if(lowRecord==null){
lowRecord =new HashMap<>();
lowRecords.put(vo.calUniqueKey(),lowRecord);
}
lowRecord.put(entity.getCode(),vo.getValueLow());
Map<String,Object> midRecord =midRecords.get(vo.calUniqueKey());
if(midRecord==null){
midRecord =new HashMap<>();
midRecords.put(vo.calUniqueKey(),midRecord);
}
midRecord.put(entity.getCode(),vo.getValueMid());
Map<String,Object> highRecord =highRecords.get(vo.calUniqueKey());
if(highRecord==null){
highRecord =new HashMap<>();
highRecords.put(vo.calUniqueKey(),highRecord);
}
highRecord.put(entity.getCode(),vo.getValueHigh());
}
}
}
String groovyScript =modelEntity.getFormula();
List<TestResultEntity> testResultEntities =new ArrayList<>();
for(PeriodWrapper key : lowRecords.keySet()){
Map<String,Object> lowRecord =lowRecords.get(key);
Map<String, Object> lowContext =new HashMap<>();
for(String var : lowRecord.keySet()) {
lowContext.put(var,new BigDecimal(lowRecord.get(var).toString()));
}
Map<String,Object> midRecord =midRecords.get(key);
Map<String, Object> midContext =new HashMap<>();
for(String var : midRecord.keySet()) {
midContext.put(var,new BigDecimal(midRecord.get(var).toString()));
}
Map<String,Object> highRecord =highRecords.get(key);
Map<String, Object> highContext =new HashMap<>();
for(String var : highRecord.keySet()) {
highContext.put(var,new BigDecimal(highRecord.get(var).toString()));
}
Double lowValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(groovyScript,lowContext).toString());
Double midValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(groovyScript,midContext).toString());
Double highValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(groovyScript,highContext).toString());
if(depFactorDefineVo instanceof DepArithmeticFactorDefineVo){
DepArithmeticFactorDefineVo vo =(DepArithmeticFactorDefineVo)depFactorDefineVo;
String reverseScript =vo.getReverseFormula();
if(StringUtils.hasText(reverseScript)){
lowValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(reverseScript,"X",lowValue).toString());
midValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(reverseScript,"X",midValue).toString());
highValue =Double.parseDouble(GroovyScriptExecutor.getInstance().eval(reverseScript,"X",highValue).toString());
}
}
lowValue =new BigDecimal(lowValue).setScale(6,BigDecimal.ROUND_HALF_UP).doubleValue();
midValue =new BigDecimal(midValue).setScale(6,BigDecimal.ROUND_HALF_UP).doubleValue();
highValue =new BigDecimal(highValue).setScale(6,BigDecimal.ROUND_HALF_UP).doubleValue();
TestResultEntity resultEntity =new TestResultEntity();
resultEntity.setTestCase(testCaseEntity);
resultEntity.setYear(key.getYear());
resultEntity.setQuarter(key.getQuarter());
resultEntity.setMonth(key.getMonth());
resultEntity.setValueLow(lowValue);
resultEntity.setValueMid(midValue);
resultEntity.setValueHigh(highValue);
testResultEntities.add(resultEntity);
}
jdbcTemplate.update("delete from ST_TEST_RESULT where TEST_CASE_ID_=?",testCaseId);
testResultService.getRepository().saveAll(testResultEntities);
}
}
}
}
}
} }

88
io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetIndicatorVo.java

@ -1,88 +0,0 @@
package io.sc.engine.st.vo;
import io.sc.engine.st.enums.StatisticalPeriodType;
import io.sc.platform.orm.api.vo.CorporationAuditorVo;
public class TargetIndicatorVo extends CorporationAuditorVo {
protected String id;
protected StatisticalPeriodType periodType;
protected Integer year;
protected Integer month;
protected Integer quarter;
protected Double pd;
protected Double lgd;
protected Double ccf;
protected String target;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public StatisticalPeriodType getPeriodType() {
return periodType;
}
public void setPeriodType(StatisticalPeriodType periodType) {
this.periodType = periodType;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public Integer getMonth() {
return month;
}
public void setMonth(Integer month) {
this.month = month;
}
public Integer getQuarter() {
return quarter;
}
public void setQuarter(Integer quarter) {
this.quarter = quarter;
}
public Double getPd() {
return pd;
}
public void setPd(Double pd) {
this.pd = pd;
}
public Double getLgd() {
return lgd;
}
public void setLgd(Double lgd) {
this.lgd = lgd;
}
public Double getCcf() {
return ccf;
}
public void setCcf(Double ccf) {
this.ccf = ccf;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
}

43
io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetVo.java

@ -1,43 +0,0 @@
package io.sc.engine.st.vo;
import io.sc.platform.orm.api.vo.CorporationAuditorVo;
public class TargetVo extends CorporationAuditorVo {
protected String id;
protected String code;
protected String name;
protected String description;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

44
io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TestCaseVo.java

@ -1,20 +1,12 @@
package io.sc.engine.st.vo; package io.sc.engine.st.vo;
import io.sc.engine.st.enums.StatisticalPeriodType; import io.sc.engine.st.jpa.entity.ModelEntity;
import io.sc.platform.orm.api.vo.CorporationAuditorVo; import io.sc.platform.orm.api.vo.CorporationAuditorVo;
import javax.persistence.Column;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;
public class TestCaseVo extends CorporationAuditorVo { public class TestCaseVo extends CorporationAuditorVo {
protected String id; protected String id;
protected Date startDate;
protected Date endDate;
protected String name; protected String name;
protected String description; protected String model;
protected StatisticalPeriodType periodType;
public String getId() { public String getId() {
return id; return id;
@ -24,22 +16,6 @@ public class TestCaseVo extends CorporationAuditorVo {
this.id = id; this.id = id;
} }
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getName() { public String getName() {
return name; return name;
} }
@ -48,19 +24,11 @@ public class TestCaseVo extends CorporationAuditorVo {
this.name = name; this.name = name;
} }
public String getDescription() { public String getModel() {
return description; return model;
}
public void setDescription(String description) {
this.description = description;
}
public StatisticalPeriodType getPeriodType() {
return periodType;
} }
public void setPeriodType(StatisticalPeriodType periodType) { public void setModel(String model) {
this.periodType = periodType; this.model = model;
} }
} }

1
io.sc.engine.st/src/main/resources/META-INF/platform/plugins/repositories.json

@ -10,6 +10,7 @@
{ {
"includes":[ "includes":[
"io.sc.engine.st.jpa.entity", "io.sc.engine.st.jpa.entity",
"io.sc.engine.st.jpa.entity.sub",
"io.sc.engine.st.jpa.repository" "io.sc.engine.st.jpa.repository"
], ],
"excludes":[] "excludes":[]

18
io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_economic_indicator.csv

@ -1,18 +0,0 @@
"ST_ECONOMIC_INDICATOR",,,,,,,,,,,,,,,,,
"ID_","PERIOD_TYPE_","YEAR_","MONTH_","QUARTER_","GDP_","M2_","CPI_","HPI_","PMI_","BLR_","JPA_VERSION_","DATA_COME_FROM_","CREATOR_","CREATE_DATE_","LAST_MODIFIER_","LAST_MODIFYDATE_","CORP_CODE_"
"ID_","统计周期类型","年","月","季","GDP(国内生产总值)(万亿)","M2(广义货币供应量)(万亿)","CPI(消费价格指数)(%)","HPI(房地产价格指数)(%)","PMI(生产者物价指数)(%)","BLR(贷款利率)(%)","JPA乐观锁版本","数据来源(INPUT:手工录入,IMPORT:系统自动导入)","创建人","创建日期","最后修改人","最后修改日期","所属法人代码"
"VARCHAR","VARCHAR","INTEGER","INTEGER","INTEGER","DECIMAL","DECIMAL","DECIMAL","DECIMAL","DECIMAL","DECIMAL","INTEGER","VARCHAR","VARCHAR","TIMESTAMP","VARCHAR","TIMESTAMP","VARCHAR"
"java.lang.String","java.lang.String","java.lang.Integer","java.lang.Integer","java.lang.Integer","java.math.BigDecimal","java.math.BigDecimal","java.math.BigDecimal","java.math.BigDecimal","java.math.BigDecimal","java.math.BigDecimal","java.lang.Integer","java.lang.String","java.lang.String","java.sql.Timestamp","java.lang.String","java.sql.Timestamp","java.lang.String"
"1e496316-c930-484b-b317-01dae6b795ae","YEAR","2011",,,"473104.000000",,"0.000000",,,,,"INPUT","admin","2024-04-26 12:59:18.0","admin","2024-04-26 15:17:14.0","_PRIMARY_"
"58270002-08e0-4c6a-ad56-8230c64c0834","YEAR","2016",,,"743585.000000",,,,,,,"INPUT","admin","2024-04-26 12:58:57.0","admin","2024-04-26 13:52:23.0","_PRIMARY_"
"5de3b2ca-8532-41cb-aead-ef766fdbb9e8","YEAR","2021",,,"1149237.000000",,,,,,,"INPUT","admin","2024-04-26 13:00:42.0","admin","2024-04-26 13:00:42.0","_PRIMARY_"
"837900bb-2087-48a6-bd30-e942a340d47c","YEAR","2013",,,"568845.000000",,,,,,,"INPUT","admin","2024-04-26 14:02:04.0","admin","2024-04-26 14:02:04.0","_PRIMARY_"
"909e4572-94d8-40f0-a8a8-3568762fe761","YEAR","2018",,,"919281.000000",,,,,,,"INPUT","admin","2024-04-26 14:02:35.0","admin","2024-04-26 14:02:35.0","_PRIMARY_"
"97d7b89b-00df-477a-9587-d019fafbc95b","YEAR","2015",,,"689052.000000",,,,,,,"INPUT","admin","2024-04-26 12:59:34.0","admin","2024-04-26 13:52:19.0","_PRIMARY_"
"a6acd46b-e726-40c0-a94f-f62bda9341fd","YEAR","2012",,,"519470.000000",,,,,,,"INPUT","admin","2024-04-26 12:57:48.0","admin","2024-04-26 13:52:10.0","_PRIMARY_"
"af26b8ec-8088-475b-baf4-14ec19b478fa","YEAR","2019",,,"986515.000000",,,,,,,"INPUT","admin","2024-04-26 12:50:47.0","admin","2024-04-26 12:52:38.0","_PRIMARY_"
"b11205ac-ca8e-4797-8c1d-c9da58a2ab95","YEAR","2020",,,"1013567.000000",,,,,,,"INPUT","admin","2024-04-26 12:58:11.0","admin","2024-04-26 13:01:07.0","_PRIMARY_"
"b7253ef9-4e4c-4496-b03e-4d149575e07e","YEAR","2023",,,"1260582.000000",,,,,,,"INPUT","admin","2024-04-26 14:03:45.0","admin","2024-04-26 14:03:45.0","_PRIMARY_"
"bd79e0c0-2bd2-4569-9a7f-adda31bc946b","YEAR","2014",,,"635910.000000",,,,,,,"INPUT","admin","2024-04-26 12:58:31.0","admin","2024-04-26 13:52:15.0","_PRIMARY_"
"ea1f038c-4ba9-4eff-b3e5-908547957b87","YEAR","2017",,,"820754.000000",,,,,,,"INPUT","admin","2024-04-26 12:53:20.0","admin","2024-04-26 12:53:20.0","_PRIMARY_"
"eaa53a70-abca-4f75-a4a9-e57fc406b5a4","YEAR","2022",,,"1204724.000000",,,,,,,"INPUT","admin","2024-04-26 12:57:17.0","admin","2024-04-26 12:57:17.0","_PRIMARY_"
1 ST_ECONOMIC_INDICATOR
2 ID_ PERIOD_TYPE_ YEAR_ MONTH_ QUARTER_ GDP_ M2_ CPI_ HPI_ PMI_ BLR_ JPA_VERSION_ DATA_COME_FROM_ CREATOR_ CREATE_DATE_ LAST_MODIFIER_ LAST_MODIFYDATE_ CORP_CODE_
3 ID_ 统计周期类型 GDP(国内生产总值)(万亿) M2(广义货币供应量)(万亿) CPI(消费价格指数)(%) HPI(房地产价格指数)(%) PMI(生产者物价指数)(%) BLR(贷款利率)(%) JPA乐观锁版本 数据来源(INPUT:手工录入,IMPORT:系统自动导入) 创建人 创建日期 最后修改人 最后修改日期 所属法人代码
4 VARCHAR VARCHAR INTEGER INTEGER INTEGER DECIMAL DECIMAL DECIMAL DECIMAL DECIMAL DECIMAL INTEGER VARCHAR VARCHAR TIMESTAMP VARCHAR TIMESTAMP VARCHAR
5 java.lang.String java.lang.String java.lang.Integer java.lang.Integer java.lang.Integer java.math.BigDecimal java.math.BigDecimal java.math.BigDecimal java.math.BigDecimal java.math.BigDecimal java.math.BigDecimal java.lang.Integer java.lang.String java.lang.String java.sql.Timestamp java.lang.String java.sql.Timestamp java.lang.String
6 1e496316-c930-484b-b317-01dae6b795ae YEAR 2011 473104.000000 0.000000 INPUT admin 2024-04-26 12:59:18.0 admin 2024-04-26 15:17:14.0 _PRIMARY_
7 58270002-08e0-4c6a-ad56-8230c64c0834 YEAR 2016 743585.000000 INPUT admin 2024-04-26 12:58:57.0 admin 2024-04-26 13:52:23.0 _PRIMARY_
8 5de3b2ca-8532-41cb-aead-ef766fdbb9e8 YEAR 2021 1149237.000000 INPUT admin 2024-04-26 13:00:42.0 admin 2024-04-26 13:00:42.0 _PRIMARY_
9 837900bb-2087-48a6-bd30-e942a340d47c YEAR 2013 568845.000000 INPUT admin 2024-04-26 14:02:04.0 admin 2024-04-26 14:02:04.0 _PRIMARY_
10 909e4572-94d8-40f0-a8a8-3568762fe761 YEAR 2018 919281.000000 INPUT admin 2024-04-26 14:02:35.0 admin 2024-04-26 14:02:35.0 _PRIMARY_
11 97d7b89b-00df-477a-9587-d019fafbc95b YEAR 2015 689052.000000 INPUT admin 2024-04-26 12:59:34.0 admin 2024-04-26 13:52:19.0 _PRIMARY_
12 a6acd46b-e726-40c0-a94f-f62bda9341fd YEAR 2012 519470.000000 INPUT admin 2024-04-26 12:57:48.0 admin 2024-04-26 13:52:10.0 _PRIMARY_
13 af26b8ec-8088-475b-baf4-14ec19b478fa YEAR 2019 986515.000000 INPUT admin 2024-04-26 12:50:47.0 admin 2024-04-26 12:52:38.0 _PRIMARY_
14 b11205ac-ca8e-4797-8c1d-c9da58a2ab95 YEAR 2020 1013567.000000 INPUT admin 2024-04-26 12:58:11.0 admin 2024-04-26 13:01:07.0 _PRIMARY_
15 b7253ef9-4e4c-4496-b03e-4d149575e07e YEAR 2023 1260582.000000 INPUT admin 2024-04-26 14:03:45.0 admin 2024-04-26 14:03:45.0 _PRIMARY_
16 bd79e0c0-2bd2-4569-9a7f-adda31bc946b YEAR 2014 635910.000000 INPUT admin 2024-04-26 12:58:31.0 admin 2024-04-26 13:52:15.0 _PRIMARY_
17 ea1f038c-4ba9-4eff-b3e5-908547957b87 YEAR 2017 820754.000000 INPUT admin 2024-04-26 12:53:20.0 admin 2024-04-26 12:53:20.0 _PRIMARY_
18 eaa53a70-abca-4f75-a4a9-e57fc406b5a4 YEAR 2022 1204724.000000 INPUT admin 2024-04-26 12:57:17.0 admin 2024-04-26 12:57:17.0 _PRIMARY_

8
io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_target.csv

@ -1,8 +0,0 @@
"ST_TARGET",,,,,,,,,,
"ID_","CODE_","NAME_","DESCRIPTION_","JPA_VERSION_","DATA_COME_FROM_","CREATOR_","CREATE_DATE_","LAST_MODIFIER_","LAST_MODIFYDATE_","CORP_CODE_"
"ID_","代码","名称","描述","JPA乐观锁版本","数据来源(INPUT:手工录入,IMPORT:系统自动导入)","创建人","创建日期","最后修改人","最后修改日期","所属法人代码"
"VARCHAR","VARCHAR","VARCHAR","VARCHAR","INTEGER","VARCHAR","VARCHAR","TIMESTAMP","VARCHAR","TIMESTAMP","VARCHAR"
"java.lang.String","java.lang.String","java.lang.String","java.lang.String","java.lang.Integer","java.lang.String","java.lang.String","java.sql.Timestamp","java.lang.String","java.sql.Timestamp","java.lang.String"
"27e0cc07-8098-4319-a7e6-0d3f1810ba41","CR","合格循环零售",,,"INPUT","admin","2024-04-26 16:08:22.0","admin","2024-04-26 16:08:22.0","_PRIMARY_"
"493611f2-06b9-4965-be72-9c285ba24ef7","PHML","个人住房抵押贷款",,,"INPUT","admin","2024-04-26 16:07:17.0","admin","2024-04-26 16:07:17.0","_PRIMARY_"
"660745d0-b106-45ce-a2d1-737159febddb","OR","其他零售",,,"INPUT","admin","2024-04-26 16:07:38.0","admin","2024-04-26 16:07:38.0","_PRIMARY_"
1 ST_TARGET
2 ID_ CODE_ NAME_ DESCRIPTION_ JPA_VERSION_ DATA_COME_FROM_ CREATOR_ CREATE_DATE_ LAST_MODIFIER_ LAST_MODIFYDATE_ CORP_CODE_
3 ID_ 代码 名称 描述 JPA乐观锁版本 数据来源(INPUT:手工录入,IMPORT:系统自动导入) 创建人 创建日期 最后修改人 最后修改日期 所属法人代码
4 VARCHAR VARCHAR VARCHAR VARCHAR INTEGER VARCHAR VARCHAR TIMESTAMP VARCHAR TIMESTAMP VARCHAR
5 java.lang.String java.lang.String java.lang.String java.lang.String java.lang.Integer java.lang.String java.lang.String java.sql.Timestamp java.lang.String java.sql.Timestamp java.lang.String
6 27e0cc07-8098-4319-a7e6-0d3f1810ba41 CR 合格循环零售 INPUT admin 2024-04-26 16:08:22.0 admin 2024-04-26 16:08:22.0 _PRIMARY_
7 493611f2-06b9-4965-be72-9c285ba24ef7 PHML 个人住房抵押贷款 INPUT admin 2024-04-26 16:07:17.0 admin 2024-04-26 16:07:17.0 _PRIMARY_
8 660745d0-b106-45ce-a2d1-737159febddb OR 其他零售 INPUT admin 2024-04-26 16:07:38.0 admin 2024-04-26 16:07:38.0 _PRIMARY_

16
io.sc.platform.core.frontend/src/routes/routes.json

@ -9,7 +9,21 @@
"redirect": null, "redirect": null,
"meta": { "meta": {
"permissions": ["/testcase/formElements/**/*"] "permissions": ["/testcase/formElements/**/*"]
} },
"children":[
{
"name": "route.testcase.likm.xxx",
"path": "testcase/likm/xxx",
"parent": "/",
"priority": 0,
"component": "component.testcase.xxx",
"componentPath": "@/views/likm/xxx.vue",
"redirect": null,
"meta": {
"permissions": ["/testcase/treeGrid/**/*"]
}
}
]
}, },
{ {

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

@ -1,6 +1,6 @@
{ {
"name": "platform-core", "name": "platform-core",
"version": "8.1.196", "version": "8.1.199",
"description": "前端核心包,用于快速构建前端的脚手架", "description": "前端核心包,用于快速构建前端的脚手架",
"private": false, "private": false,
"keywords": [], "keywords": [],
@ -93,7 +93,7 @@
"luckyexcel": "1.0.1", "luckyexcel": "1.0.1",
"mockjs": "1.1.0", "mockjs": "1.1.0",
"pinia": "2.1.7", "pinia": "2.1.7",
"platform-core": "8.1.196", "platform-core": "8.1.199",
"quasar": "2.15.3", "quasar": "2.15.3",
"tailwindcss": "3.4.3", "tailwindcss": "3.4.3",
"vue": "3.4.24", "vue": "3.4.24",

18
io.sc.platform.core.frontend/template-project/src/routes/routes.json

@ -5,11 +5,25 @@
"parent": "/", "parent": "/",
"priority": 0, "priority": 0,
"component": "component.testcase.formElements", "component": "component.testcase.formElements",
"componentPath": "@/views/Standard.vue", "componentPath": "@/views/FormElements.vue",
"redirect": null, "redirect": null,
"meta": { "meta": {
"permissions": ["/testcase/formElements/**/*"] "permissions": ["/testcase/formElements/**/*"]
} },
"children":[
{
"name": "route.testcase.likm.xxx",
"path": "testcase/likm/xxx",
"parent": "/",
"priority": 0,
"component": "component.testcase.xxx",
"componentPath": "@/views/likm/xxx.vue",
"redirect": null,
"meta": {
"permissions": ["/testcase/treeGrid/**/*"]
}
}
]
}, },
{ {

2
io.sc.platform.core/src/main/java/io/sc/platform/core/response/ResponseWrapper.java

@ -9,7 +9,7 @@ public class ResponseWrapper {
public static final int SUCCESS_CODE =200; public static final int SUCCESS_CODE =200;
public static final int VALIDATE_ERROR =1001; public static final int VALIDATE_ERROR =1001;
protected int code; protected int code =500;
public int getCode() { public int getCode() {
return code; return code;

8
io.sc.platform.core/src/main/java/io/sc/platform/core/service/SpringExpressionParserService.java

@ -0,0 +1,8 @@
package io.sc.platform.core.service;
import io.sc.platform.core.support.KeyValue;
import org.springframework.expression.Expression;
public interface SpringExpressionParserService {
public <T> T eval(String expression, Class<T> clazz, KeyValue<String,Object>... keyValues);
}

37
io.sc.platform.core/src/main/java/io/sc/platform/core/service/impl/SpringExpressionParserServiceImpl.java

@ -0,0 +1,37 @@
package io.sc.platform.core.service.impl;
import io.sc.platform.core.service.SpringExpressionParserService;
import io.sc.platform.core.support.KeyValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.expression.BeanFactoryResolver;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.stereotype.Service;
@Service
public class SpringExpressionParserServiceImpl implements SpringExpressionParserService {
@Autowired private ApplicationContext applicationContext;
private ExpressionParser parser = new SpelExpressionParser();
@Override
public <T> T eval(String expression, Class<T> clazz, KeyValue<String,Object>... keyValues) {
Expression _expression =parser.parseExpression(expression);
if(_expression==null){
return null;
}
StandardEvaluationContext context = new StandardEvaluationContext();
if(applicationContext!=null) {
context.setBeanResolver(new BeanFactoryResolver(applicationContext));
}
if(keyValues!=null && keyValues.length>0){
for(KeyValue<String,Object> keyValue : keyValues){
context.setVariable(keyValue.getKey(),keyValue.getValue());
}
}
return _expression.getValue(context,clazz);
}
}

26
io.sc.platform.developer.doc/asciidoc/platform-extension/platform-extension.adoc

@ -68,4 +68,28 @@ public class AdministratorInstallerItem implements InstallerItem { <1>
<3> 具体安装时的操作 <3> 具体安装时的操作
=== 添加 SPI 服务实现文件 === 添加 SPI 服务实现文件
image::platform-extension/002.png[,80%] image::platform-extension/002.png[,80%]
== Restful API 返回结果
=== 格式
[source,json]
----
{
"code" : 200, <1>
"messageI18nKey" : "success", <2>
"message" : "success", <3>
"data" : { <4>
}
}
----
<1> 返回状态码, 不同于 http 状态码
<2> 消息多语言消息键
<3> 消息多语言消息
<4> 数据体
=== 返回码说明
|===
| 代码 | 说明 | 示例
| 200 | 成功 |
| 1001 | 数据验证错误 |
|===

1
settings.gradle

@ -5,6 +5,7 @@ include ':com.xxl.job.executor'
include ':erm' include ':erm'
include ':erm.api' include ':erm.api'
include ':erm.frontend' include ':erm.frontend'
include ':io.sc.algorithm.weka'
include ':io.sc.engine.mv' include ':io.sc.engine.mv'
include ':io.sc.engine.mv.frontend' include ':io.sc.engine.mv.frontend'
include ':io.sc.engine.mv.sample' include ':io.sc.engine.mv.sample'

Loading…
Cancel
Save