diff --git a/io.sc.engine.st.frontend/src/routes/routes.json b/io.sc.engine.st.frontend/src/routes/routes.json index 22914894..55bd5401 100644 --- a/io.sc.engine.st.frontend/src/routes/routes.json +++ b/io.sc.engine.st.frontend/src/routes/routes.json @@ -1,46 +1,76 @@ [ { - "name": "route.engine.st.factorManager", - "path": "st/factorManager", + "name": "route.engine.st.indepFactorManager", + "path": "st/indepFactorManager", "parent": "/", "priority": 0, "module": "io.sc.engine.st.frontend", - "component": "component.engine.st.factorManager", - "componentPath": "@/views/FactorManager.vue", + "component": "component.engine.st.indepFactorManager", + "componentPath": "@/views/IndepFactor/Manager.vue", "redirect": null, "meta": { "permissions": [ - "/st/factorManager/**/*" + "/st/indepFactorManager/**/*" ] } }, { - "name": "route.engine.st.target", - "path": "st/target", + "name": "route.engine.st.depFactorManager", + "path": "st/depFactorManager", "parent": "/", "priority": 0, "module": "io.sc.engine.st.frontend", - "component": "component.engine.st.target", - "componentPath": "@/views/Target.vue", + "component": "component.engine.st.depFactorManager", + "componentPath": "@/views/DepFactor/Manager.vue", "redirect": null, "meta": { "permissions": [ - "/st/target/**/*" + "/st/depFactorManager/**/*" ] } }, { - "name": "route.engine.st.ead", - "path": "st/ead", + "name": "route.engine.st.modelManager", + "path": "st/modelManager", "parent": "/", "priority": 0, "module": "io.sc.engine.st.frontend", - "component": "component.engine.st.ead", - "componentPath": "@/views/EAD.vue", + "component": "component.engine.st.modelManager", + "componentPath": "@/views/Model/Manager.vue", "redirect": null, "meta": { "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/**/*" ] } } diff --git a/io.sc.engine.st.frontend/src/views/Scenario.vue b/io.sc.engine.st.frontend/src/views/Scenario.vue deleted file mode 100644 index 2117c8fe..00000000 --- a/io.sc.engine.st.frontend/src/views/Scenario.vue +++ /dev/null @@ -1,167 +0,0 @@ - - diff --git a/io.sc.engine.st.frontend/src/views/Scenario/PercentileDialog.vue b/io.sc.engine.st.frontend/src/views/Scenario/PercentileDialog.vue new file mode 100644 index 00000000..87838ef1 --- /dev/null +++ b/io.sc.engine.st.frontend/src/views/Scenario/PercentileDialog.vue @@ -0,0 +1,74 @@ + + diff --git a/io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactor.vue b/io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactor.vue new file mode 100644 index 00000000..c1187c98 --- /dev/null +++ b/io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactor.vue @@ -0,0 +1,224 @@ + + diff --git a/io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactorDefine.vue b/io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactorDefine.vue new file mode 100644 index 00000000..185ee7dc --- /dev/null +++ b/io.sc.engine.st.frontend/src/views/Scenario/ScenarioFactorDefine.vue @@ -0,0 +1,220 @@ + + diff --git a/io.sc.engine.st.frontend/src/views/Target.vue b/io.sc.engine.st.frontend/src/views/Target.vue deleted file mode 100644 index 43b6bd58..00000000 --- a/io.sc.engine.st.frontend/src/views/Target.vue +++ /dev/null @@ -1,211 +0,0 @@ - - diff --git a/io.sc.engine.st.frontend/src/views/TestCase.vue b/io.sc.engine.st.frontend/src/views/TestCase.vue deleted file mode 100644 index 36b90a51..00000000 --- a/io.sc.engine.st.frontend/src/views/TestCase.vue +++ /dev/null @@ -1,211 +0,0 @@ - - diff --git a/io.sc.engine.st.frontend/src/views/TestCase/TestCase.vue b/io.sc.engine.st.frontend/src/views/TestCase/TestCase.vue new file mode 100644 index 00000000..abf9e5fb --- /dev/null +++ b/io.sc.engine.st.frontend/src/views/TestCase/TestCase.vue @@ -0,0 +1,103 @@ + + diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetIndicatorWebController.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetIndicatorWebController.java deleted file mode 100644 index ab365229..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetIndicatorWebController.java +++ /dev/null @@ -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 { - -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetWebController.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetWebController.java deleted file mode 100644 index c3e173fd..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TargetWebController.java +++ /dev/null @@ -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 { - -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TestCaseWebController.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TestCaseWebController.java index 643a3b7a..edd38973 100644 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/controller/TestCaseWebController.java +++ b/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.vo.TestCaseVo; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController("io.sc.engine.st.controller.TestCaseWebController") @RequestMapping("/api/st/testCase") public class TestCaseWebController extends RestCrudController { - + @PostMapping("test") + public void test(@RequestParam("testCaseId")String testCaseId) throws Exception { + service.test(testCaseId); + } } diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/enums/PeriodType.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/enums/PeriodType.java deleted file mode 100644 index 866f8654..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/enums/PeriodType.java +++ /dev/null @@ -1,11 +0,0 @@ -package io.sc.engine.st.enums; - -/** - * 周期枚举 - */ -public enum PeriodType { - YEAR, //年 - QUARTER, //季度 - MONTH, //月 - DAY; //日 -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/enums/StatisticalPeriodType.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/enums/StatisticalPeriodType.java deleted file mode 100644 index 880c02cf..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/enums/StatisticalPeriodType.java +++ /dev/null @@ -1,10 +0,0 @@ -package io.sc.engine.st.enums; - -/** - * 统计周期类型枚举 - */ -public enum StatisticalPeriodType { - YEAR, //年 - QUARTER, //季度 - MONTH; //月 -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/FactorEntity.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/FactorEntity.java deleted file mode 100644 index 0b2daee4..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/FactorEntity.java +++ /dev/null @@ -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 { - @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; - } -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetEntity.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetEntity.java deleted file mode 100644 index 47c41847..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetEntity.java +++ /dev/null @@ -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 { - @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; - } -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetIndicatorEntity.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetIndicatorEntity.java deleted file mode 100644 index c80c27ba..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TargetIndicatorEntity.java +++ /dev/null @@ -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 { - @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; - } -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TestCaseEntity.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TestCaseEntity.java index 79839205..6bde0ca7 100644 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/entity/TestCaseEntity.java +++ b/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; -import io.sc.engine.st.enums.StatisticalPeriodType; +import io.sc.engine.st.support.PeriodWrapper; import io.sc.engine.st.vo.TestCaseVo; import io.sc.platform.orm.entity.CorporationAuditorEntity; import org.hibernate.annotations.GenericGenerator; @@ -8,7 +8,6 @@ import org.hibernate.annotations.GenericGenerator; import javax.persistence.*; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.util.Date; @Entity(name="io.sc.engine.st.jpa.entity.TestCaseEntity") @Table(name="ST_TEST_CASE") @@ -20,44 +19,28 @@ public class TestCaseEntity extends CorporationAuditorEntity { @Size(max=36) 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) @NotBlank @Size(max=255) protected String name; - @Column(name="DESCRIPTION_", length=255) - @Size(max=255) - protected String description; - - @Column(name="PERIOD_TYPE_") - @Enumerated(EnumType.STRING) - protected StatisticalPeriodType periodType; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "MODEL_ID_") + protected ModelEntity model; @Override public TestCaseVo toVo() { TestCaseVo vo =new TestCaseVo(); super.toVo(vo); vo.setId(this.getId()); - vo.setStartDate(this.getStartDate()); - vo.setEndDate(this.getEndDate()); vo.setName(this.getName()); - vo.setDescription(this.getDescription()); - vo.setPeriodType(this.getPeriodType()); + vo.setModel(this.getModel()==null?null:this.getModel().getId()); return vo; } public TestCaseEntity(){} - - public TestCaseEntity(String id) { - this.id = id; + public TestCaseEntity(String id){ + this.id =id; } public String getId() { @@ -68,22 +51,6 @@ public class TestCaseEntity extends CorporationAuditorEntity { 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() { return name; } @@ -92,19 +59,11 @@ public class TestCaseEntity extends CorporationAuditorEntity { this.name = name; } - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public StatisticalPeriodType getPeriodType() { - return periodType; + public ModelEntity getModel() { + return model; } - public void setPeriodType(StatisticalPeriodType periodType) { - this.periodType = periodType; + public void setModel(ModelEntity model) { + this.model = model; } } diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetIndicatorRepository.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetIndicatorRepository.java deleted file mode 100644 index fe628aa6..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetIndicatorRepository.java +++ /dev/null @@ -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{ - -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetRepository.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetRepository.java deleted file mode 100644 index 774063df..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/jpa/repository/TargetRepository.java +++ /dev/null @@ -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{ - -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetIndicatorService.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetIndicatorService.java deleted file mode 100644 index 78ee8f38..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetIndicatorService.java +++ /dev/null @@ -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{ -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetService.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetService.java deleted file mode 100644 index e4cf450e..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TargetService.java +++ /dev/null @@ -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{ -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TestCaseService.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TestCaseService.java index 4c59f984..ae324228 100644 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/TestCaseService.java +++ b/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.repository.TestCaseRepository; import io.sc.platform.orm.service.DaoService; +import org.springframework.web.bind.annotation.RequestParam; public interface TestCaseService extends DaoService{ + public void test(String testCaseId) throws Exception; } diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetIndicatorServiceImpl.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetIndicatorServiceImpl.java deleted file mode 100644 index ea103092..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetIndicatorServiceImpl.java +++ /dev/null @@ -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 implements TargetIndicatorService { - -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetServiceImpl.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetServiceImpl.java deleted file mode 100644 index adece80d..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TargetServiceImpl.java +++ /dev/null @@ -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 implements TargetService { - -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TestCaseServiceImpl.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TestCaseServiceImpl.java index 5a530468..a9c03353 100644 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/service/impl/TestCaseServiceImpl.java +++ b/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; -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.service.ScenarioFactorService; 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.util.EntityVoUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; 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") public class TestCaseServiceImpl extends DaoServiceImpl 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 factorDefineEntities = modelEntity.getIndepFactorDefines(); + DepFactorDefineVo depFactorDefineVo = modelEntity.getDepFactorDefine().toVo(); + if(factorDefineEntities!=null && !factorDefineEntities.isEmpty()){ + Map> lowRecords =new TreeMap<>(PeriodWrapper.comparator); + Map> midRecords =new TreeMap<>(PeriodWrapper.comparator); + Map> highRecords =new TreeMap<>(PeriodWrapper.comparator); + for(IndepFactorDefineEntity entity : factorDefineEntities){ + List vos =scenarioFactorService.findByFactorDefineId(entity.getId()); + if(vos!=null && !vos.isEmpty()){ + for(ScenarioFactorVo vo : vos){ + Map lowRecord =lowRecords.get(vo.calUniqueKey()); + if(lowRecord==null){ + lowRecord =new HashMap<>(); + lowRecords.put(vo.calUniqueKey(),lowRecord); + } + lowRecord.put(entity.getCode(),vo.getValueLow()); + + Map midRecord =midRecords.get(vo.calUniqueKey()); + if(midRecord==null){ + midRecord =new HashMap<>(); + midRecords.put(vo.calUniqueKey(),midRecord); + } + midRecord.put(entity.getCode(),vo.getValueMid()); + + Map 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 testResultEntities =new ArrayList<>(); + for(PeriodWrapper key : lowRecords.keySet()){ + Map lowRecord =lowRecords.get(key); + Map lowContext =new HashMap<>(); + for(String var : lowRecord.keySet()) { + lowContext.put(var,new BigDecimal(lowRecord.get(var).toString())); + } + + Map midRecord =midRecords.get(key); + Map midContext =new HashMap<>(); + for(String var : midRecord.keySet()) { + midContext.put(var,new BigDecimal(midRecord.get(var).toString())); + } + + Map highRecord =highRecords.get(key); + Map 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); + } + } + } + } + } } diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetIndicatorVo.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetIndicatorVo.java deleted file mode 100644 index 879d57db..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetIndicatorVo.java +++ /dev/null @@ -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; - } -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetVo.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetVo.java deleted file mode 100644 index c187456d..00000000 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TargetVo.java +++ /dev/null @@ -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; - } - -} diff --git a/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TestCaseVo.java b/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TestCaseVo.java index e36a1e3f..c7866eac 100644 --- a/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TestCaseVo.java +++ b/io.sc.engine.st/src/main/java/io/sc/engine/st/vo/TestCaseVo.java @@ -1,20 +1,12 @@ 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 javax.persistence.Column; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import java.util.Date; - public class TestCaseVo extends CorporationAuditorVo { protected String id; - protected Date startDate; - protected Date endDate; protected String name; - protected String description; - protected StatisticalPeriodType periodType; + protected String model; public String getId() { return id; @@ -24,22 +16,6 @@ public class TestCaseVo extends CorporationAuditorVo { 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() { return name; } @@ -48,19 +24,11 @@ public class TestCaseVo extends CorporationAuditorVo { this.name = name; } - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public StatisticalPeriodType getPeriodType() { - return periodType; + public String getModel() { + return model; } - public void setPeriodType(StatisticalPeriodType periodType) { - this.periodType = periodType; + public void setModel(String model) { + this.model = model; } } diff --git a/io.sc.engine.st/src/main/resources/META-INF/platform/plugins/repositories.json b/io.sc.engine.st/src/main/resources/META-INF/platform/plugins/repositories.json index a2aa215c..1080b0ff 100644 --- a/io.sc.engine.st/src/main/resources/META-INF/platform/plugins/repositories.json +++ b/io.sc.engine.st/src/main/resources/META-INF/platform/plugins/repositories.json @@ -10,6 +10,7 @@ { "includes":[ "io.sc.engine.st.jpa.entity", + "io.sc.engine.st.jpa.entity.sub", "io.sc.engine.st.jpa.repository" ], "excludes":[] diff --git a/io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_economic_indicator.csv b/io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_economic_indicator.csv deleted file mode 100644 index b51cc5d6..00000000 --- a/io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_economic_indicator.csv +++ /dev/null @@ -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_" diff --git a/io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_target.csv b/io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_target.csv deleted file mode 100644 index d1d6aaa0..00000000 --- a/io.sc.engine.st/src/main/resources/io/sc/engine/st/liquibase/data/st_target.csv +++ /dev/null @@ -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_" diff --git a/io.sc.platform.core.frontend/src/routes/routes.json b/io.sc.platform.core.frontend/src/routes/routes.json index 6d5af58e..2a2eef80 100644 --- a/io.sc.platform.core.frontend/src/routes/routes.json +++ b/io.sc.platform.core.frontend/src/routes/routes.json @@ -9,7 +9,21 @@ "redirect": null, "meta": { "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/**/*"] + } + } + ] }, { diff --git a/io.sc.platform.core.frontend/template-project/package.json b/io.sc.platform.core.frontend/template-project/package.json index aaec24f5..6aaa7554 100644 --- a/io.sc.platform.core.frontend/template-project/package.json +++ b/io.sc.platform.core.frontend/template-project/package.json @@ -1,6 +1,6 @@ { "name": "platform-core", - "version": "8.1.196", + "version": "8.1.199", "description": "前端核心包,用于快速构建前端的脚手架", "private": false, "keywords": [], @@ -93,7 +93,7 @@ "luckyexcel": "1.0.1", "mockjs": "1.1.0", "pinia": "2.1.7", - "platform-core": "8.1.196", + "platform-core": "8.1.199", "quasar": "2.15.3", "tailwindcss": "3.4.3", "vue": "3.4.24", diff --git a/io.sc.platform.core.frontend/template-project/src/routes/routes.json b/io.sc.platform.core.frontend/template-project/src/routes/routes.json index b2ec8bee..2a2eef80 100644 --- a/io.sc.platform.core.frontend/template-project/src/routes/routes.json +++ b/io.sc.platform.core.frontend/template-project/src/routes/routes.json @@ -5,11 +5,25 @@ "parent": "/", "priority": 0, "component": "component.testcase.formElements", - "componentPath": "@/views/Standard.vue", + "componentPath": "@/views/FormElements.vue", "redirect": null, "meta": { "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/**/*"] + } + } + ] }, { diff --git a/io.sc.platform.core/src/main/java/io/sc/platform/core/response/ResponseWrapper.java b/io.sc.platform.core/src/main/java/io/sc/platform/core/response/ResponseWrapper.java index c4fb90be..13ae516a 100644 --- a/io.sc.platform.core/src/main/java/io/sc/platform/core/response/ResponseWrapper.java +++ b/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 VALIDATE_ERROR =1001; - protected int code; + protected int code =500; public int getCode() { return code; diff --git a/io.sc.platform.core/src/main/java/io/sc/platform/core/service/SpringExpressionParserService.java b/io.sc.platform.core/src/main/java/io/sc/platform/core/service/SpringExpressionParserService.java new file mode 100644 index 00000000..7eb8583e --- /dev/null +++ b/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 eval(String expression, Class clazz, KeyValue... keyValues); +} diff --git a/io.sc.platform.core/src/main/java/io/sc/platform/core/service/impl/SpringExpressionParserServiceImpl.java b/io.sc.platform.core/src/main/java/io/sc/platform/core/service/impl/SpringExpressionParserServiceImpl.java new file mode 100644 index 00000000..b4831b9d --- /dev/null +++ b/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 eval(String expression, Class clazz, KeyValue... 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 keyValue : keyValues){ + context.setVariable(keyValue.getKey(),keyValue.getValue()); + } + } + return _expression.getValue(context,clazz); + } +} diff --git a/io.sc.platform.developer.doc/asciidoc/platform-extension/platform-extension.adoc b/io.sc.platform.developer.doc/asciidoc/platform-extension/platform-extension.adoc index 04da3f33..37e6ace2 100644 --- a/io.sc.platform.developer.doc/asciidoc/platform-extension/platform-extension.adoc +++ b/io.sc.platform.developer.doc/asciidoc/platform-extension/platform-extension.adoc @@ -68,4 +68,28 @@ public class AdministratorInstallerItem implements InstallerItem { <1> <3> 具体安装时的操作 === 添加 SPI 服务实现文件 -image::platform-extension/002.png[,80%] \ No newline at end of file +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 | 数据验证错误 | +|=== \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 5cdf0df7..491f7134 100755 --- a/settings.gradle +++ b/settings.gradle @@ -5,6 +5,7 @@ include ':com.xxl.job.executor' include ':erm' include ':erm.api' include ':erm.frontend' +include ':io.sc.algorithm.weka' include ':io.sc.engine.mv' include ':io.sc.engine.mv.frontend' include ':io.sc.engine.mv.sample'