From a5cdbf569067822e3232d2177b8a9aac1ed95b69 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 29 五月 2024 17:32:00 +0800 Subject: [PATCH] 1. 修改自评逻辑中,问题整改的判断方式为已整改并且整改审核通过; 2. 新增评估详情获取接口; --- src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JAScore.kt | 2 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt | 2 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt | 7 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt | 31 +- src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrlTest.kt | 11 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem8.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/storage/StScoreItem1.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem1.kt | 3 pom.xml | 153 ++++++----- src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt | 14 /dev/null | 21 - src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt | 1 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt | 168 +++++++++++++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt | 104 +------- src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt | 22 - src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt | 2 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt | 27 ++ src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrl.kt | 4 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem1.kt | 3 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem1.kt | 3 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreVo.kt | 2 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt | 105 ++++++-- 22 files changed, 421 insertions(+), 270 deletions(-) diff --git a/pom.xml b/pom.xml index 531cf5e..b4fd6e9 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> -<!-- <kotlin.version>1.5.0</kotlin.version>--> + <!-- <kotlin.version>1.5.0</kotlin.version>--> <kotlin.version>1.4.32</kotlin.version> <!-- tk.mybatis --> <mapper.plugin>tk.mybatis.mapper.generator.MapperPlugin</mapper.plugin> @@ -32,6 +32,17 @@ </properties> <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-quartz</artifactId> + <exclusions> + <exclusion> + <artifactId>spring-boot-starter-logging</artifactId> + <groupId>org.springframework.boot</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId> @@ -84,9 +95,9 @@ <scope>runtime</scope> </dependency> <!--<dependency>--> - <!--<groupId>org.springframework.boot</groupId>--> - <!--<artifactId>spring-boot-starter-tomcat</artifactId>--> - <!--<scope>provided</scope>--> + <!--<groupId>org.springframework.boot</groupId>--> + <!--<artifactId>spring-boot-starter-tomcat</artifactId>--> + <!--<scope>provided</scope>--> <!--</dependency>--> <dependency> <groupId>org.springframework.boot</groupId> @@ -121,9 +132,9 @@ <!-- https://mvnrepository.com/artifact/com.alibaba/druid --> <dependency> - <groupId>com.alibaba</groupId> - <artifactId>druid</artifactId> - <version>1.1.6</version> + <groupId>com.alibaba</groupId> + <artifactId>druid</artifactId> + <version>1.1.6</version> </dependency> <!-- https://mvnrepository.com/artifact/net.coobird/thumbnailator --> @@ -158,17 +169,17 @@ <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-typehandlers-jsr310 --> <!--<dependency>--> - <!--<groupId>org.mybatis</groupId>--> - <!--<artifactId>mybatis-typehandlers-jsr310</artifactId>--> - <!--<version>1.0.2</version>--> + <!--<groupId>org.mybatis</groupId>--> + <!--<artifactId>mybatis-typehandlers-jsr310</artifactId>--> + <!--<version>1.0.2</version>--> <!--</dependency>--> <!--<!– https://mvnrepository.com/artifact/org.docx4j/docx4j-ImportXHTML –>--> <!--<dependency>--> - <!--<groupId>org.docx4j</groupId>--> - <!--<artifactId>docx4j-ImportXHTML</artifactId>--> - <!--<version>3.3.6</version>--> + <!--<groupId>org.docx4j</groupId>--> + <!--<artifactId>docx4j-ImportXHTML</artifactId>--> + <!--<version>3.3.6</version>--> <!--</dependency>--> <!--mapper--> @@ -240,18 +251,18 @@ </dependency> <!--<dependency>--> - <!--<groupId>com.alibaba</groupId>--> - <!--<artifactId>druid-spring-boot-starter</artifactId>--> - <!--<version>1.1.6</version>--> + <!--<groupId>com.alibaba</groupId>--> + <!--<artifactId>druid-spring-boot-starter</artifactId>--> + <!--<version>1.1.6</version>--> <!--</dependency>--> <!-- https://mvnrepository.com/artifact/junit/junit --> -<!-- <dependency>--> -<!-- <groupId>junit</groupId>--> -<!-- <artifactId>junit</artifactId>--> -<!-- <version>4.12</version>--> -<!-- <scope>test</scope>--> -<!-- </dependency>--> + <!-- <dependency>--> + <!-- <groupId>junit</groupId>--> + <!-- <artifactId>junit</artifactId>--> + <!-- <version>4.12</version>--> + <!-- <scope>test</scope>--> + <!-- </dependency>--> <!-- https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-test-junit --> <dependency> @@ -299,16 +310,16 @@ <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 --> <!--<dependency>--> - <!--<groupId>io.springfox</groupId>--> - <!--<artifactId>springfox-swagger2</artifactId>--> - <!--<version>2.8.0</version>--> + <!--<groupId>io.springfox</groupId>--> + <!--<artifactId>springfox-swagger2</artifactId>--> + <!--<version>2.8.0</version>--> <!--</dependency>--> <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui --> <!--<dependency>--> - <!--<groupId>io.springfox</groupId>--> - <!--<artifactId>springfox-swagger-ui</artifactId>--> - <!--<version>2.8.0</version>--> + <!--<groupId>io.springfox</groupId>--> + <!--<artifactId>springfox-swagger-ui</artifactId>--> + <!--<version>2.8.0</version>--> <!--</dependency>--> <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> @@ -347,30 +358,30 @@ <testSourceDirectory>src/test/kotlin</testSourceDirectory> <plugins> -<!-- <plugin>--> -<!-- <groupId>org.springframework.boot</groupId>--> -<!-- <artifactId>spring-boot-maven-plugin</artifactId>--> -<!-- </plugin>--> + <!-- <plugin>--> + <!-- <groupId>org.springframework.boot</groupId>--> + <!-- <artifactId>spring-boot-maven-plugin</artifactId>--> + <!-- </plugin>--> <plugin> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-plugin</artifactId> -<!-- <version>${kotlin.version}</version>--> -<!-- <executions>--> -<!-- <execution>--> -<!-- <id>compile</id>--> -<!-- <phase>compile</phase>--> -<!-- <goals>--> -<!-- <goal>compile</goal>--> -<!-- </goals>--> -<!-- </execution>--> -<!-- <execution>--> -<!-- <id>test-compile</id>--> -<!-- <phase>test-compile</phase>--> -<!-- <goals>--> -<!-- <goal>test-compile</goal>--> -<!-- </goals>--> -<!-- </execution>--> -<!-- </executions>--> + <!-- <version>${kotlin.version}</version>--> + <!-- <executions>--> + <!-- <execution>--> + <!-- <id>compile</id>--> + <!-- <phase>compile</phase>--> + <!-- <goals>--> + <!-- <goal>compile</goal>--> + <!-- </goals>--> + <!-- </execution>--> + <!-- <execution>--> + <!-- <id>test-compile</id>--> + <!-- <phase>test-compile</phase>--> + <!-- <goals>--> + <!-- <goal>test-compile</goal>--> + <!-- </goals>--> + <!-- </execution>--> + <!-- </executions>--> <configuration> <args> <arg>-Xjsr305=strict</arg> @@ -427,7 +438,7 @@ <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.2</version> <configuration> -<!-- <configurationFile>src/main/resources/generator/generatorConfig4ds1.xml</configurationFile>--> + <!-- <configurationFile>src/main/resources/generator/generatorConfig4ds1.xml</configurationFile>--> <configurationFile>src/main/resources/generator/generatorConfig4ds3.xml</configurationFile> <overwrite>true</overwrite> <verbose>true</verbose> @@ -441,34 +452,34 @@ </dependency> </dependencies> </plugin> -<!-- <plugin>--> -<!-- <groupId>org.apache.maven.plugins</groupId>--> -<!-- <artifactId>maven-resources-plugin</artifactId>--> -<!-- <configuration>--> -<!-- <delimiters>@</delimiters>--> -<!-- <useDefaultDelimiters>false</useDefaultDelimiters>--> -<!-- </configuration>--> -<!-- </plugin>--> + <!-- <plugin>--> + <!-- <groupId>org.apache.maven.plugins</groupId>--> + <!-- <artifactId>maven-resources-plugin</artifactId>--> + <!-- <configuration>--> + <!-- <delimiters>@</delimiters>--> + <!-- <useDefaultDelimiters>false</useDefaultDelimiters>--> + <!-- </configuration>--> + <!-- </plugin>--> </plugins> <resources> <resource> <filtering>true</filtering> <directory>src/main/resources</directory> -<!-- <excludes>--> -<!-- <exclude>application-dev.yml</exclude>--> -<!-- <exclude>application-pro.yml</exclude>--> -<!-- <exclude>application.yml</exclude>--> -<!-- </excludes>--> + <!-- <excludes>--> + <!-- <exclude>application-dev.yml</exclude>--> + <!-- <exclude>application-pro.yml</exclude>--> + <!-- <exclude>application.yml</exclude>--> + <!-- </excludes>--> </resource> -<!-- <resource>--> -<!-- <filtering>true</filtering>--> -<!-- <directory>src/main/resources</directory>--> -<!-- <includes>--> -<!-- <include>application-${profileActive}.yml</include>--> -<!-- <include>application.yml</include>--> -<!-- </includes>--> -<!-- </resource>--> + <!-- <resource>--> + <!-- <filtering>true</filtering>--> + <!-- <directory>src/main/resources</directory>--> + <!-- <includes>--> + <!-- <include>application-${profileActive}.yml</include>--> + <!-- <include>application.yml</include>--> + <!-- </includes>--> + <!-- </resource>--> </resources> </build> diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt index b4f9b26..4f36d06 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt @@ -25,7 +25,7 @@ private val fumeSiteMapMapper: FumeSiteMapMapper, private val fumeDailyAnalysisMapper: FumeDailyAnalysisMapper, private val fumeExceptionDataMapper: FumeExceptionDataMapper, -): AopDataAnalysis<FumeDailyAnalysis>(aopDbMapper, aopSceneTypeCheck, aopOutput) { +) : AopDataAnalysis<FumeDailyAnalysis>(aopDbMapper, aopSceneTypeCheck, aopOutput) { // 娌圭儫鏁版嵁鏆傛棤鍖哄潎鍊肩殑璁$畻 override fun districtAvg(source: AopDataSource?): Double? { @@ -45,7 +45,11 @@ val map = mutableMapOf<String?, MutableList<FumeDailyAnalysis?>>() fumeDailyAnalysisMapper.selectByExample(Example(FumeDailyAnalysis::class.java).apply { createCriteria().andBetween("fumeDate", evaluationScene.config?.startTime, evaluationScene.config?.endTime) - .andIn("fumeDevId", deviceCodeList) + .apply { + if (deviceCodeList.isNotEmpty()) { + andIn("fumeDevId", deviceCodeList) + } + } }).forEach { if (!map.containsKey(it?.fumeDevId)) { map[it?.fumeDevId] = mutableListOf() @@ -66,7 +70,9 @@ } else { val code = deviceCodeList[0] fumeExceptionDataMapper.selectByExample(Example(FumeExceptionData::class.java).apply { - createCriteria().andBetween("beginTime", evaluationScene.config?.startTime, evaluationScene.config?.endTime) + createCriteria().andBetween("beginTime", + evaluationScene.config?.startTime, + evaluationScene.config?.endTime) .andEqualTo("devId", code) .andEqualTo("exception", "鏁版嵁寮傚父") .andEqualTo("exceptionType", "0") @@ -122,7 +128,7 @@ ): Double { var total = .0 var count = 0 - dataList.forEach {list -> + dataList.forEach { list -> list.forEach { val noon = it?.noonOnlineRate?.removeSuffix("%")?.toDouble()?.div(100) val night = it?.nightOnlineRate?.removeSuffix("%")?.toDouble()?.div(100) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem1.kt index 4f6bbeb..f81cec0 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem1.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem1.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.business.autooutput.score.construction import cn.flightfeather.supervision.business.autooutput.score.ScoreItem +import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example @@ -44,7 +45,7 @@ val total = p.size var changed = 0 p.forEach { - if (it.ischanged == true) { + if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) { changed++ } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JAScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JAScore.kt index def18ff..87752c3 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JAScore.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JAScore.kt @@ -48,7 +48,7 @@ */ private fun transform(oldS: Int): Int { return when { - // 鍩烘湰瑙勮寖 + // 鍩烘湰瑙勮寖(90..94)鍜岃鑼冿紙>=95锛� oldS >= 90 -> 50 // 涓嶈鑼� oldS >= 50 -> 30 diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem1.kt index 8cf3d74..c8442cf 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem1.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem1.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.business.autooutput.score.mixingplant import cn.flightfeather.supervision.business.autooutput.score.ScoreItem +import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example @@ -44,7 +45,7 @@ val total = p.size var changed = 0 p.forEach { - if (it.ischanged == true) { + if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) { changed++ } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem8.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem8.kt index da462ef..b5abf84 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem8.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem8.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.business.autooutput.score.restaurant import cn.flightfeather.supervision.business.autooutput.score.ScoreItem +import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example @@ -44,7 +45,7 @@ val total = p.size var changed = 0 p.forEach { - if (it.ischanged == true) { + if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) { changed++ } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/storage/StScoreItem1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/storage/StScoreItem1.kt index 0451cba..ab63041 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/storage/StScoreItem1.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/storage/StScoreItem1.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.business.autooutput.score.storage import cn.flightfeather.supervision.business.autooutput.score.ScoreItem +import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example @@ -44,7 +45,7 @@ val total = p.size var changed = 0 p.forEach { - if (it.ischanged == true) { + if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) { changed++ } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem1.kt index 1597a98..dee972b 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem1.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem1.kt @@ -1,6 +1,7 @@ package cn.flightfeather.supervision.business.autooutput.score.wharf import cn.flightfeather.supervision.business.autooutput.score.ScoreItem +import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.Problemlist import org.springframework.stereotype.Component import tk.mybatis.mapper.entity.Example @@ -44,7 +45,7 @@ val total = p.size var changed = 0 p.forEach { - if (it.ischanged == true) { + if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) { changed++ } } diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JingAnScoreTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrl.kt similarity index 93% rename from src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JingAnScoreTaskCtrl.kt rename to src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrl.kt index 56a0f47..c90fc0d 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JingAnScoreTaskCtrl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrl.kt @@ -11,7 +11,7 @@ * 闈欏畨鍖�50鍒嗗埗璇勫垎杞崲浠诲姟 */ @Component -class JingAnScoreTaskCtrl( +class JinAnScoreTaskCtrl( private val backgroundTaskCtrl: BackgroundTaskCtrl, private val jaScore: JAScore, private val evaluationRep: EvaluationRep @@ -20,7 +20,7 @@ /** * 闈欏畨宸ュ湴鍒嗘暟杞崲浠诲姟 */ - fun startTaskJingAn(startTime: LocalDateTime) { + fun startTaskJinAn(startTime: LocalDateTime) { startTask("31", "3100", "310106", startTime) } diff --git a/src/main/kotlin/cn/flightfeather/supervision/datasource/TestBean.kt b/src/main/kotlin/cn/flightfeather/supervision/datasource/TestBean.kt deleted file mode 100644 index b596a6b..0000000 --- a/src/main/kotlin/cn/flightfeather/supervision/datasource/TestBean.kt +++ /dev/null @@ -1,21 +0,0 @@ -package cn.flightfeather.supervision.datasource - -data class TestBean(var datasource: String? = null, - var type: String? = null, - var driverClassName: String? = null, - var username: String? = null, - var password: String? = null, - var initialSize: Int? = null, - var minIdle: Int? = null, - var maxWait: Long? = null, - var timeBetweenEvictionRunsMillis: Long? = null, - var minEvictableIdleTimeMillis: Long? = null, - var validationQuery: String? = null, - var testWhileIdle: Boolean? = true, - var testOnBorrow: Boolean? = true, - var testOnReturn: Boolean? = true, - var poolPreparedStatements: Boolean? = true, - var maxPoolPreparedStatementPerConnectionSize: Int? = null, - var filters: String? = null, - var connectionProperties: String? = null, - var useGlobalDataSourceStat: Boolean? = true) \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt index dd40759..21704a3 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt @@ -2,7 +2,9 @@ import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule +import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper +import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper2 import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo import org.springframework.stereotype.Repository import tk.mybatis.mapper.entity.Example @@ -13,12 +15,14 @@ @Repository class EvaluationRuleRep( private val evaluationruleMapper: EvaluationruleMapper, + private val evaluationsubruleMapper2: EvaluationsubruleMapper2, private val sceneRep: SceneRep, ) { /** * 鏍规嵁鍙傛暟鏌ヨ鎬昏鍒� * @param areaEvaVo 鏌ヨ鍙傛暟 + * @return */ fun findBaseRule(areaEvaVo: AreaEvaVo): List<Evaluationrule?> { return evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { @@ -32,11 +36,22 @@ }) } + /** + * 鏍规嵁宸℃煡浠诲姟id鎵惧埌瀵瑰簲鑷姩璇勪及瑙勫垯 + * @param subTaskId + * @return + */ fun findAutoEvaluationRule(subTaskId:String): Evaluationrule? { val scene = sceneRep.findBySubTask(subTaskId) return findAutoEvaluationRule(Constant.SceneType.getByValue(scene?.typeid.toString())) } + /** + * 鏍规嵁鍦烘櫙绫诲瀷鎵惧埌鑷姩璇勪及瑙勫垯 + * 鑷姩璇勪及瑙勫垯鍙傛暟[Evaluationrule.tasktypeid] = 99 + * @param sceneType + * @return + */ fun findAutoEvaluationRule(sceneType: Constant.SceneType): Evaluationrule? { return evaluationruleMapper.selectOne(Evaluationrule().apply { scensetypeid = sceneType.value.toByteOrNull() @@ -44,4 +59,16 @@ }) } + /** + * 鏍规嵁鎬昏鍒檌d鎵惧埌瀛愯鍒� + * @param ruleId + * @return + */ + fun findSubRule(ruleId: String?): List<Evaluationsubrule2> { + return evaluationsubruleMapper2.selectByExample(Example(Evaluationsubrule2::class.java).apply { + createCriteria().andEqualTo("erguid", ruleId) + orderBy("ertype").orderBy("displayid") + }) + } + } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt index 0c4d13e..eb64adf 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt @@ -24,4 +24,6 @@ fun searchSubTaskByKeyword(userId: String, keyword: String, page: Int, perPage: Int): BaseResponse<List<SubtaskVo>> fun getDailyReport(config: ExcelConfigVo): BaseTableVo + + fun getScoreDetail(subTaskId: String): ScoreDetail } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt index 2326646..e9d5732 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt @@ -1,5 +1,6 @@ package cn.flightfeather.supervision.lightshare.service.impl +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.domain.ds1.entity.* import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper @@ -58,12 +59,10 @@ override fun getAutoScore(subTaskId: String): List<EvaluationVo> { //瀛愯鍒欓�愭潯寰楀垎 val subRuleScores = evaluationRep.findItemEvaluation(subTaskId) - //鎬昏鍒檌d - val ruleId = mutableListOf<Evaluation>() //璇勫垎鎬昏鍒� - val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) + val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) ?: throw BizException("鏈壘鍒扮浉鍏宠嚜鍔ㄨ瘎浼拌鍒�") //鎬昏鍒欏搴旂殑璇勫垎瀛愯鍒� - val subRules = mutableListOf<Evaluationsubrule2>() + val subRules = evaluationRuleRep.findSubRule(rule.guid) //鏌ヨ缁撴灉 val resultList = mutableListOf<EvaluationVo>() @@ -72,10 +71,10 @@ when (it.ertype) { 2 -> resultList.add(EvaluationVo().apply { id = it.guid - title1 = it.itemname + title = it.itemname scoreMode = it.extension1 gradeMode = it.extension2 - score = when (gradeMode) { + maxScore = when (gradeMode) { "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 "add_mode" -> it.maxscore ?: 0 else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 @@ -93,7 +92,7 @@ 3 -> { for (r in resultList) { if (it.fatherid == r.id) { - r.sub1.add(SubEvaluationVo().apply { + r.subList.add(SubEvaluationVo().apply { id = it.guid title2 = it.itemname gradeMode = it.extension2 @@ -121,24 +120,24 @@ resultList.forEach{ r -> //4绾х殑璇勪及椤圭洿鎺ラ檮灞炰簬2绾ц瘎浼伴」 if (r.id == it.fatherid) { - if (r.sub1.isEmpty()) { - r.sub1.add(SubEvaluationVo().apply { + if (r.subList.isEmpty()) { + r.subList.add(SubEvaluationVo().apply { placeholder = true id = it.guid - title2 = r.title1 - score = r.score + title2 = r.title + score = r.maxScore gradeMode = r.gradeMode selectMode = r.selectMode group = _group++ }) } - r.sub1[0].sub2.add(ThirdEvaluationVo().apply { + r.subList[0].sub2.add(ThirdEvaluationVo().apply { id = it.guid content = it.itemname - score = when (r.sub1[0].gradeMode) { - "minus_mode" -> r.score.plus(it.maxscore ?: 0) + score = when (r.subList[0].gradeMode) { + "minus_mode" -> r.maxScore.plus(it.maxscore ?: 0) "add_mode" -> it.maxscore ?: 0 - else -> r.score.plus(it.maxscore ?: 0) + else -> r.maxScore.plus(it.maxscore ?: 0) } //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑 for (s in subRuleScores) { @@ -149,7 +148,7 @@ } }) } else { - r.sub1.forEach { sr -> + r.subList.forEach { sr -> if (sr.id == it.fatherid){ sr.sub2.add(ThirdEvaluationVo().apply { id = it.guid diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt index 3322c91..726afa8 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt @@ -434,6 +434,7 @@ override fun createOneScene(scense: Scense) { //1. 鎻掑叆鍦烘櫙琛� + scense.townname = scense.townname?.trim() sceneRep.insert(scense) //2. 鐢熸垚瀵瑰簲璐︽埛淇℃伅 val userInfo = userinfoService.createAccount(scense) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt index 8b0e284..c7be139 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt @@ -6,9 +6,12 @@ import cn.flightfeather.supervision.business.report.file.ReportThree import cn.flightfeather.supervision.business.report.file.ReportTwo import cn.flightfeather.supervision.business.report.template.* +import cn.flightfeather.supervision.common.exception.BizException import cn.flightfeather.supervision.common.utils.* import cn.flightfeather.supervision.domain.ds1.entity.* import cn.flightfeather.supervision.domain.ds1.mapper.* +import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep +import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRuleRep import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper @@ -34,36 +37,38 @@ */ @Service class SearchServiceImpl( - val userinfoMapper: UserinfoMapper, - val subtaskMapper: SubtaskMapper, - val scenseMapper: ScenseMapper, - val sceneConstructionSiteMapper: SceneConstructionSiteMapper, - val sceneMixingPlantMapper: SceneMixingPlantMapper, - val sceneStorageYardMapper: SceneStorageYardMapper, - val sceneWharfMapper: SceneWharfMapper, - val problemlistMapper: ProblemlistMapper, - val problemtypeMapper: ProblemtypeMapper, - val townMapper: TownMapper, - val mediafileMapper: MediafileMapper, - val scoreMapper: ScoreMapper, - val inspectionMapper: InspectionMapper, - val taskMapper: TaskMapper, - val monitorobjectversionMapper: MonitorobjectversionMapper, - val evaluationruleMapper: EvaluationruleMapper, - val evaluationsubruleMapper: EvaluationsubruleMapper2, - val evaluationMapper: EvaluationMapper, - val itemevaluationMapper: ItemevaluationMapper, - val ledgerSubTypeMapper: LedgerSubTypeMapper, - val ledgerRecordMapper: LedgerRecordMapper, - val userMapMapper: UserMapMapper, - val taskService: TaskService, - @Value("\${filePath}") var filePath: String, - @Value("\${imgPath}") var imgPath: String + val userinfoMapper: UserinfoMapper, + val subtaskMapper: SubtaskMapper, + val scenseMapper: ScenseMapper, + val sceneConstructionSiteMapper: SceneConstructionSiteMapper, + val sceneMixingPlantMapper: SceneMixingPlantMapper, + val sceneStorageYardMapper: SceneStorageYardMapper, + val sceneWharfMapper: SceneWharfMapper, + val problemlistMapper: ProblemlistMapper, + val problemtypeMapper: ProblemtypeMapper, + val townMapper: TownMapper, + val mediafileMapper: MediafileMapper, + val scoreMapper: ScoreMapper, + val inspectionMapper: InspectionMapper, + val taskMapper: TaskMapper, + val monitorobjectversionMapper: MonitorobjectversionMapper, + val evaluationruleMapper: EvaluationruleMapper, + val evaluationsubruleMapper: EvaluationsubruleMapper2, + val evaluationMapper: EvaluationMapper, + val itemevaluationMapper: ItemevaluationMapper, + val ledgerSubTypeMapper: LedgerSubTypeMapper, + val ledgerRecordMapper: LedgerRecordMapper, + val userMapMapper: UserMapMapper, + val taskService: TaskService, + private val evaluationRep: EvaluationRep, + private val evaluationRuleRep: EvaluationRuleRep, + @Value("\${filePath}") var filePath: String, + @Value("\${imgPath}") var imgPath: String, ) : SearchService { private val dateUtil = DateUtil() - override fun writeToFile(config: ExcelConfigVo, mode:Int) { + override fun writeToFile(config: ExcelConfigVo, mode: Int) { val dbMapper = DbMapper( scenseMapper, problemlistMapper, @@ -76,7 +81,7 @@ sceneWharfMapper, taskMapper, evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper, - ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper + ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper ) val dataSource = DataSource(config, dbMapper) val t = when (mode) { @@ -252,7 +257,8 @@ //寤虹珛绗竴灞傜洰褰曪紝鍖呭惈鎵�鏈夌殑浠诲姟 val time = dateUtil.DateToString(Date(), "yyyy-MM-dd_HH-mm-ss") - var basePath = Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + "temp" + File.separator + time + var basePath = + Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + "temp" + File.separator + time var file = File(basePath) var i = 1 while (file.exists() && i <= 100) { @@ -303,7 +309,8 @@ mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { createCriteria().andEqualTo("businessguid", p.guid) }).forEach { m -> - val picPath = Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + m.extension1 + m.guid + ".jpg" + val picPath = + Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + m.extension1 + m.guid + ".jpg" val fromFile = File(picPath) val picName = p.problemname + "_" + p.location + "($y).jpg" val toFile = File(pPath + File.separator + picName) @@ -343,7 +350,8 @@ //寤虹珛绗竴灞傜洰褰曪紝鍖呭惈鎵�鏈夌殑浠诲姟 val topTask = taskMapper.selectByPrimaryKey(topTaskId) val time = dateUtil.DateToString(Date(), "yyyy-MM-dd_HH-mm-ss") - val basePath = Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + "temp" + File.separator + topTask.name + val basePath = + Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + "temp" + File.separator + topTask.name val file = File(basePath) if (!file.exists()) { file.mkdirs() @@ -452,7 +460,13 @@ return response } - override fun searchScore4JingAn(token: String, year: Int, month: Int, page: Int?, perPage: Int?): BaseResponse<List<ScoreVo>> { + override fun searchScore4JingAn( + token: String, + year: Int, + month: Int, + page: Int?, + perPage: Int?, + ): BaseResponse<List<ScoreVo>> { if (token != "jingan") { return BaseResponse(false) } @@ -475,7 +489,12 @@ return BaseResponse(true, head = DataHead(p.pageNum, p.pages), data = result) } - override fun searchSubTaskByKeyword(userId: String, keyword: String, page: Int, perPage: Int): BaseResponse<List<SubtaskVo>> { + override fun searchSubTaskByKeyword( + userId: String, + keyword: String, + page: Int, + perPage: Int, + ): BaseResponse<List<SubtaskVo>> { val userInfo = userinfoMapper.selectByPrimaryKey(userId) if (userInfo.usertypeid?.toInt() == 3) return BaseResponse(false, "浼佷笟鐢ㄦ埛鏃犳煡璇㈡潈闄�")//浼佷笟鐢ㄦ埛鏃犳硶鏌ヨ val result = mutableListOf<SubtaskVo>() @@ -517,7 +536,8 @@ evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper, ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper ) - val task = taskService.getByDistrictCode(config.districtCode, config.startTime)?.takeIf { it.isNotEmpty() }?.get(0) + val task = + taskService.getByDistrictCode(config.districtCode, config.startTime)?.takeIf { it.isNotEmpty() }?.get(0) config.topTaskGuid = task?.tguid ?: "" val dataSource = mutableListOf<DataSource>() config.sceneType = Constant.SceneType.TYPE1.value.toInt() @@ -538,4 +558,23 @@ return BaseTableVo(result.first, result.second) } + + override fun getScoreDetail(subTaskId: String): ScoreDetail { + //瀛愯鍒欓�愭潯寰楀垎 + val subRuleScores = evaluationRep.findItemEvaluation(subTaskId) + //璇勫垎鎬昏鍒� + val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) ?: throw BizException("鏈壘鍒扮浉鍏宠嚜鍔ㄨ瘎浼拌鍒�") + //鎬昏鍒欏搴旂殑璇勫垎瀛愯鍒� + val subRules = evaluationRuleRep.findSubRule(rule.guid) + //鏌ヨ缁撴灉 + val result = ScoreDetail() + + subRules.forEach { + it.ertype ?: return@forEach + result.addDetail(result.details, it, it.ertype!! - 1, subRuleScores, true) + } + result.calScore() + + return result + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt index 676a708..dafb0c5 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt @@ -596,89 +596,19 @@ } } - -// val example = Example(Subtask::class.java).apply { -// createCriteria().andEqualTo("districtcode", _districtCode) -// .andGreaterThanOrEqualTo("planstarttime", _startTime) -// .andLessThanOrEqualTo("planendtime", _endTime) -// } -// -// var counts = 0 -// -// val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) -// -// subtaskMapper.selectByExample(example).forEach { s -> -// -// val scene = scenseMapper.selectByPrimaryKey(s.scenseid) -// val inspection = inspectionMapper.selectByExample(Example(Inspection::class.java).apply { -// createCriteria().andEqualTo("stguid", s.stguid) -// }).takeIf { it.isNotEmpty() }?.get(0) -// val evaluation = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { -// createCriteria().andEqualTo("stguid", s.stguid) -// }).takeIf { it.isNotEmpty() }?.get(0) -// -// if (scene.typeid != _sceneType.toByte()) { -// return@forEach -// } else { -// counts++ -// } -// -// -// val subtaskSearchResultVo = SubtaskSearchResultVo().apply { -// this.subTaskId = s.stguid -// this.districtName = scene.districtname -// this.townName = scene.townname -// this.sceneName = scene.name -// this.sceneAddress = scene.location -// this.planStartTime = s.planstarttime -// this.planEndTime = s.planendtime -// this.status = s.status -// this.path= inspection?.extension1 -// this.score = evaluation?.resultscorebef?.toIntOrNull() -// this.level = when { -// score == null -> null -// score!! >= 54 -> "鍚堟牸" -// else -> "涓嶅悎鏍�" -// } -// } -// tempResult.data.add(subtaskSearchResultVo) -// -// problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { -// createCriteria().andEqualTo("stguid", s.stguid) -// }).forEach { p -> -// val problem = ProblemDetail().apply { -// this.problemId = p.guid -// this.problemName = p.problemname -// this.longitude = p.longitude?.toDouble() -// this.latitude = p.latitude?.toDouble() -// this.location = p.location -// this.rectification = p.ischanged -// this.rectificationTime = p.changedtime -// } -// subtaskSearchResultVo.problemList.add(problem) -// -// mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { -// createCriteria().andEqualTo("businessguid", p.guid) -// }).forEach { m -> -// val url = m.extension1 + m.guid + ".jpg" -// if (m.ischanged == true) { -// problem.rectificationPics.add(url) -// } else { -// problem.problemPics.add(url) -// } -// } -// } -// } -// -// tempResult.head = DataHead().apply { -// this.page = p.pageNum -// this.totalPage = p.pages -// } - return result } - override fun searchSubTask2(token: String, updateTime: String?, sceneType: Int?, districtCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<BaseSearchResultVo> { + override fun searchSubTask2( + token: String, + updateTime: String?, + sceneType: Int?, + districtCode: String?, + startTime: String?, + endTime: String?, + page: Int?, + perPage: Int?, + ): BaseResponse<BaseSearchResultVo> { if (token != "jinshan") { return BaseResponse(false, "璇锋眰token閿欒") } @@ -728,13 +658,13 @@ problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { createCriteria().andEqualTo("stguid", s.subTaskId) - .andNotEqualTo("extension3", Constant.PROBLEM_UNCHECKED) - .andNotEqualTo("extension3", Constant.PROBLEM_CHECK_FAIL) - .andNotEqualTo("extension3", Constant.CHANGE_CHECK_FAIL) - .andIsNotNull("extension3") + .andNotEqualTo("extension3", Constant.PROBLEM_UNCHECKED) + .andNotEqualTo("extension3", Constant.PROBLEM_CHECK_FAIL) + .andNotEqualTo("extension3", Constant.CHANGE_CHECK_FAIL) + .andIsNotNull("extension3") time?.let { and(createCriteria().orGreaterThan("time", it) - .orGreaterThan("changedtime", it)) + .orGreaterThan("changedtime", it)) } }).forEach { p -> val problem = ProblemDetail().apply { @@ -798,7 +728,7 @@ // val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30) subtaskMapper.getSubtask2(time, time2, _districtCode, _sceneType?.toByte(), null, null).forEach { if (!subtaskMap.containsKey(it.subTaskId)) { - val vo =SubtaskSearchResultVo() + val vo = SubtaskSearchResultVo() BeanUtils.copyProperties(it, vo) subtaskMap[it.subTaskId] = vo } @@ -808,7 +738,7 @@ problemMap[it.problemId] = problemDetail subtaskMap[it.subTaskId]?.problemList?.add(problemDetail) } - val url = it.mExtension1 + it.mGuid+ ".jpg" + val url = it.mExtension1 + it.mGuid + ".jpg" if (it.isChanged == true) { problemMap[it.problemId]?.rectificationPics?.add(url) } else { diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt index 2cb6d2f..9b20267 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt @@ -116,7 +116,7 @@ scence.let { // 鍒ゆ柇璇ュ満鏅槸鍚﹀凡鏈夊搴旇处鎴� val user = userInfoSVRep.findUser(it.guid) - if (user != null) return Userinfo() + if (user != null) return user val sceneName = it.name ?: return Userinfo() val uName = getUName(sceneName) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt index e3b006b..efd7cec 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt @@ -1,44 +1,203 @@ package cn.flightfeather.supervision.lightshare.vo +import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 +import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation +import com.fasterxml.jackson.annotation.JsonInclude + /** * 璇勫垎瑙勫垯鍙婂緱鍒� */ +@JsonInclude(JsonInclude.Include.NON_NULL) +class ScoreDetail { + // 鎬诲垎 + var totalScore: Int = 0 + + // 寰楀垎 + var score: Int = 0 + + // 寰楀垎缁嗗垯 + var details = mutableListOf<ScoreItem>() + + /** + * 鏂板涓�鏉¤瘎浼拌鍒欒褰� + * 璇勪及瑙勫垯鐨勪紶鍏ユ湁椤哄簭瑕佹眰锛屽繀椤绘槸鎸夌収娴呭眰绾ц嚦娣卞眰绾х殑椤哄簭浼犲叆锛岃瘎浼板眰绾� @see [Evaluationsubrule2.ertype] + * @param details 缁撴灉 + * @param rule 璇勪及瑙勫垯 + * @param level 璇勪及瑙勫垯瀵瑰簲鐨勫眰绾ф繁搴︼紝浠�1寮�濮嬮�掑锛�1涓烘渶椤跺眰 + * @param resList 鍚勬潯瑙勫垯瀵瑰簲鐨勮瘎浼扮粨鏋� + * @param onlyShowSelected 鍙坊鍔犻�変腑鐨勯�夐」 + */ + fun addDetail( + details: MutableList<ScoreItem>, + rule: Evaluationsubrule2, + level: Int, + resList: List<Itemevaluation>, + onlyShowSelected: Boolean = false, + ) { + if (level == 1) { + val scoreItem = ScoreItem.fromRule(rule, resList) + if (onlyShowSelected) { + if (scoreItem.select) details.add(scoreItem) + } else { + details.add(scoreItem) + } + } else if (level > 1) { + var isFind = false + // 鍒ゆ柇鎻掑叆瑙勫垯鏄惁鏄綋鍓嶅眰绾ц瘎浼伴泦鍚堜腑鏌愪竴椤圭殑瀛愯瘎浼� + for (d in details) { + if (rule.fatherid == d.id) { + if (d.subList == null) d.subList = mutableListOf() + addDetail(d.subList!!, rule, 1, resList, onlyShowSelected) + isFind = true + break + } + } + // 鑻ユ湭鎵惧埌锛屽垯寰�涓嬩竴灞傜骇缁х画鏌ユ壘 + if (!isFind && (level - 1 > 1)) { + details.forEach { d -> + d.subList?.let { + addDetail(it, rule, level - 1, resList, onlyShowSelected) + } + } + } + } + } + + /** + * 璁$畻鎬诲垎鍜屽緱鍒� + */ + fun calScore() { + details.forEach { + totalScore += it.maxScore + if (it.gradeMode == "minus_mode") { + score += (it.score + it.maxScore) + } else if (it.gradeMode == "add_mode") { + score += it.score + } + } + } +} + +@JsonInclude(JsonInclude.Include.NON_NULL) +class ScoreItem { + //鎺掑簭绱㈠紩 + var index: Int? = null + + //璇勪及瑙勫垯绾у埆锛�2锛�3锛�4)锛屽�艰秺澶х骇鍒秺浣� + var level: Int? = null + + //瑙勫垯id + var id: String? = null + + //瑙勫垯鎻忚堪 + var title: String? = null + + //鎬诲垎鍊� + var maxScore: Int = 0 + + //瀹為檯寰楀垎 + var score: Int = 0 + + //鏄惁閫変腑 + var select: Boolean = false + + //basic_score: 鍩虹鍒嗭紝蹇呴�夛紱addition_score锛氶檮鍔犲垎锛屽彲閫夛紱null锛氶粯璁ゅ熀纭�鍒� + var scoreMode: String? = null + + //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 + var gradeMode: String? = null + + //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 + var selectMode: String? = null + + //浜岀骇瀛愯鍒� + var subList: MutableList<ScoreItem>? = null + + companion object { + /** + * 鏍规嵁瑙勫垯鍜屽緱鍒嗙粨鏋滅敓鎴愬緱鍒嗛」 + * @param rule + * @param resList + */ + fun fromRule(rule: Evaluationsubrule2, resList: List<Itemevaluation>): ScoreItem { + return ScoreItem().apply { + index = rule.displayid?.toInt() + level = rule.ertype + id = rule.guid + title = rule.itemname + scoreMode = rule.extension1 + gradeMode = rule.extension2 + maxScore = rule.maxscore ?: 0 + selectMode = rule.extension3 + + //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑 + for (s in resList) { + if (rule.guid == s.esrguid) { + score = s.value?.toInt() ?: 0 + select = s.extension1 == "true" + break + } + } + } + } + } +} + +@JsonInclude(JsonInclude.Include.NON_NULL) class EvaluationVo { //瑙勫垯id var id: String? = null + //瑙勫垯鎻忚堪 - var title1: String? = null - //鍒嗗�� + var title: String? = null + + //鎬诲垎鍊� + var maxScore: Int = 0 + + //瀹為檯寰楀垎 var score: Int = 0 + //鏄惁閫変腑 var select: Boolean = false + //basic_score: 鍩虹鍒嗭紝蹇呴�夛紱addition_score锛氶檮鍔犲垎锛屽彲閫夛紱null锛氶粯璁ゅ熀纭�鍒� var scoreMode: String? = "basic_score" + //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 var gradeMode: String? = "minus_mode" + //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯 var selectMode: String? = "single_mode" + //浜岀骇瀛愯鍒� - var sub1: MutableList<SubEvaluationVo> = mutableListOf() + var subList: MutableList<SubEvaluationVo> = mutableListOf() } class SubEvaluationVo { //鏈夋椂鍊欎竴绾х殑瑙勫垯涓嬮潰鐩存帴鏄笁绾ц鍒欙紝娌℃湁浜岀骇瑙勫垯锛屽洜姝ゆ鏃剁殑浜岀骇瑙勫垯鍙槸涓轰簡缁撴瀯瀹屾暣鎬ц�屽嚭鐜扮殑 var placeholder: Boolean = false + //瑙勫垯id var id: String? = null + //瑙勫垯鎻忚堪 var title2: String? = null + //鍒嗗�� var score: Int = 0 + //鏄惁閫変腑 var select: Boolean = false + //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱 var gradeMode: String? = "minus_mode" + //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱 var selectMode: String? = "single_mode" + //浜岀骇瑙勫垯鍒嗙粍 var group: Int? = null + //涓夌骇瀛愯鍒� var sub2: MutableList<ThirdEvaluationVo> = mutableListOf() } @@ -46,10 +205,13 @@ class ThirdEvaluationVo { //瑙勫垯id var id: String? = null + //瑙勫垯鎻忚堪 var content: String? = null + //鍒嗗�� var score: Int = 0 + //鏄惁閫変腑 var select: Boolean = false } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreVo.kt index c05cfc3..555f2a8 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreVo.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreVo.kt @@ -2,6 +2,8 @@ class ScoreVo { + var sceneId: String? = null + var sceneName: String? = null var year: Int? = null diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt index ccd526c..d95a418 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt @@ -5,6 +5,7 @@ import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam import org.springframework.beans.factory.annotation.Autowired import org.springframework.web.bind.annotation.* import springfox.documentation.annotations.ApiIgnore @@ -42,6 +43,12 @@ @RequestParam("per_page", required = false) perPage: Int? ) = searchService.searchScore4JingAn(token, year, month, page, perPage) + @ApiOperation(value = "鏌ユ壘宸℃煡浠诲姟鑷姩璇勪及鐨勮瘎鍒嗙粏鑺�") + @GetMapping("/score/detail") + fun getAutoScore( + @ApiParam(value = "宸℃煡浠诲姟id") @RequestParam subTaskId: String, + ) = resPack { searchService.getScoreDetail(subTaskId) } + @GetMapping("/subtask/jinshan") fun searchSubTask2( @RequestParam("token") token: String, diff --git a/src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JingAnScoreTaskCtrlTest.kt b/src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrlTest.kt similarity index 70% rename from src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JingAnScoreTaskCtrlTest.kt rename to src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrlTest.kt index 6672ec5..1a6a96a 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JingAnScoreTaskCtrlTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrlTest.kt @@ -1,7 +1,6 @@ package cn.flightfeather.supervision.business.bgtask import org.junit.Test -import org.junit.jupiter.api.Assertions.* import org.junit.jupiter.api.extension.ExtendWith import org.junit.runner.RunWith import org.springframework.beans.factory.annotation.Autowired @@ -13,15 +12,15 @@ @RunWith(SpringRunner::class) @ExtendWith(SpringExtension::class) @SpringBootTest -class JingAnScoreTaskCtrlTest() { +class JinAnScoreTaskCtrlTest() { @Autowired - lateinit var jingAnScoreTaskCtrl: JingAnScoreTaskCtrl + lateinit var jinAnScoreTaskCtrl: JinAnScoreTaskCtrl @Test fun startTask() { - var time = LocalDateTime.of(2023, 10, 1, 0, 0, 0) - repeat(4) { - jingAnScoreTaskCtrl.startTaskJingAn(time) + var time = LocalDateTime.of(2024, 2, 1, 0, 0, 0) + repeat(3) { + jinAnScoreTaskCtrl.startTaskJinAn(time) time = time.plusMonths(1) } } diff --git a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt index 5d7dfde..0e55d90 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt +++ b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt @@ -44,26 +44,8 @@ @Test fun createTZUserInfo() { - val sId = listOf("lMqvVUjDrcAfb5l9", - "iRn69RgMMJVCnvVy", - "BHkeYXhWBIN7dpm4", - "moT0gClykLAgTedp", - "9tNfxmcUBspynqOB", - "dXcHOIqFvFRSeKhg", - "XNoilpfLZESw5DP0", - "f4fOMCcBAtrmqDO7", - "GyOZyyiouI15lfdZ", - "k2FSexhq1Yj3GXAA", - "K7FTWRkLFrfenq4G", - "0nPo3EoR7K0JHq6d", - "YHYxGucNfjkMjSLI", - "ppzbVvgaqTbHLMFL", - "eJcnnfg6joXLUlYN", - "dSuH4hr66NAfflti", - "Ba8jWakmIYexMxvK", - "jYRzLMfB81qfOaec", - "L5ABNgmzgqDLGWnw", - "yYy88ocNnnZDreIK", + val sId = listOf( + "9jqhywmfvpgvxrT2" ) sId.forEach { val scene = sceneRep.findScene(sceneId = it) ?: return@forEach -- Gitblit v1.9.3