From c1becf4cbd2e99601ce011c14b8742427249cfb4 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 09 一月 2024 17:25:05 +0800
Subject: [PATCH] 1. 多项调整
---
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/EvaluationMapper.kt | 3
src/main/resources/mapper/ds1/EvaluationMapper.xml | 92 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt | 37
src/main/resources/application-pro.yml | 17
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationruleService.kt | 3
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopEvaluation.kt | 46
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustDataMapper.kt | 12
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt | 54
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataConfig.kt | 6
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/FumeSiteMapMapper.kt | 8
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt | 54
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt | 8
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt | 30
src/main/resources/application-dev.yml | 13
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt | 32
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5.kt | 118 +
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteMapMapper.java | 8
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/storage/StScoreItem1.kt | 6
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationruleController.kt | 5
src/main/resources/application-test.yml | 28
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSCsDataAnalysis.kt | 24
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationruleServiceImpl.kt | 11
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreItem.kt | 6
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt | 9
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt | 4
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt | 2
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt | 10
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt | 10
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt | 24
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaEvaVo.kt | 12
src/test/kotlin/cn/flightfeather/supervision/business/QRCodeTest.kt | 8
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreUtil.kt | 22
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem11.kt | 12
src/main/kotlin/cn/flightfeather/supervision/business/Info.kt | 26
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem8.kt | 11
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem1.kt | 6
pom.xml | 45
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt | 50
src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt | 8
src/test/kotlin/cn/flightfeather/supervision/business/autooutput/AopEvaluationTest.kt | 106 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt | 35
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt | 3
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt | 46
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt | 38
src/main/resources/mapper/ds3/JSDustDataMapper.xml | 44
src/main/resources/mapper/ds2/OverallEvaluationMapper.xml | 27
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopTaskCtrl.kt | 80 +
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem2.kt | 8
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/OverallEvaluationMapper.kt | 8
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt | 43
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt | 16
src/main/resources/application.yml | 40
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopSceneTypeCheck.kt | 6
src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt | 20
src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt | 56 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt | 14
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt | 9
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt | 3
src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt | 44
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/FumeSiteMap.java | 144 ++
src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt | 126 ++
src/main/resources/mapper/ds3/JSDustSiteMapMapper.xml | 24
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem1.kt | 6
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/BgTaskService.kt | 30
src/main/resources/generator/generatorConfig4ds3.xml | 18
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSWhDataAnalysis.kt | 24
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt | 8
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt | 28
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteMap.java | 144 ++
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem9.kt | 12
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/LedgerServiceImpl.kt | 2
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt | 38
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/enum/JSSceneType.kt | 7
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/OverallEvaluation.java | 211 +++
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt | 32
src/main/resources/mapper/ds3/FumeSiteMapMapper.xml | 24
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem2.kt | 8
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/OverallEvaluationRep.kt | 60 +
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustData.java | 139 ++
src/main/resources/generator/generatorConfig4ds1.xml | 29
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AutoScoreResultVo.kt | 24
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseResponse.kt | 20
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt | 142 ++
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt | 145 ++
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5BackUp.kt | 86 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt | 12
src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskConditionVo.kt | 10
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem1.kt | 6
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem10.kt | 11
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSMpDataAnalysis.kt | 24
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem2.kt | 8
src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt | 50
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem7.kt | 6
src/main/resources/log4j2.xml | 4
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationrule.kt | 2
/dev/null | 59 -
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt | 16
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt | 6
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt | 25
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt | 4
100 files changed, 2,804 insertions(+), 496 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2d674a9..0bb7353 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,6 +28,7 @@
<!-- tk.mybatis -->
<mapper.plugin>tk.mybatis.mapper.generator.MapperPlugin</mapper.plugin>
<mapper.Mapper>tk.mybatis.mapper.common.Mapper</mapper.Mapper>
+ <resource.delimiters>@</resource.delimiters>
</properties>
<dependencies>
@@ -419,6 +420,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/generatorConfig4ds3.xml</configurationFile>
<overwrite>true</overwrite>
<verbose>true</verbose>
@@ -432,26 +434,34 @@
</dependency>
</dependencies>
</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>
@@ -470,9 +480,12 @@
<properties>
<profileActive>pro</profileActive>
</properties>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
+ </profile>
+ <profile>
+ <id>test</id>
+ <properties>
+ <profileActive>test</profileActive>
+ </properties>
</profile>
</profiles>
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/AutoScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/AutoScore.kt
deleted file mode 100644
index a8daa0e..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/AutoScore.kt
+++ /dev/null
@@ -1,484 +0,0 @@
-package cn.flightfeather.supervision.business
-
-import cn.flightfeather.supervision.domain.ds1.entity.*
-import cn.flightfeather.supervision.common.utils.UUIDGenerator
-import cn.flightfeather.supervision.lightshare.service.*
-import cn.flightfeather.supervision.lightshare.vo.InspectionVo
-import cn.flightfeather.supervision.lightshare.vo.ProblemlistVo
-import cn.flightfeather.supervision.lightshare.vo.ScenseVo
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import java.math.RoundingMode
-import java.util.*
-import javax.annotation.PostConstruct
-import kotlin.collections.ArrayList
-
-/**
- * @author riku
- * 2019.3.15
- * 鑷姩璇勫垎
- * 鏍规嵁鍙栬瘉闂鑷姩寰楀嚭榛樿璇勫垎
- * 璇勫垎椤瑰垎涓�2銆�3銆�4涓夌鍒嗙被绛夌骇锛�2涓烘渶澶х殑鍒嗙被銆�4涓烘渶灏忥紙鏈�璇︾粏锛夌殑鍒嗙被锛�
- * 閫氳繃瀵圭瓑绾т负4鐨勮瘎鍒嗛」杩涜鍏蜂綋鎵撳垎锛屽垎鍒牴鎹檮灞炲叧绯荤粺璁″緱鍑虹瓑绾�3銆�2鐨勬�诲緱鍒嗭紝
- * 鏈�缁堟墍鏈夌瓑绾�2鐨勮瘎鍒嗛」姹傚拰鍗充负鎬诲垎
- */
-
-@Component
-class AutoScore {
-
- companion object {
- private lateinit var autoScore: AutoScore
-
- //闂鍏抽敭璇嶏紝鍖呭惈姝ゅ叧閿瘝鐨勯棶棰樺尯鍒寰�
- private final var TOPIC = "绉皹"
- }
-
- @Autowired
- lateinit var problemlistService: ProblemlistService
- @Autowired
- lateinit var evaluationruleService: EvaluationruleService
- @Autowired
- lateinit var evaluationsubruleService: EvaluationsubruleService
- @Autowired
- lateinit var scenseService: ScenseService
- @Autowired
- lateinit var inspectionService: InspectionService
- @Autowired
- lateinit var evaluationService: EvaluationService
- @Autowired
- lateinit var itemevaluationService: ItemevaluationService
-
- private var problems: ArrayList<ProblemlistVo> = ArrayList()
-
- private var allRules: ArrayList<Evaluationsubrule> = ArrayList()
-
- private var inspection = InspectionVo()
-
- private var evaluationrule: Evaluationrule? = null
-
- private var scense: ScenseVo? = null
-
- private var totalPoint = 0
-
- //瀛愯瘎鍒嗛」寰楀垎鍒楄〃
- val childScorelist = ArrayList<Itemevaluation>()
- //鎬诲垎
- val totalScore = Evaluation()
-
- var subtask = Subtask()
-
- var rate = 1f
-
- val random = Random()
-
-// var getTotalPointDone = false
-
- @PostConstruct
- fun init() {
- autoScore = this
- autoScore.problemlistService = this.problemlistService
- autoScore.evaluationruleService = this.evaluationruleService
- autoScore.evaluationsubruleService = this.evaluationsubruleService
- autoScore.scenseService = this.scenseService
- autoScore.inspectionService = this.inspectionService
- autoScore.evaluationService = this.evaluationService
- autoScore.itemevaluationService = this.itemevaluationService
- }
-
- fun test(): InspectionVo {
- return autoScore.inspectionService.findByID("048ENlnke0L8C9Gi")
- }
-
- fun calculateScore() {
- //鑾峰彇瀛愪换鍔″搴旂殑闂鍒楄〃
- this.problems.addAll(autoScore.problemlistService.findBySubtaskId(subtask.stguid!!))
- //鑾峰彇瀛愪换鍔″搴旂殑鍦烘櫙淇℃伅
- scense = autoScore.scenseService.findOne(subtask.scenseid!!)
- //鑾峰彇瀵瑰簲浠诲姟绫诲瀷銆佸満鏅被鍨嬨�佸尯鍘跨殑璇勫垎琛ㄥ悕绉�
- val evaluationrule = autoScore.evaluationruleService.findBySpecificRule(subtask.typeno, scense!!.typeid, subtask.districtcode)
- if (evaluationrule === null) return
- this.evaluationrule = evaluationrule
- //鑾峰彇瀵瑰簲鐨勫叿浣撹瘎鍒嗙粏鍒�
- allRules = autoScore.evaluationsubruleService.findByRuleId(evaluationrule.guid!!) as ArrayList<Evaluationsubrule>
- //鑾峰彇宸℃煡淇℃伅
- inspection = autoScore.inspectionService.findBySubTaskID(subtask.stguid!!)
-
-
- //鐩爣鍒嗘暟
- val goalScore = getGoalScore(this.problems)
-
- val titleRule = Evaluationsubrule()
- val titleOptionRange = ArrayList<Int>()
- val titleIsGood = true
-
- totalPoint = getTotalPoint(allRules, titleRule.guid)
- rate = goalScore.toFloat() / totalPoint.toFloat()
-
- //寰楀埌鐨刾oint鏄墸鍒嗗垎鏁�
- var point = autoGeneration(titleRule, titleOptionRange, titleIsGood)
- point?.let { adJustTotalPoint(totalPoint -Math.abs(it), goalScore) }
- point = getTotalPointAfterAdJust()
- createTotalScore(point)
- update()
- }
-
- /**
- * 鑾峰彇鏈�缁堟�诲緱鍒�
- */
- fun getTotalPointAfterAdJust(): Int? {
- val subRules = getSubRulesByFatherId(allRules, null)
- var point = 0
- subRules.forEach {
- for (c in childScorelist) {
- if (!c.value.isNullOrBlank()
- && it.guid == c.esrguid) {
- point += c.value?.toInt() ?: 0
- }
- }
- }
-
- return point
- }
-
- /**
- * 鑷姩鎵撳垎
- * @param fatherRule
- * @param optionRange
- * @param isGood
- */
- fun autoGeneration(fatherRule: Evaluationsubrule, optionRange: ArrayList<Int>?, isGood: Boolean): Int? {
-
- val nextSubRules = getSubRulesByFatherId(allRules, fatherRule.guid)
- //鏃犲瓙椤圭殑鏈�灏忚瘎鍒嗛」锛岀粰鍑哄緱鍒�
- if (nextSubRules.isEmpty()) {
- val totalScore = writeScore4th(fatherRule, optionRange, isGood, rate)
- createNewChildScore(fatherRule, totalScore)
- return totalScore
- }
- //鏈夊瓙椤圭殑璇勫垎椤癸紝浠ユ瘡椤瑰瓙椤逛负鐖堕」缁х画閫掑綊锛岃幏鍙栨�诲垎
- else {
- var totalScore = 0//鏈夊瓙椤圭殑璇勫垎椤逛竴瀹氫細鏈夊垎鏁帮紝涓嶄細鍑虹幇null鐨勬儏鍐�
- var nextIsGood = isGood
- var nextOptionRange = getOptionRange(fatherRule.guid, isGood, fatherRule.extension1)
- if (isGood) {
- for (problem in problems) {
- if (!fatherRule.problemlist.isNullOrBlank()) {
- if (fatherRule.problemlist!!.contains(problem.ptguid ?: "null")) {
- nextOptionRange = getOptionRange(fatherRule.guid!!, !isGood, fatherRule.extension1)
- nextIsGood = false
- break
- }
- }
- }
- }
-
- var nextTmpTotalScore = 0//鎵�鏈夊瓙椤圭殑鎬诲緱鍒�
- nextSubRules.forEach {
- val nextFatherRule = it
- val score = autoGeneration(nextFatherRule, nextOptionRange, nextIsGood)
- if (score != null) {
- nextTmpTotalScore += score
- }
- }
-
- if (nextTmpTotalScore >= (0-(fatherRule.maxscore?: totalPoint))) {
- totalScore += nextTmpTotalScore
- } else {
- reGrade(nextSubRules, nextOptionRange, fatherRule.maxscore!!)
- }
- //鍙栧緱鎬诲垎鍚庯紝鐢熸垚瀵瑰簲鐨勮瘎鍒嗕俊鎭苟瀛樺叆鍒楄〃
- if (!fatherRule.guid.isNullOrBlank())
- createNewChildScore(fatherRule, totalScore)
-
- return totalScore
- }
- }
-
- //濉啓璇︾粏璇勫垎椤圭殑鍒嗘暟
- fun writeScore4th(rule: Evaluationsubrule, optionRange: ArrayList<Int>?, isGood: Boolean, rate: Float): Int? {
-
- val optionId = (rule.displayid?.toInt() ?: 1) - 1
- if (optionRange?.contains(optionId) == true) {
- //鍙栧緱鍙�夊垎鏁扮殑涓棿鍊�
- val maxScore = rule.maxscore
- val minScore = rule.minscore
- val middleScore = (maxScore!! + minScore!!) / 2
-
- var tmpScore = 0
-
- val b = (maxScore * rate).toBigDecimal()
-
- if (isGood) {
- tmpScore = b.setScale(0, RoundingMode.HALF_UP).toInt()
-// if ((maxScore-tmpScore)!=0) {
-// tmpScore += random.nextInt(maxScore - tmpScore)
-// }
- //鐩墠璇勫垎涓哄噺鍒嗚鍒欙紝鍙褰曞噺鍒�
- tmpScore = 0 - (maxScore - tmpScore)
- } else {
- //杈冨樊閫夐」鐨勮瘎鍒嗗湪鈥滄渶灏忓垎~涓棿鍒嗏�濅腑闅忔満閫夊彇锛堝寘鍚腑闂村�硷級
- tmpScore = if ((maxScore + minScore) % 2 == 0) {
- random.nextInt(maxScore - middleScore + 1) + minScore
- } else {
- random.nextInt(maxScore - middleScore) + minScore
- }
- //鐩墠璇勫垎涓哄噺鍒嗚鍒欙紝鍙褰曞噺鍒�
- tmpScore = 0 - (maxScore - tmpScore)
- }
-
- return tmpScore
- }
- //鑻ヤ笉闇�瑕佽瘎鍒嗭紝姝ゅ灏嗗叾璁剧疆涓虹┖
- return null
- }
-
- //鎸夌収鐖秈d鏌ユ壘瀛愯瘎鍒嗛」
- fun getSubRulesByFatherId(rules: ArrayList<Evaluationsubrule>, fatherId: String?): List<Evaluationsubrule> {
- val subRules = mutableListOf<Evaluationsubrule>()
- rules.forEach {
- if (it.fatherid == fatherId
- || (fatherId.isNullOrBlank() && it.fatherid.isNullOrBlank())) {
- subRules.add(it)
-// rules.remove(it)
- }
- }
- return subRules
- }
-
- //鑾峰彇闅忔満璇勫垎鐨勮瘎鍒嗛」鍒楄〃
- fun getOptionRange(fatherId: String?, isGood: Boolean, mutiChoice: String?): ArrayList<Int>? {
- if (fatherId.isNullOrBlank()) return ArrayList<Int>()
- val nextSubRules = getSubRulesByFatherId(allRules, fatherId)
- val list = ArrayList<Int>()
- val size = nextSubRules.size
- val midIndex = Math.ceil((size.toDouble() / 2.toDouble())).toInt()
-
- when (mutiChoice) {
- //鍗曢��
- "0" -> {
- val index = if (isGood) {
- random.nextInt(midIndex)
- } else {
- random.nextInt(midIndex) + midIndex
- }
- list.add(index)
- }
- //澶氶��
- "1" -> {
- val optionNum = random.nextInt(size) + 1//閫夐」涓暟
- for (i in 1..optionNum) {
- var index = random.nextInt(size)
- while (list.contains(index)) {
- index = random.nextInt(size)
- }
- list.add(index)
- }
- }
- //鍏ㄩ��
- "2" -> {
- for (index in nextSubRules.indices) {
- list.add(index)
- }
- }
- null -> return null
- }
-
- return list
- }
-
- //澶氶�夐」璇勫垎瓒呰繃鎬诲垎锛岄噸鏂板垎閰嶅垎鏁�
- fun reGrade(subRules: List<Evaluationsubrule>, optionRange: ArrayList<Int>?, maxScore: Int) {
- var remainScore = maxScore
- val a = optionRange?.size ?: 1
-
- for (it in subRules) {
- if (optionRange?.contains(it.displayid?.toInt()) == true) {
- var score = random.nextInt(maxScore / a)
- remainScore -= score
- if (remainScore < 0) {
- score = remainScore
- }
- //<editor-fold desc="鏇存柊鍒嗘暟(鍑忓垎妯″紡)">
- for (c in childScorelist) {
- if (c.esrguid == it.guid) {
- c.value = (0 - score).toString()
- break
- }
- }
- //</editor-fold>
-
- //<editor-fold desc="鎬诲垎琚墸瀹屽悗锛屼笉鍐嶈瘎鍒�">
- if (remainScore <= 0) {
- break
- }
- //</editor-fold>
- }
- }
- }
-
- //鍒涘缓鍗曢」璇勫垎瀵硅薄
- fun createNewChildScore(subRule: Evaluationsubrule, score: Int?) {
- val itemevaluation = Itemevaluation()
- itemevaluation.ieguid = UUIDGenerator.generate16ShortUUID()
- itemevaluation.iguid = inspection.guid
- itemevaluation.stguid = subtask.stguid
- itemevaluation.sguid = subtask.scenseid
- itemevaluation.sensename = subtask.scensename
- itemevaluation.erguid = evaluationrule!!.guid
- itemevaluation.rulename = evaluationrule!!.rulename
- itemevaluation.ruletype = 2
-// itemevaluation.ertype = subRule.ertype
- itemevaluation.esrguid = subRule.guid
- itemevaluation.name = subRule.itemname
- if (score === null) {
- itemevaluation.value = null
- } else {
- itemevaluation.value = score.toString()
- }
- childScorelist.add(itemevaluation)
- }
-
- //鍒涘缓鎬诲垎瀵硅薄
- fun createTotalScore(point: Int?) {
- totalScore.guid = UUIDGenerator.generate16ShortUUID()
- totalScore.iguid = inspection.guid
- totalScore.stguid = subtask.stguid
- totalScore.sguid = scense?.guid
- totalScore.scensetypeid = scense?.typeid
- totalScore.scensetype =scense?.type
- totalScore.subscensetypeid = scense?.scensesubtypeid
- totalScore.subscensetype = scense?.scensesubtype
- totalScore.ertype = evaluationrule?.ruletype?.toByte()
- totalScore.provincecode = scense?.provincecode
- totalScore.provincename = scense?.provincename
- totalScore.citycode = scense?.citycode
- totalScore.cityname = scense?.cityname
- totalScore.districtcode = scense?.districtcode
- totalScore.districtname = scense?.districtname
- totalScore.towncode = scense?.towncode
- totalScore.townname = scense?.townname
- totalScore.scensename = scense?.name
- totalScore.scenseaddress = scense?.location
- totalScore.evaluatetime = Date()
- totalScore.evaluatorguid = "admin"
- totalScore.evaluatorusername = "admin"
- totalScore.evaluatorrealname = "admin"
- totalScore.createdate = Date()
- totalScore.resultscorebef = (totalPoint - Math.abs(point!!)).toInt().toString()
- }
-
- //鑾峰彇鎬诲垎
- fun getTotalPoint(rules: ArrayList<Evaluationsubrule>, fatherId: String?): Int {
- val rules1 = getSubRulesByFatherId(rules, fatherId)
- var point = 0
- rules1.forEach {
- point += it.maxscore?: 0
- }
- return point
- }
-
- //鏁版嵁搴撴洿鏂�
- fun update() {
-// println(totalScore)
- autoScore.evaluationService.save(totalScore)
- childScorelist.forEach {
- autoScore.itemevaluationService.save(it)
-// println(it)
- }
- }
-
- //鏍规嵁闂涓暟闅忔満鑾峰彇搴斿緱鎬诲垎
- fun getGoalScore(problems: ArrayList<ProblemlistVo>): Int {
- var result = 0
- var p = 0
- var c = 2
- problems.forEach {
- p += if (it.problemname?.contains(TOPIC) == true) {
- 5
- } else {
- 10
- }
- if (it.ischanged == false) {
- c = if (!it.changecatalog.isNullOrBlank()) {
- 1
- } else {
- 0
- }
- }
- }
- result = when (p) {
- 0 -> {
- randomScore(3, 20, 5)
- }
- in 1..5 -> {
- randomScore(c, 42, 7)
- }
- 10 ->{
- randomScore(c, 50, 7)
- }
- in 15..40 -> {
- randomScore(c, 66, 21)
- }
- else -> {
- randomScore(c, 75, 8)
- }
-
- }
- return result
- }
-
- private fun randomScore(c: Int, p: Int, t:Int): Int {
- println(p / 3)
- return random.nextInt(t / 3) + 120 - p + t * c / 3
- }
-
- //璋冩暣鏈�缁堝垎鏁�
- fun adJustTotalPoint(totalPoint: Int, goalScore: Int) {
- var value = goalScore - totalPoint
- var fatherRule = Evaluationsubrule()
- var subRules = ArrayList<Evaluationsubrule>()
-
- for (it in allRules) {
- if (it.itemname == "闄勫姞鍒�") {
- fatherRule = it
- subRules = getSubRulesByFatherId(allRules, fatherRule.guid) as ArrayList<Evaluationsubrule>
- break
- }
- }
- value = foo1(fatherRule, subRules, value)
-
- }
-
- private fun foo1(fatherRule: Evaluationsubrule, subRules: List<Evaluationsubrule>, remainValue: Int): Int {
- var value = remainValue
- for (it in childScorelist) {
- if (it.name == fatherRule.itemname) {
- val culValue = it.value?.toInt()
- var tmp = culValue
- tmp = tmp?.plus(value)
- if (tmp != null) when {
- tmp > 0 -> {
- value -= (fatherRule.minscore ?: 0) - culValue!!
- it.value = fatherRule.minscore.toString()
- }
- tmp < 0 - (fatherRule.maxscore ?: 20) -> {
- value -= (0 - (fatherRule.maxscore ?: 20)) - culValue!!
- it.value = (0 - (fatherRule.maxscore ?: 20)).toString()
- }
- else -> it.value = tmp.toString()
- }
- for (s in subRules) {
- loop@ for (i in childScorelist) {
- if (s.guid == i.esrguid
- && i.value != null) {
- i.value = it.value
- break@loop
- }
- }
- }
- break
- }
- }
- return value
- }
-}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/Info.kt b/src/main/kotlin/cn/flightfeather/supervision/business/Info.kt
index 4403c16..d0ad1e3 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/Info.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/Info.kt
@@ -7,20 +7,20 @@
data class Info(
//鍦烘櫙鐢ㄦ埛id
- val userId: String?,
+ val userId: String?,
//椋炵窘鐜涓満鏅搴旂殑鐢ㄦ埛id
- val tzUserId: String?,
+ val tzUserId: String?,
//鍦烘櫙id
- val sceneId: String?,
+ val sceneId: String?,
//鍦烘櫙鍚嶇О
- val sceneName: String?,
- var sceneType: Constant.ScenseType,
- var year: Int? = null,
- val month: Int? = null,
- val period: Int? = null,
- val sTime: LocalDateTime? = null,
- val eTime: LocalDateTime? = null,
- val subTask: Subtask? = null,
- val sceneIndex: Int? = null,
- val online:Boolean = true
+ val sceneName: String?,
+ var sceneType: Constant.SceneType,
+ var year: Int? = null,
+ val month: Int? = null,
+ val period: Int? = null,
+ val sTime: LocalDateTime? = null,
+ val eTime: LocalDateTime? = null,
+ val subTask: Subtask? = null,
+ val sceneIndex: Int? = null,
+ val online:Boolean = true
)
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/ScoreItem.kt b/src/main/kotlin/cn/flightfeather/supervision/business/ScoreItem.kt
deleted file mode 100644
index 71db5bc..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/ScoreItem.kt
+++ /dev/null
@@ -1,159 +0,0 @@
-package cn.flightfeather.supervision.business
-
-import cn.flightfeather.supervision.common.utils.DateUtil
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
-import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
-import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper
-import org.springframework.beans.factory.annotation.Autowired
-import tk.mybatis.mapper.entity.Example
-import kotlin.math.abs
-import kotlin.properties.Delegates
-
-/**
- * 鑷姩璇勫垎鏉$洰
- */
-abstract class ScoreItem() {
-
- //鑷姩璇勫垎鏉$洰id
- abstract var id: String
- //鑷姩璇勫垎鏉$洰鍚嶇О
- abstract var name:String
- //鏈�澶у垎鍊�
- var maxScore: Int = 0
- //鏈�灏忓垎鍊硷紙榛樿0鍒嗭級
- var minScore: Int = 0
-
- lateinit var info: Info
-
- val dateUtil = DateUtil()
- // 璇勫垎椤规槸鍚﹁眮鍏嶄笉鎵e垎
- var exemption = false
-
- //璇勫垎椤�
- private var evaluationsubrule: Evaluationsubrule2? = null
- //璇勫垎椤瑰搴旈�夐」
- private var evaluationsubruleList = listOf<Evaluationsubrule2>()
-
- @Autowired
- lateinit var problemlistMapper: ProblemlistMapper
-
- /**
- * 鎵ц鐩稿叧闂鑷姩鎵e垎閫昏緫鍜岀壒娈婃墸鍒嗛�昏緫
- *
- */
- fun execute(info: Info, eList: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>) {
- this.info = info
- if (!exemption) {
- getRule(eList)
- problemCheck()
- calScore()
- }
- }
-
- /**
- * 鍙墽琛岀壒娈婃墸鍒嗛�昏緫
- */
- fun execute2(info: Info, eList: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>) {
- this.info = info
- if (!exemption) {
- getRule(eList)
- calScore()
- }
- }
-
- /**
- * 鑾峰彇璇勫垎瑙勫垯
- */
- private fun getRule(eList: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>) {
- for (e in eList) {
- if (e.first.guid == id) {
- evaluationsubrule = e.first
- evaluationsubrule?.maxscore?.let { maxScore = it }
- evaluationsubrule?.minscore?.let { minScore = it }
- evaluationsubruleList = e.second.sortedBy { it.displayid }
- break
- }
- }
- }
-
- /**
- * 妫�鏌ヨ瘎鍒嗛」瀵瑰簲鐨勯棶棰樻槸鍚﹀瓨鍦紝璁板綍鎵e垎
- */
- private fun problemCheck() {
- // 鏍规嵁璇勫垎瑙勫垯瀵瑰簲鐨勫叿浣撻棶棰橈紝鏌ヨ褰撳墠鏃堕棿娈典笅鏄惁鏈夎褰曡闂
- evaluationsubruleList.forEach {
- if (it.fatherid == id) {
- // 鏍规嵁瑙勫垯瀵瑰簲鐨勭浉鍏抽棶棰榠d锛屾煡鎵剧敤鎴峰湪褰撳墠鏃堕棿娈靛唴鏄惁鏈夊彂鐢熻闂锛屾湁鍒欐墸闄ょ浉搴旂殑鍒嗘暟
- val pList = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("sguid", info.sceneId)
- .andGreaterThanOrEqualTo("time", info.sTime)
- .andLessThan("time", info.eTime)
- }).map { p-> p.ptguid }
- it.problemlist?.split(",")?.forEach {pId ->
- if (pList.contains(pId)) {
- it.extension1 = (0 - (it.maxscore ?: 0)).toString()
- }
- }
- }
- }
-// var total: Int? = null
-// subRule.forEach {
-// if (!it.extension1.isNullOrBlank()) {
-// total = (total?:0) + it.extension1!!.toInt()
-// }
-// }
-// if (total == null) {
-// rule.extension1 = "0"
-// } else {
-// val s = if (abs(total!!) > rule.maxscore!!) {
-// 0 - rule.maxscore!!
-// } else {
-// total
-// }
-// rule.extension1 = s.toString()
-// }
- }
-
- /**
- * 鏍规嵁绯荤粺澶栬幏鍙栫殑淇℃伅锛岃繘琛屾墸鍒嗗垽瀹氥�傝繑鍥為渶瑕佹墸鍒嗙殑鏉$洰搴忓彿
- * @param size 浼犲叆璇勫垎鏉$洰鐨勬暟閲忥紝璇勫垎鏉$洰鎸夌収涓�瀹氳鍒欒繘琛屾帓搴�
- * @return 杩斿洖闇�瑕佹墸鍒嗙殑璇勫垎鏉$洰鐨勫簭鍙�
- */
- abstract fun otherProblem(size: Int): Int?
-
- /**
- * 鑷姩璇勫垎璁$畻閫昏緫
- */
- fun calScore() {
- if (evaluationsubruleList.isEmpty()) {
- println("${name}: 璇勫垎鏉$洰涓虹┖锛屼笉鍋氳瘎鍒�")
- return
- }
-
- otherProblem(evaluationsubruleList.size)?.let {i-> evaluationsubruleList[i].getScore(maxScore) }
-
- var total: Int? = null
- evaluationsubruleList.forEach {
- if (!it.extension1.isNullOrBlank()) {
- total = (total ?: 0) + it.extension1!!.toInt()
- }
- }
- if (total == null) {
- evaluationsubrule?.extension1 = "0"
- } else {
- val s = if (abs(total!!) > evaluationsubrule?.maxscore!!) {
- 0 - evaluationsubrule?.maxscore!!
- } else {
- total
- }
- evaluationsubrule?.extension1 = s.toString()
- }
- }
-
- /**
- * 鍑忓垎妯″紡涓嬶紝璁$畻鍏蜂綋閫夐」鐨勫緱鍒�
- */
- fun Evaluationsubrule2.getScore(maxScore: Int) {
- extension1 = (0 - (maxscore ?: 0)).toString()
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopTaskCtrl.kt
new file mode 100644
index 0000000..c013604
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopTaskCtrl.kt
@@ -0,0 +1,80 @@
+package cn.flightfeather.supervision.business.autooutput
+
+import cn.flightfeather.supervision.business.autooutput.dataanalysis.*
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
+import cn.flightfeather.supervision.business.autooutput.score.AopCreditCode
+import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
+import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
+import cn.flightfeather.supervision.common.executor.BgTaskStatus
+import cn.flightfeather.supervision.common.executor.BgTaskType
+import cn.flightfeather.supervision.common.utils.Constant
+import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import org.springframework.stereotype.Component
+import java.time.LocalDate
+
+/**
+ * 鑷姩璇勪及浠诲姟绠$悊
+ */
+@Component
+class AopTaskCtrl(
+ private val aopEvaluation: AopEvaluation,
+ private val aopCreditCode: AopCreditCode,
+ private val jaCsDataAnalysis: JACsDataAnalysis,
+ private val xhFuDataAnalysis: XHFuDataAnalysis,
+ private val jsCsDataAnalysis: JSCsDataAnalysis,
+ private val jsMpDataAnalysis: JSMpDataAnalysis,
+ private val jsWhDataAnalysis: JSWhDataAnalysis,
+ private val backgroundTaskCtrl: BackgroundTaskCtrl,
+ private val taskRep: TaskRep,
+) {
+ private val dataAnalysisMap = mutableMapOf<String, MutableMap<Int, AopDataAnalysis<*>>>()
+
+ init {
+ listOf("310106", "310104", "310116").forEach { dataAnalysisMap[it] = mutableMapOf() }
+ dataAnalysisMap["310106"]?.put(Constant.SceneType.TYPE1.value.toInt(), jaCsDataAnalysis)
+ dataAnalysisMap["310104"]?.put(Constant.SceneType.TYPE5.value.toInt(), xhFuDataAnalysis)
+ dataAnalysisMap["310116"]?.put(Constant.SceneType.TYPE1.value.toInt(), jsCsDataAnalysis)
+ dataAnalysisMap["310116"]?.put(Constant.SceneType.TYPE2.value.toInt(), jsWhDataAnalysis)
+ dataAnalysisMap["310116"]?.put(Constant.SceneType.TYPE3.value.toInt(), jsMpDataAnalysis)
+ }
+
+ fun startNewTask(areaVo: AreaVo): BgTaskStatus {
+ val task = taskRep.findOneTask(areaVo)
+ val taskId = task?.tguid
+ if (taskId != null) {
+ val districtCode = areaVo.districtcode
+ val districtName = areaVo.districtname
+ val d = LocalDate.parse(areaVo.starttime)
+ val year = d.year
+ val month = d.monthValue
+ val sceneType = areaVo.scensetypeid?.toInt() ?: throw IllegalStateException("鍦烘櫙绫诲瀷鏈缃紝鏃犳硶璇勪及")
+
+ val id = "${BgTaskType.AUTO_SCORE.name}-${districtCode}-${sceneType}"
+ val name = "${districtName}${Constant.SceneType.getDes(sceneType)}鑷姩璇勫垎"
+ val bgTask = backgroundTaskCtrl.startNewTask(BgTaskType.AUTO_SCORE, id, name) {
+ dataAnalysis(districtCode, sceneType, taskId, year, month)
+
+ aopEvaluation.executeByTopTask(taskId, sceneType)
+
+ aopCreditCode.execute(AopDataConfig(
+ year = year,
+ month = month,
+ districtName = districtName,
+ sceneType = sceneType,
+ period = 1
+ ))
+ true
+ }
+ return bgTask.taskStatus
+ } else {
+ throw IllegalStateException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�")
+ }
+ }
+
+ private fun dataAnalysis(districtCode: String?, sceneType: Int, taskId: String, year: Int, month: Int) {
+ val aopDataAnalysis = dataAnalysisMap[districtCode]?.get(sceneType)
+ aopDataAnalysis?.setResource(taskId, sceneType, year, month)
+ aopDataAnalysis?.execute()
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt
similarity index 72%
rename from src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopDataAnalysis.kt
rename to src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt
index e0f5e50..417ca2d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopDataAnalysis.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt
@@ -1,4 +1,4 @@
-package cn.flightfeather.supervision.business.autooutput.score
+package cn.flightfeather.supervision.business.autooutput.dataanalysis
import cn.flightfeather.supervision.business.autooutput.AopOutput
import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
@@ -22,13 +22,21 @@
) {
/**
- * 缁熻涓棿瀛樺偍缁撴瀯
+ * 缁熻鏁版嵁 涓存椂瀛樺偍缁撴瀯
*/
inner class TempResult(
var total: Double = .0,
var count: Int = 0,
){
- fun avg(): Double {
+ var avg: Double = -1.0
+ get() {
+ if (field == -1.0) {
+ field = avg()
+ }
+ return field
+ }
+
+ private fun avg(): Double {
return if (count == 0) {
.0
} else {
@@ -53,25 +61,39 @@
/**
* 鎵ц缁熻閫昏緫
*/
- fun execute() {
- val dAvg = districtAvg(source)
+ fun execute(avg: Double? = null) {
+ //璁$畻鍖哄潎鍊�
+ val dAvg = avg ?: districtAvg(source)
+ println("鍧囧�硷細${dAvg}")
//寰幆澶勭悊姣忎釜鍦烘櫙
source?.loop { _, evaluationScene ->
//鑾峰彇鍘熷鐩戞祴鏁版嵁
val dataList = fetchDataResources(evaluationScene)
//璁$畻缁熻缁撴灉
- val tempExceedTimes = TempResult()
- val tempAvg = TempResult()
- val tempMax = TempResult()
- val tempMin = TempResult()
+ var tempExceedTimes = TempResult()
+ var tempAvg = TempResult()
+ var tempMax = TempResult()
+ var tempMin = TempResult()
dataList.forEach {
- it.forEach {t ->
+ // 鐩戞祴鐐规湁澶氬彴璁惧鏃讹紝姣忓彴璁惧鍗曠嫭缁熻锛屽彇鍧囧�兼渶楂樼殑涓虹粺璁$粨鏋�
+ val _tempExceedTimes = TempResult()
+ val _tempAvg = TempResult()
+ val _tempMax = TempResult()
+ val _tempMin = TempResult()
+ it.forEach { t ->
t?.let {
- exceedTimes(t, tempExceedTimes)
- avg(t, tempAvg)
- max(t, tempMax)
- min(t, tempMin)
+ exceedTimes(t, _tempExceedTimes)
+ avg(t, _tempAvg)
+ max(t, _tempMax)
+ min(t, _tempMin)
}
+ }
+ // 淇濈暀鍧囧�兼渶楂樼殑涓�鍙拌澶�
+ if (_tempAvg.avg > tempAvg.avg) {
+ tempExceedTimes = _tempExceedTimes
+ tempAvg = _tempAvg
+ tempMax = _tempMax
+ tempMin = _tempMin
}
}
val dustDataResult = DustDataResult().apply {
@@ -79,7 +101,7 @@
drSceneName = evaluationScene.scene.value?.name
drTime = source?.config?.startTime
drExceedTimes = tempExceedTimes.count
- drAvg = tempAvg.avg()
+ drAvg = tempAvg.avg
drMax = tempMax.total
drMin = tempMin.total
drOverAvgPer = overAvgRate(drAvg, dAvg)
@@ -125,7 +147,7 @@
/**
* 瓒呮湀鍧囧�肩櫨鍒嗘瘮
*/
- abstract fun overAvgRate(avg: Double, dAvg: Double?): Double
+ abstract fun overAvgRate(avg: Double, dAvg: Double?): Double?
/**
* 鏁版嵁涓暟
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JADataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt
similarity index 95%
rename from src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JADataAnalysis.kt
rename to src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt
index d38fe60..31e2109 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JADataAnalysis.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt
@@ -1,10 +1,9 @@
-package cn.flightfeather.supervision.business.autooutput.score.construction
+package cn.flightfeather.supervision.business.autooutput.dataanalysis
import cn.flightfeather.supervision.business.autooutput.AopOutput
import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource
import cn.flightfeather.supervision.business.autooutput.datasource.AopDbMapper
import cn.flightfeather.supervision.business.autooutput.datasource.AopSceneTypeCheck
-import cn.flightfeather.supervision.business.autooutput.score.AopDataAnalysis
import cn.flightfeather.supervision.domain.ds2.entity.DustSiteMap
import cn.flightfeather.supervision.domain.ds2.entity.HourDustData
import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteMapMapper
@@ -20,7 +19,7 @@
* 闈欏畨宸ュ湴鎵皹鐩戞祴鏁版嵁缁熻
*/
@Component
-class JADataAnalysis(
+class JACsDataAnalysis(
aopDbMapper: AopDbMapper,
aopSceneTypeCheck: AopSceneTypeCheck,
aopOutput: AopOutput,
@@ -39,6 +38,7 @@
var count = 0
hourDustDataMapper.selectByExample(Example(HourDustData::class.java).apply {
createCriteria().andBetween("lst", source?.config?.startTime, source?.config?.endTime)
+ .andEqualTo("flag", "N")
}).forEach {
it?.dustvalue?.let { v ->
total += v
@@ -116,11 +116,11 @@
}
}
- override fun overAvgRate(avg: Double, dAvg: Double?): Double {
+ override fun overAvgRate(avg: Double, dAvg: Double?): Double? {
return if (dAvg != null) {
round(((avg - dAvg) / dAvg) * 1000) / 1000
} else {
- .0
+ null
}
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSCsDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSCsDataAnalysis.kt
new file mode 100644
index 0000000..2f434e9
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSCsDataAnalysis.kt
@@ -0,0 +1,24 @@
+package cn.flightfeather.supervision.business.autooutput.dataanalysis
+
+import cn.flightfeather.supervision.business.autooutput.AopOutput
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDbMapper
+import cn.flightfeather.supervision.business.autooutput.datasource.AopSceneTypeCheck
+import cn.flightfeather.supervision.domain.ds3.enum.JSSceneType
+import cn.flightfeather.supervision.domain.ds3.mapper.JSDustDataMapper
+import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper
+import org.springframework.stereotype.Component
+
+/**
+ * 閲戝北宸ュ湴鎵皹鐩戞祴鏁版嵁缁熻
+ */
+@Component
+class JSCsDataAnalysis(
+ aopDbMapper: AopDbMapper,
+ aopSceneTypeCheck: AopSceneTypeCheck,
+ aopOutput: AopOutput,
+ jsDustDataMapper: JSDustDataMapper,
+ jsDustSiteMapMapper: JSDustSiteMapMapper
+) : JSDustDataAnalysis(aopDbMapper, aopSceneTypeCheck, aopOutput, jsDustDataMapper, jsDustSiteMapMapper){
+
+ override var sceneType: JSSceneType = JSSceneType.Construction
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt
new file mode 100644
index 0000000..83ab24d
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt
@@ -0,0 +1,142 @@
+package cn.flightfeather.supervision.business.autooutput.dataanalysis
+
+import cn.flightfeather.supervision.business.autooutput.AopOutput
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDbMapper
+import cn.flightfeather.supervision.business.autooutput.datasource.AopSceneTypeCheck
+import cn.flightfeather.supervision.domain.ds3.entity.JSDustData
+import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap
+import cn.flightfeather.supervision.domain.ds3.enum.JSSceneType
+import cn.flightfeather.supervision.domain.ds3.mapper.JSDustDataMapper
+import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper
+import tk.mybatis.mapper.entity.Example
+import java.time.Duration
+import java.time.LocalDateTime
+import java.time.ZoneId
+import kotlin.math.round
+
+/**
+ * 閲戝北鎵皹鐩戞祴鏁版嵁缁熻
+ */
+abstract class JSDustDataAnalysis(
+ aopDbMapper: AopDbMapper,
+ aopSceneTypeCheck: AopSceneTypeCheck,
+ aopOutput: AopOutput,
+ private val jsDustDataMapper: JSDustDataMapper,
+ private val jsDustSiteMapMapper: JSDustSiteMapMapper,
+) : AopDataAnalysis<JSDustData>(aopDbMapper, aopSceneTypeCheck, aopOutput){
+
+ abstract var sceneType: JSSceneType
+
+ override fun districtAvg(source: AopDataSource?): Double? {
+ var total = .0
+ var count = 0
+
+ var page = 0
+ val perPage = 20000
+ var hasNextPage = false
+ do {
+ val res = jsDustDataMapper
+ .getDataBySceneType(source?.config?.startTime, source?.config?.endTime, sceneType.value,
+ page * perPage, perPage)
+ res.forEach {
+ it?.dustValue?.let { v ->
+ total += v
+ count++
+ }
+ }
+ page++
+ hasNextPage = res.isNotEmpty()
+ println("鍧囧�艰绠楋細褰撳墠椤电爜 $page")
+ } while (hasNextPage)
+
+ return if (count == 0) {
+ .0
+ } else {
+ round((total / count) * 1000) / 1000
+ }
+ }
+
+ override fun fetchDataResources(evaluationScene: AopDataSource.EvaluationScene): List<List<JSDustData?>> {
+ val dustSiteMaps = jsDustSiteMapMapper.selectByExample(Example(JSDustSiteMap::class.java).apply {
+ createCriteria().andEqualTo("svUserId", evaluationScene.userInfo.value?.guid)
+ .andIsNotNull("jsDeviceCode")
+ })
+ if (dustSiteMaps.isEmpty()) return emptyList()
+
+ val mnCodeList = dustSiteMaps.map { it?.jsDeviceCode }
+ val map = mutableMapOf<String?, MutableList<JSDustData?>>()
+ jsDustDataMapper.selectByExample(Example(JSDustData::class.java).apply {
+ createCriteria().andBetween("lst", evaluationScene.config?.startTime, evaluationScene.config?.endTime)
+ .andIn("mnCode", mnCodeList)
+ }).forEach {
+ if (!map.containsKey(it?.mnCode)) {
+ map[it?.mnCode] = mutableListOf()
+ }
+ map[it?.mnCode]?.add(it)
+ }
+ val res = mutableListOf<List<JSDustData?>>()
+ map.forEach { (_, u) ->
+ res.add(u)
+ }
+ return res
+ }
+
+ override fun exceedTimes(data: JSDustData, t: TempResult) {
+ data.dustValue?.let {
+ if (it >= 1) {
+ t.count++
+ }
+ }
+ }
+
+ override fun avg(data: JSDustData, t: TempResult) {
+ data.dustValue?.let {
+ t.total += it
+ t.count++
+ }
+ }
+
+ override fun max(data: JSDustData, t: TempResult) {
+ data.dustValue?.let {
+ if (it > t.total) {
+ t.total = it
+ }
+ }
+ }
+
+ override fun min(data: JSDustData, t: TempResult) {
+ data.dustValue?.let {
+ if (t.count == 0 || it < t.total) {
+ t.total = it
+ }
+ // 閫氳繃t.count 鏉ュ垽瀹氭槸鍚︽槸鍒濆鍖栫姸鎬�
+ if (t.count == 0) t.count = 1
+ }
+ }
+
+ override fun overAvgRate(avg: Double, dAvg: Double?): Double? {
+ return if (dAvg != null) {
+ round(((avg - dAvg) / dAvg) * 1000) / 1000
+ } else {
+ null
+ }
+ }
+
+ override fun effectiveRate(
+ dataList: List<List<JSDustData?>>,
+ evaluationScene: AopDataSource.EvaluationScene,
+ ): Double {
+ if (dataList.isEmpty()) return .0
+
+ val st = LocalDateTime.ofInstant(evaluationScene.config?.startTime?.toInstant(), ZoneId.systemDefault())
+ val et = LocalDateTime.ofInstant(evaluationScene.config?.endTime?.toInstant(), ZoneId.systemDefault())
+ val days = Duration.between(st, et).toDays() + 1
+
+ return if (days == 0L) {
+ .0
+ } else {
+ round((count(dataList) / (dataList.size * days * 24 * 4).toDouble()) * 1000) / 1000
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSMpDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSMpDataAnalysis.kt
new file mode 100644
index 0000000..8020662
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSMpDataAnalysis.kt
@@ -0,0 +1,24 @@
+package cn.flightfeather.supervision.business.autooutput.dataanalysis
+
+import cn.flightfeather.supervision.business.autooutput.AopOutput
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDbMapper
+import cn.flightfeather.supervision.business.autooutput.datasource.AopSceneTypeCheck
+import cn.flightfeather.supervision.domain.ds3.enum.JSSceneType
+import cn.flightfeather.supervision.domain.ds3.mapper.JSDustDataMapper
+import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper
+import org.springframework.stereotype.Component
+
+/**
+ * 閲戝北鎼呮媽绔欐壃灏樼洃娴嬫暟鎹粺璁�
+ */
+@Component
+class JSMpDataAnalysis(
+ aopDbMapper: AopDbMapper,
+ aopSceneTypeCheck: AopSceneTypeCheck,
+ aopOutput: AopOutput,
+ jsDustDataMapper: JSDustDataMapper,
+ jsDustSiteMapMapper: JSDustSiteMapMapper,
+) : JSDustDataAnalysis(aopDbMapper, aopSceneTypeCheck, aopOutput, jsDustDataMapper, jsDustSiteMapMapper) {
+
+ override var sceneType: JSSceneType = JSSceneType.MixingPlant
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSWhDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSWhDataAnalysis.kt
new file mode 100644
index 0000000..222cd24
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSWhDataAnalysis.kt
@@ -0,0 +1,24 @@
+package cn.flightfeather.supervision.business.autooutput.dataanalysis
+
+import cn.flightfeather.supervision.business.autooutput.AopOutput
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDbMapper
+import cn.flightfeather.supervision.business.autooutput.datasource.AopSceneTypeCheck
+import cn.flightfeather.supervision.domain.ds3.enum.JSSceneType
+import cn.flightfeather.supervision.domain.ds3.mapper.JSDustDataMapper
+import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper
+import org.springframework.stereotype.Component
+
+/**
+ * 閲戝北鐮佸ご鎵皹鐩戞祴鏁版嵁缁熻
+ */
+@Component
+class JSWhDataAnalysis(
+ aopDbMapper: AopDbMapper,
+ aopSceneTypeCheck: AopSceneTypeCheck,
+ aopOutput: AopOutput,
+ jsDustDataMapper: JSDustDataMapper,
+ jsDustSiteMapMapper: JSDustSiteMapMapper,
+) : JSDustDataAnalysis(aopDbMapper, aopSceneTypeCheck, aopOutput, jsDustDataMapper, jsDustSiteMapMapper) {
+
+ override var sceneType: JSSceneType = JSSceneType.Wharf
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..b4f9b26
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt
@@ -0,0 +1,145 @@
+package cn.flightfeather.supervision.business.autooutput.dataanalysis
+
+import cn.flightfeather.supervision.business.autooutput.AopOutput
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDbMapper
+import cn.flightfeather.supervision.business.autooutput.datasource.AopSceneTypeCheck
+import cn.flightfeather.supervision.domain.ds3.entity.FumeDailyAnalysis
+import cn.flightfeather.supervision.domain.ds3.entity.FumeExceptionData
+import cn.flightfeather.supervision.domain.ds3.entity.FumeSiteMap
+import cn.flightfeather.supervision.domain.ds3.mapper.FumeDailyAnalysisMapper
+import cn.flightfeather.supervision.domain.ds3.mapper.FumeExceptionDataMapper
+import cn.flightfeather.supervision.domain.ds3.mapper.FumeSiteMapMapper
+import org.springframework.stereotype.Component
+import tk.mybatis.mapper.entity.Example
+import kotlin.math.round
+
+/**
+ * 寰愭眹娌圭儫鐩戞祴鏁版嵁缁熻
+ */
+@Component
+class XHFuDataAnalysis(
+ aopDbMapper: AopDbMapper,
+ aopSceneTypeCheck: AopSceneTypeCheck,
+ aopOutput: AopOutput,
+ private val fumeSiteMapMapper: FumeSiteMapMapper,
+ private val fumeDailyAnalysisMapper: FumeDailyAnalysisMapper,
+ private val fumeExceptionDataMapper: FumeExceptionDataMapper,
+): AopDataAnalysis<FumeDailyAnalysis>(aopDbMapper, aopSceneTypeCheck, aopOutput) {
+
+ // 娌圭儫鏁版嵁鏆傛棤鍖哄潎鍊肩殑璁$畻
+ override fun districtAvg(source: AopDataSource?): Double? {
+ return null
+ }
+
+ private fun getDeviceCodes(evaluationScene: AopDataSource.EvaluationScene): List<String?> {
+ val fumeSiteMaps = fumeSiteMapMapper.selectByExample(Example(FumeSiteMap::class.java).apply {
+ createCriteria().andEqualTo("svUserId", evaluationScene.userInfo.value?.guid)
+ .andIsNotNull("xhDeviceCode")
+ })
+ return fumeSiteMaps.map { it?.xhDeviceCode }
+ }
+
+ override fun fetchDataResources(evaluationScene: AopDataSource.EvaluationScene): List<List<FumeDailyAnalysis?>> {
+ val deviceCodeList = getDeviceCodes(evaluationScene)
+ 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)
+ }).forEach {
+ if (!map.containsKey(it?.fumeDevId)) {
+ map[it?.fumeDevId] = mutableListOf()
+ }
+ map[it?.fumeDevId]?.add(it)
+ }
+ val res = mutableListOf<List<FumeDailyAnalysis?>>()
+ map.forEach { (_, u) ->
+ res.add(u)
+ }
+ return res
+ }
+
+ fun fetchExceptionData(evaluationScene: AopDataSource.EvaluationScene): List<FumeExceptionData?> {
+ val deviceCodeList = getDeviceCodes(evaluationScene)
+ return if (deviceCodeList.isEmpty()) {
+ emptyList()
+ } else {
+ val code = deviceCodeList[0]
+ fumeExceptionDataMapper.selectByExample(Example(FumeExceptionData::class.java).apply {
+ createCriteria().andBetween("beginTime", evaluationScene.config?.startTime, evaluationScene.config?.endTime)
+ .andEqualTo("devId", code)
+ .andEqualTo("exception", "鏁版嵁寮傚父")
+ .andEqualTo("exceptionType", "0")
+ })
+ }
+ }
+
+ /**
+ * 娌圭儫瓒呮爣鏁�
+ * 鍙粺璁¢噸鐐规椂娈靛唴锛堜腑鍗堛�佹櫄涓婏級鐨勮秴鏍囨儏鍐�
+ */
+ override fun exceedTimes(data: FumeDailyAnalysis, t: TempResult) {
+ data.noonExceedingNum?.toInt()?.let {
+ t.count += it
+ }
+ data.nightExceedingNum?.toInt()?.let {
+ t.count += it
+ }
+ }
+
+ override fun avg(data: FumeDailyAnalysis, t: TempResult) {
+ data.fumeDayAverage?.let {
+ t.total += it
+ t.count++
+ }
+ }
+
+ override fun max(data: FumeDailyAnalysis, t: TempResult) {
+ data.fumeDayMax?.let {
+ if (it > t.total) {
+ t.total = it
+ }
+ }
+ }
+
+ override fun min(data: FumeDailyAnalysis, t: TempResult) {
+ data.fumeDayMin?.let {
+ if (t.count == 0 || it < t.total) {
+ t.total = it
+ }
+ // 閫氳繃t.count 鏉ュ垽瀹氭槸鍚︽槸鍒濆鍖栫姸鎬�
+ if (t.count == 0) t.count = 1
+ }
+ }
+
+ override fun overAvgRate(avg: Double, dAvg: Double?): Double? {
+ return null
+ }
+
+ override fun effectiveRate(
+ dataList: List<List<FumeDailyAnalysis?>>,
+ evaluationScene: AopDataSource.EvaluationScene,
+ ): Double {
+ var total = .0
+ var count = 0
+ dataList.forEach {list ->
+ list.forEach {
+ val noon = it?.noonOnlineRate?.removeSuffix("%")?.toDouble()?.div(100)
+ val night = it?.nightOnlineRate?.removeSuffix("%")?.toDouble()?.div(100)
+ noon?.let {
+ total += noon
+ count++
+ }
+ night?.let {
+ total += night
+ count++
+ }
+ }
+ }
+ return if (count == 0) {
+ .0
+ } else {
+ round((total / count) * 1000) / 1000
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataConfig.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataConfig.kt
index 2be7918..8a6df97 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataConfig.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataConfig.kt
@@ -9,8 +9,8 @@
* 鏁版嵁鏉ユ簮鍙傛暟
*/
data class AopDataConfig(
- val startTime: Date? = null,
- val endTime: Date? = null,
+ var startTime: Date? = null,
+ var endTime: Date? = null,
val year: Int? = null,
val month: Int? = null,
@@ -25,7 +25,7 @@
val topTaskGuid: String? = null,
/**
- * 鍦烘櫙绫诲瀷鏍规嵁涓嶅悓绯荤粺閲囩敤涓嶅悓鐨勫�硷紝鍙傝�僛Constant.ScenseType]
+ * 鍦烘櫙绫诲瀷鏍规嵁涓嶅悓绯荤粺閲囩敤涓嶅悓鐨勫�硷紝鍙傝�僛Constant.SceneType]
*/
var sceneType: Int? = null,
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
index 80d462f..088061b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
@@ -47,6 +47,18 @@
}
}
+ fun setResource(subtask: Subtask) {
+ val scene = aopDbMapper.scenseMapper.selectByPrimaryKey(subtask.scenseid)
+ val sceneType = scene.typeid?.toInt()
+ val config = AopDataConfig(topTaskGuid = subtask.tguid, sceneType = sceneType,
+ districtName = subtask.districtname, townCode = subtask.towncode)
+ evaluationScene.config = config
+// val check = aopSceneTypeCheck.checkSceneType(sceneType)
+ this.mode = 0
+ sceneSourceList.clear()
+ sceneSourceList.add(scene)
+ }
+
/**
* 杞鏁版嵁婧�
*/
@@ -83,12 +95,6 @@
aopDbMapper.scenseMapper.selectByExample(Example(Scense::class.java).apply {
createCriteria()
.andIn("guid", taskSceneIdList)
-// .andEqualTo("provincecode", config.provinceCode)
-// .andEqualTo("citycode", config.cityCode)
-// .andEqualTo("districtcode", config.districtCode)
-// .andEqualTo("towncode", config.townCode)
-// .andEqualTo("typeid", config.sceneType)
-// .andNotEqualTo("extension1", '0')
})?.let { sceneSourceList.addAll(it) }
}
@@ -166,23 +172,23 @@
val baseScene = InfoProxy<BaseScene> {_,_ ->
return@InfoProxy when (config?.sceneType.toString()) {
// 鐩戠绯荤粺
- Constant.ScenseType.TYPE1.value -> {
+ Constant.SceneType.TYPE1.value -> {
aopDbMapper.sceneConstructionSiteMapper.selectByPrimaryKey(scene.value?.guid)
}
- Constant.ScenseType.TYPE2.value -> {
+ Constant.SceneType.TYPE2.value -> {
aopDbMapper.sceneWharfMapper.selectByPrimaryKey(scene.value?.guid)
}
- Constant.ScenseType.TYPE3.value -> {
+ Constant.SceneType.TYPE3.value -> {
aopDbMapper.sceneMixingPlantMapper.selectByPrimaryKey(scene.value?.guid)
}
- Constant.ScenseType.TYPE14.value -> {
+ Constant.SceneType.TYPE14.value -> {
aopDbMapper.sceneStorageYardMapper.selectByPrimaryKey(scene.value?.guid)
}
// 鍙拌处绯荤粺
- Constant.ScenseType.TYPE5.value -> {
+ Constant.SceneType.TYPE5.value -> {
aopDbMapper.restaurantBaseInfoMapper.selectByPrimaryKey(userInfoTZ.value?.guid)
}
- Constant.ScenseType.TYPE6.value -> {
+ Constant.SceneType.TYPE6.value -> {
aopDbMapper.vehicleBaseInfoMapper.selectByPrimaryKey(userInfoTZ.value?.guid)
}
else -> null
@@ -295,7 +301,7 @@
//蹇呭~鍙拌处鏁伴噺
val ledgerCount = InfoProxy<Int>(config?.sceneType.toString()) {_, cacheMap ->
- val tzSceneType = Constant.ScenseType.typeMap(scene.value?.typeid)
+ val tzSceneType = Constant.SceneType.typeMap(scene.value?.typeid)
val list = aopDbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply {
createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true)
})
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopSceneTypeCheck.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopSceneTypeCheck.kt
index dd7f6fa..b819f36 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopSceneTypeCheck.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopSceneTypeCheck.kt
@@ -17,12 +17,12 @@
* 鍦烘櫙绫诲瀷鍒ゅ畾
* @return 鍒ゆ柇缁撴灉锛岋紙鏄惁浣跨敤鏈郴缁熷畾涔夛紝绫诲瀷鍊硷級
*/
- fun checkSceneType(sceneType: Int): Pair<Boolean, Int> {
+ fun checkSceneType(sceneType: Int?): Pair<Boolean, Int?> {
// TODO: 2023/9/7 閫氳繃鏁版嵁搴撻厤缃〃鍐冲畾褰撳墠绫诲瀷鐨勬渶缁堢被鍨嬪畾涔�
// FIXME: 2023/9/7 鏆傛椂鍐欐鐩稿叧閰嶇疆
- return if (sceneType.toString() == Constant.ScenseType.TYPE6.value) {
- Pair(false, Constant.ScenseType.typeMap(sceneType.toByte())!!.toInt())
+ return if (sceneType.toString() == Constant.SceneType.TYPE6.value) {
+ Pair(false, Constant.SceneType.typeMap(sceneType?.toByte())!!.toInt())
} else {
Pair(true, sceneType)
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
new file mode 100644
index 0000000..4bfc770
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
@@ -0,0 +1,46 @@
+package cn.flightfeather.supervision.business.autooutput.score
+
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
+import cn.flightfeather.supervision.common.utils.Constant
+import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
+import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
+import cn.flightfeather.supervision.domain.ds2.repository.OverallEvaluationRep
+import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep
+import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep
+import org.springframework.stereotype.Component
+import java.time.LocalDate
+
+/**
+ * 鏍规嵁鑷姩璇勪及[AopEvaluation]缁撴灉鐢熸垚鐜俊鐮�
+ */
+@Component
+class AopCreditCode(
+ private val userInfoTZRep: UserInfoTZRep,
+ private val userMapRep: UserMapRep,
+ private val evaluationRep: EvaluationRep,
+ private val overallEvaluationRep: OverallEvaluationRep,
+) {
+
+ fun execute(config: AopDataConfig) {
+ if (config.year == null || config.month == null) throw IllegalStateException("鐜俊鐮佽瘎浼版椂蹇呴』浼犻�掓椂闂存潯浠�!")
+ // 鎵惧埌椋炵窘鐜涓渶瑕佺敓鎴愮幆淇$爜鐨勬墍鏈夌珯鐐�
+ val sceneType = Constant.SceneType.getByValue(config.sceneType.toString())
+ val userList = findUsers(config.districtName, sceneType)
+ val date = LocalDate.of(config.year, config.month, 1)
+ val endDate = date.plusMonths(config.period.toLong() - 1)
+ userList.forEach {
+ userMapRep.findFromSupervision(it)?.let { s ->
+ // 浠庨缇界洃绠$郴缁熶腑鏌ユ壘璇勫垎
+ val e = evaluationRep.findByScene(s.guid, date)
+ e?.resultscorebef?.toInt()?.let {score ->
+ // 鏍规嵁璇勫垎鐢熸垚瀵瑰簲鐨勭幆淇$爜
+ overallEvaluationRep.insertOrUpdateOne(it?.guid, score, sceneType, date, endDate)
+ }
+ }
+ }
+ }
+
+ private fun findUsers(districtName: String?, type: Constant.SceneType): List<UserinfoTZ?> {
+ return userInfoTZRep.findEnterpriseUser(districtName, type)
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopEvaluation.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopEvaluation.kt
index a2c9c8c..384110f 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopEvaluation.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopEvaluation.kt
@@ -15,6 +15,7 @@
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
+import cn.flightfeather.supervision.domain.ds1.entity.Subtask
import org.springframework.stereotype.Component
import java.util.*
import kotlin.math.abs
@@ -24,9 +25,9 @@
*/
@Component
class AopEvaluation(
+ private val aopOutput: AopOutput,
private val aopDbMapper: AopDbMapper,
private val aopSceneTypeCheck: AopSceneTypeCheck,
- private val aopOutput: AopOutput,
csScoreItem1: CsScoreItem1,
csScoreItem2: CsScoreItem2,
mpScoreItem1: MpScoreItem1,
@@ -35,15 +36,14 @@
whScoreItem1: WhScoreItem1,
whScoreItem2: WhScoreItem2,
reScoreItem5: ReScoreItem5,
- reScoreItem7: ReScoreItem7,
+ // FIXME: 2023/12/29 鍒犲幓鐗规畩璇勪及瑙勫垯
+// reScoreItem7: ReScoreItem7,
reScoreItem8: ReScoreItem8,
reScoreItem9: ReScoreItem9,
reScoreItem10: ReScoreItem10,
reScoreItem11: ReScoreItem11,
) {
- //鏁版嵁婧�
- private var source: AopDataSource? = null
//鐗瑰畾璇勫垎椤癸紙闄や簡缁熶竴鐨勬牴鎹贰鏌ラ棶棰樼洿鎺ユ墸鍒嗗锛屾湁鐗瑰畾鐨勬墸鍒嗛�昏緫鐨勮瘎浼伴」锛�
private val itemList = mutableListOf<ScoreItem>()
@@ -57,7 +57,7 @@
add(whScoreItem1)
add(whScoreItem2)
add(reScoreItem5)
- add(reScoreItem7)
+// add(reScoreItem7)
add(reScoreItem8)
add(reScoreItem9)
add(reScoreItem10)
@@ -65,18 +65,43 @@
}
}
- fun setResource(topTaskGuid: String?, sceneType: Int, districtName: String? = null, townCode: String? = null) {
- source = AopDataSource(aopDbMapper, aopSceneTypeCheck)
- source?.setResource(topTaskGuid, sceneType, districtName, townCode)
+ fun executeByTopTask(topTaskGuid: String?, sceneType: Int, districtName: String? = null, townCode: String? = null) {
+ val source = setResource(topTaskGuid, sceneType, districtName, townCode)
+ execute(source)
+ }
+
+ /**
+ * 瀵圭壒瀹氱殑宸℃煡浠诲姟杩涜鍗曠嫭璇勫垎
+ */
+ fun executeBySubTask(subTask:Subtask) {
+ val source = setResource(subTask)
+ execute(source)
+ }
+
+ private fun setResource(subTask: Subtask): AopDataSource {
+ val source = AopDataSource(aopDbMapper, aopSceneTypeCheck)
+ source.setResource(subTask)
+ return source
+ }
+
+ private fun setResource(
+ topTaskGuid: String?,
+ sceneType: Int,
+ districtName: String?,
+ townCode: String?,
+ ): AopDataSource {
+ val source = AopDataSource(aopDbMapper, aopSceneTypeCheck)
+ source.setResource(topTaskGuid, sceneType, districtName, townCode)
+ return source
}
/**
* 鎵ц璇勫垎閫昏緫
*/
- fun execute() {
+ private fun execute(source: AopDataSource) {
//鑾峰彇鏁版嵁婧愶紙寰呰瘎浼扮殑鍦烘櫙锛�
//寰幆澶勭悊姣忎釜鍦烘櫙
- source?.loop {index, evaluationScene ->
+ source.loop {index, evaluationScene ->
if (evaluationScene.noRecord()) return@loop
itemGrade(index, evaluationScene)
@@ -84,7 +109,6 @@
aopOutput.toDbEvaluation(evaluationScene, this)
}
}
-
}
/**
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreItem.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreItem.kt
index 4a50913..6264100 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreItem.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreItem.kt
@@ -66,7 +66,7 @@
* @param size 浼犲叆璇勫垎鏉$洰鐨勬暟閲忥紝璇勫垎鏉$洰鎸夌収涓�瀹氳鍒欒繘琛屾帓搴�
* @return 杩斿洖闇�瑕佹墸鍒嗙殑璇勫垎鏉$洰鐨勫簭鍙�
*/
- abstract fun otherProblem(size: Int): Int?
+ abstract fun otherProblem(size: Int): List<Int>?
/**
* 鑷姩璇勫垎璁$畻閫昏緫
@@ -77,7 +77,9 @@
return
}
- otherProblem(rulePair?.second!!.size)?.let {i-> rulePair?.second!![i].getScore() }
+ otherProblem(rulePair?.second!!.size)?.let { it.forEach {i ->
+ rulePair?.second!![i].getScore()
+ } }
ScoreUtil.subRuleCal(rulePair)
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreUtil.kt
index b1385d3..05d102d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreUtil.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreUtil.kt
@@ -2,11 +2,13 @@
import cn.flightfeather.supervision.business.Info
import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource
+import cn.flightfeather.supervision.common.utils.ExcelUtil
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.domain.ds1.entity.Inspection
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
+import org.apache.poi.hssf.util.HSSFColor
import kotlin.math.abs
/**
@@ -63,4 +65,24 @@
value = itemRule.extension1 ?: "0"
extension1 = (itemRule.extension1 != null).toString()
}
+
+ /**
+ * 鍒嗘暟杞崲鐜俊鐮�
+ */
+ fun scoreToCredit(s: Int?): Pair<Int?, String?> {
+ return when (s) {
+ in 0..59 -> Pair(2, "绾㈢爜")
+ in 60..89 -> Pair(1, "榛勭爜")
+ in 90..100 -> Pair(0, "缁跨爜")
+ null -> Pair(null, null)
+ else -> Pair(-1, "瓒呭嚭鑼冨洿")
+ }
+ }
+
+ /**
+ * 鍒嗘暟杞崲瑙勮寖绛夌骇
+ */
+ fun scoreToStandard() {
+
+ }
}
\ No newline at end of file
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 80df22a..4f6bbeb 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
@@ -33,7 +33,7 @@
* 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
* 2.闂鏃犳暣鏀�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
createCriteria().andEqualTo("stguid", evaluationScene.subTask.value?.stguid)
// .andGreaterThanOrEqualTo("time", info.sTime)
@@ -49,8 +49,8 @@
}
}
return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
+ changed == 0 && total > 0 -> listOf(1)
+ changed < total -> listOf(0)
else -> null
}
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem2.kt
index 40a8ae9..e25c9e1 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem2.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem2.kt
@@ -40,7 +40,7 @@
* 1.鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�
* 2.鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val time = evaluationScene.subTask.value?.planstarttime
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
@@ -51,14 +51,14 @@
.andEqualTo("drSceneId", evaluationScene.scene.value?.guid)
})
- var result: Int? = null
+ var result = mutableListOf<Int>()
r.forEach {
if (it == null) return@forEach
if (it.drExceedTimes > 0) {
- result = 0
+ result.add(0)
}
if (it.drOverAvgPer > 0.2) {
- result = 1
+ result.add(1)
}
}
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 41ef7b6..8cf3d74 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
@@ -33,7 +33,7 @@
* 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
* 2.闂鏃犳暣鏀�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
createCriteria().andEqualTo("stguid", evaluationScene.subTask.value?.stguid)
// .andGreaterThanOrEqualTo("time", info.sTime)
@@ -49,8 +49,8 @@
}
}
return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
+ changed == 0 && total > 0 -> listOf(1)
+ changed < total -> listOf(0)
else -> null
}
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem2.kt
index 1e99a24..c77c7c6 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem2.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem2.kt
@@ -40,7 +40,7 @@
* 1.鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�
* 2.鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val time = evaluationScene.subTask.value?.planstarttime
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
@@ -51,14 +51,14 @@
.andEqualTo("drSceneId", evaluationScene.scene.value?.guid)
})
- var result: Int? = null
+ var result = mutableListOf<Int>()
r.forEach {
if (it == null) return@forEach
if (it.drExceedTimes > 0) {
- result = 0
+ result.add(0)
}
if (it.drOverAvgPer > 0.2) {
- result = 1
+ result.add(1)
}
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem10.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem10.kt
index 10faf8d..d7b7b88 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem10.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem10.kt
@@ -38,7 +38,7 @@
* 3.鏀跺埌鎵ф硶鎰忚涔�
* 4.鏈夌幆澧冭繚娉曡涓轰笖鍙楀埌琛屾斂澶勭綒
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val time = evaluationScene.subTask.value?.planstarttime
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
val s = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
@@ -48,21 +48,16 @@
when {
condition3(s, e) -> {
i = 3
- if (i > size - 1) i = size - 1
- return i
}
condition2(s, e) -> {
i = 2
- if (i > size - 1) i = size - 1
- return i
}
condition1(s, e) -> {
i = 1
- if (i > size - 1) i = size - 1
- return i
}
- else -> return null
}
+ if (i > size - 1) i = size - 1
+ return listOf(i)
}
/**
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem11.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem11.kt
index 746cb89..4bf2f21 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem11.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem11.kt
@@ -25,17 +25,15 @@
* 1.鐜淇$敤涓嶈鑼冩垨鎵胯鏈寜鏃舵彁浜ゆ垨瓒呮湁鏁堟湡锛屼互鍙婃秹鍙婃硶浜哄彉鏇寸殑鎴栬惀涓氭墽鐓у彉鏇存湭閲嶆柊鎵胯鐨�
* 2.鐜淇$敤鑷瘎鏈寜鏃惰嚜璇勬垨鏈寜鏃舵彁
*/
- override fun otherProblem(size: Int): Int? {
- var i = 1
+ override fun otherProblem(size: Int): List<Int>? {
+ var i = 0
if (condition1()) {
- if (i > size - 1) i = size - 1
- return i
+ i = 1
} else if (condition2()) {
i = 2
- if (i > size - 1) i = size - 1
- return i
}
- return null
+ if (i > size - 1) i = size - 1
+ return listOf(i)
}
/**
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5.kt
index 688df3e..9200e28 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5.kt
@@ -1,18 +1,23 @@
package cn.flightfeather.supervision.business.autooutput.score.restaurant
+import cn.flightfeather.supervision.business.autooutput.dataanalysis.XHFuDataAnalysis
import cn.flightfeather.supervision.business.autooutput.score.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
+import cn.flightfeather.supervision.domain.ds3.entity.FumeDailyAnalysis
+import cn.flightfeather.supervision.domain.ds3.entity.FumeExceptionData
+import cn.flightfeather.supervision.domain.ds3.mapper.FumeDailyAnalysisMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
import java.time.LocalDateTime
import java.time.ZoneId
+import java.util.*
import javax.annotation.PostConstruct
@Component
-class ReScoreItem5: ScoreItem() {
+class ReScoreItem5(private val xhFuDataAnalysis: XHFuDataAnalysis) : ScoreItem() {
companion object {
private lateinit var instance: ReScoreItem5
}
@@ -24,7 +29,7 @@
override var id: String = "PSQUi9f0f7JK6w9d"
- override var name: String="娌圭儫鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇"
+ override var name: String = "娌圭儫鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇"
@Autowired
lateinit var dustDataResultMapper: DustDataResultMapper
@@ -32,67 +37,80 @@
/**
* 寰愭眹鍖洪楗洃绠″钩鍙拌仈缃戣褰曘�佸湪绾跨巼鍒嗘瀽鏁版嵁鍜岄珮宄扮粡钀ユ椂娈靛皬鏃惰秴鏍囨儏鍐�
* 閫夐」濡備笅锛�
- * 1.鏁版嵁鏃犲紓甯镐笖鏃犺秴鏍囨垨鏄剧ず鍑�鍖栬缃竻娲�
- * 2.楂樺嘲缁忚惀鏃舵鏁版嵁鍦ㄧ嚎鐜囦綆浜�90%鎴栨樉绀哄噣鍖栬缃晠闅�
- * 3.褰撴湀楂樺嘲缁忚惀鏃舵鍑虹幇涓夋鍙婁互涓�10鍒嗛挓鍧囧�艰秴鏍囨垨鏄剧ず鍑�鍖栬缃緝鑴�
- * 4.褰撴湀楂樺嘲缁忚惀鏃舵鏁版嵁鎸佺画寮傚父鎴栧嚭鐜颁笁娆″強浠ヤ笂灏忔椂鏁版嵁瓒呮爣鎴栨棤娌圭儫鍑�鍖栬缃垨鍑�鍖栬缃湭姝e父寮�鍚�
+ * 1.鏁版嵁鏃犲紓甯镐笖鏃犺秴鏍囨垨鏄剧ず鍑�鍖栬缃竻娲侊紙涓嶆墸鍒嗭級
+ * 2.褰撴湀瀛樺湪鏃ラ珮宄扮粡钀ユ椂娈垫暟鎹湪绾跨巼浣庝簬90%涓斿嚭鐜�3鏃ュ強浠ヤ笂锛堟墸5鍒嗭級
+ * 3.褰撴湀瀛樺湪鏃ラ珮宄扮粡钀ユ椂娈佃繛缁笁娆″強浠ヤ笂10鍒嗛挓鍧囧�艰秴鏍囦笖鍑虹幇2鏃ュ強浠ュ唴鐨勬垨鏄剧ず鍑�鍖栬缃緝鑴忥紙鎵�5鍒嗭級
+ * 4.褰撴湀瀛樺湪鏃ラ珮宄扮粡钀ユ椂娈佃繛缁笁娆″強浠ヤ笂10鍒嗛挓鍧囧�艰秴鏍囦笖鍑虹幇3鏃ュ強浠ヤ笂鐨勬垨鏃犳补鐑熷噣鍖栬缃垨鍑�鍖栬缃湭姝e父寮�鍚垨鏄剧ず鍑�鍖栬缃晠闅滐紙鎵�10鍒嗭級
*/
- override fun otherProblem(size: Int): Int? {
- var i = 1
- when {
- condition1() -> {
- if (i > size - 1) i = size - 1
- return i
- }
- condition2() -> {
- i = 2
- if (i > size - 1) i = size - 1
- return i
- }
- condition3() -> {
- i = 3
- if (i > size - 1) i = size - 1
- return i
- }
- else -> return null
- }
- }
+ override fun otherProblem(size: Int): List<Int>? {
+ val result = mutableListOf<Int>()
- /**
- * @return true 楂樺嘲缁忚惀鏃舵鏁版嵁鍦ㄧ嚎鐜囦綆浜�90%鎴栨樉绀哄噣鍖栬缃晠闅�
- */
- private fun condition1(): Boolean {
- return false
- }
-
- /**
- * @return true 褰撴湀楂樺嘲缁忚惀鏃舵鍑虹幇涓夋鍙婁互涓�10鍒嗛挓鍧囧�艰秴鏍囨垨鏄剧ず鍑�鍖栬缃緝鑴�
- */
- private fun condition2(): Boolean {
val time = evaluationScene.subTask.value?.planstarttime
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
val et = st.plusMonths(1)
- val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
- createCriteria().andGreaterThanOrEqualTo("drTime", st)
- .andLessThan("drTime", et)
- .andEqualTo("drSceneId", evaluationScene.scene.value?.guid)
- })
+ evaluationScene.config?.startTime = Date.from(st.atZone(ZoneId.systemDefault()).toInstant())
+ evaluationScene.config?.endTime = Date.from(et.atZone(ZoneId.systemDefault()).toInstant())
+ val dailyAnalysisDataList = xhFuDataAnalysis.fetchDataResources(evaluationScene)
+ val exceptionDataList = xhFuDataAnalysis.fetchExceptionData(evaluationScene)
- var result = false
- r.forEach {
- if (it == null) return@forEach
- if (it.drExceedTimes >= 3) {
- result = true
+ var count = 0
+ dailyAnalysisDataList.forEach { it.forEach dList@ {f ->
+ val keyOnlineRate = f?.keyOnlineRate?.split("%")?.get(0)?.toDouble() ?: return@dList
+ if (keyOnlineRate < 0.9) {
+ count++
+ }
+ } }
+
+ if (count >= 3) {
+ result.add(1)
+ }
+
+ val dayList = mutableListOf<Int>()
+ exceptionDataList.forEach {
+ // 涓嶅湪楂樺嘲鏃舵鐨勫紓甯告暟鎹笉浣滀负鍒ゆ柇渚濇嵁
+ if (!peakPeriod(it)) return@forEach
+ // 寮傚父鏃堕暱澶т簬绛変簬20鍒嗛挓锛岃〃绀轰笁涓椂闂寸偣鐨勬暟鎹紓甯�
+ if ((it?.endTime?.time?.minus(it.beginTime.time) ?: 0) >= (20 * 60 * 1000)) {
+ val cal = Calendar.getInstance()
+ cal.time = it!!.beginTime
+ val date = cal.get(Calendar.DAY_OF_MONTH)
+ if (!dayList.contains(date)) {
+ dayList.add(date)
+ }
}
}
+ //鏃ラ珮宄扮粡钀ユ椂娈佃繛缁笁娆″強浠ヤ笂10鍒嗛挓鍧囧�艰秴鏍囦笖鍑虹幇3鏃ュ強浠ヤ笂
+ if (dayList.size >= 3) {
+ result.add(3)
+ }
+ //鏃ラ珮宄扮粡钀ユ椂娈佃繛缁笁娆″強浠ヤ笂10鍒嗛挓鍧囧�艰秴鏍囦笖鍑虹幇2鏃ュ強浠ュ唴
+ else if (dayList.size > 0) {
+ result.add(2)
+ }
+
return result
}
/**
- * @return true 褰撴湀楂樺嘲缁忚惀鏃舵鏁版嵁鎸佺画寮傚父鎴栧嚭鐜颁笁娆″強浠ヤ笂灏忔椂鏁版嵁瓒呮爣鎴栨棤娌圭儫鍑�鍖栬缃垨鍑�鍖栬缃湭姝e父寮�鍚�
+ * 鍒ゆ柇寮傚父鏄惁澶勪簬楂樺嘲鏃舵
*/
- private fun condition3(): Boolean {
- return false
+ private fun peakPeriod(data: FumeExceptionData?): Boolean {
+ if (data == null) return false
+ val today = LocalDateTime.ofInstant(data.beginTime.toInstant(), ZoneId.systemDefault())
+ val noonP1 = today.withHour(9).withMinute(59).withSecond(59)
+ val noonP2 = today.withHour(14).withMinute(0).withSecond(0)
+ val nightP1 = today.withHour(16).withMinute(59).withSecond(59)
+ val nightP2 = today.withHour(21).withMinute(0).withSecond(0)
+ val beginTime = LocalDateTime.ofInstant(data.beginTime.toInstant(), ZoneId.systemDefault())
+ val endTime = LocalDateTime.ofInstant(data.endTime.toInstant(), ZoneId.systemDefault())
+ val b1 =
+ (beginTime.isAfter(noonP1) && beginTime.isBefore(noonP2)) || (beginTime.isAfter(nightP1) && beginTime.isBefore(
+ nightP2))
+ val b2 = (endTime.isAfter(noonP1) && endTime.isBefore(noonP2)) || (endTime.isAfter(nightP1) && endTime.isBefore(
+ nightP2))
+
+ return b1 || b2
}
+
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5BackUp.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5BackUp.kt
new file mode 100644
index 0000000..c7dbd23
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5BackUp.kt
@@ -0,0 +1,86 @@
+package cn.flightfeather.supervision.business.autooutput.score.restaurant
+
+import cn.flightfeather.supervision.business.autooutput.score.ScoreItem
+import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
+import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Component
+import tk.mybatis.mapper.entity.Example
+import java.time.LocalDateTime
+import java.time.ZoneId
+import javax.annotation.PostConstruct
+
+@Component
+class ReScoreItem5BackUp: ScoreItem() {
+ companion object {
+ private lateinit var instance: ReScoreItem5BackUp
+ }
+
+ @PostConstruct
+ fun init() {
+ instance = this
+ }
+
+ override var id: String = "PSQUi9f0f7JK6w9d"
+
+ override var name: String="娌圭儫鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇"
+
+ @Autowired
+ lateinit var dustDataResultMapper: DustDataResultMapper
+
+ /**
+ * 寰愭眹鍖洪楗洃绠″钩鍙拌仈缃戣褰曘�佸湪绾跨巼鍒嗘瀽鏁版嵁鍜岄珮宄扮粡钀ユ椂娈靛皬鏃惰秴鏍囨儏鍐�
+ * 閫夐」濡備笅锛�
+ * 1.鏁版嵁鏃犲紓甯镐笖鏃犺秴鏍囨垨鏄剧ず鍑�鍖栬缃竻娲�
+ * 2.楂樺嘲缁忚惀鏃舵鏁版嵁鍦ㄧ嚎鐜囦綆浜�90%鎴栨樉绀哄噣鍖栬缃晠闅�
+ * 3.褰撴湀楂樺嘲缁忚惀鏃舵鍑虹幇涓夋鍙婁互涓�10鍒嗛挓鍧囧�艰秴鏍囨垨鏄剧ず鍑�鍖栬缃緝鑴�
+ * 4.褰撴湀楂樺嘲缁忚惀鏃舵鏁版嵁鎸佺画寮傚父鎴栧嚭鐜颁笁娆″強浠ヤ笂灏忔椂鏁版嵁瓒呮爣鎴栨棤娌圭儫鍑�鍖栬缃垨鍑�鍖栬缃湭姝e父寮�鍚�
+ */
+ override fun otherProblem(size: Int): List<Int>? {
+ val time = evaluationScene.subTask.value?.planstarttime
+ val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
+ val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
+ val et = st.plusMonths(1)
+ val res = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
+ createCriteria().andGreaterThanOrEqualTo("drTime", st)
+ .andLessThan("drTime", et)
+ .andEqualTo("drSceneId", evaluationScene.scene.value?.guid)
+ }).takeIf { it.isNotEmpty() }?.get(0) ?: return null
+
+ var i = 0
+ when {
+ condition1(res) -> {
+ i = 1
+ }
+ condition2(res) -> {
+ i = 2
+ }
+ condition3(res) -> {
+ i = 3
+ }
+ }
+ if (i > size - 1) i = size - 1
+ return listOf(i)
+ }
+
+ /**
+ * @return true 楂樺嘲缁忚惀鏃舵鏁版嵁鍦ㄧ嚎鐜囦綆浜�90%鎴栨樉绀哄噣鍖栬缃晠闅�
+ */
+ private fun condition1(res: DustDataResult): Boolean {
+ return res.drEffectiveRate < .9
+ }
+
+ /**
+ * @return true 褰撴湀楂樺嘲缁忚惀鏃舵鍑虹幇涓夋鍙婁互涓�10鍒嗛挓鍧囧�艰秴鏍囨垨鏄剧ず鍑�鍖栬缃緝鑴�
+ */
+ private fun condition2(res: DustDataResult): Boolean {
+ return res.drExceedTimes >= 3
+ }
+
+ /**
+ * @return true 褰撴湀楂樺嘲缁忚惀鏃舵鏁版嵁鎸佺画寮傚父鎴栧嚭鐜颁笁娆″強浠ヤ笂灏忔椂鏁版嵁瓒呮爣鎴栨棤娌圭儫鍑�鍖栬缃垨鍑�鍖栬缃湭姝e父寮�鍚�
+ */
+ private fun condition3(res: DustDataResult): Boolean {
+ return false
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem7.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem7.kt
index 24b01a8..b18f272 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem7.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem7.kt
@@ -46,7 +46,7 @@
* 2.鍙拌处灏戦噺缂哄け鎴栨湭鍙婃椂璁板綍鏇存柊
* 3.鍙拌处涓ラ噸缂哄け鎴栧叧閿彴璐︽棤鏁�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
// TODO: 2021/3/9 鎵惧嚭鐢ㄦ埛绫诲瀷瀵瑰簲鐨勫繀濉彴璐�
val time = evaluationScene.subTask.value?.planstarttime
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
@@ -66,13 +66,11 @@
var i = 1
if (condition1(ledgerTypeCount, rCount)) {
if (i > size - 1) i = size - 1
- return i
} else if (condition2(ledgerTypeCount, rCount)) {
i = 2
if (i > size - 1) i = size - 1
- return i
}
- return null
+ return listOf(i)
}
/**
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 b66e538..da462ef 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
@@ -29,10 +29,11 @@
/**
* 鎵ф硶妫�鏌ユ眹鎬绘儏鍐�
* 閫夐」濡備笅锛�
- * 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
- * 2.闂鏃犳暣鏀�
+ * 1.鍏ㄩ儴鎸夋椂鏁存敼骞跺強鏃舵彁浜ゆ潗鏂�
+ * 2.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
+ * 3.闂鏃犳暣鏀�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
createCriteria().andEqualTo("stguid", evaluationScene.subTask.value?.stguid)
// .andGreaterThanOrEqualTo("time", info.sTime)
@@ -48,8 +49,8 @@
}
}
return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
+ changed == 0 && total > 0 -> listOf(2)
+ changed < total -> listOf(1)
else -> null
}
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem9.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem9.kt
index 431585c..9b04fe1 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem9.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem9.kt
@@ -37,7 +37,7 @@
* 2.鏈搴﹀彂鐢熷崟娆″尯绾т俊璁挎姇璇�
* 3.鏈搴﹀彂鐢熷競绾т俊璁挎姇璇夋垨澶氭鍖虹骇淇¤銆佹姇璇夋垨鐩戠涓嶉厤鍚�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val time = evaluationScene.subTask.value?.planstarttime
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
@@ -49,16 +49,14 @@
.andLessThan("cpTime", et)
})
- var i = 2
+ var i = 0
if (condition2(complaints)) {
- if (i > size - 1) i = size - 1
- return i
+ i = 2
} else if (condition1(complaints)) {
i = 1
- if (i > size - 1) i = size - 1
- return i
}
- return null
+ if (i > size - 1) i = size - 1
+ return listOf(i)
}
/**
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 af8a12f..0451cba 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
@@ -33,7 +33,7 @@
* 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
* 2.闂鏃犳暣鏀�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
createCriteria().andEqualTo("stguid", evaluationScene.subTask.value?.stguid)
// .andGreaterThanOrEqualTo("time", info.sTime)
@@ -49,8 +49,8 @@
}
}
return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
+ changed == 0 && total > 0 -> listOf(1)
+ changed < total -> listOf(0)
else -> null
}
}
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 65548c0..1597a98 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
@@ -33,7 +33,7 @@
* 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
* 2.闂鏃犳暣鏀�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
createCriteria().andEqualTo("stguid", evaluationScene.subTask.value?.stguid)
// .andGreaterThanOrEqualTo("time", info.sTime)
@@ -49,8 +49,8 @@
}
}
return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
+ changed == 0 && total > 0 -> listOf(1)
+ changed < total -> listOf(0)
else -> null
}
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem2.kt
index d7e18d6..0acdeed 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem2.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem2.kt
@@ -40,7 +40,7 @@
* 1.鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�
* 2.鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�
*/
- override fun otherProblem(size: Int): Int? {
+ override fun otherProblem(size: Int): List<Int>? {
val time = evaluationScene.subTask.value?.planstarttime
val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
@@ -51,14 +51,14 @@
.andEqualTo("drSceneId", evaluationScene.scene.value?.guid)
})
- var result: Int? = null
+ var result = mutableListOf<Int>()
r.forEach {
if (it == null) return@forEach
if (it.drExceedTimes > 0) {
- result = 0
+ result.add(0)
}
if (it.drOverAvgPer > 0.2) {
- result = 1
+ result.add(1)
}
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt
deleted file mode 100644
index ec108f7..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt
+++ /dev/null
@@ -1,521 +0,0 @@
-package cn.flightfeather.supervision.business.fume
-
-import cn.flightfeather.supervision.business.Info
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.business.fume.item.*
-import cn.flightfeather.supervision.common.utils.Constant
-import cn.flightfeather.supervision.common.utils.DateUtil
-import cn.flightfeather.supervision.common.utils.ExcelUtil
-import cn.flightfeather.supervision.common.utils.UUIDGenerator
-import cn.flightfeather.supervision.domain.ds1.entity.*
-import cn.flightfeather.supervision.domain.ds1.mapper.*
-import cn.flightfeather.supervision.domain.ds2.entity.UserMap
-import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
-import org.apache.poi.hssf.usermodel.HSSFWorkbook
-import org.apache.poi.hssf.util.HSSFColor
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.io.File
-import java.io.FileOutputStream
-import java.time.*
-import java.util.*
-import javax.annotation.PostConstruct
-import kotlin.math.abs
-
-/**
- * 鑷姩璇勫垎
- */
-@Component
-class AutoScore3(
- val scoreItem_1: ScoreItem_1, val scoreItem_2: ScoreItem_2, val scoreItem_3: ScoreItem_3,
- val scoreItem_4: ScoreItem_4, val scoreItem_5: ScoreItem_5, val scoreItem_6: ScoreItem_6,
- val scoreItem_7: ScoreItem_7, val scoreItem_8: ScoreItem_8, val scoreItem_9: ScoreItem_9,
- val scoreItem_10: ScoreItem_10, val scoreItem_11: ScoreItem_11,
-) {
- companion object {
- private lateinit var instance: AutoScore3
- //鐗规畩璇勫垎椤癸紝璁$畻鎬诲垎鏃讹紝鑻ユ璇勫垎椤瑰緱鍒嗭紝褰撳姞涓婃璇勫垎椤瑰悗鐨勬�诲垎涓嶈秴杩囧緱鍒嗕笂闄愶紝鍒欒绠楋紝鍚﹀垯鑸嶅幓
- private const val SPECIAL_RULE = "鐩戞祴璁惧"
- // 椁愰ギ
- private val SCENE_TYPE = Constant.ScenseType.TYPE5
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- @Autowired
- lateinit var userinfoMapper: UserinfoMapper
-
- @Autowired
- lateinit var userMapMapper: UserMapMapper
-
- @Autowired
- lateinit var scenseMapper: ScenseMapper
-
- @Autowired
- lateinit var evaluationruleMapper: EvaluationruleMapper
-
- @Autowired
- lateinit var evaluationsubruleMapper: EvaluationsubruleMapper2
-
- @Autowired
- lateinit var evaluationMapper: EvaluationMapper
-
- @Autowired
- lateinit var itemevaluationMapper: ItemevaluationMapper
-
- @Autowired
- lateinit var problemlistMapper: ProblemlistMapper
-
- //鍐冲畾鏄惁鍐檋3
- private val hasHead3 = true
-
- private var totalScore = 100//婊″垎
-
- private val itemList = mutableListOf<ScoreItem>()
-
- private val baseRules = mutableListOf<Evaluationrule>()
-
- private val rules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>()
-
- private val topItems = mutableListOf<Evaluationsubrule2>()
-
- private var workbook = HSSFWorkbook()
-
- init {
- itemList.apply {
- add(scoreItem_1)
- add(scoreItem_2)
- add(scoreItem_3)
- add(scoreItem_4)
- add(scoreItem_5)
- add(scoreItem_6)
- add(scoreItem_7)
- add(scoreItem_9)
- add(scoreItem_10)
- add(scoreItem_11)
- add(scoreItem_8)
- }
- }
-
- fun go(_year: Int? = null, _month: Int? = null, _period: Int = 1) {
- /** 1.excel鏂囦欢鍑嗗*************************************************************************/
- val fileName = "${SCENE_TYPE.text}鑷姩璇勫垎-${DateUtil().DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls"
-// val filePath = "E:\\宸ヤ綔\\寮�鍙慭\绗笁鏂圭洃绠pp\\鑷姩璇勫垎\\椁愰ギ\\$fileName"
- val filePath = "C:\\work\\宸ヤ綔\\绗笁鏂圭洃绠\鑷姩璇勫垎\\椁愰ギ\\$fileName"
- val out = FileOutputStream(File(filePath))
-
- getScoreItem()
-
-
-
- val contents = mutableListOf<Array<Any>>()
-
- val h1 = mutableListOf<ExcelUtil.MyCell>()
- h1.add(ExcelUtil.MyCell(""))
- val h2 = mutableListOf<ExcelUtil.MyCell>()
- h2.add(ExcelUtil.MyCell(""))
- val h3 = mutableListOf<String>()
- h3.add("")
- topItems.forEach {
- h1.add(ExcelUtil.MyCell(it.itemname ?: "", 1, 0))
- for (r in rules) {
- if (r.first.fatherid == it.guid || r.first.guid == it.guid) {
- h2.add(ExcelUtil.MyCell(r.first.itemname ?: "", 1, 0))
- // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3
- if (hasHead3) {
- r.second.forEach { s ->
- h3.add(s.itemname ?: "")
- h2.last().colSpan++
- h1.last().colSpan++
- }
- } else {
- h2.last().colSpan++
- h1.last().colSpan++
- }
- }
- }
- }
- // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3
- if (hasHead3) {
- h1.add(ExcelUtil.MyCell("鎬诲垎", 3, 1))
- h1.add(ExcelUtil.MyCell("鐜俊鐮�", 3, 1))
- } else {
- h1.add(ExcelUtil.MyCell("鎬诲垎", 2, 1))
- h1.add(ExcelUtil.MyCell("鐜俊鐮�", 2, 1))
- }
-
- contents.add(h1.toTypedArray())
- contents.add(h2.toTypedArray())
- // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3
- if (hasHead3) {
- contents.add(h3.toTypedArray())
- }
-
- /** 2. 绛涢�夋墦鍒嗗満鏅�*************************************************************************/
- val sceneList = scenseMapper.selectByExample(Example(Scense::class.java).apply {
- createCriteria().andEqualTo("typeid", SCENE_TYPE.value.toByte())
- .andNotEqualTo("extension1", '0')
-// createCriteria().andEqualTo("guid", "eKIUnqn4RB64UNM0")
- })
-
- val now = LocalDate.now()
- val year = _year ?: now.year
- val month = _month ?: now.monthValue
- val sMonth = DateUtil().getStartMonthByPeriod(month, _period) ?: 1
- val eMonth = sMonth + _period - 1
- val sTime = LocalDateTime.of(year, sMonth, 1, 0, 0)
- val eTime = sTime.plusMonths(_period.toLong())
- val period = "${year}/$sMonth-$eMonth"
-
- /** 3. 寰幆澶勭悊姣忎釜鍦烘櫙锛岀粰姣忎釜鍦烘櫙鎵撳垎*************************************************************************/
- sceneList.forEach {
- // 姣忎釜鍦烘櫙鐨勮瘎鍒嗚眮鍏嶉」閮戒笉涓�瀹氱浉鍚岋紝棣栧厛鍒濆鍖栨槸鍚﹁眮鍏嶆爣蹇�
- itemList.forEach { s->
- s.exemption = false
- }
- // 鍙拌处绠$悊涓哄繀璞佸厤椤�
-// scoreItem_7.exemption = true
- // 瀵瑰簲鐨勮眮鍏嶉棶棰樻竻绌�
- scoreItem_8.clear()
-
- topItems.forEach { s -> s.extension1 = null }
- rules.forEach { p ->
- p.first.extension1 = null
- p.second.forEach { e -> e.extension1 = null }
- }
-
- val userInfo = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
- createCriteria().andEqualTo("dGuid", it.guid)
- })?.takeIf { l -> l.isNotEmpty() }?.get(0)
-
- val tzUserId = userMapMapper.selectByExample(Example(UserMap::class.java).apply {
- createCriteria().andEqualTo("svUserId", userInfo?.guid)
- })?.takeIf { m-> m.isNotEmpty() }?.get(0)?.tzUserId
-
- val info = Info(
- userInfo?.guid,
- tzUserId,
- it.guid,
- it.name,
- SCENE_TYPE,
- year,
- month,
- _period,
- sTime, eTime
- )
-
- var score = 0
-
- /** 3. 鏍规嵁绯荤粺璁板綍鐨勯棶棰樺強澶栭儴鏉ユ簮锛岃绠楀叿浣撹瘎鍒嗗瓙椤�*************************************************************************/
- val itemEvaluations = mutableListOf<Itemevaluation>()
- rules.forEach {r ->
- // 璇勫垎鏉$洰
- val rule = r.first
- // 鍏蜂綋璇勫垎閫夐」
- val subRule = r.second
- subRule.forEach {sr ->
- sr.problemlist?.let {pId ->
- problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("sguid", info.sceneId)
- .andEqualTo("ptguid", pId)
- .andGreaterThanOrEqualTo("time", info.sTime)
- .andLessThan("time", info.eTime)
- })?.takeIf { p-> p.isNotEmpty() }?.run {
- sr.extension1 = (0 - (sr.maxscore ?: 0)).toString()
-
- // 褰撹鍒欐墸鍒嗘椂锛屾牴鎹搴旇眮鍏嶇殑瑙勫垯id锛屽皢瀵瑰簲鐨勮鍒欒缃负璞佸厤鐘舵�侊紝鍚屾椂娓呯┖鍏舵墸鍒�
- sr.gitlist?.split(";")?.forEach {g->
- findRule(g) {r,p ->
- // 娓呯┖鍏宠仈瑙勫垯鐨勬墸鍒�
- p.first.extension1 = "0"
- p.second.forEach { it.extension1 = "0" }
- // 鎵惧埌瀵瑰簲鐨勮瘎浼皊coreItem锛屽皢鍏惰缃负璞佸厤鐘舵��
- for (i in itemList) {
- if (i.id == p.first.guid) {
- i.exemption = true
- scoreItem_8.setExemptionProblem(p.second)
- break
- }
- }
- }
- }
-
- // 褰撹鍒欐墸鍒嗘椂锛屾牴鎹搴旂殑鑱斿姩鎵e垎瑙勫垯id锛屽皢瀵瑰簲瑙勫垯杩涜鑱斿姩鎵e垎
- sr.devicelist?.split(";")?.forEach {d ->
- findRule(d) {r,p ->
- // 鎵i櫎鑱斿姩瑙勫垯寰楀垎
- r.extension1 = (0 - (r.maxscore ?: 0)).toString()
- }
- }
- }
- }
- }
- var total: Int? = null
- subRule.forEach {sr ->
- if (!sr.extension1.isNullOrBlank()) {
- total = (total ?: 0) + sr.extension1!!.toInt()
- }
- }
- if (total == null) {
- rule.extension1 = "0"
- } else {
- val s = if (abs(total!!) > rule.maxscore!!) {
- 0 - rule.maxscore!!
- } else {
- total
- }
- rule.extension1 = s.toString()
- }
- }
- itemList.forEach { si ->
- si.execute2(info, rules)
- }
-
- /** 4. 琛ュ叏鍚勪笂绾ц瘎鍒嗛」鐨勮鍒�*************************************************************************/
- this.rules.forEach { r ->
- val fatherId = r.first.fatherid
- for (t in topItems) {
- if (t.guid == fatherId) {
- var s = t.extension1?.toIntOrNull() ?: 0
- s += r.first.extension1?.toIntOrNull() ?: 0
- t.extension1 = s.toString()
- break
- }
- }
- }
-
- /** 4. 璁$畻鎬诲垎*************************************************************************/
- var total = 0//鎬绘墸闄ょ殑鍒嗘暟
- topItems.forEach top@{ top ->
- total += top.extension1?.toIntOrNull() ?: 0
- }
- val evaluationList = mutableListOf<Evaluation>()
- var evaluationId: String? = null
- baseRules.forEach {
- val evaluation = Evaluation().apply {
- guid = UUIDGenerator.generate16ShortUUID()
- iguid = info.userId
- stguid = it.guid
- scensetypeid = info.sceneType.value.toByte()
- ertype = it.ruletype?.toByte()
- scensename = period
- evaluatorguid = "system"
- evaluatorusername = "system"
- evaluatorrealname = "2"
- resultscorebef = (totalScore - abs(total)).toString()
- createdate = Date()
- updatedate = Date()
- }
- if (evaluation.ertype?.toInt() == 1) {
- evaluationId = evaluation.guid
- }
- evaluationList.add(evaluation)
- }
- //瀛愰」鍏蜂綋寰楀垎
- val itemevaluationList = mutableListOf<Itemevaluation>()
- topItems.forEach { subRule ->
- val item = newItemEvaluation(info, subRule, evaluationId)
- itemevaluationList.add(item)
- }
- rules.forEach { p ->
- if (p.first.ertype != 2) {
- val item = newItemEvaluation(info, p.first, evaluationId)
- itemevaluationList.add(item)
- }
- p.second.forEach { r ->
- val item1 = newItemEvaluation(info, r, evaluationId)
- itemevaluationList.add(item1)
- }
- }
- // 娣诲姞鑷虫枃妗�
- addToFile(contents, info, evaluationList, topItems, this.rules)
-// val r = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply {
-// createCriteria().andEqualTo("scensename", period)
-// .andEqualTo("evaluatorguid", "system")
-// .andEqualTo("iguid", info.userId)
-//// .andEqualTo("ertype", 1)
-// }).let { eList ->
-// var guid: String? = null
-// for (e in eList) {
-// if (e.ertype?.toInt() == 1) {
-// guid = e.guid
-// break
-// }
-// }
-// guid?.let {
-// eList.forEach { e ->
-// evaluationMapper.delete(e)
-// }
-// itemevaluationMapper.deleteByExample(Example(Itemevaluation::class.java).apply {
-// createCriteria().andEqualTo("sguid", guid)
-// })
-// }
-// } ?: 0
- // 鍐欏叆鏁版嵁搴�
-// if (r > 0) {
-// evaluationList.forEach { el -> evaluationMapper.insert(el) }
-// itemevaluationList.forEach { il -> itemevaluationMapper.insert(il) }
-// for (e in evaluationList) {
-// if (e.ertype?.toInt()?.equals(0) == true) {
-// finalScore(e, year, eMonth, period)
-// break
-// }
-// }
-// }
- }
-
- // 鍐欏叆鏂囨。
- ExcelUtil.write(emptyList(), contents, workbook)
- workbook.write(out)
- workbook.close()
- out.flush()
- out.close()
- }
-
- /**
- * 鑾峰彇璇勫垎瑙勫垯
- */
- private fun getScoreItem() {
- this.rules.clear()
- baseRules.clear()
-
- val rule = evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
- createCriteria()
- .andEqualTo("tasktypeid", 99)
- .andEqualTo("scensetypeid", SCENE_TYPE.value.toByte())
-// .andEqualTo("districtcode", "310104")
- })
- if (rule.isNotEmpty()) {
- baseRules.addAll(rule)
-
- val ruleId = rule[0].guid
- val rules = evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule2::class.java).apply {
- createCriteria().andEqualTo("erguid", ruleId)
- })
- rules.forEach {
- if (it.ertype == 2) {
- topItems.add(it)
- }
- }
- topItems.sortBy { it.displayid }
-
- var t = 0
- topItems.forEach {
- t += it.maxscore ?: 0
- val tempRules = mutableListOf<Evaluationsubrule2>()
- for (i in rules) {
- if (i.fatherid == it.guid && i.ertype == 3) {
- tempRules.add(i)
- }
- }
- //璇勫垎澶ч」濡傛灉娌℃湁鎵惧埌璇勫垎灏忛」锛屽垯璇存槑鍏剁洿鎺ュ搴旀渶灏忚瘎鍒嗛」锛屽叾鏈韩鍙樻垚璇勫垎椤�
- if (tempRules.isEmpty()) {
- tempRules.add(it)
- }
- tempRules.sortBy { t-> t.displayid }
- tempRules.forEach {temp ->
- val tempSubRules = mutableListOf<Evaluationsubrule2>()
- for (i in rules) {
- if (i.fatherid == temp.guid && i.ertype == 4) {
- tempSubRules.add(i)
- }
- }
- tempSubRules.sortBy {ts-> ts.displayid }
- this.rules.add(Pair(temp, tempSubRules))
- }
- }
-// this.totalScore = t
- }
- }
-
- /**
- * 鐢熸垚鏂扮殑涓�鏉¤瘎鍒嗚褰�
- */
- private fun newItemEvaluation(info: Info, itemRule: Evaluationsubrule2, evaluationId: String?) = cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation()
- .apply {
- var rule: Evaluationrule? = null
- for (r in baseRules) {
- if (r.guid == itemRule.erguid) {
- rule = r
- break
- }
- }
- ieguid = UUIDGenerator.generate16ShortUUID()
- iguid = info.userId
- sguid = evaluationId
- erguid = rule?.guid
- rulename = rule?.rulename
- ruletype = rule?.ruletype?.toInt()
- ertype = itemRule.ertype
- esrguid = itemRule.guid
- name = itemRule.itemname
- value = itemRule.extension1 ?: "0"
- extension1 = (itemRule.extension1 != null).toString()
- }
-
- private fun addToFile(contents: MutableList<Array<Any>>, info: Info, evaluations: List<Evaluation>, topItems: MutableList<Evaluationsubrule2>,
- rules: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>) {
- val cList = mutableListOf<Any>()
- // FIXME: 2021/4/28 鐢ㄦ埛鍚嶆槸鍚︽坊鍔犺处鍙�
-// cList.add("${info.userName}\t${info.userId}")
- cList.add("${info.sceneName}")
- //姣忎竴椤瑰叿浣撳緱鍒�
- topItems.forEach {
- for (r in rules) {
- if (r.first.fatherid == it.guid || r.first.guid == it.guid) {
- // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3
- if (hasHead3) {
- r.second.forEach {s ->
- cList.add(s.extension1 ?: .0)
- }
- } else {
- cList.add(.0 - (r.first.extension1?.toDoubleOrNull() ?: .0))
- }
- }
- }
- }
- //鎬诲垎鍜岀幆淇$爜
- evaluations.forEach {
- if ((it.ertype?.toInt() == 2)) {
- cList.add(it.resultscorebef?.toDoubleOrNull() ?: .0)
- val code = when (it.resultscorebef?.toIntOrNull() ?: 0) {
- in 0..59 -> ExcelUtil.MyCell("绾㈢爜", fontColor = HSSFColor.HSSFColorPredefined.RED.index)
- in 60..89 -> ExcelUtil.MyCell("榛勭爜", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index)
- in 90..100 -> ExcelUtil.MyCell("缁跨爜", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index)
- else -> ExcelUtil.MyCell("瓒呭嚭鑼冨洿锛�${it.resultscoreaft}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index)
- }
- cList.add(code)
- }
- }
- contents.add(cList.toTypedArray())
- }
-
- /**
- * 鏍规嵁瑙勫垯id鏌ユ壘瑙勫垯鍙婂叾鎵�鍦ㄧ粍
- */
- private fun findRule(
- ruleId: String,
- onFound: (r: Evaluationsubrule2, p: Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>) -> Unit
- ) {
- with(rules)breaking@ {
- forEach {
- if (it.first.guid == ruleId) {
- onFound(it.first, it)
- return@breaking
- } else {
- for (r in it.second) {
- if (r.guid == ruleId) {
- onFound(r, it)
- return@breaking
- }
- }
- }
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_1.kt
deleted file mode 100644
index 3777aa8..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_1.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
-import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationMapper
-import cn.flightfeather.supervision.domain.ds2.mapper.BaseInfoMapper
-import cn.flightfeather.supervision.domain.ds2.mapper.FumeMinuteValueMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_1: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_1
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- @Autowired
- lateinit var fumeMinuteValueMapper: FumeMinuteValueMapper
-
- @Autowired
- lateinit var baseInfoMapper: BaseInfoMapper
-
- override var id: String = "2COC44k7d9dlnR4c"
-
- override var name: String="娌圭儫鍦ㄧ嚎鐩戞祴璁惧"
-
- /**
- * 閫夐」濡備笅锛�
- * 1.鏈畨瑁呮补鐑熷湪绾跨洃娴嬭澶�
- * 2.娌圭儫鍦ㄧ嚎璁惧瀹夎涓嶈鑼�
- * 3.娌圭儫鍦ㄧ嚎鐩戞祴璁惧鏈仈缃�
- * 4.绉佽嚜闂茬疆鍋滆繍/鎷嗛櫎璁惧
- */
- override fun otherProblem(size: Int): Int? {
- var i = 2
- if (i > size - 1) i = size - 1
- if (condition1()) {
- return i
- }
- return null
- }
-
- /**
- * @return false 寰愭眹鍖洪楗洃绠″钩鍙拌仈缃戣褰曞拰鍦ㄧ嚎鐜囧垎鏋愭暟鎹紝纭畾鑱旂綉涓斾换涓�缁忚惀楂樺嘲鍦ㄧ嚎鐜囬珮浜�90%鍗充笉鎵e垎
- * true 鍏朵粬鎯呭喌鍧囨墸10鍒�
- */
- private fun condition1(): Boolean {
- // 鏌ヨ褰撳墠鐢ㄦ埛鐨勬补鐑熺洃娴嬭澶囩殑鏁版嵁鍦ㄧ嚎鐜�
- val userId = info.userId
- val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
-
- return false
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_10.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_10.kt
deleted file mode 100644
index 5dda836..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_10.kt
+++ /dev/null
@@ -1,97 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds2.entity.Punishment
-import cn.flightfeather.supervision.domain.ds2.mapper.PunishmentMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.time.LocalDate
-import java.time.ZoneId
-import java.util.*
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_10: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_10
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- @Autowired
- lateinit var punishmentMapper: PunishmentMapper
-
- override var id: String = "dlALSsoF63Z2FOz0"
-
- override var name: String = "琛屾斂澶勭綒"
-
- /**
- * 瀛e害鍐呰鏀垮缃氳褰曡鏍煎寲瀵煎叆
- * 閫夐」濡備笅锛�
- * 1.鏃犺矗浠ゆ暣鏀广�佹墽娉曟剰瑙佸拰琛屾斂澶勭綒
- * 2.鏀跺埌璐d护鏀规鍐冲畾涔�
- * 3.鏀跺埌鎵ф硶鎰忚涔�
- * 4.鏈夌幆澧冭繚娉曡涓轰笖鍙楀埌琛屾斂澶勭綒
- */
- override fun otherProblem(size: Int): Int? {
- val s = Date.from(info.sTime?.atZone(ZoneId.systemDefault())?.toInstant())
- val e = Date.from(info.eTime?.atZone(ZoneId.systemDefault())?.toInstant())
-
- var i = 1
- when {
- condition3(s, e) -> {
- i = 3
- if (i > size - 1) i = size - 1
- return i
- }
- condition2(s, e) -> {
- i = 2
- if (i > size - 1) i = size - 1
- return i
- }
- condition1(s, e) -> {
- i = 1
- if (i > size - 1) i = size - 1
- return i
- }
- else -> return null
- }
- }
-
- /**
- * @return true 鏀跺埌璐d护鏀规鍐冲畾涔�
- */
- private fun condition1(s: Date, e: Date): Boolean {
- val p = punishmentMapper.selectByExample(Example(Punishment::class.java).apply {
- createCriteria().andEqualTo("pmSceneId", info.tzUserId)
- .andEqualTo("pmExtension1", "1")
- .andGreaterThanOrEqualTo("pmTime", s)
- .andLessThan("pmTime", e)
- })
- return p.isNotEmpty()
- }
-
- /**
- * @return true 鏀跺埌鎵ф硶鎰忚涔�
- */
- private fun condition2(s: Date, e: Date): Boolean {
- return false
- }
-
- /**
- * @return true 鏈夌幆澧冭繚娉曡涓轰笖鍙楀埌琛屾斂澶勭綒
- */
- private fun condition3(s: Date, e: Date): Boolean {
- val p = punishmentMapper.selectByExample(Example(Punishment::class.java).apply {
- createCriteria().andEqualTo("pmSceneId", info.tzUserId)
- .andEqualTo("pmExtension1", "0")
- .andGreaterThanOrEqualTo("pmTime", s)
- .andLessThan("pmTime", e)
- })
- return p.isNotEmpty()
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_11.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_11.kt
deleted file mode 100644
index 76a75a2..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_11.kt
+++ /dev/null
@@ -1,56 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
-import org.springframework.stereotype.Component
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_11: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_11
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "QFzQPYgUXaHU4tTD"
-
- override var name: String="淇$敤鎵胯鑷瘎"
-
- /**
- * 椋炵窘鐜APP骞村害鎵胯鍜屾湀搴﹁嚜璇勮褰�
- * 閫夐」濡備笅锛�
- * 1.鐜淇$敤涓嶈鑼冩垨鎵胯鏈寜鏃舵彁浜ゆ垨瓒呮湁鏁堟湡锛屼互鍙婃秹鍙婃硶浜哄彉鏇寸殑鎴栬惀涓氭墽鐓у彉鏇存湭閲嶆柊鎵胯鐨�
- * 2.鐜淇$敤鑷瘎鏈寜鏃惰嚜璇勬垨鏈寜鏃舵彁
- */
- override fun otherProblem(size: Int): Int? {
- var i = 1
- if (condition1()) {
- if (i > size - 1) i = size - 1
- return i
- } else if (condition2()) {
- i = 2
- if (i > size - 1) i = size - 1
- return i
- }
- return null
- }
-
- /**
- * @return true 鐜淇$敤涓嶈鑼冩垨鎵胯鏈寜鏃舵彁浜ゆ垨瓒呮湁鏁堟湡锛屼互鍙婃秹鍙婃硶浜哄彉鏇寸殑鎴栬惀涓氭墽鐓у彉鏇存湭閲嶆柊鎵胯鐨�
- */
- private fun condition1(): Boolean {
- return false
- }
-
- /**
- * @return true 鐜淇$敤鑷瘎鏈寜鏃惰嚜璇勬垨鏈寜鏃舵彁
- */
- private fun condition2(): Boolean {
- return false
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_2.kt
deleted file mode 100644
index 3be8d5d..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_2.kt
+++ /dev/null
@@ -1,76 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord
-import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-/**
- * 瀛e害鍐呮湭鍦ㄧ嚎鎻愪氦鐜瘎瀹℃壒鏂囦欢锛屾垨鏃犳湁鏁堝嵄搴熷妗堬紝鍗虫墸10鍒嗭紙鍗卞簾鐩稿叧鍙拌处缂哄け涓ラ噸鐨勶紝鍙瀹氫负鏃犳瑙勭幆璇勫鎵规枃浠讹紝鎵�10鍒嗭級
- */
-@Component
-class ScoreItem_2: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_2
-
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- @Autowired
- lateinit var ledgerRecordMapper: LedgerRecordMapper
-
- override var id: String = "f9mxgKhMpMO0QYYt"
-
- override var name: String="娌圭儫鍑�鍖栬鏂借澶�"
-
- private val ledgerIdList = listOf(
- 2200,//璁惧瀹夎鍚堝悓
- 2201,//浜у搧璐ㄦ
- 2202,//鍑�鍖栧櫒鍚堟牸璇�
- 2203,//娓呮礂鍚堝悓
- 2204,//娓呮礂璁板綍
- 2205,//璁惧缁翠慨淇濆吇
- )
-
- /**
- * 鍦ㄧ嚎鍙拌处璁板綍锛屾棤鐜板満闂涓旀补鐑熷噣鍖栬澶囨湁鍚堝悓鍜屾娴嬫姤鍛婄殑绠楀悎瑙勶紝涓嶆墸鍒嗭紝鍏朵粬鎯呭喌鍙傜湅涓夌骇鎸囨爣銆�
- * 閫夐」濡備笅锛�
- * 1.璁惧绗﹀悎銆奃B 31/844 -2014銆嬩笖姝e父杩愯
- * 2.椋庨噺涓嶈冻銆佽繃澶ф垨闆嗘皵缃╁畨瑁呬綅缃繃楂樻垨闆嗘皵缃╂湭瀹屽叏瑕嗙洊鐏跺ご鎴栭泦姘旂僵鏄庢樉鎸傛补銆佹穻娌规垨娌圭儫绠¢亾鐮存崯銆佷笉瀵嗗皝
- * 3.鍑�鍖栫巼浣庝簬90%鎴栨秹瀚屾棤缁勭粐鎺掓斁锛堟秹鎴峰闂ㄧ獥鏈叧闂垨鎺掓皵鎵囩洿閫氭埛澶栵級
- * 4.鏃犲噣鍖栬缃垨鍑�鍖栬缃棽缃�
- */
- override fun otherProblem(size: Int): Int? {
- var i = 3
- if (i > size - 1) i = size - 1
- if (condition1()) {
- return i
- }
- return null
- }
-
- private fun condition1(): Boolean {
-// return if (info.tzUserId != null) {
-// //2銆佸鏋滄湁璁板綍锛屾煡璇㈢浉鍏冲彴璐︾殑鎻愪氦鎯呭喌
-// val r = ledgerRecordMapper.selectByExample(Example(LedgerRecord::class.java).apply {
-// createCriteria().andIn("lsSubtypeid", ledgerIdList)
-// .andEqualTo("lrYear", info.year)
-// .andEqualTo("lrMonth", info.month)
-// .andEqualTo("lrSubmitid", info.tzUserId)
-// })
-// //2.1銆� 濡傛灉涓婁紶鍙拌处涓嶉綈鍏紝鎵e垎
-// r.size < ledgerIdList.size
-// } else {
-// //3銆佸鏋滄病鏈夊搴旇褰曪紝杩斿洖false
-// false
-// }
- return false
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_3.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_3.kt
deleted file mode 100644
index 706b5e4..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_3.kt
+++ /dev/null
@@ -1,73 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
-import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord
-import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_3: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_3
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- @Autowired
- lateinit var ledgerRecordMapper: LedgerRecordMapper
-
- override var id: String = "gxJgISevmhFuMJnE"
-
- override var name: String="娌圭儫鍦ㄧ嚎鐩戞祴璁惧缁存姢"
-
- /**
- * 鍦ㄧ嚎鍙拌处涓繍缁磋褰曞強鏃舵彁浜や笖纭畾鑱旂綉涓斾换涓�缁忚惀楂樺嘲鍦ㄧ嚎鐜囬珮浜�90%鍗充笉鎵e垎锛屽叾浠栨墸10鍒嗐��
- * 閫夐」濡備笅锛�
- * 1.娌圭儫鐩戞祴璁惧鏈寜鏈熻繍缁存垨杩愮淮棰戞涓嶈冻锛堝皯浜庝竴瀛e害涓�娆★級
- * 2.娌圭儫鐩戞祴璁惧杩愯寮傚父锛堟寚绀虹伅寮傚父銆侀儴鍒嗘ā鍧椾笉杩愯鎴栫己澶辩瓑锛�
- * 3.娌圭儫鐩戞祴璁惧鏈甯稿紑鍚�
- */
- override fun otherProblem(size: Int): Int? {
- var i = 0
- if (condition1()) {
- if (i > size - 1) i = size - 1
- return i
- } else if (condition2()) {
- i = 2
- if (i > size - 1) i = size - 1
- return i
- }
- return null
- }
-
- /**
- * @return false 鍦ㄧ嚎鍙拌处涓繍缁磋褰曞強鏃舵彁浜�
- * true 鍦ㄧ嚎鍙拌处涓繍缁磋褰曟湭鍙婃椂鎻愪氦
- */
- private fun condition1(): Boolean {
-// val l = ledgerRecordMapper.selectByExample(Example(LedgerRecord::class.java).apply {
-// createCriteria().andEqualTo("lsSubtypeid", 2304)//璁惧杩愮淮璁板綍
-// .andEqualTo("lrYear", info.year)
-// .andEqualTo("lrMonth", info.month)
-// .andEqualTo("lrSubmitid", info.tzUserId)
-// })
-// return l.size == 0
- return false
- }
-
- /**
- * @return false 纭畾鑱旂綉涓斾换涓�缁忚惀楂樺嘲鍦ㄧ嚎鐜囬珮浜�90%鍗充笉鎵e垎
- * true 鍏朵粬鎵�10鍒�
- */
- private fun condition2(): Boolean {
- return false
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_4.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_4.kt
deleted file mode 100644
index 21eeb81..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_4.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord
-import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_4: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_4
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- @Autowired
- lateinit var ledgerRecordMapper: LedgerRecordMapper
-
- override var id: String = "vYEKaBft6nsqDhtD"
-
- override var name: String="娌圭儫鍑�鍖栬鏂借澶囩淮鎶�"
-
- /**
- * 鍦ㄧ嚎鍙拌处璁板綍娌圭儫鍑�鍖栬澶囨湁娓呮礂鍚堝悓鍜屾竻娲楀崟鎹殑榛樿鍚堣锛屼笉鎵e垎
- * 閫夐」濡備笅锛�
- * 1.娓呮礂鏁堟灉涓嶄匠鎴栨帓鍙f祿鐑熴�佸埡婵�鎬у紓鍛虫槑鏄�
- * 2.鏈寜鏈熷強鏃舵竻娲楁垨娓呮礂棰戞涓嶈冻锛堟竻娲楀悎鍚岀害瀹氬拰绠$悊瑕佹眰锛�
- * 3.鏁呴殰鎴栨崯鍧忔湭鍙婃椂缁翠慨鎴栦笉姝d骇浣跨敤锛堥绻侀棿姝囧紑鍚�/楂樺嘲鏃舵杩愯鏃堕棿涓嶈冻/鎸囩ず鐏紓甯革級鎴栧悗鍘ㄦ补鐑熼噸銆佸埡婵�鍛虫槑鏄�
- * 4.鏈紑鍚垨闂茬疆锛堜笉閫氱數锛�
- */
- override fun otherProblem(size: Int): Int? {
- var i = 3
- if (i > size - 1) i = size - 1
- return when {
- condition2() -> {
- i
- }
- condition1() -> {
- i = 1
- if (i > size - 1) i = size - 1
- i
- }
- else -> {
- null
- }
- }
- }
-
- /**
- * @return false 鍦ㄧ嚎鍙拌处璁板綍娌圭儫鍑�鍖栬澶囨湁娓呮礂鍚堝悓鍜屾竻娲楀崟鎹殑榛樿鍚堣锛屼笉鎵e垎
- * true
- */
- private fun condition1(): Boolean {
- //1. 鏌ヨ鏄惁鏈夋竻娲楀悎鍚屽拰娓呮礂璁板綍
-// val l = ledgerRecordMapper.selectByExample(Example(LedgerRecord::class.java).apply {
-// createCriteria().andIn("lsSubtypeid", listOf(2203, 2204))//璁惧瀹夎鍚堝悓
-// .andEqualTo("lrYear", info.year)
-//// .andEqualTo("lrMonth", info.month)
-// .andEqualTo("lrSubmitid", info.tzUserId)
-// })
-// return l.size == 0
- return false
- }
-
- /**
- * @return true 鏈畨瑁呭噣鍖栬缃紝鎸夌収15鍒嗘墸闄わ紝鍙婇�夐」4
- */
- private fun condition2(): Boolean {
- //1. 鏌ヨ鏄惁鎻愪氦璁惧瀹夎鍚堝悓鍙拌处
-// val l = ledgerRecordMapper.selectByExample(Example(LedgerRecord::class.java).apply {
-// createCriteria().andEqualTo("lsSubtypeid", 2200)//璁惧瀹夎鍚堝悓
-// .andEqualTo("lrYear", info.year)
-//// .andEqualTo("lrMonth", info.month)
-// .andEqualTo("lrSubmitid", info.tzUserId)
-// })
-// return l.size == 0
- return false
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt
deleted file mode 100644
index c4a0b5f..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt
+++ /dev/null
@@ -1,94 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
-import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.time.LocalDateTime
-import java.time.ZoneId
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_5: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_5
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "PSQUi9f0f7JK6w9d"
-
- override var name: String="娌圭儫鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇"
-
- @Autowired
- lateinit var dustDataResultMapper: DustDataResultMapper
-
- /**
- * 寰愭眹鍖洪楗洃绠″钩鍙拌仈缃戣褰曘�佸湪绾跨巼鍒嗘瀽鏁版嵁鍜岄珮宄扮粡钀ユ椂娈靛皬鏃惰秴鏍囨儏鍐�
- * 閫夐」濡備笅锛�
- * 1.鏁版嵁鏃犲紓甯镐笖鏃犺秴鏍囨垨鏄剧ず鍑�鍖栬缃竻娲�
- * 2.楂樺嘲缁忚惀鏃舵鏁版嵁鍦ㄧ嚎鐜囦綆浜�90%鎴栨樉绀哄噣鍖栬缃晠闅�
- * 3.褰撴湀楂樺嘲缁忚惀鏃舵鍑虹幇涓夋鍙婁互涓�10鍒嗛挓鍧囧�艰秴鏍囨垨鏄剧ず鍑�鍖栬缃緝鑴�
- * 4.褰撴湀楂樺嘲缁忚惀鏃舵鏁版嵁鎸佺画寮傚父鎴栧嚭鐜颁笁娆″強浠ヤ笂灏忔椂鏁版嵁瓒呮爣鎴栨棤娌圭儫鍑�鍖栬缃垨鍑�鍖栬缃湭姝e父寮�鍚�
- */
- override fun otherProblem(size: Int): Int? {
- var i = 1
- when {
- condition1() -> {
- if (i > size - 1) i = size - 1
- return i
- }
- condition2() -> {
- i = 2
- if (i > size - 1) i = size - 1
- return i
- }
- condition3() -> {
- i = 3
- if (i > size - 1) i = size - 1
- return i
- }
- else -> return null
- }
- }
-
- /**
- * @return true 楂樺嘲缁忚惀鏃舵鏁版嵁鍦ㄧ嚎鐜囦綆浜�90%鎴栨樉绀哄噣鍖栬缃晠闅�
- */
- private fun condition1(): Boolean {
- return false
- }
-
- /**
- * @return true 褰撴湀楂樺嘲缁忚惀鏃舵鍑虹幇涓夋鍙婁互涓�10鍒嗛挓鍧囧�艰秴鏍囨垨鏄剧ず鍑�鍖栬缃緝鑴�
- */
- private fun condition2(): Boolean {
- val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
- createCriteria().andGreaterThanOrEqualTo("drTime", info.sTime)
- .andLessThan("drTime", info.eTime)
- .andEqualTo("drSceneId", info.sceneId)
- })
-
- var result = false
- r.forEach {
- if (it == null) return@forEach
- if (it.drExceedTimes > 0) {
- result = true
- }
- }
- return result
- }
-
- /**
- * @return true 褰撴湀楂樺嘲缁忚惀鏃舵鏁版嵁鎸佺画寮傚父鎴栧嚭鐜颁笁娆″強浠ヤ笂灏忔椂鏁版嵁瓒呮爣鎴栨棤娌圭儫鍑�鍖栬缃垨鍑�鍖栬缃湭姝e父寮�鍚�
- */
- private fun condition3(): Boolean {
- return false
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_6.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_6.kt
deleted file mode 100644
index d9f6e49..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_6.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_6 : ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_6
- }
-
- @Autowired
- lateinit var scoreItem5: ScoreItem_5
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "JmcRohk4fWO1eOpW"
-
- override var name: String = "绌鸿皟銆侀鏈哄櫔澹�"
-
- /**
- * 鎵ф硶妫�鏌ユ儏鍐碉紝鏃犳鏌ラ粯璁や笉鎵e垎銆�
- * 閫夐」濡備笅锛�
- * 1.鍣0鏃犲紓甯告垨闅斿櫔銆侀檷鍣帾鏂藉畬澶�
- * 2.瀹夎浣嶇疆璺濈浣忔埛杈冭繎锛屾棤闅斿櫔銆侀檷鍣帾鏂斤紝鍣0鎴栨尟鍔ㄦ壈姘�
- * 3.鏄奸棿>60dB鎴栧櫔澹版槑鏄撅紝鏃犻殧鍣�侀檷鍣帾鏂斤紝澶滈棿姝e父
- * 4.澶滈棿>50dB鎴栧櫔澹版槑鏄惧鑷存壈姘戯紝涓旀棤闅斿櫔銆侀檷鍣帾鏂�
- */
- override fun otherProblem(size: Int): Int? {
- var i = 3
- if (i > size - 1) i = size - 1
- if (condition1()) {
- return i
- }
- return null
- }
-
- /**
- * @return true 鏈夋墽娉曟鏌ユ儏鍐�
- */
- private fun condition1(): Boolean {
- return false
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_7.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_7.kt
deleted file mode 100644
index 18b21fc..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_7.kt
+++ /dev/null
@@ -1,87 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
-import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord
-import cn.flightfeather.supervision.domain.ds2.entity.LedgerSubType
-import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper
-import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_7: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_7
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- init {
- exemption = true
- }
-
- @Autowired
- lateinit var ledgerRecordMapper: LedgerRecordMapper
-
- @Autowired
- lateinit var ledgerSubTypeMapper: LedgerSubTypeMapper
-
- override var id: String = "wfzFTlcZ3xMdj5M2"
-
- override var name: String = "鍙拌处绠$悊"
-
- /**
- * 鍦ㄧ嚎鍙拌处璁板綍鐨勬彁浜ょ被鍒畬鏁存�у拰鍙婃椂鎬�
- * 閫夐」r濡備笅锛�
- * 1.鍙拌处绫诲埆榻愬叏銆佸畬鏁淬�佸強鏃惰褰曟洿鏂�
- * 2.鍙拌处灏戦噺缂哄け鎴栨湭鍙婃椂璁板綍鏇存柊
- * 3.鍙拌处涓ラ噸缂哄け鎴栧叧閿彴璐︽棤鏁�
- */
- override fun otherProblem(size: Int): Int? {
- // TODO: 2021/3/9 鎵惧嚭鐢ㄦ埛绫诲瀷瀵瑰簲鐨勫繀濉彴璐�
- val ledgerTypeCount = ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply {
- createCriteria().andEqualTo("lScenetype", "1").andEqualTo("lNeedupdate", true)
- })
- val rCount = ledgerRecordMapper.selectCountByExample(Example(LedgerRecord::class.java).apply {
- createCriteria().andEqualTo("lrYear", info.year)
- .andGreaterThanOrEqualTo("lrSubmitdate", info.sTime)
- .andLessThanOrEqualTo("lrSubmitdate", info.eTime)
- .andEqualTo("lrSubmitid", info.tzUserId)
- })
- var i = 1
- if (condition1(ledgerTypeCount, rCount)) {
- if (i > size - 1) i = size - 1
- return i
- } else if (condition2(ledgerTypeCount, rCount)) {
- i = 2
- if (i > size - 1) i = size - 1
- return i
- }
- return null
- }
-
- /**
- * @param c1 蹇呭~椤瑰彴璐︾被鍒暟
- * @param c2 瀹為檯涓婁紶鏁�
- * @return true 鍙拌处灏戦噺缂哄け鎴栨湭鍙婃椂璁板綍鏇存柊
- */
- private fun condition1(c1: Int, c2: Int): Boolean {
- return c2 > 0 && c2 < c1 * (info.period ?: 0)
- }
-
- /**
- * @param c1 蹇呭~椤瑰彴璐︾被鍒暟
- * @param c2 瀹為檯涓婁紶鏁�
- * @return true 鍙拌处涓ラ噸缂哄け鎴栧叧閿彴璐︽棤鏁�
- */
- private fun condition2(c1: Int, c2: Int): Boolean {
- return c2 == 0
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_8.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_8.kt
deleted file mode 100644
index 12cb292..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_8.kt
+++ /dev/null
@@ -1,108 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
-import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.time.LocalDate
-import java.time.ZoneId
-import java.time.format.DateTimeFormatter
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_8: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_8
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- // 璞佸厤闂id鍒楄〃锛岃眮鍏嶄笉鍋氳瘎浠风殑闂锛屽叾瀵瑰簲鐨勬暣鏀逛篃搴旇涓嶅啀璁$畻
- private val exemptionItemIdList = mutableListOf<String?>()
-
- override var id: String = "yAAn3zm6e2PenHeJ"
-
- override var name: String="鏁存敼鎺柦鍙婃晥鏋�"
-
- /**
- * 娓呯┖闇�瑕佽眮鍏嶇殑闂
- */
- fun clear() {
- exemptionItemIdList.clear()
- }
-
- /**
- * 璁剧疆闇�瑕佽眮鍏嶇殑闂
- */
- fun setExemptionProblem(
- list: List<String>,
- eList: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>
- ) {
- eList.forEach {
- if (list.contains(it.first.guid)) {
- it.second.forEach {e ->
- exemptionItemIdList.addAll(e.problemlist?.split(",") ?: emptyList())
- }
- }
- }
- }
-
- fun setExemptionProblem(list: List<Evaluationsubrule2>) {
- list.forEach {
- exemptionItemIdList.addAll(it.problemlist?.split(",") ?: emptyList())
- }
- }
-
- /**
- * 鎵ф硶妫�鏌ユ眹鎬绘儏鍐�
- * 閫夐」濡備笅锛�
- * 1.鍏ㄩ儴鎸夋椂鏁存敼骞跺強鏃舵彁浜ゆ潗鏂�
- * 2.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
- * 3.闂鏃犳暣鏀�
- */
- override fun otherProblem(size: Int): Int? {
- val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("sguid", info.sceneId)
- .andGreaterThanOrEqualTo("time", info.sTime)
- .andLessThan("time", info.eTime).apply {
- if (exemptionItemIdList.isNotEmpty()) {
- // FIXME: 2022/1/27 姝ゅ鏍规嵁鐗规畩瑕佹眰锛屽皢銆愬彴璐︿弗閲嶇己澶辨垨鍏抽敭鍙拌处鏃犳晥銆戝拰銆愬彴璐﹀皯閲忕己澶辨垨鏈強鏃惰褰曟洿鏂般�戜袱涓棶棰樺墧闄わ紝涓嶈绠楀湪鏁存敼鐜囧唴
- andNotIn("ptguid", exemptionItemIdList)
- }
- }
- })
- var i = 0
-
- val total = p.size
- var changed = 0
- p.forEach {
- if (it.ischanged == true) {
- changed++
- }
- }
- return when {
- changed == 0 && total > 0 -> 2
- changed < total -> 1
- else -> 0
- }
- }
-
- /**
- * @return true 闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
- */
- private fun condition1(): Boolean {
- return false
- }
-
- /**
- * @return true 闂鏃犳暣鏀�
- */
- private fun condition2(): Boolean {
- return false
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_9.kt b/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_9.kt
deleted file mode 100644
index b04fc11..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_9.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-package cn.flightfeather.supervision.business.fume.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds2.entity.Complaint
-import cn.flightfeather.supervision.domain.ds2.mapper.ComplaintMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.time.LocalDate
-import java.time.ZoneId
-import java.time.format.DateTimeFormatter
-import javax.annotation.PostConstruct
-
-@Component
-class ScoreItem_9: ScoreItem() {
- companion object {
- private lateinit var instance: ScoreItem_9
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- @Autowired
- lateinit var complaintMapper: ComplaintMapper
-
- override var id: String = "mTre4cqan43BOW82"
-
- override var name: String="淇¤鎶曡瘔"
-
- /**
- * 瀛e害鍐呬俊璁胯褰曡鏍煎寲瀵煎叆
- * 閫夐」濡備笅锛�
- * 1.鏃犱俊璁裤�佹棤鎶曡瘔銆佺洃绠¢厤鍚堢Н鏋�
- * 2.鏈搴﹀彂鐢熷崟娆″尯绾т俊璁挎姇璇�
- * 3.鏈搴﹀彂鐢熷競绾т俊璁挎姇璇夋垨澶氭鍖虹骇淇¤銆佹姇璇夋垨鐩戠涓嶉厤鍚�
- */
- override fun otherProblem(size: Int): Int? {
- val complaints = complaintMapper.selectByExample(Example(Complaint::class.java).apply {
- createCriteria().andEqualTo("cpSceneid", info.tzUserId)
- .andGreaterThanOrEqualTo("cpTime", info.sTime)
- .andLessThan("cpTime", info.eTime)
- })
-
- var i = 2
- if (condition2(complaints)) {
- if (i > size - 1) i = size - 1
- return i
- } else if (condition1(complaints)) {
- i = 1
- if (i > size - 1) i = size - 1
- return i
- }
- return null
- }
-
- /**
- * @return true 鏈搴﹀彂鐢熷崟娆″尯绾т俊璁挎姇璇�
- */
- private fun condition1(c: List<Complaint>): Boolean {
- c.forEach {
- if (it.cpExtension1 == "1") {
- return true
- }
- }
- return false
- }
-
- /**
- * @return true 鏈搴﹀彂鐢熷競绾т俊璁挎姇璇夋垨澶氭鍖虹骇淇¤銆佹姇璇夋垨鐩戠涓嶉厤鍚�
- */
- private fun condition2(c: List<Complaint>): Boolean {
- var count = 0
- c.forEach {
- if (it.cpExtension1 == "0") {
- //鍙戠敓甯傜骇淇¤鎶曡瘔
- return true
- } else {
- count++
- }
- }
- return count > 1
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/fume/package-info.java b/src/main/kotlin/cn/flightfeather/supervision/business/fume/package-info.java
deleted file mode 100644
index 431e4ff..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/fume/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Date 2022/1/19 16:07
- * Created by feiyu
- * 椁愰ギ娌圭儫鑷姩璇勫垎
- */
-package cn.flightfeather.supervision.business.fume;
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
index 350740f..65594e6 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -11,13 +11,9 @@
import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
-import java.time.Duration
import java.time.LocalDateTime
import java.time.ZoneId
-import javax.annotation.PostConstruct
/**
* 鎶ュ憡鎵�闇�婧愭暟鎹�
@@ -73,7 +69,7 @@
*/
fun areaName(): String {
val t = dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid)
- return "${dateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.ScenseType.getDes(config.sceneType)}"
+ return "${dateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.SceneType.getDes(config.sceneType)}"
}
/**
@@ -164,16 +160,16 @@
get() {
if (_baseScene == null) {
_baseScene = when (this.scene?.typeid.toString()) {
- Constant.ScenseType.TYPE1.value -> {
+ Constant.SceneType.TYPE1.value -> {
dbMapper.sceneConstructionSiteMapper.selectByPrimaryKey(scene?.guid)
}
- Constant.ScenseType.TYPE2.value -> {
+ Constant.SceneType.TYPE2.value -> {
dbMapper.sceneWharfMapper.selectByPrimaryKey(scene?.guid)
}
- Constant.ScenseType.TYPE3.value -> {
+ Constant.SceneType.TYPE3.value -> {
dbMapper.sceneMixingPlantMapper.selectByPrimaryKey(scene?.guid)
}
- Constant.ScenseType.TYPE14.value -> {
+ Constant.SceneType.TYPE14.value -> {
dbMapper.sceneStorageYardMapper.selectByPrimaryKey(scene?.guid)
}
else -> null
@@ -307,7 +303,7 @@
val ledgerCount: Int
get() {
if (_ledgerCount == -1) {
- val tzSceneType = Constant.ScenseType.typeMap(scene?.typeid)
+ val tzSceneType = Constant.SceneType.typeMap(scene?.typeid)
_ledgerCount = dbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply {
createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true)
})
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt
index e84c977..05225f1 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt
@@ -21,19 +21,19 @@
var status: String? = ""
var stage: String? = ""
when (rowData.scene?.typeid.toString()) {
- Constant.ScenseType.TYPE1.value -> {
+ Constant.SceneType.TYPE1.value -> {
(rowData.baseScene as SceneConstructionSite?)?.apply {
status = csStatus
stage = siExtension1
}
}
- Constant.ScenseType.TYPE2.value -> {
+ Constant.SceneType.TYPE2.value -> {
status = (rowData.baseScene as SceneWharf?)?.getwStatus()
}
- Constant.ScenseType.TYPE3.value -> {
+ Constant.SceneType.TYPE3.value -> {
status = (rowData.baseScene as SceneMixingPlant?)?.mpStatus
}
- Constant.ScenseType.TYPE14.value -> {
+ Constant.SceneType.TYPE14.value -> {
status = (rowData.baseScene as SceneStorageYard?)?.syStatus
}
else -> ""
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt
index 9dc944a..f39c6d4 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt
@@ -27,20 +27,18 @@
//鎬诲垎鍜岀幆淇$爜
rowData.evaluation.let { e ->
val s = e?.resultscorebef?.toIntOrNull() ?: -1
- val code = when (s) {
- in 0..59 -> ExcelUtil.MyCell("绾㈢爜", fontColor = HSSFColor.HSSFColorPredefined.RED.index)
- in 60..89 -> ExcelUtil.MyCell("榛勭爜", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index)
- in 90..100 -> ExcelUtil.MyCell("缁跨爜", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index)
- -1 -> ExcelUtil.MyCell("", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index)
- else -> ExcelUtil.MyCell("瓒呭嚭鑼冨洿锛�${s}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index)
+ val code = when {
+ s in 0..59 -> ExcelUtil.MyCell("绾㈢爜", fontColor = HSSFColor.HSSFColorPredefined.RED.index)
+ s in 60..89 -> ExcelUtil.MyCell("榛勭爜", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index)
+ s >= 90 -> ExcelUtil.MyCell("缁跨爜", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index)
+ else -> ExcelUtil.MyCell("", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index)
}
- val normalization = when (s) {
- in 0..39 -> ExcelUtil.MyCell("涓ラ噸涓嶈鑼�", fontColor = HSSFColor.HSSFColorPredefined.RED.index)
- in 40..89 -> ExcelUtil.MyCell("涓嶈鑼�", fontColor = HSSFColor.HSSFColorPredefined.ROSE.index)
- in 90..99 -> ExcelUtil.MyCell("鍩烘湰瑙勮寖", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index)
- 100 -> ExcelUtil.MyCell("瑙勮寖", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index)
- -1 -> ExcelUtil.MyCell("", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index)
- else -> ExcelUtil.MyCell("瓒呭嚭鑼冨洿锛�${s}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index)
+ val normalization = when {
+ s in 0..39 -> ExcelUtil.MyCell("涓ラ噸涓嶈鑼�", fontColor = HSSFColor.HSSFColorPredefined.RED.index)
+ s in 40..89 -> ExcelUtil.MyCell("涓嶈鑼�", fontColor = HSSFColor.HSSFColorPredefined.ROSE.index)
+ s in 90..99 -> ExcelUtil.MyCell("鍩烘湰瑙勮寖", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index)
+ s >= 100 -> ExcelUtil.MyCell("瑙勮寖", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index)
+ else -> ExcelUtil.MyCell("", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index)
}
add(code)
add(normalization)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt
index 0899468..fdec9ce 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt
@@ -12,7 +12,6 @@
import cn.flightfeather.supervision.domain.ds1.entity.SceneMixingPlant
import cn.flightfeather.supervision.domain.ds1.entity.SceneStorageYard
import cn.flightfeather.supervision.domain.ds1.entity.SceneWharf
-import kotlin.math.round
/**
* 鍒嗚闀囬棶棰樻暣鏀瑰垎鏋愭眹鎬昏〃
@@ -47,16 +46,16 @@
districtMap[k]?.apply {
sceneCount++
val status = when (dataSource.config.sceneType.toString()) {
- Constant.ScenseType.TYPE1.value -> {
+ Constant.SceneType.TYPE1.value -> {
(rowData.baseScene as SceneConstructionSite?)?.csStatus
}
- Constant.ScenseType.TYPE2.value -> {
+ Constant.SceneType.TYPE2.value -> {
(rowData.baseScene as SceneWharf?)?.getwStatus()
}
- Constant.ScenseType.TYPE3.value -> {
+ Constant.SceneType.TYPE3.value -> {
(rowData.baseScene as SceneMixingPlant?)?.mpStatus
}
- Constant.ScenseType.TYPE14.value -> {
+ Constant.SceneType.TYPE14.value -> {
(rowData.baseScene as SceneStorageYard?)?.syStatus
}
else -> ""
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt
index a0982c3..1de9b3d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt
@@ -3,7 +3,6 @@
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.ExcelUtil
-import kotlin.math.round
class ProTypeRankMainSummary(dataSource: DataSource) : ProTypeRankSummary(dataSource) {
override val templateName: String = "鏈堝害涓昏鎴栧吀鍨嬮棶棰樺垎鏋愯〃"
@@ -11,7 +10,7 @@
override fun formatTable(summarys: MutableList<Summary>) {
//鎺掑悕闈犲墠鐨刴ax涓棶棰樿璁ゅ畾涓轰富瑕佹垨鍏稿瀷闂
val max = when (dataSource.config.sceneType.toString()) {
- Constant.ScenseType.TYPE1.value -> 5
+ Constant.SceneType.TYPE1.value -> 5
else -> 4
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt
index 0c185c8..2a12726 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt
@@ -6,7 +6,6 @@
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.ExcelUtil
import cn.flightfeather.supervision.domain.ds1.entity.SceneConstructionSite
-import kotlin.math.round
class ProTypeStatusSummary(dataSource: DataSource) : BaseTemplate(dataSource) {
override val cols: List<BaseCols> = listOf()
@@ -14,7 +13,7 @@
@Throws(Exception::class)
override fun execute() {
- if (dataSource.config.sceneType.toString() != Constant.ScenseType.TYPE1.value) {
+ if (dataSource.config.sceneType.toString() != Constant.SceneType.TYPE1.value) {
// throw IllegalStateException("${templateName}鍙兘閽堝宸ュ湴杩涜鍒嗘瀽锛屽綋鍓嶄紶鍏ュ満鏅被鍨嬬紪鍙蜂负${dataSource.config.sceneType}")
println("sadas")
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/JinAnScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/JinAnScore.kt
deleted file mode 100644
index a5d82d9..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/JinAnScore.kt
+++ /dev/null
@@ -1,62 +0,0 @@
-package cn.flightfeather.supervision.business.storage
-
-import cn.flightfeather.supervision.business.Info
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
-import cn.flightfeather.supervision.domain.ds1.entity.Score
-import cn.flightfeather.supervision.domain.ds1.mapper.ScoreMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.time.LocalDateTime
-import java.time.ZoneId
-
-/**
- * 涓婃捣甯傞潤瀹夊尯鍗曠嫭鐨�50鍒嗗埗璇勫垎缁撴灉锛�
- * 鏍规嵁[StAutoScore]鑷姩璇勫垎缁撴灉杩涜杞崲寰楀嚭
- */
-@Component
-class JinAnScore {
-
- @Autowired
- lateinit var scoreMapper: ScoreMapper
-
- fun toDb(e: Evaluation, info: Info) {
- val time = LocalDateTime.ofInstant(e.evaluatetime?.toInstant(), ZoneId.systemDefault())
- val scoreVo = Score().apply {
- sceneId = e.sguid
- sceneName = e.scensename
- year = time.year
- month = time.monthValue
- districtCode = e.districtcode
- districtName = e.districtname
- score = transform(e.resultscorebef?.toIntOrNull() ?: 0)
- completion = !info.online
- }
-
- val res = scoreMapper.selectByExample(Example(Score::class.java).apply {
- createCriteria().andEqualTo("sceneId", e.sguid)
- .andEqualTo("year", time.year)
- .andEqualTo("month", time.monthValue)
- })
- if (res.isNotEmpty()) {
- scoreVo.id = res[0].id
- scoreMapper.updateByPrimaryKeySelective(scoreVo)
- } else {
- scoreMapper.insert(scoreVo)
- }
- }
-
- /**
- * 鍒嗘暟杞崲
- */
- private fun transform(oldS: Int): Int {
- return when {
- // 鍩烘湰瑙勮寖
- oldS >= 90 -> 50
- // 涓嶈鑼�
- oldS >= 50 -> 30
- // 涓ラ噸涓嶈鑼�
- else -> 10
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
deleted file mode 100644
index 09c69a3..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
+++ /dev/null
@@ -1,531 +0,0 @@
-package cn.flightfeather.supervision.business.storage
-
-import cn.flightfeather.supervision.business.Info
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.business.storage.item.*
-import cn.flightfeather.supervision.common.utils.Constant
-import cn.flightfeather.supervision.common.utils.DateUtil
-import cn.flightfeather.supervision.common.utils.ExcelUtil
-import cn.flightfeather.supervision.common.utils.UUIDGenerator
-import cn.flightfeather.supervision.domain.ds1.entity.*
-import cn.flightfeather.supervision.domain.ds1.mapper.*
-import cn.flightfeather.supervision.domain.ds2.entity.UserMap
-import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
-import org.apache.poi.hssf.usermodel.HSSFWorkbook
-import org.apache.poi.hssf.util.HSSFColor
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.io.File
-import java.io.FileOutputStream
-import java.util.*
-import javax.annotation.PostConstruct
-import kotlin.math.abs
-
-/**
- * Date 2022/1/21 13:44
- * Created by feiyu
- * 宸ュ湴鑷姩璇勫垎
- */
-@Component
-
-class StAutoScore(
- csScoreItem_1: CsScoreItem_1,
- csScoreItem_2: CsScoreItem_2,
- mpScoreItem_1: MpScoreItem_1,
- mpScoreItem_2: MpScoreItem_2,
- stScoreItem_1: StScoreItem_1,
- whScoreItem_1: WhScoreItem_1,
- whScoreItem_2: WhScoreItem_2,
- val jinAnScore: JinAnScore,
- var sceneType: Constant.ScenseType = Constant.ScenseType.TYPE1, )
-{
- companion object {
- private lateinit var instance: StAutoScore
- }
-
- @Autowired
- lateinit var userinfoMapper: UserinfoMapper
-
- @Autowired
- lateinit var userMapMapper: UserMapMapper
-
- @Autowired
- lateinit var scenseMapper: ScenseMapper
-
- @Autowired
- lateinit var evaluationruleMapper: EvaluationruleMapper
-
- @Autowired
- lateinit var evaluationsubruleMapper: EvaluationsubruleMapper2
-
- @Autowired
- lateinit var evaluationMapper: EvaluationMapper
-
- @Autowired
- lateinit var itemevaluationMapper: ItemevaluationMapper
-
- @Autowired
- lateinit var problemlistMapper: ProblemlistMapper
-
- @Autowired
- lateinit var monitorobjectversionMapper: MonitorobjectversionMapper
-
- @Autowired
- lateinit var taskMapper: TaskMapper
-
- @Autowired
- lateinit var inspectionMapper: InspectionMapper
-
- @Autowired
- lateinit var subtaskMapper: SubtaskMapper
-
- //鍐冲畾鏄惁鍐檋3
- private val hasHead3 = true
-
- private var totalScore = 100//婊″垎
-
- private val itemList = mutableListOf<ScoreItem>()
-
- private val baseRules = mutableListOf<Evaluationrule>()
-
- private val rules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>()
-
- private val topItems = mutableListOf<Evaluationsubrule2>()
-
- // excel鏂囨。
- private var workbook = HSSFWorkbook()
- // 鏂囨。琛屾暟鎹�
- private val rows = mutableListOf<Array<Any>>()
-
- init {
- itemList.apply {
- add(csScoreItem_1)
- add(csScoreItem_2)
- add(mpScoreItem_1)
- add(mpScoreItem_2)
- add(stScoreItem_1)
- add(whScoreItem_1)
- add(whScoreItem_2)
- }
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
-
-
- /**
- * 鎬讳换鍔℃墦鍒�
- * 鏍规嵁鎬讳换鍔★紝瀵逛笅灞炴墍鏈夌殑宸℃煡浠诲姟鎸ㄤ釜鎵撳垎
- * @param topTaskId 鎬讳换鍔d
- */
- fun topTaskGrade(topTaskId:String) {
- rows.clear()
- getScoreItem()
- subtaskMapper.selectByTopTask2(topTaskId, sceneType.value.toInt()).forEach {
- sceneGradeP(it)
-// sceneGradeToFile(it)
- }
-// toFile()
- }
-
- /**
- * 鍗曞満鏅墦鍒�
- * @param subtask 宸℃煡浠诲姟
- */
- fun sceneGrade(subtask: Subtask) {
- // 鑾峰彇璇勫垎瑙勫垯
- getScoreItem()
-
- sceneGradeP(subtask)
- }
-
- private fun sceneGradeP(subtask: Subtask) {
- val info = itemGrade(subtask)
- val result = totalGrade(info, subtask) ?: return
- toDb(info, result)
-// jinAnScore.toDb(result.first, info)
-// addToFile(rows, info, result.first)
-// toFile()
- }
-
- fun sceneGradeToFile(subtask: Subtask) {
- // 鑾峰彇璇勫垎瑙勫垯
- getScoreItem()
-
- val info = itemGrade(subtask)
- val result = totalGrade(info, subtask) ?: return
- addToFile(rows, info, result.first)
- }
-
- fun grade(subtask: Subtask) {
-
- }
-
- /**
- * 鏉$洰鎵撳垎
- */
- private fun itemGrade(subtask: Subtask): Info {
- // 瑙勫垯鏉$洰寰楀垎鍒濆鍖�
- topItems.forEach { s -> s.extension1 = null }
- rules.forEach { p ->
- p.first.extension1 = null
- p.second.forEach { e -> e.extension1 = null }
- }
-
-
- // 鑾峰彇椋炵窘鐩戠绯荤粺鐢ㄦ埛淇℃伅
- val userInfo = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
- createCriteria().andEqualTo("dGuid", subtask.scenseid)
- })?.takeIf { l -> l.isNotEmpty() }?.get(0)
- // 鑾峰彇椋炵窘鐜绯荤粺鐢ㄦ埛淇℃伅
- val tzUserId = userMapMapper.selectByExample(Example(UserMap::class.java).apply {
- createCriteria().andEqualTo("svUserId", userInfo?.guid)
- })?.takeIf { m -> m.isNotEmpty() }?.get(0)?.tzUserId
- val scene = scenseMapper.selectByPrimaryKey(subtask.scenseid)
-
- val info =
- Info(userInfo?.guid,
- tzUserId,
- subtask.scenseid,
- subtask.scensename,
- sceneType,
- subTask = subtask,
- sceneIndex = scene.index,
- online = scene.extension1 != "0"
- )
-
- /** 1. 鏍规嵁璇勫垎瑙勫垯瀵瑰簲鐨勯棶棰樿嚜鍔ㄥ垽鏂槸鍚︽墸鍒�***************************************************************/
- // 鑾峰彇璇ユ宸℃煡浠诲姟涓嬬殑鎵�鏈夐棶棰�
- val pList = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("stguid", info.subTask?.stguid)
- }).map { it.ptguid }
- // 璁$畻姣忔潯璇勫垎瑙勫垯鐨勫緱鍒�
- rules.forEach { r ->
- // 璇勫垎鏉$洰
- val rule = r.first
- // 鍏蜂綋璇勫垎閫夐」
- val subRule = r.second
- subRule.forEach { sr ->
- // 瀛樺湪澶氫釜璇勫垎椤瑰拰鍚屼竴涓棶棰樺叧鑱旓紝鍥犳蹇呴』鍏ㄩ儴璇勫垎椤归兘鍒ゅ畾涓�閬�
- sr.problemlist?.split(",")?.forEach { pId ->
- if (pList.contains(pId)) {
- sr.extension1 = (0 - (sr.maxscore ?: 0)).toString()
- }
- }
- }
- var total: Int? = null
- subRule.forEach { sr ->
- if (!sr.extension1.isNullOrBlank()) {
- total = (total ?: 0) + sr.extension1!!.toInt()
- }
- }
- if (total == null) {
- rule.extension1 = "0"
- } else {
- val s = if (abs(total!!) > rule.maxscore!!) {
- 0 - rule.maxscore!!
- } else {
- total
- }
- rule.extension1 = s.toString()
- }
- }
- /** 2.閮ㄥ垎鏈夌壒娈婅瘎鍒嗛�昏緫鐨勮鍒欒繘琛岃绠�*************************************************************************/
- itemList.forEach { item -> item.execute2(info, rules) }
-
- /** 3. 琛ュ叏鍚勪笂绾ц瘎鍒嗛」鐨勮鍒�*************************************************************************/
- this.rules.forEach { r ->
- val fatherId = r.first.fatherid
- for (t in topItems) {
- if (t.guid == fatherId) {
- var s = t.extension1?.toIntOrNull() ?: 0
- s += r.first.extension1?.toIntOrNull() ?: 0
- // 闄愬埗鏈�楂樻墸鍒�
- if (abs(s) > (t.maxscore ?: 0)) {
- s = 0 - (t.maxscore ?: 0)
- }
- t.extension1 = s.toString()
- break
- }
- }
- }
- return info
- }
-
- /**
- * 璁$畻鎬诲垎
- */
- private fun totalGrade(info: Info, subtask: Subtask): Pair<Evaluation, List<Itemevaluation>>? {
- /** 4. 璁$畻鎬诲垎*************************************************************************/
- val scene = scenseMapper.selectByPrimaryKey(info.subTask?.scenseid) ?: return null
- val inspection = inspectionMapper.selectByExample(Example(Inspection::class.java).apply {
- createCriteria().andEqualTo("stguid", info.subTask?.stguid)
- })?.takeIf { it.isNotEmpty() }?.let { it[0] }
- var total = 0//鎬绘墸闄ょ殑鍒嗘暟
- topItems.forEach top@{ top ->
- total += top.extension1?.toIntOrNull() ?: 0
- }
- val evaluation = Evaluation()
- baseRules.forEach {
- evaluation.apply {
- guid = UUIDGenerator.generate16ShortUUID()
- iguid = inspection?.guid
- stguid = info.subTask?.stguid
- sguid = info.subTask?.scenseid
- scensetypeid = scene.typeid
- scensetype = scene.type
- subscensetypeid = scene.scensesubtypeid
- subscensetype = scene.scensesubtype
- ertype = it.ruletype?.toByte()
- provincecode = scene.provincecode
- provincename = scene.provincename
- citycode = scene.citycode
- cityname = scene.cityname
- districtcode = scene.districtcode
- districtname = scene.districtname
- towncode = scene.towncode
- townname = scene.townname
- scensename = scene.name
- scenseaddress = scene.location
- evaluatetime = subtask.planstarttime
- evaluatorguid = "admin"
- evaluatorusername = "admin"
- evaluatorrealname = "admin"
- resultscorebef = (totalScore - abs(total)).toString()
- createdate = subtask.planstarttime
- updatedate = Date()
- }
- }
- //瀛愰」鍏蜂綋寰楀垎
- val itemevaluationList = mutableListOf<Itemevaluation>()
- topItems.forEach { subRule ->
- val item = newItemEvaluation(info, subRule, inspection)
- itemevaluationList.add(item)
- }
- rules.forEach { p ->
- if (p.first.ertype != 2) {
- val item = newItemEvaluation(info, p.first, inspection)
- itemevaluationList.add(item)
- }
- p.second.forEach { r ->
- val item1 = newItemEvaluation(info, r, inspection)
- itemevaluationList.add(item1)
- }
- }
- return Pair(evaluation, itemevaluationList)
- }
-
- /**
- * 灏嗚瘎鍒嗚褰曡緭鍑鸿嚦鏁版嵁搴�
- */
- private fun toDb(info: Info, p: Pair<Evaluation, List<Itemevaluation>>) {
- //鍘婚櫎宸叉湁璁板綍
- evaluationMapper.deleteByExample(Example(Evaluation::class.java).apply {
- createCriteria().andEqualTo("stguid", info.subTask?.stguid)
- })
- itemevaluationMapper.deleteByExample(Example(Itemevaluation::class.java).apply {
- createCriteria().andEqualTo("stguid", info.subTask?.stguid)
- })
-
- //鍐欏叆鏁版嵁搴�
- evaluationMapper.insert(p.first)
- p.second.forEach { il -> itemevaluationMapper.insert(il) }
- }
-
- /**
- * 杞崲涓�鏉¤瘎鍒嗚嚦excel涓殑涓�琛�
- */
- private fun addToFile(contents: MutableList<Array<Any>>, info: Info, evaluations: Evaluation) {
- val cList = mutableListOf<Any>()
- // FIXME: 2021/4/28 鐢ㄦ埛鍚嶆槸鍚︽坊鍔犺处鍙�
-// cList.add("${info.userName}\t${info.userId}")
- cList.add(info.sceneIndex ?: -99)
- cList.add("")
- cList.add("${info.sceneName}")
- //姣忎竴椤瑰叿浣撳緱鍒�
- topItems.forEach {
- for (r in rules) {
- if (r.first.fatherid == it.guid || r.first.guid == it.guid) {
- // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3
- if (hasHead3) {
- r.second.forEach { s ->
- cList.add(s.extension1?.toInt() ?: "")
- }
- } else {
- cList.add(r.first.extension1?.toInt() ?: "")
- }
- }
- }
- }
- //鎬诲垎鍜岀幆淇$爜
- evaluations.let {
- cList.add(it.resultscorebef?.toDoubleOrNull() ?: .0)
- val code = when (it.resultscorebef?.toIntOrNull() ?: 0) {
- in 0..59 -> ExcelUtil.MyCell("涓嶈鑼�", fontColor = HSSFColor.HSSFColorPredefined.RED.index)
- in 60..89 -> ExcelUtil.MyCell("鍩烘湰瑙勮寖", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index)
- in 90..100 -> ExcelUtil.MyCell("瑙勮寖", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index)
- else -> ExcelUtil.MyCell("瓒呭嚭鑼冨洿锛�${it.resultscoreaft}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index)
- }
- cList.add(code)
- }
- contents.add(cList.toTypedArray())
- }
-
- /**
- * 灏嗚瘎鍒嗚褰曡緭鍑轰负excel
- */
- private fun toFile() {
- val contents = mutableListOf<Array<Any>>()
-
- val h1 = mutableListOf<ExcelUtil.MyCell>()
- h1.add(ExcelUtil.MyCell("琛ㄥ崟缂栧彿", if (hasHead3) 3 else 2))
- h1.add(ExcelUtil.MyCell("鍞竴搴忓彿", if (hasHead3) 3 else 2))
- h1.add(ExcelUtil.MyCell("鍦烘櫙鍚嶇О", if (hasHead3) 3 else 2))
- val h2 = mutableListOf<ExcelUtil.MyCell>()
- h2.add(ExcelUtil.MyCell(""))
- h2.add(ExcelUtil.MyCell(""))
- h2.add(ExcelUtil.MyCell(""))
- val h3 = mutableListOf<String>()
- h3.add("")
- h3.add("")
- h3.add("")
- topItems.forEach {
- h1.add(ExcelUtil.MyCell(it.itemname ?: "", 1, 0))
- for (r in rules) {
- if (r.first.fatherid == it.guid || r.first.guid == it.guid) {
- h2.add(ExcelUtil.MyCell(r.first.itemname ?: "", 1, 0))
- // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3
- if (hasHead3) {
- r.second.forEach { s ->
- h3.add(s.itemname ?: "")
- h2.last().colSpan++
- h1.last().colSpan++
- }
- } else {
- h2.last().colSpan++
- h1.last().colSpan++
- }
- }
- }
- }
- // 鍐冲畾鏄惁鍐檋3
- if (hasHead3) {
- h1.add(ExcelUtil.MyCell("鎬诲垎", 3, 1))
- h1.add(ExcelUtil.MyCell("闃叉不瑙勮寖鎬�", 3, 1))
- } else {
- h1.add(ExcelUtil.MyCell("鎬诲垎", 2, 1))
- h1.add(ExcelUtil.MyCell("闃叉不瑙勮寖鎬�", 2, 1))
- }
-
- contents.add(h1.toTypedArray())
- contents.add(h2.toTypedArray())
- // 鍐冲畾鏄惁鍐檋3
- if (hasHead3) {
- contents.add(h3.toTypedArray())
- }
-
- rows.sortBy { it[0] as Int }
- contents.addAll(rows)
-
- // 鍐欏叆鏂囨。
- val fileName = "${sceneType.text}鑷姩璇勫垎-${DateUtil().DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls"
- val filePath = "C:\\work\\宸ヤ綔\\绗笁鏂圭洃绠\鑷姩璇勫垎\\${sceneType.text}\\$fileName"
- val file = File(filePath)
- if (!file.parentFile.exists()) {
- file.parentFile.mkdirs()
- }
- val out = FileOutputStream(File(filePath))
- ExcelUtil.write(emptyList(), contents, workbook)
- workbook.write(out)
- workbook.close()
- out.flush()
- out.close()
- }
-
- /**
- * 鑾峰彇璇勫垎瑙勫垯
- */
- private fun getScoreItem() {
- this.rules.clear()
- baseRules.clear()
- topItems.clear()
-
- val rule = evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
- createCriteria()
- .andEqualTo("tasktypeid", 99)
- .andEqualTo("scensetypeid", sceneType.value.toByte())
- })
- if (rule.isNotEmpty()) {
- baseRules.addAll(rule)
-
- val ruleId = rule[0].guid
- val rules = evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule2::class.java).apply {
- createCriteria().andEqualTo("erguid", ruleId)
- })
- rules.forEach {
- if (it.ertype == 2) {
- topItems.add(it)
- }
- }
- topItems.sortBy { it.displayid }
-
- var t = 0
- topItems.forEach {
- t += it.maxscore ?: 0
- val tempRules = mutableListOf<Evaluationsubrule2>()
- for (i in rules) {
- if (i.fatherid == it.guid && i.ertype == 3) {
- tempRules.add(i)
- }
- }
- //璇勫垎澶ч」濡傛灉娌℃湁鎵惧埌璇勫垎灏忛」锛屽垯璇存槑鍏剁洿鎺ュ搴旀渶灏忚瘎鍒嗛」锛屽叾鏈韩鍙樻垚璇勫垎椤�
- if (tempRules.isEmpty()) {
- tempRules.add(it)
- }
- tempRules.sortBy { t-> t.displayid }
- tempRules.forEach {temp ->
- val tempSubRules = mutableListOf<Evaluationsubrule2>()
- for (i in rules) {
- if (i.fatherid == temp.guid && i.ertype == 4) {
- tempSubRules.add(i)
- }
- }
- tempSubRules.sortBy {ts-> ts.displayid }
- this.rules.add(Pair(temp, tempSubRules))
- }
- }
- this.totalScore = t
- }
- }
-
- /**
- * 鐢熸垚鏂扮殑涓�鏉¤瘎鍒嗚褰�
- */
- private fun newItemEvaluation(info: Info, itemRule: Evaluationsubrule2, inspection: Inspection?) = Itemevaluation()
- .apply {
- var rule: Evaluationrule? = null
- for (r in baseRules) {
- if (r.guid == itemRule.erguid) {
- rule = r
- break
- }
- }
- ieguid = UUIDGenerator.generate16ShortUUID()
- iguid = inspection?.guid
- stguid = info.subTask?.stguid
- sguid = info.subTask?.scenseid
- sensename = info.subTask?.scensename
- erguid = rule?.guid
- rulename = rule?.rulename
- ruletype = rule?.ruletype?.toInt()
- ertype = itemRule.ertype
- esrguid = itemRule.guid
- name = itemRule.itemname
- value = itemRule.extension1 ?: "0"
- extension1 = (itemRule.extension1 != null).toString()
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt
deleted file mode 100644
index 81163e5..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package cn.flightfeather.supervision.business.storage.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-/**
- * Date 2022/1/20 16:14
- * Created by feiyu
- * 宸ュ湴
- */
-@Component
-class CsScoreItem_1:ScoreItem() {
-
- companion object {
- private lateinit var instance: CsScoreItem_1
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "amSNTZfXs2XXR1td"
-
- override var name: String = "鏁存敼鎺柦鍙婃晥鏋�"
-
- /**
- * 鎵ф硶妫�鏌ユ眹鎬绘儏鍐�
- * 閫夐」濡備笅锛�
- * 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
- * 2.闂鏃犳暣鏀�
- */
- override fun otherProblem(size: Int): Int? {
- val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("stguid", info.subTask?.stguid)
-// .andGreaterThanOrEqualTo("time", info.sTime)
-// .andLessThan("time", info.eTime)
- })
- var i = 0
-
- val total = p.size
- var changed = 0
- p.forEach {
- if (it.ischanged == true) {
- changed++
- }
- }
- return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
- else -> null
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt
deleted file mode 100644
index d0211a7..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-package cn.flightfeather.supervision.business.storage.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
-import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.time.LocalDateTime
-import java.time.ZoneId
-import javax.annotation.PostConstruct
-
-/**
- * Date 2022/1/20 16:14
- * Created by feiyu
- * 宸ュ湴
- */
-@Component
-class CsScoreItem_2:ScoreItem() {
-
- companion object {
- private lateinit var instance: CsScoreItem_2
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "dCQbQ8ibc6nexiJo"
-
- override var name: String = "鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇"
-
- @Autowired
- lateinit var dustDataResultMapper: DustDataResultMapper
-
- /**
- * 鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇
- * 閫夐」濡備笅锛�
- * 1.鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�
- * 2.鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�
- */
- override fun otherProblem(size: Int): Int? {
- val time = info.subTask?.planstarttime
- val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
- val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
- val et = st.plusMonths(1)
- val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
- createCriteria().andGreaterThanOrEqualTo("drTime", st)
- .andLessThan("drTime", et)
- .andEqualTo("drSceneId", info.sceneId)
- })
-
- var result: Int? = null
- r.forEach {
- if (it == null) return@forEach
- if (it.drExceedTimes > 0) {
- result = 0
- }
- if (it.drOverAvgPer > 0) {
- result = 1
- }
- }
-
- return result
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt
deleted file mode 100644
index 4dcd316..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package cn.flightfeather.supervision.business.storage.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-/**
- * Date 2022/1/20 16:14
- * Created by feiyu
- * 鎼呮媽绔�
- */
-@Component
-class MpScoreItem_1:ScoreItem() {
-
- companion object {
- private lateinit var instance: MpScoreItem_1
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "KxWcuelbrnCtzw6n"
-
- override var name: String = "鏁存敼鎺柦鍙婃晥鏋�"
-
- /**
- * 鎵ф硶妫�鏌ユ眹鎬绘儏鍐�
- * 閫夐」濡備笅锛�
- * 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
- * 2.闂鏃犳暣鏀�
- */
- override fun otherProblem(size: Int): Int? {
- val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("stguid", info.subTask?.stguid)
-// .andGreaterThanOrEqualTo("time", info.sTime)
-// .andLessThan("time", info.eTime)
- })
- var i = 0
-
- val total = p.size
- var changed = 0
- p.forEach {
- if (it.ischanged == true) {
- changed++
- }
- }
- return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
- else -> null
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt
deleted file mode 100644
index eb6eb0d..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-package cn.flightfeather.supervision.business.storage.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
-import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.time.LocalDateTime
-import java.time.ZoneId
-import javax.annotation.PostConstruct
-
-/**
- * Date 2022/1/20 16:14
- * Created by feiyu
- * 鎼呮媽绔�
- */
-@Component
-class MpScoreItem_2:ScoreItem() {
-
- companion object {
- private lateinit var instance: MpScoreItem_2
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "BoVfRjr5r7RtsqGC"
-
- override var name: String = "鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇"
-
- @Autowired
- lateinit var dustDataResultMapper: DustDataResultMapper
-
- /**
- * 鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇
- * 閫夐」濡備笅锛�
- * 1.鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�
- * 2.鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�
- */
- override fun otherProblem(size: Int): Int? {
- val time = info.subTask?.planstarttime
- val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
- val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
- val et = st.plusMonths(1)
- val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
- createCriteria().andGreaterThanOrEqualTo("drTime", st)
- .andLessThan("drTime", et)
- .andEqualTo("drSceneId", info.sceneId)
- })
-
- var result: Int? = null
- r.forEach {
- if (it == null) return@forEach
- if (it.drExceedTimes > 0) {
- result = 0
- }
- if (it.drOverAvgPer > 0) {
- result = 1
- }
- }
-
- return result
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt
deleted file mode 100644
index dd7135f..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package cn.flightfeather.supervision.business.storage.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-/**
- * Date 2022/1/20 16:14
- * Created by feiyu
- * 鍫嗗満
- */
-@Component
-class StScoreItem_1:ScoreItem() {
-
- companion object {
- private lateinit var instance: StScoreItem_1
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "csInMYhgbBqWRyeB"
-
- override var name: String = "鏁存敼鎺柦鍙婃晥鏋�"
-
- /**
- * 鎵ф硶妫�鏌ユ眹鎬绘儏鍐�
- * 閫夐」濡備笅锛�
- * 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
- * 2.闂鏃犳暣鏀�
- */
- override fun otherProblem(size: Int): Int? {
- val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("stguid", info.subTask?.stguid)
-// .andGreaterThanOrEqualTo("time", info.sTime)
-// .andLessThan("time", info.eTime)
- })
- var i = 0
-
- val total = p.size
- var changed = 0
- p.forEach {
- if (it.ischanged == true) {
- changed++
- }
- }
- return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
- else -> null
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt
deleted file mode 100644
index 8e3b5cb..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt
+++ /dev/null
@@ -1,57 +0,0 @@
-package cn.flightfeather.supervision.business.storage.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import javax.annotation.PostConstruct
-
-/**
- * Date 2022/1/20 16:14
- * Created by feiyu
- * 鐮佸ご
- */
-@Component
-class WhScoreItem_1:ScoreItem() {
-
- companion object {
- private lateinit var instance: WhScoreItem_1
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "mgvVEecYRV8xrnf2"
-
- override var name: String = "鏁存敼鎺柦鍙婃晥鏋�"
-
- /**
- * 鎵ф硶妫�鏌ユ眹鎬绘儏鍐�
- * 閫夐」濡備笅锛�
- * 1.闂閮ㄥ垎鏁存敼鎴栦笉鍙婃椂鎻愪緵鏉愭枡
- * 2.闂鏃犳暣鏀�
- */
- override fun otherProblem(size: Int): Int? {
- val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("stguid", info.subTask?.stguid)
-// .andGreaterThanOrEqualTo("time", info.sTime)
-// .andLessThan("time", info.eTime)
- })
- var i = 0
-
- val total = p.size
- var changed = 0
- p.forEach {
- if (it.ischanged == true) {
- changed++
- }
- }
- return when {
- changed == 0 && total > 0 -> 1
- changed < total -> 0
- else -> null
- }
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt
deleted file mode 100644
index ebca9e0..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt
+++ /dev/null
@@ -1,67 +0,0 @@
-package cn.flightfeather.supervision.business.storage.item
-
-import cn.flightfeather.supervision.business.ScoreItem
-import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
-import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.stereotype.Component
-import tk.mybatis.mapper.entity.Example
-import java.time.LocalDateTime
-import java.time.ZoneId
-import javax.annotation.PostConstruct
-
-/**
- * Date 2022/1/20 16:14
- * Created by feiyu
- * 鐮佸ご
- */
-@Component
-class WhScoreItem_2:ScoreItem() {
-
- companion object {
- private lateinit var instance: WhScoreItem_2
- }
-
- @PostConstruct
- fun init() {
- instance = this
- }
-
- override var id: String = "5NNLSvkVRFfASMhc"
-
- override var name: String = "鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇"
-
- @Autowired
- lateinit var dustDataResultMapper: DustDataResultMapper
-
- /**
- * 鎵皹鍦ㄧ嚎鐩戞祴鏁版嵁閲忕骇
- * 閫夐」濡備笅锛�
- * 1.鐩戞祴鏁版嵁鍑虹幇鍗曟棩鍙婁互涓婃湁鏁堣秴鏍�
- * 2.鐩戞祴鏁版嵁鏈堝潎鍊艰秴鍖哄煙鏈堝潎鍊�20%浠ヤ笂鎴栨暟鎹槑鏄惧紓甯�
- */
- override fun otherProblem(size: Int): Int? {
- val time = info.subTask?.planstarttime
- val lt = LocalDateTime.ofInstant(time?.toInstant(), ZoneId.systemDefault())
- val st = lt.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
- val et = st.plusMonths(1)
- val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
- createCriteria().andGreaterThanOrEqualTo("drTime", st)
- .andLessThan("drTime", et)
- .andEqualTo("drSceneId", info.sceneId)
- })
-
- var result: Int? = null
- r.forEach {
- if (it == null) return@forEach
- if (it.drExceedTimes > 0) {
- result = 0
- }
- if (it.drOverAvgPer > 0) {
- result = 1
- }
- }
-
- return result
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/package-info.java b/src/main/kotlin/cn/flightfeather/supervision/business/storage/package-info.java
deleted file mode 100644
index dfacbe8..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/package-info.java
+++ /dev/null
@@ -1,6 +0,0 @@
-/**
- * Date 2022/1/19 16:07
- * Created by feiyu
- * 宸ュ湴鑷姩璇勫垎閫昏緫
- */
-package cn.flightfeather.supervision.business.storage;
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt
new file mode 100644
index 0000000..72423b9
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt
@@ -0,0 +1,126 @@
+package cn.flightfeather.supervision.common.executor
+
+import org.springframework.stereotype.Component
+import java.time.LocalDateTime
+import java.util.concurrent.ConcurrentHashMap
+import java.util.concurrent.Executors
+import kotlin.jvm.Throws
+
+/**
+ * 鍚庡彴鑰楁椂浠诲姟绮剧‘绠$悊
+ */
+@Component
+class BackgroundTaskCtrl {
+
+ // 浠诲姟鍒楄〃
+ private val taskCollection = ConcurrentHashMap<BgTaskType, ConcurrentHashMap<String, BgTask>>()
+ // 绾跨▼姹�
+ private val executorService = Executors.newCachedThreadPool()
+
+ /**
+ * 鏂板浠诲姟
+ */
+ @Throws(IllegalStateException::class)
+ fun newTask(type: BgTaskType, id: String, name: String, task: () -> Boolean): BgTask {
+ if (!taskCollection.containsKey(type)) {
+ taskCollection[type] = ConcurrentHashMap<String, BgTask>()
+ }
+ val taskSet = taskCollection[type]!!
+ if (taskSet.containsKey(id)) throw IllegalStateException("鏃犳硶鍒涘缓浠诲姟锛� 浠诲姟[${name}]鐨刬d閲嶅")
+ val t = BgTask(type, id, name, task)
+ taskSet[id] = t
+ return t
+ }
+
+ /**
+ * 寮�濮嬩换鍔�
+ */
+ @Throws(IllegalStateException::class)
+ fun startTask(type: BgTaskType, id: String): BgTask {
+ val taskSet = taskCollection[type] ?: throw throw IllegalStateException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔$被鍨媅${type.des}]涓嶅瓨鍦�")
+ val t = taskSet[id] ?: throw IllegalStateException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔${id}]涓嶅瓨鍦�")
+ return startTask(t)
+ }
+
+ @Throws(IllegalStateException::class)
+ fun startTask(task: BgTask): BgTask {
+ if (task.taskStatus.status != TaskStatus.WAITING) {
+ if (task.taskStatus.status == TaskStatus.RUNNING) {
+ throw IllegalStateException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]姝e湪鎵ц")
+ } else {
+ throw IllegalStateException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]宸茬粨鏉�")
+ }
+ } else {
+ task.ready()
+ task.future = executorService.submit { task.execute() }
+ return task
+ }
+ }
+
+ /**
+ * 鏂板骞跺紑濮嬩换鍔�
+ */
+ @Throws(IllegalStateException::class)
+ fun startNewTask(type: BgTaskType, id: String, name: String, task: () -> Boolean): BgTask {
+ val t = newTask(type, id, name, task)
+ return startTask(t)
+ }
+
+ /**
+ * 鑾峰彇浠诲姟鐘舵��
+ */
+ fun getTaskStatus(type: BgTaskType?, id: String? = null): List<BgTaskStatus?> {
+ if (type != null) {
+ val set = taskCollection[type] ?: return emptyList()
+ return if (id == null) {
+ set.toList().map {
+ it.second.taskStatus
+ }.sortedBy { it.createTime }
+ } else {
+ val s = set[id]?.taskStatus
+ listOf(s)
+ }
+ } else {
+ val res = mutableListOf<BgTaskStatus?>()
+ taskCollection.forEach { (t, u) ->
+ val statusList = u.toList().map {
+ it.second.taskStatus
+ }
+ res.addAll(statusList)
+ }
+ return res.sortedBy { it?.createTime }
+ }
+ }
+
+ /**
+ * 寮哄埗鍏抽棴浠诲姟
+ */
+ @Throws(IllegalStateException::class)
+ fun shutDownTask(type: BgTaskType, id: String?): List<BgTaskStatus?> {
+ val taskMap = taskCollection[type] ?: throw IllegalStateException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔$被鍨媅${type.des}]鏈垱寤�")
+ return if (id != null) {
+ val task = taskMap[id] ?: throw IllegalStateException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔${id}]涓嶅瓨鍦�")
+ task.shutdown()
+ listOf(task.taskStatus)
+ } else {
+ val res = mutableListOf<BgTaskStatus?>()
+ taskMap.forEach { (t, u) ->
+ u.shutdown()
+ res.add(u.taskStatus)
+ }
+ res.sortedBy { it?.createTime }
+ }
+ }
+
+ @Throws(IllegalStateException::class)
+ fun removeTask(type: BgTaskType, id: String): Boolean {
+ val statusList = shutDownTask(type, id)
+ if (statusList.isNotEmpty()) {
+ val s = statusList.first() ?: throw IllegalStateException("鏃犳硶绉婚櫎浠诲姟锛屼换鍔′笉瀛樺湪")
+ taskCollection[s.type]?.remove(s.id)
+ return true
+ }
+ return false
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt
new file mode 100644
index 0000000..953eac3
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt
@@ -0,0 +1,50 @@
+package cn.flightfeather.supervision.common.executor
+
+import org.springframework.scheduling.annotation.Async
+import java.time.LocalDateTime
+import java.util.concurrent.Future
+
+/**
+ * 鍚庡彴浠诲姟
+ */
+class BgTask(
+ val type: BgTaskType,
+ val id: String,
+ val name: String,
+ private val task: () -> Boolean,
+) {
+ var taskStatus = BgTaskStatus(type, id, name)
+ var future: Future<*>? = null
+
+ fun ready() {
+ taskStatus.status = TaskStatus.RUNNING
+ taskStatus.startTime = LocalDateTime.now()
+ }
+
+ fun execute() {
+ val res = task()
+ if (res) success() else fail()
+ }
+
+ fun success() {
+ taskStatus.status = TaskStatus.SUCCESS
+ complete()
+ }
+
+ fun fail() {
+ taskStatus.status = TaskStatus.FAIL
+ complete()
+ }
+
+ fun shutdown() {
+ if (future?.isCancelled == false && !future!!.isDone) {
+ future!!.cancel(true)
+ taskStatus.status = TaskStatus.SHUTDOWN
+ complete()
+ }
+ }
+
+ fun complete() {
+ taskStatus.endTime = LocalDateTime.now()
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskConditionVo.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskConditionVo.kt
new file mode 100644
index 0000000..26d3fff
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskConditionVo.kt
@@ -0,0 +1,10 @@
+package cn.flightfeather.supervision.common.executor
+
+/**
+ * 鍚庡彴浠诲姟鏌ヨ鏉′欢
+ */
+class BgTaskConditionVo {
+
+ var type: BgTaskType? = null
+ var id: String? = null
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt
new file mode 100644
index 0000000..22d6fa9
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt
@@ -0,0 +1,56 @@
+package cn.flightfeather.supervision.common.executor
+
+import java.time.Duration
+import java.time.LocalDateTime
+
+/**
+ * 鍚庡彴鑰楁椂浠诲姟鐘舵��
+ */
+class BgTaskStatus(
+ val type: BgTaskType,
+ val id: String,
+ val name: String,
+) {
+ // 浠诲姟鐘舵��
+ var status: TaskStatus = TaskStatus.WAITING
+
+ // 寮�濮嬫椂闂�
+ var startTime: LocalDateTime? = null
+
+ // 缁撴潫鏃堕棿
+ var endTime: LocalDateTime? = null
+
+ // 鍒涘缓鏃堕棿
+ var createTime: LocalDateTime = LocalDateTime.now()
+
+ // 杩愯鏃堕暱锛堢锛�
+ val runTime: Long
+ get() {
+ when (status) {
+ TaskStatus.WAITING -> {
+ return 0
+ }
+ TaskStatus.RUNNING -> {
+ val now = LocalDateTime.now()
+ val duration = Duration.between(startTime, now)
+ return duration.toMillis() / 1000
+ }
+ TaskStatus.SUCCESS,
+ TaskStatus.FAIL,
+ TaskStatus.SHUTDOWN,
+ -> {
+ val duration = Duration.between(startTime, endTime)
+ return duration.toMillis() / 1000
+ }
+ }
+ }
+
+}
+
+enum class TaskStatus {
+ WAITING,
+ RUNNING,
+ SUCCESS,
+ FAIL,
+ SHUTDOWN
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt
new file mode 100644
index 0000000..d1b471f
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt
@@ -0,0 +1,20 @@
+package cn.flightfeather.supervision.common.executor
+
+enum class BgTaskType(val index: Int, val des: String) {
+ //娴嬭瘯浠诲姟
+ TEST(0, "娴嬭瘯浠诲姟"),
+ //鑷姩璇勫垎
+ AUTO_SCORE(1, "鑷姩璇勪及浠诲姟");
+
+
+ companion object {
+
+ fun getByIndex(index: Int?): BgTaskType? {
+ return when (index) {
+ TEST.index -> TEST
+ AUTO_SCORE.index -> AUTO_SCORE
+ else -> null
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
index 5b5e162..bc73931 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
@@ -2,8 +2,12 @@
class Constant{
//鐢ㄦ埛
- enum class UserType(val text: String){
- ALLUSER("0")//鎵�鏈夌敤鎴�
+ enum class UserType(val value: Int, val des: String){
+ ALL_USER(-1,"0"),//鎵�鏈夌敤鎴�
+ ADMIN(0, "绠$悊鍛�"),
+ INSIDER(1, "鍐呴儴浜哄憳"),
+ GOV(2, "鏀垮簻閮ㄩ棬"),
+ ENTERPRISE(3, "浼佷笟")
}
//瑙勮寖绫诲埆
enum class RuleType(val value: Byte, val text: String){
@@ -16,7 +20,7 @@
RUNINGSTATUS3("3","宸茬粨鏉�")
}
//鍦烘櫙绫诲瀷
- enum class ScenseType(val value: String, val text: String){
+ enum class SceneType(val value: String, val text: String){
TYPE1("1","宸ュ湴"), TYPE2("2","鐮佸ご"),
TYPE3("3","姘存偿鎼呮媽绔�"), TYPE4("4","宸ヤ笟浼佷笟"),
TYPE5("5","椁愰ギ"), TYPE6("6","姹戒慨"),
diff --git a/src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt b/src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt
index f0a66e6..7a159fe 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/config/Swagger2Configuration.kt
@@ -16,16 +16,16 @@
*/
@Configuration
@EnableSwagger2
-class Swagger2Configuration {
+class Swagger2Configuration(
+ @Value("\${springfox.documentation.swagger.v2.enabled}")
+ var swagger2Enable: Boolean
+) {
companion object {
const val SWAGGER_SCAN_BASE_PACKAGE = "cn.flightfeather.supervision"
const val VERSION = "1.0.0"
}
-
- @Value("\${springfox.documentation.swagger.v2.enabled}")
- private val swagger2Enable: Boolean = true
@Bean
fun createRestApi(): Docket =
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationrule.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationrule.kt
index f8f1e54..e636136 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationrule.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationrule.kt
@@ -98,7 +98,7 @@
* 浠庡�煎煙琛ㄨ幏鍙栵紙1 鐪侊紱2 鍦板競锛�3 鍖哄幙锛�4 琛楅晣锛�5 娣峰悎锛�
*/
@Column(name = "ER_IsUse")
- var isuse: String? = null
+ var isuse: Boolean? = null
@Column(name = "ER_StartTime")
var starttime: Date? = null
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/EvaluationMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/EvaluationMapper.kt
index 25e8861..839c0a9 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/EvaluationMapper.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/EvaluationMapper.kt
@@ -2,8 +2,11 @@
import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
import cn.flightfeather.supervision.domain.util.MyMapper
+import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo
import org.apache.ibatis.annotations.Mapper
@Mapper
interface EvaluationMapper:MyMapper<Evaluation> {
+
+ fun findEvaluation(topTaskId: String, sceneTypeId: String): List<AutoScoreResultVo>
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt
new file mode 100644
index 0000000..0d7eb94
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt
@@ -0,0 +1,43 @@
+package cn.flightfeather.supervision.domain.ds1.repository
+
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
+import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationMapper
+import cn.flightfeather.supervision.domain.ds1.mapper.ItemevaluationMapper
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo
+import org.springframework.stereotype.Repository
+import tk.mybatis.mapper.entity.Example
+import java.time.LocalDate
+
+@Repository
+class EvaluationRep(
+ private val evaluationMapper: EvaluationMapper,
+ private val itemevaluationMapper: ItemevaluationMapper,
+ private val taskRep: TaskRep,
+) {
+
+ /**
+ * 鏌ユ壘鍦烘櫙瀵瑰簲鐨勫緱鍒�
+ * @param sceneId 鍦烘櫙id
+ * @param date 鏃ユ湡锛屽彧浣跨敤骞村拰鏈�
+ * @return
+ */
+ fun findByScene(sceneId: String?, date: LocalDate): Evaluation? {
+ val sT = date.withDayOfMonth(1).atStartOfDay()
+ val eT = sT.plusMonths(1).minusSeconds(1)
+ val res = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply {
+ createCriteria().andEqualTo("sguid", sceneId)
+ .andBetween("evaluatetime", sT, eT)
+ })
+ return if (res.isNotEmpty()) res[0] else null
+ }
+
+ /**
+ * 鏌ユ壘鑷姩璇勫垎缁撴灉
+ */
+ fun findAutoScore(areaVo: AreaVo): List<AutoScoreResultVo?>? {
+ areaVo.scensetypeid ?: return null
+ val task = taskRep.findOneTask(areaVo) ?: return null
+ return evaluationMapper.findEvaluation(task.tguid!!, areaVo.scensetypeid!!)
+ }
+}
\ 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
new file mode 100644
index 0000000..9014743
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt
@@ -0,0 +1,30 @@
+package cn.flightfeather.supervision.domain.ds1.repository
+
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
+import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
+import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo
+import org.springframework.stereotype.Repository
+import tk.mybatis.mapper.entity.Example
+
+/**
+ * 璇勪及瑙勫垯鏁版嵁搴撶浉鍏虫搷浣�
+ */
+@Repository
+class EvaluationRuleRep(private val evaluationruleMapper: EvaluationruleMapper) {
+
+ /**
+ * 鏍规嵁鍙傛暟鏌ヨ鎬昏鍒�
+ * @param areaEvaVo 鏌ヨ鍙傛暟
+ */
+ fun findBaseRule(areaEvaVo: AreaEvaVo): List<Evaluationrule?> {
+ return evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
+ createCriteria().andEqualTo("tasktypeid", areaEvaVo.taskTypeId)
+ .andEqualTo("scensetypeid", areaEvaVo.scensetypeid)
+ .andEqualTo("provincecode", areaEvaVo.provincecode)
+ .andEqualTo("citycode", areaEvaVo.citycode)
+ .andEqualTo("districtcode", areaEvaVo.districtcode)
+ .andEqualTo("towncode", areaEvaVo.towncode)
+ .andEqualTo("isuse", true)
+ })
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt
new file mode 100644
index 0000000..8dba496
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt
@@ -0,0 +1,38 @@
+package cn.flightfeather.supervision.domain.ds1.repository
+
+import cn.flightfeather.supervision.domain.ds1.entity.Task
+import cn.flightfeather.supervision.domain.ds1.mapper.TaskMapper
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import org.springframework.stereotype.Repository
+import java.time.LocalDate
+import java.time.ZoneId
+import java.util.*
+
+@Repository
+class TaskRep(private val taskMapper: TaskMapper) {
+
+ private fun exampleTask(areaVo: AreaVo): Task?{
+ areaVo.starttime ?: return null
+ val mStart = LocalDate.parse(areaVo.starttime).withDayOfMonth(1).atStartOfDay()
+ val mEnd = mStart.plusMonths(1).minusSeconds(1)
+ return Task().apply {
+ provincecode = areaVo.provincecode
+ citycode = areaVo.citycode
+ districtcode = areaVo.districtcode
+ starttime = Date.from(mStart.atZone(ZoneId.systemDefault()).toInstant())
+ endtime = Date.from(mEnd.atZone(ZoneId.systemDefault()).toInstant())
+ }
+ }
+ /**
+ * 鏌ユ壘涓�涓�讳换鍔�
+ */
+ fun findOneTask(areaVo: AreaVo): Task? {
+ val example = exampleTask(areaVo) ?: return null
+ return taskMapper.selectOne(example)
+ }
+
+ fun findTasks(areaVo: AreaVo): List<Task?> {
+ val example = exampleTask(areaVo) ?: return emptyList()
+ return taskMapper.select(example)
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/OverallEvaluation.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/OverallEvaluation.java
new file mode 100644
index 0000000..f0ba1a9
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/OverallEvaluation.java
@@ -0,0 +1,211 @@
+package cn.flightfeather.supervision.domain.ds2.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.util.Date;
+
+@Table(name = "ea_t_overall_evaluation")
+public class OverallEvaluation {
+ @Id
+ @Column(name = "OE_GUID")
+ private Integer oeGuid;
+
+ @Column(name = "BI_GUID")
+ private String biGuid;
+
+ @Column(name = "OE_Score")
+ private Integer oeScore;
+
+ @Column(name = "OE_Publish_Time")
+ private Date oePublishTime;
+
+ @Column(name = "OE_Update_Time")
+ private Date oeUpdateTime;
+
+ @Column(name = "OE_Scene_Type_Id")
+ private Byte oeSceneTypeId;
+
+ @Column(name = "OE_Scene_Type")
+ private String oeSceneType;
+
+ @Column(name = "OE_Period")
+ private String oePeriod;
+
+ @Column(name = "OE_Code_Level")
+ private Byte oeCodeLevel;
+
+ /**
+ * 鐢熸晥寮�濮嬫椂闂�
+ */
+ @Column(name = "OE_Start_Time")
+ private Date oeStartTime;
+
+ /**
+ * 鐢熸晥缁撴潫鏃堕棿
+ */
+ @Column(name = "OE_End_Time")
+ private Date oeEndTime;
+
+ /**
+ * @return OE_GUID
+ */
+ public Integer getOeGuid() {
+ return oeGuid;
+ }
+
+ /**
+ * @param oeGuid
+ */
+ public void setOeGuid(Integer oeGuid) {
+ this.oeGuid = oeGuid;
+ }
+
+ /**
+ * @return BI_GUID
+ */
+ public String getBiGuid() {
+ return biGuid;
+ }
+
+ /**
+ * @param biGuid
+ */
+ public void setBiGuid(String biGuid) {
+ this.biGuid = biGuid == null ? null : biGuid.trim();
+ }
+
+ /**
+ * @return OE_Score
+ */
+ public Integer getOeScore() {
+ return oeScore;
+ }
+
+ /**
+ * @param oeScore
+ */
+ public void setOeScore(Integer oeScore) {
+ this.oeScore = oeScore;
+ }
+
+ /**
+ * @return OE_Publish_Time
+ */
+ public Date getOePublishTime() {
+ return oePublishTime;
+ }
+
+ /**
+ * @param oePublishTime
+ */
+ public void setOePublishTime(Date oePublishTime) {
+ this.oePublishTime = oePublishTime;
+ }
+
+ /**
+ * @return OE_Update_Time
+ */
+ public Date getOeUpdateTime() {
+ return oeUpdateTime;
+ }
+
+ /**
+ * @param oeUpdateTime
+ */
+ public void setOeUpdateTime(Date oeUpdateTime) {
+ this.oeUpdateTime = oeUpdateTime;
+ }
+
+ /**
+ * @return OE_Scene_Type_Id
+ */
+ public Byte getOeSceneTypeId() {
+ return oeSceneTypeId;
+ }
+
+ /**
+ * @param oeSceneTypeId
+ */
+ public void setOeSceneTypeId(Byte oeSceneTypeId) {
+ this.oeSceneTypeId = oeSceneTypeId;
+ }
+
+ /**
+ * @return OE_Scene_Type
+ */
+ public String getOeSceneType() {
+ return oeSceneType;
+ }
+
+ /**
+ * @param oeSceneType
+ */
+ public void setOeSceneType(String oeSceneType) {
+ this.oeSceneType = oeSceneType == null ? null : oeSceneType.trim();
+ }
+
+ /**
+ * @return OE_Period
+ */
+ public String getOePeriod() {
+ return oePeriod;
+ }
+
+ /**
+ * @param oePeriod
+ */
+ public void setOePeriod(String oePeriod) {
+ this.oePeriod = oePeriod == null ? null : oePeriod.trim();
+ }
+
+ /**
+ * @return OE_Code_Level
+ */
+ public Byte getOeCodeLevel() {
+ return oeCodeLevel;
+ }
+
+ /**
+ * @param oeCodeLevel
+ */
+ public void setOeCodeLevel(Byte oeCodeLevel) {
+ this.oeCodeLevel = oeCodeLevel;
+ }
+
+ /**
+ * 鑾峰彇鐢熸晥寮�濮嬫椂闂�
+ *
+ * @return RE_Start_Time - 鐢熸晥寮�濮嬫椂闂�
+ */
+ public Date getOeStartTime() {
+ return oeStartTime;
+ }
+
+ /**
+ * 璁剧疆鐢熸晥寮�濮嬫椂闂�
+ *
+ * @param oeStartTime 鐢熸晥寮�濮嬫椂闂�
+ */
+ public void setOeStartTime(Date oeStartTime) {
+ this.oeStartTime = oeStartTime;
+ }
+
+ /**
+ * 鑾峰彇鐢熸晥缁撴潫鏃堕棿
+ *
+ * @return RE_End_Time - 鐢熸晥缁撴潫鏃堕棿
+ */
+ public Date getOeEndTime() {
+ return oeEndTime;
+ }
+
+ /**
+ * 璁剧疆鐢熸晥缁撴潫鏃堕棿
+ *
+ * @param oeEndTime 鐢熸晥缁撴潫鏃堕棿
+ */
+ public void setOeEndTime(Date oeEndTime) {
+ this.oeEndTime = oeEndTime;
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/OverallEvaluationMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/OverallEvaluationMapper.kt
new file mode 100644
index 0000000..586e16f
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/mapper/OverallEvaluationMapper.kt
@@ -0,0 +1,8 @@
+package cn.flightfeather.supervision.domain.ds2.mapper
+
+import cn.flightfeather.supervision.domain.ds2.entity.OverallEvaluation
+import cn.flightfeather.supervision.domain.util.MyMapper
+import org.apache.ibatis.annotations.Mapper
+
+@Mapper
+interface OverallEvaluationMapper : MyMapper<OverallEvaluation?>
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/OverallEvaluationRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/OverallEvaluationRep.kt
new file mode 100644
index 0000000..b99a538
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/OverallEvaluationRep.kt
@@ -0,0 +1,60 @@
+package cn.flightfeather.supervision.domain.ds2.repository
+
+import cn.flightfeather.supervision.business.autooutput.score.ScoreUtil
+import cn.flightfeather.supervision.common.utils.Constant
+import cn.flightfeather.supervision.domain.ds2.entity.OverallEvaluation
+import cn.flightfeather.supervision.domain.ds2.mapper.OverallEvaluationMapper
+import org.springframework.stereotype.Repository
+import java.time.LocalDate
+import java.time.ZoneId
+import java.util.*
+
+@Repository
+class OverallEvaluationRep(private val overallEvaluationMapper: OverallEvaluationMapper){
+
+ /**
+ * 鎻掑叆涓�鏉$幆淇$爜璁板綍
+ * @param userId
+ * @param score
+ * @param sceneType
+ * @param sT
+ * @param eT
+ * @return
+ */
+ fun insertOrUpdateOne(
+ userId: String?,
+ score: Int?,
+ sceneType: Constant.SceneType,
+ sT: LocalDate,
+ eT: LocalDate,
+ ): Int {
+ val period = "${sT.year}/${sT.monthValue}-${eT.monthValue}"
+ val codeLevel = ScoreUtil.scoreToCredit(score)
+ val oE = overallEvaluationMapper.selectOne(OverallEvaluation().apply {
+ biGuid = userId
+ oePeriod = period
+ })
+ if (oE != null) {
+ oE.oeScore = score
+ oE.oeCodeLevel = codeLevel.first?.toByte()
+ return overallEvaluationMapper.updateByPrimaryKey(oE)
+ } else {
+ val startTime = sT.withDayOfMonth(1)
+ val endTime = eT.plusMonths(1).withDayOfMonth(1).minusDays(1)
+ val publishTime = Date.from(endTime.plusDays(1).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())
+ val e = OverallEvaluation().apply {
+ biGuid = userId
+ oeScore = score
+ oePublishTime = publishTime
+ oeUpdateTime = publishTime
+ oeSceneTypeId = Constant.SceneType.typeMap(sceneType.value.toByte())
+ oeSceneType = sceneType.text
+ oePeriod = period
+ oeCodeLevel = codeLevel.first?.toByte()
+ oeStartTime = Date.from(startTime.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())
+ oeEndTime = Date.from(endTime.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())
+ }
+ return overallEvaluationMapper.insert(e)
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt
new file mode 100644
index 0000000..955ed62
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt
@@ -0,0 +1,28 @@
+package cn.flightfeather.supervision.domain.ds2.repository
+
+import cn.flightfeather.supervision.common.utils.Constant
+import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
+import cn.flightfeather.supervision.domain.ds2.mapper.UserinfoTZMapper
+import org.springframework.stereotype.Repository
+import tk.mybatis.mapper.entity.Example
+
+@Repository
+class UserInfoTZRep(private val userinfoTZMapper: UserinfoTZMapper) {
+
+ /**
+ * 鏌ユ壘鍦ㄧ嚎鐨勬寮忎紒涓氱敤鎴�
+ * @param district 鍖哄幙鍚嶇О
+ * @param sceneType 鍦烘櫙绫诲瀷
+ * @return
+ */
+ fun findEnterpriseUser(district: String?, sceneType: Constant.SceneType): List<UserinfoTZ?> {
+ val type = Constant.SceneType.typeMap(sceneType.value.toByte())
+ return userinfoTZMapper.selectByExample(Example(UserinfoTZ::class.java).apply {
+ createCriteria().andEqualTo("extension2", type)
+ .andEqualTo("extension1", district)
+ .andEqualTo("usertypeid", Constant.UserType.ENTERPRISE.value)
+ .andEqualTo("isenable", true)
+ and(createCriteria().orIsNull("workno").orNotEqualTo("workno", "test"))
+ })
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt
new file mode 100644
index 0000000..022a302
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt
@@ -0,0 +1,38 @@
+package cn.flightfeather.supervision.domain.ds2.repository
+
+import cn.flightfeather.supervision.domain.ds1.entity.Scense
+import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper
+import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper
+import cn.flightfeather.supervision.domain.ds2.entity.UserMap
+import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
+import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
+import org.springframework.stereotype.Repository
+
+@Repository
+class UserMapRep(
+ private val userMapMapper: UserMapMapper,
+ private val scenseMapper: ScenseMapper,
+ private val userinfoMapper: UserinfoMapper
+) {
+
+ /**
+ * 浠庨缇界洃绠$郴缁熶腑鏌ユ壘鍩烘湰淇℃伅
+ * @param userinfoTZ 椋炵窘鐜涓殑鐢ㄦ埛淇℃伅
+ * @return
+ */
+ fun findFromSupervision(userinfoTZ: UserinfoTZ?): Scense? {
+ val userMap = UserMap().apply {
+ tzUserId = userinfoTZ?.guid
+ }
+ // 鎵惧埌涓や釜绯荤粺鐢ㄦ埛鐨勫搴斿叧绯�
+ val uMap = userMapMapper.selectOne(userMap)
+ if (uMap == null) {
+ println("${userinfoTZ?.guid}, ${userinfoTZ?.realname}")
+ return null
+ }
+ // 鎵惧埌椋炵窘鐩戠涓殑鐢ㄦ埛淇℃伅
+ val userInfoSp = userinfoMapper.selectByPrimaryKey(uMap.svUserId)
+ // 鎵惧埌椋炵窘鐩戠涓殑鍦烘櫙淇℃伅
+ return scenseMapper.selectByPrimaryKey(userInfoSp.dGuid)
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/FumeSiteMap.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/FumeSiteMap.java
new file mode 100644
index 0000000..85a2b89
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/FumeSiteMap.java
@@ -0,0 +1,144 @@
+package cn.flightfeather.supervision.domain.ds3.entity;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "fu_xh_t_site_map")
+public class FumeSiteMap {
+ @Id
+ @Column(name = "Id")
+ private Integer id;
+
+ @Column(name = "TZ_User_Id")
+ private String tzUserId;
+
+ @Column(name = "TZ_User_Name")
+ private String tzUserName;
+
+ @Column(name = "XH_Device_Code")
+ private String xhDeviceCode;
+
+ @Column(name = "XH_Device_Name")
+ private String xhDeviceName;
+
+ @Column(name = "SV_User_Id")
+ private String svUserId;
+
+ @Column(name = "SV_User_Name")
+ private String svUserName;
+
+ @Column(name = "Create_Time")
+ private Date createTime;
+
+ /**
+ * @return Id
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ */
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ /**
+ * @return TZ_User_Id
+ */
+ public String getTzUserId() {
+ return tzUserId;
+ }
+
+ /**
+ * @param tzUserId
+ */
+ public void setTzUserId(String tzUserId) {
+ this.tzUserId = tzUserId == null ? null : tzUserId.trim();
+ }
+
+ /**
+ * @return TZ_User_Name
+ */
+ public String getTzUserName() {
+ return tzUserName;
+ }
+
+ /**
+ * @param tzUserName
+ */
+ public void setTzUserName(String tzUserName) {
+ this.tzUserName = tzUserName == null ? null : tzUserName.trim();
+ }
+
+ /**
+ * @return XH_Device_Code
+ */
+ public String getXhDeviceCode() {
+ return xhDeviceCode;
+ }
+
+ /**
+ * @param xhDeviceCode
+ */
+ public void setXhDeviceCode(String xhDeviceCode) {
+ this.xhDeviceCode = xhDeviceCode == null ? null : xhDeviceCode.trim();
+ }
+
+ /**
+ * @return XH_Device_Name
+ */
+ public String getXhDeviceName() {
+ return xhDeviceName;
+ }
+
+ /**
+ * @param xhDeviceName
+ */
+ public void setXhDeviceName(String xhDeviceName) {
+ this.xhDeviceName = xhDeviceName == null ? null : xhDeviceName.trim();
+ }
+
+ /**
+ * @return SV_User_Id
+ */
+ public String getSvUserId() {
+ return svUserId;
+ }
+
+ /**
+ * @param svUserId
+ */
+ public void setSvUserId(String svUserId) {
+ this.svUserId = svUserId == null ? null : svUserId.trim();
+ }
+
+ /**
+ * @return SV_User_Name
+ */
+ public String getSvUserName() {
+ return svUserName;
+ }
+
+ /**
+ * @param svUserName
+ */
+ public void setSvUserName(String svUserName) {
+ this.svUserName = svUserName == null ? null : svUserName.trim();
+ }
+
+ /**
+ * @return Create_Time
+ */
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ /**
+ * @param createTime
+ */
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustData.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustData.java
new file mode 100644
index 0000000..3b5d775
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustData.java
@@ -0,0 +1,139 @@
+package cn.flightfeather.supervision.domain.ds3.entity;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "ja_t_dust_site_data_info")
+public class JSDustData {
+ @Id
+ private Integer id;
+
+ @Column(name = "mn_code")
+ private String mnCode;
+
+ @Column(name = "dust_value")
+ private Double dustValue;
+
+ @Column(name = "noise_value")
+ private Double noiseValue;
+
+ private Date lst;
+
+ private String quality;
+
+ private Integer grade;
+
+ private String flag;
+
+ /**
+ * @return id
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ */
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ /**
+ * @return mn_code
+ */
+ public String getMnCode() {
+ return mnCode;
+ }
+
+ /**
+ * @param mnCode
+ */
+ public void setMnCode(String mnCode) {
+ this.mnCode = mnCode == null ? null : mnCode.trim();
+ }
+
+ /**
+ * @return dust_value
+ */
+ public Double getDustValue() {
+ return dustValue;
+ }
+
+ /**
+ * @param dustValue
+ */
+ public void setDustValue(Double dustValue) {
+ this.dustValue = dustValue;
+ }
+
+ /**
+ * @return noise_value
+ */
+ public Double getNoiseValue() {
+ return noiseValue;
+ }
+
+ /**
+ * @param noiseValue
+ */
+ public void setNoiseValue(Double noiseValue) {
+ this.noiseValue = noiseValue;
+ }
+
+ /**
+ * @return lst
+ */
+ public Date getLst() {
+ return lst;
+ }
+
+ /**
+ * @param lst
+ */
+ public void setLst(Date lst) {
+ this.lst = lst;
+ }
+
+ /**
+ * @return quality
+ */
+ public String getQuality() {
+ return quality;
+ }
+
+ /**
+ * @param quality
+ */
+ public void setQuality(String quality) {
+ this.quality = quality == null ? null : quality.trim();
+ }
+
+ /**
+ * @return grade
+ */
+ public Integer getGrade() {
+ return grade;
+ }
+
+ /**
+ * @param grade
+ */
+ public void setGrade(Integer grade) {
+ this.grade = grade;
+ }
+
+ /**
+ * @return flag
+ */
+ public String getFlag() {
+ return flag;
+ }
+
+ /**
+ * @param flag
+ */
+ public void setFlag(String flag) {
+ this.flag = flag == null ? null : flag.trim();
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteMap.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteMap.java
new file mode 100644
index 0000000..faa26ed
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteMap.java
@@ -0,0 +1,144 @@
+package cn.flightfeather.supervision.domain.ds3.entity;
+
+import java.util.Date;
+import javax.persistence.*;
+
+@Table(name = "du_js_t_site_map")
+public class JSDustSiteMap {
+ @Id
+ @Column(name = "Id")
+ private Integer id;
+
+ @Column(name = "TZ_User_Id")
+ private String tzUserId;
+
+ @Column(name = "TZ_User_Name")
+ private String tzUserName;
+
+ @Column(name = "JS_Device_Code")
+ private String jsDeviceCode;
+
+ @Column(name = "JS_Device_Name")
+ private String jsDeviceName;
+
+ @Column(name = "SV_User_Id")
+ private String svUserId;
+
+ @Column(name = "SV_User_Name")
+ private String svUserName;
+
+ @Column(name = "Create_Time")
+ private Date createTime;
+
+ /**
+ * @return Id
+ */
+ public Integer getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ */
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ /**
+ * @return TZ_User_Id
+ */
+ public String getTzUserId() {
+ return tzUserId;
+ }
+
+ /**
+ * @param tzUserId
+ */
+ public void setTzUserId(String tzUserId) {
+ this.tzUserId = tzUserId == null ? null : tzUserId.trim();
+ }
+
+ /**
+ * @return TZ_User_Name
+ */
+ public String getTzUserName() {
+ return tzUserName;
+ }
+
+ /**
+ * @param tzUserName
+ */
+ public void setTzUserName(String tzUserName) {
+ this.tzUserName = tzUserName == null ? null : tzUserName.trim();
+ }
+
+ /**
+ * @return JS_Device_Code
+ */
+ public String getJsDeviceCode() {
+ return jsDeviceCode;
+ }
+
+ /**
+ * @param jsDeviceCode
+ */
+ public void setJsDeviceCode(String jsDeviceCode) {
+ this.jsDeviceCode = jsDeviceCode == null ? null : jsDeviceCode.trim();
+ }
+
+ /**
+ * @return JS_Device_Name
+ */
+ public String getJsDeviceName() {
+ return jsDeviceName;
+ }
+
+ /**
+ * @param jsDeviceName
+ */
+ public void setJsDeviceName(String jsDeviceName) {
+ this.jsDeviceName = jsDeviceName == null ? null : jsDeviceName.trim();
+ }
+
+ /**
+ * @return SV_User_Id
+ */
+ public String getSvUserId() {
+ return svUserId;
+ }
+
+ /**
+ * @param svUserId
+ */
+ public void setSvUserId(String svUserId) {
+ this.svUserId = svUserId == null ? null : svUserId.trim();
+ }
+
+ /**
+ * @return SV_User_Name
+ */
+ public String getSvUserName() {
+ return svUserName;
+ }
+
+ /**
+ * @param svUserName
+ */
+ public void setSvUserName(String svUserName) {
+ this.svUserName = svUserName == null ? null : svUserName.trim();
+ }
+
+ /**
+ * @return Create_Time
+ */
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ /**
+ * @param createTime
+ */
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/enum/JSSceneType.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/enum/JSSceneType.kt
new file mode 100644
index 0000000..733cc75
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/enum/JSSceneType.kt
@@ -0,0 +1,7 @@
+package cn.flightfeather.supervision.domain.ds3.enum
+
+enum class JSSceneType(val value:Int, val des:String) {
+ Construction(1, "寤虹瓚宸ュ湴"),
+ Wharf(3, "鐮佸ご"),
+ MixingPlant(4, "鎼呮媽绔�")
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/FumeSiteMapMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/FumeSiteMapMapper.kt
new file mode 100644
index 0000000..52c081d
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/FumeSiteMapMapper.kt
@@ -0,0 +1,8 @@
+package cn.flightfeather.supervision.domain.ds3.mapper
+
+import cn.flightfeather.supervision.domain.ds3.entity.FumeSiteMap
+import cn.flightfeather.supervision.domain.util.MyMapper
+import org.apache.ibatis.annotations.Mapper
+
+@Mapper
+interface FumeSiteMapMapper : MyMapper<FumeSiteMap?>
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustDataMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustDataMapper.kt
new file mode 100644
index 0000000..7f3cf12
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustDataMapper.kt
@@ -0,0 +1,12 @@
+package cn.flightfeather.supervision.domain.ds3.mapper
+
+import cn.flightfeather.supervision.domain.ds3.entity.JSDustData
+import cn.flightfeather.supervision.domain.util.MyMapper
+import org.apache.ibatis.annotations.Mapper
+import java.util.*
+
+@Mapper
+interface JSDustDataMapper : MyMapper<JSDustData?> {
+
+ fun getDataBySceneType(st: Date?, et: Date?, sceneType: Int, startIndex:Int, perPage:Int): List<JSDustData?>
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteMapMapper.java b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteMapMapper.java
new file mode 100644
index 0000000..9aba365
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteMapMapper.java
@@ -0,0 +1,8 @@
+package cn.flightfeather.supervision.domain.ds3.mapper;
+
+import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap;
+import cn.flightfeather.supervision.domain.util.MyMapper;
+import tk.mybatis.mapper.common.Mapper;
+
+public interface JSDustSiteMapMapper extends MyMapper<JSDustSiteMap> {
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/BgTaskService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/BgTaskService.kt
new file mode 100644
index 0000000..cf52539
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/BgTaskService.kt
@@ -0,0 +1,30 @@
+package cn.flightfeather.supervision.lightshare.service
+
+import cn.flightfeather.supervision.common.executor.BgTaskConditionVo
+import cn.flightfeather.supervision.common.executor.BgTaskStatus
+
+interface BgTaskService {
+
+ /**
+ * 鑾峰彇浠诲姟鐘舵��
+ */
+ fun getTaskStatus(condition: BgTaskConditionVo): List<BgTaskStatus?>
+
+ fun startTask(condition: BgTaskConditionVo): BgTaskStatus?
+
+ fun shutDownTask(condition: BgTaskConditionVo): List<BgTaskStatus?>
+
+ fun removeTask(condition: BgTaskConditionVo): Boolean
+
+ /******************************Test************************************************/
+ /**
+ * 鏂板缓骞惰繍琛屼竴涓祴璇曚换鍔�
+ */
+ fun startNewTestTask(taskId: String): BgTaskStatus?
+
+ /**
+ * 鏂板缓涓�涓祴璇曚换鍔�
+ */
+ fun newTestTask(taskId: String): BgTaskStatus?
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
index 38b81f4..2f897f6 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
@@ -1,7 +1,11 @@
package cn.flightfeather.supervision.lightshare.service
+import cn.flightfeather.supervision.common.executor.BgTaskStatus
import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
+import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo
+import cn.flightfeather.supervision.lightshare.vo.BaseResponse
interface EvaluationService {
@@ -19,8 +23,6 @@
fun getRankOfTown(tguid: String, scensetypeid: String?):List<AreaVo>
- fun getTopTaskByScene(sceneId: String?): String?
-
fun autoScore(districtCode: String, time: String): List<String>
fun autoScore2(subTaskId: String): List<String>
@@ -28,4 +30,12 @@
fun autoScore3(tGuid: String, sceneTypeId: String): String
fun findByInspectionId(inspectionId:String):List<Evaluation>
+
+ /**
+ * 鑷姩璇勪及
+ * @param areaVo 璇勪及鑼冨洿
+ */
+ fun autoEvaluate(areaVo: AreaVo): BgTaskStatus?
+
+ fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>?
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationruleService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationruleService.kt
index 4250395..d6c66e0 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationruleService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationruleService.kt
@@ -1,6 +1,8 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
+import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
interface EvaluationruleService {
@@ -16,4 +18,5 @@
fun findBySpecificRule(tasktypeid: Byte?, scensetypeid: Byte?, districtcode: String?): Evaluationrule?
+ fun find(areaVo: AreaEvaVo): List<Evaluationrule?>
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt
index 5ffa7ac..7228a57 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt
@@ -1,10 +1,8 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Task
-import cn.flightfeather.supervision.lightshare.vo.DayTaskProgressVo
-import cn.flightfeather.supervision.lightshare.vo.RankVo
-import cn.flightfeather.supervision.lightshare.vo.TaskFrequencyVo
-import cn.flightfeather.supervision.lightshare.vo.TaskVo
+import cn.flightfeather.supervision.lightshare.vo.*
+import org.springframework.web.bind.annotation.RequestBody
import java.util.*
interface TaskService {
@@ -52,4 +50,6 @@
fun getByDistrictCode(districtCode: String, date: Date):List<TaskVo>
+ fun findTask(areaVo: AreaVo):List<Task?>
+
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt
new file mode 100644
index 0000000..613e021
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt
@@ -0,0 +1,54 @@
+package cn.flightfeather.supervision.lightshare.service.impl
+
+import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
+import cn.flightfeather.supervision.common.executor.BgTaskConditionVo
+import cn.flightfeather.supervision.common.executor.BgTaskStatus
+import cn.flightfeather.supervision.common.executor.BgTaskType
+import cn.flightfeather.supervision.lightshare.service.BgTaskService
+import org.springframework.stereotype.Service
+
+@Service
+class BgTaskServiceImpl(private val backgroundTaskCtrl: BackgroundTaskCtrl) : BgTaskService {
+
+ override fun getTaskStatus(condition: BgTaskConditionVo): List<BgTaskStatus?> {
+ return backgroundTaskCtrl.getTaskStatus(condition.type, condition.id)
+ }
+
+ override fun startTask(condition: BgTaskConditionVo): BgTaskStatus? {
+ condition.type ?: throw IllegalStateException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
+ condition.id ?: throw IllegalStateException("浠诲姟id涓嶈兘涓虹┖")
+
+ val task = backgroundTaskCtrl.startTask(condition.type!!, condition.id!!)
+ return task.taskStatus
+ }
+
+ override fun shutDownTask(condition: BgTaskConditionVo): List<BgTaskStatus?> {
+ condition.type ?: throw IllegalStateException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
+ return backgroundTaskCtrl.shutDownTask(condition.type!!, condition.id)
+ }
+
+ override fun removeTask(condition: BgTaskConditionVo): Boolean {
+ condition.type ?: throw IllegalStateException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
+ condition.id ?: throw IllegalStateException("浠诲姟id涓嶈兘涓虹┖")
+ return backgroundTaskCtrl.removeTask(condition.type!!, condition.id!!)
+ }
+
+ override fun startNewTestTask(taskId: String): BgTaskStatus? {
+ val task = backgroundTaskCtrl.startNewTask(BgTaskType.TEST, taskId, "娴嬭瘯浠诲姟-${taskId}") { testTask() }
+ return task.taskStatus
+ }
+
+ override fun newTestTask(taskId: String): BgTaskStatus? {
+ val task = backgroundTaskCtrl.newTask(BgTaskType.TEST, taskId, "娴嬭瘯浠诲姟-${taskId}") { testTask() }
+ return task.taskStatus
+ }
+
+ private fun testTask(): Boolean {
+ var times = 10
+ while (times > 0) {
+ Thread.sleep(2000)
+ times--
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt
index 62c497c..4b27486 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt
@@ -82,12 +82,12 @@
override fun getLocation(sceneType: Int): List<Domainitem> {
val lId = when (sceneType.toString()) {
- Constant.ScenseType.TYPE1.value -> Constant.INDUSTRY_LOCATION_ID
- Constant.ScenseType.TYPE2.value -> Constant.WHARF_LOCATION_ID
- Constant.ScenseType.TYPE14.value -> Constant.STORAGE_YARD_LOCATION_ID
- Constant.ScenseType.TYPE3.value -> Constant.MIX_LOCATION_ID
- Constant.ScenseType.TYPE5.value -> Constant.RESTAURANT_LOCATION_ID
- Constant.ScenseType.TYPE6.value -> Constant.Vehicle_LOCATION_ID
+ Constant.SceneType.TYPE1.value -> Constant.INDUSTRY_LOCATION_ID
+ Constant.SceneType.TYPE2.value -> Constant.WHARF_LOCATION_ID
+ Constant.SceneType.TYPE14.value -> Constant.STORAGE_YARD_LOCATION_ID
+ Constant.SceneType.TYPE3.value -> Constant.MIX_LOCATION_ID
+ Constant.SceneType.TYPE5.value -> Constant.RESTAURANT_LOCATION_ID
+ Constant.SceneType.TYPE6.value -> Constant.Vehicle_LOCATION_ID
else -> Constant.INDUSTRY_LOCATION_ID
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
index 43af688..f5fc097 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
@@ -1,7 +1,11 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.AutoScore2
-import cn.flightfeather.supervision.business.storage.StAutoScore
+import cn.flightfeather.supervision.business.autooutput.AopTaskCtrl
+import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
+import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
+import cn.flightfeather.supervision.common.executor.BgTaskStatus
+import cn.flightfeather.supervision.common.executor.BgTaskType
import cn.flightfeather.supervision.domain.ds1.entity.Domainitem
import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
@@ -11,10 +15,12 @@
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.Domain
+import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
import cn.flightfeather.supervision.lightshare.service.EvaluationService
import cn.flightfeather.supervision.lightshare.service.SubtaskService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
-import cn.flightfeather.supervision.lightshare.vo.SubtaskVo
+import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo
+import cn.flightfeather.supervision.lightshare.vo.BaseResponse
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
@@ -22,7 +28,11 @@
import kotlin.Comparator
@Service
-class EvaluationServiceImpl(val evaluationMapper: EvaluationMapper) : EvaluationService {
+class EvaluationServiceImpl(
+ private val evaluationMapper: EvaluationMapper,
+ private val evaluationRep: EvaluationRep,
+ private val aopTaskCtrl: AopTaskCtrl,
+) : EvaluationService {
@Autowired
lateinit var subtaskService: SubtaskService
@@ -31,7 +41,7 @@
@Autowired
lateinit var subtaskMapper: SubtaskMapper
@Autowired
- lateinit var autoScore: StAutoScore
+ lateinit var aopEvaluation: AopEvaluation
private var isAutoScoreRunning = false
//鑾峰彇鏌愰《灞備换鍔′笅鏌愪釜鍦烘櫙鐨勮閬撹瘎鍒嗘帓鍚�
@@ -187,21 +197,6 @@
return areaVolist
}
- override fun getTopTaskByScene(sceneId: String?): String? {
- val example = Example(Evaluation::class.java)
- val criteria = example.createCriteria()
- criteria.andEqualTo("sguid", sceneId)
- example.orderBy("evaluatetime").desc()
- val evaluationlist = evaluationMapper.selectByExample(example)
- var subtask = SubtaskVo()
- if (evaluationlist.isNotEmpty()) {
- val stguid = evaluationlist[0].stguid
- if (stguid != null)
- subtask = subtaskService.findByID(stguid)
- }
- return subtask.tguid
- }
-
override fun autoScore(districtCode: String, time: String): List<String> {
val resultList = mutableListOf<String>()
@@ -251,9 +246,10 @@
override fun autoScore3(tGuid: String, sceneTypeId: String): String {
if (isAutoScoreRunning) return "鑷姩璇勫垎鎵ц涓紝璇风瓑寰呭畬鎴�"
isAutoScoreRunning = true
- val t = Constant.ScenseType.getByValue(sceneTypeId)
- autoScore.sceneType = t
- autoScore.topTaskGrade(tGuid)
+// val t = Constant.ScenseType.getByValue(sceneTypeId)
+// autoScore.sceneType = t
+// autoScore.topTaskGrade(tGuid)
+ aopEvaluation.executeByTopTask(tGuid, sceneTypeId.toInt())
isAutoScoreRunning = false
return "鑷姩璇勫垎瀹屾垚"
}
@@ -263,4 +259,14 @@
createCriteria().andEqualTo("iguid", inspectionId)
})
}
+
+ override fun autoEvaluate(areaVo: AreaVo): BgTaskStatus? {
+ //鎵ц鑷姩璇勪及
+ return aopTaskCtrl.startNewTask(areaVo)
+ }
+
+ override fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>? {
+ //1. 鏌ユ壘鍘嗗彶璁板綍锛屾煡鐪嬭瘎浼版槸鍚﹀凡瀛樺湪
+ return evaluationRep.findAutoScore(areaVo)
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationruleServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationruleServiceImpl.kt
index 18aa474..8bee125 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationruleServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationruleServiceImpl.kt
@@ -2,12 +2,17 @@
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
+import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRuleRep
import cn.flightfeather.supervision.lightshare.service.EvaluationruleService
+import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
@Service
-class EvaluationruleServiceImpl(val evaluationruleMapper: EvaluationruleMapper) : EvaluationruleService {
+class EvaluationruleServiceImpl(
+ private val evaluationruleMapper: EvaluationruleMapper,
+ private val evaluationRuleRep: EvaluationRuleRep
+) : EvaluationruleService {
override fun findOne(id: String): Evaluationrule{
return evaluationruleMapper.selectByPrimaryKey(id)
@@ -30,4 +35,8 @@
val evaluationrules = evaluationruleMapper.selectByExample(example)
return if (evaluationrules.size>0) evaluationrules[0] else null
}
+
+ override fun find(areaVo: AreaEvaVo): List<Evaluationrule?> {
+ return evaluationRuleRep.findBaseRule(areaVo)
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt
index b73efb9..37be34c 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt
@@ -29,6 +29,8 @@
@Autowired
lateinit var subtaskService: SubtaskService
+ private val dateUtil = DateUtil()
+
//鑾峰彇姹℃煋鍦烘櫙鐗堟湰涓婚〉鐨勭洃绠℃儏鍐靛睍绀哄唴瀹�
override fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo {
val maps = inspectionMapper.getInspectionInfoByScene(sceneId, topTaskId)
@@ -43,9 +45,10 @@
inspectionInfoVo.inspectionId = map["inspectionId"].toString()
inspectionInfoVo.subtaskId = map["subtaskId"].toString()
inspectionInfoVo.inspected = map["isInspected"].toString().equals("1")
- inspectionInfoVo.inspectionTime = map["inspectionTime"].toString()
- val time = inspectionInfoVo.inspectionTime
- inspectionInfoVo.inspectionTime = time?.substring(0, time.length-11)
+ map["inspectionTime"]?.let {
+ val time = it.toString()
+ inspectionInfoVo.inspectionTime = dateUtil.StringToString(time, DateUtil.DateStyle.YYYY_MM_DD)
+ }
inspectionInfoVo.inspectionTimes = map["inspectionTimes"].toString().toInt()
inspectionInfoVo.promised = map["isPromised"].toString().equals("1")
inspectionInfoVo.changed = map["isChanged"].toString().equals("1")
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/LedgerServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/LedgerServiceImpl.kt
index f974ff8..c01a950 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/LedgerServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/LedgerServiceImpl.kt
@@ -62,7 +62,7 @@
val typeCount = ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply {
createCriteria().andEqualTo(
"lScenetype",
- Constant.ScenseType.typeMap(sceneLedgerSummary.scene?.typeid)
+ Constant.SceneType.typeMap(sceneLedgerSummary.scene?.typeid)
)
.andEqualTo("lNeedupdate", true)
})
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 09bde16..19e54ff 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
@@ -264,10 +264,10 @@
sceneDetail.scense = scene
val mapper = when (scene.typeid.toString()) {
- Constant.ScenseType.TYPE1.value -> sceneConstructionSiteMapper
- Constant.ScenseType.TYPE2.value -> sceneWharfMapper
- Constant.ScenseType.TYPE3.value -> sceneMixingPlantMapper
- Constant.ScenseType.TYPE14.value -> sceneStorageYardMapper
+ Constant.SceneType.TYPE1.value -> sceneConstructionSiteMapper
+ Constant.SceneType.TYPE2.value -> sceneWharfMapper
+ Constant.SceneType.TYPE3.value -> sceneMixingPlantMapper
+ Constant.SceneType.TYPE14.value -> sceneStorageYardMapper
else -> null
}
@@ -304,7 +304,7 @@
var r = 0
var isUpdate = true
when (typeId.toString()) {
- Constant.ScenseType.TYPE1.value -> {
+ Constant.SceneType.TYPE1.value -> {
val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneConstructionSite::class.java)
if (subScene.getsGuid() != null) {
val record = sceneConstructionSiteMapper.selectByPrimaryKey(subScene.getsGuid())
@@ -316,7 +316,7 @@
}
}
}
- Constant.ScenseType.TYPE2.value -> {
+ Constant.SceneType.TYPE2.value -> {
val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneWharf::class.java)
if (subScene.getsGuid() != null) {
val record = sceneWharfMapper.selectByPrimaryKey(subScene.getsGuid())
@@ -328,7 +328,7 @@
}
}
}
- Constant.ScenseType.TYPE3.value -> {
+ Constant.SceneType.TYPE3.value -> {
val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneMixingPlant::class.java)
if (subScene.getsGuid() != null) {
val record = sceneMixingPlantMapper.selectByPrimaryKey(subScene.getsGuid())
@@ -340,7 +340,7 @@
}
}
}
- Constant.ScenseType.TYPE14.value -> {
+ Constant.SceneType.TYPE14.value -> {
val subScene = Gson().fromJson(sceneDetailStr.subScene, SceneStorageYard::class.java)
if (subScene.getsGuid() != null) {
val record = sceneStorageYardMapper.selectByPrimaryKey(subScene.getsGuid())
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 1cdc743..3070b2e 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
@@ -22,9 +22,7 @@
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
-import java.io.OutputStream
import java.net.URLEncoder
-import java.nio.charset.Charset
import java.nio.charset.StandardCharsets
import java.util.*
import javax.servlet.http.HttpServletResponse
@@ -519,7 +517,7 @@
val task = taskService.getByDistrictCode(config.districtCode, config.startTime)?.takeIf { it.isNotEmpty() }?.get(0)
config.topTaskGuid = task?.tguid ?: ""
val dataSource = mutableListOf<DataSource>()
- config.sceneType = Constant.ScenseType.TYPE1.value.toInt()
+ config.sceneType = Constant.SceneType.TYPE1.value.toInt()
dataSource.add(DataSource(config, dbMapper))
// val config2 = config.copy(sceneType = Constant.ScenseType.TYPE2.value.toInt())
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 1cebbb9..556871c 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
@@ -1,8 +1,6 @@
package cn.flightfeather.supervision.lightshare.service.impl
-import cn.flightfeather.supervision.business.storage.JinAnScore
-import cn.flightfeather.supervision.business.storage.StAutoScore
-import cn.flightfeather.supervision.business.storage.item.*
+import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds1.mapper.*
import cn.flightfeather.supervision.common.utils.Constant
@@ -24,20 +22,11 @@
@Service
class SubtaskServiceImpl(
private val subtaskMapper: SubtaskMapper,
- private val mpScoreItem_1: MpScoreItem_1,
- private val mpScoreItem_2: MpScoreItem_2,
- private val stScoreItem_1: StScoreItem_1,
- private val whScoreItem_1: WhScoreItem_1,
- private val whScoreItem_2: WhScoreItem_2,
- private val jinAnScore: JinAnScore,
+ private val aopEvaluation: AopEvaluation,
) : SubtaskService {
val dateUtil = DateUtil()
- @Autowired
- lateinit var scoreItem1: CsScoreItem_1
- @Autowired
- lateinit var scoreItem2: CsScoreItem_2
@Autowired
lateinit var taskService: TaskService
@Autowired
@@ -71,7 +60,7 @@
if (StringUtil.isNotEmpty(areaVo.towncode))
criteria.andEqualTo("towncode", areaVo.towncode)
criteria.andBetween("planstarttime", areaVo.starttime, areaVo.endtime)
- if (!Objects.equals(userGuid, Constant.UserType.ALLUSER.text))
+ if (!Objects.equals(userGuid, Constant.UserType.ALL_USER.des))
criteria.andLike("executorguids","%"+userGuid+"%")
var completecount = 0
var subtasklist = subtaskMapper.selectByExample(example)
@@ -479,20 +468,7 @@
criteria.andEqualTo("stguid", subtask.stguid)
val result = evaluationMapper.selectByExample(example)
if (result.isEmpty()) {
-// if (subtask.districtname == "寰愭眹鍖�") {
-// val autoScore = AutoScore2()
-// autoScore.subtask = subtask
-// autoScore.calculateScore()
-// } else {
-// val autoScore = AutoScore()
-// autoScore.subtask = subtask
-// autoScore.calculateScore()
-// }
- val s = scenseMapper.selectByPrimaryKey(subtask.scenseid)
- val autoScore = StAutoScore(scoreItem1, scoreItem2, mpScoreItem_1, mpScoreItem_2, stScoreItem_1,
- whScoreItem_1, whScoreItem_2, jinAnScore)
- autoScore.sceneType = Constant.ScenseType.getByValue(s.typeid?.toString())
- autoScore.sceneGrade(subtask)
+ aopEvaluation.executeBySubTask(subtask)
}
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
index e80a61c..cb7885b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
@@ -8,6 +8,7 @@
import cn.flightfeather.supervision.domain.ds1.mapper.TaskMapper
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.DateUtil
+import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.lightshare.service.EvaluationService
import cn.flightfeather.supervision.lightshare.service.SubtaskService
import cn.flightfeather.supervision.lightshare.service.TaskService
@@ -21,7 +22,7 @@
import kotlin.collections.ArrayList
@Service
-class TaskServiceImpl(val taskMapper: TaskMapper) : TaskService {
+class TaskServiceImpl(val taskMapper: TaskMapper, private val taskRep: TaskRep,) : TaskService {
@Autowired
lateinit var subtaskService: SubtaskService
@@ -725,4 +726,7 @@
return taskProgressVolist
}
+ override fun findTask(areaVo: AreaVo): List<Task?> {
+ return taskRep.findTasks(areaVo)
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaEvaVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaEvaVo.kt
new file mode 100644
index 0000000..50bf37d
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaEvaVo.kt
@@ -0,0 +1,12 @@
+package cn.flightfeather.supervision.lightshare.vo
+
+import com.fasterxml.jackson.annotation.JsonInclude
+
+/**
+ * 璇勪及瑙勫垯鏌ヨ鏉′欢
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+class AreaEvaVo : AreaVo() {
+ // 璇勪及瑙勫垯绫诲瀷锛�1锛氬贰鏌ユ儏鍐佃瘎浼帮紱99锛氳嚜鍔ㄨ瘎浼�
+ var taskTypeId: Int = 1
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
index feb7ec6..7531298 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
@@ -3,7 +3,7 @@
import com.fasterxml.jackson.annotation.JsonInclude
@JsonInclude(JsonInclude.Include.NON_NULL)
-class AreaVo{
+open class AreaVo{
var provincecode: String? = null
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AutoScoreResultVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AutoScoreResultVo.kt
new file mode 100644
index 0000000..335e3e1
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AutoScoreResultVo.kt
@@ -0,0 +1,24 @@
+package cn.flightfeather.supervision.lightshare.vo
+
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
+import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
+import cn.flightfeather.supervision.domain.ds1.entity.Subtask
+import java.util.*
+
+/**
+ * 鑷姩璇勪及缁撴灉
+ */
+class AutoScoreResultVo {
+ var userId: String? = null
+ var userName: String? = null
+ var sceneId: String? = null
+ var sceneName: String? = null
+ var pName: String? = null
+ var cName: String? = null
+ var dName: String? = null
+ var tName: String? = null
+ var subTaskId:String? = null
+ var subTaskTime: Date? = null
+ var evaluation: Evaluation? = null
+ var itemEvaluations: List<Itemevaluation?>? = null
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseResponse.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseResponse.kt
index bc876f8..b0f1806 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseResponse.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseResponse.kt
@@ -18,15 +18,15 @@
var message: String = "",
val head: DataHead? = null,
@ApiModelProperty("璇锋眰杩斿洖鏁版嵁")
- val data: T? = null
-){
- init {
- if (message.isBlank()) {
- message = if (success) {
- "璇锋眰鎴愬姛"
- } else {
- "璇锋眰澶辫触"
- }
- }
+ val data: T? = null,
+) {
+ init {
+ if (message.isBlank()) {
+ message = if (success) {
+ "璇锋眰鎴愬姛"
+ } else {
+ "璇锋眰澶辫触"
+ }
}
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt
new file mode 100644
index 0000000..ac7f6e1
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt
@@ -0,0 +1,25 @@
+package cn.flightfeather.supervision.lightshare.web
+
+import cn.flightfeather.supervision.lightshare.vo.BaseResponse
+import cn.flightfeather.supervision.lightshare.vo.DataHead
+
+/**
+ * 鍖呰鎺ュ彛杩斿洖缁撴灉
+ */
+fun resPack(service: () -> Any?): BaseResponse<Any> {
+ return try {
+ val res = service()
+ if (res is Pair<*, *>) {
+ val head = res.first
+ if (head is DataHead) {
+ BaseResponse(true, head = head, data = res.second)
+ } else {
+ BaseResponse(true, data = res.second)
+ }
+ } else {
+ BaseResponse(true, data = res)
+ }
+ } catch (e: Exception) {
+ BaseResponse(false, message = e.message ?: "")
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt
new file mode 100644
index 0000000..5db3784
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt
@@ -0,0 +1,37 @@
+package cn.flightfeather.supervision.lightshare.web
+
+import cn.flightfeather.supervision.common.executor.BgTaskConditionVo
+import cn.flightfeather.supervision.lightshare.service.BgTaskService
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import org.springframework.web.bind.annotation.*
+
+@Api(tags = ["BgTaskController"], description = "鍚庡彴鑰楁椂浠诲姟API鎺ュ彛")
+@RestController
+@RequestMapping("/bgTask")
+class BgTaskController(val bgTaskService: BgTaskService){
+
+ @ApiOperation(value = "鑾峰彇鍚庡彴浠诲姟鐘舵��")
+ @PostMapping("/status")
+ fun getTaskStatus(@RequestBody condition: BgTaskConditionVo) = resPack { bgTaskService.getTaskStatus(condition) }
+
+ @ApiOperation(value = "杩愯涓�涓换鍔�")
+ @PutMapping("/start")
+ fun startTask(@RequestBody condition: BgTaskConditionVo) = resPack { bgTaskService.startTask(condition) }
+
+ @ApiOperation(value = "寮哄埗鍏抽棴浠诲姟")
+ @PutMapping("/shutDown")
+ fun shutDownTask(@RequestBody condition: BgTaskConditionVo) = resPack { bgTaskService.shutDownTask(condition) }
+
+ @ApiOperation(value = "绉婚櫎涓�涓换鍔�")
+ @PutMapping("/remove")
+ fun removeTask(@RequestBody condition: BgTaskConditionVo) = resPack { bgTaskService.removeTask(condition) }
+
+ @ApiOperation(value = "鏂板缓骞惰繍琛屼竴涓祴璇曚换鍔�")
+ @PutMapping("/newTask/test/start")
+ fun startNewTestTask(@RequestParam taskId: String) = resPack { bgTaskService.startNewTestTask(taskId) }
+
+ @ApiOperation(value = "鏂板缓涓�涓祴璇曚换鍔�")
+ @PutMapping("/newTask/test")
+ fun newTestTask(@RequestParam taskId: String) = resPack { bgTaskService.newTestTask(taskId) }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
index 1bc358c..c857357 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
@@ -2,7 +2,9 @@
import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
import cn.flightfeather.supervision.lightshare.service.EvaluationService
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.*
@Api(tags = ["EvaluationController"], description = "璇勪及鎬诲垎API鎺ュ彛")
@@ -25,27 +27,42 @@
fun delete(@PathVariable id: String) = evaluationService.delete(id)
@GetMapping("/rankofscense")
- fun getRankOfScense(@RequestParam(value = "tguid", required = true) tguid: String,
- @RequestParam(value = "scensetypeid", required = false) scensetypeid: String?,
- @RequestParam(value = "ruletypeid", required = false) ruletypeid: ByteArray?) = evaluationService.getRankOfSense(tguid, scensetypeid, ruletypeid)
+ fun getRankOfScense(
+ @RequestParam(value = "tguid", required = true) tguid: String,
+ @RequestParam(value = "scensetypeid", required = false) scensetypeid: String?,
+ @RequestParam(value = "ruletypeid", required = false) ruletypeid: ByteArray?,
+ ) = evaluationService.getRankOfSense(tguid, scensetypeid, ruletypeid)
@GetMapping("/rankoftown")
- fun getRankOfTown(@RequestParam(value = "tguid", required = true) tguid: String,
- @RequestParam(value = "scensetypeid", required = false) scensetypeid: String?) = evaluationService.getRankOfTown(tguid, scensetypeid)
+ fun getRankOfTown(
+ @RequestParam(value = "tguid", required = true) tguid: String,
+ @RequestParam(value = "scensetypeid", required = false) scensetypeid: String?,
+ ) = evaluationService.getRankOfTown(tguid, scensetypeid)
@GetMapping("/autoScore")
- fun autoScore(@RequestParam(value = "districtCode") districtCode: String,
- @RequestParam(value = "time") time: String) = evaluationService.autoScore(districtCode, time)
+ fun autoScore(
+ @RequestParam(value = "districtCode") districtCode: String,
+ @RequestParam(value = "time") time: String,
+ ) = evaluationService.autoScore(districtCode, time)
@GetMapping("/autoScore3")
fun autoScore3(
@RequestParam(value = "topTaskId") tGuid: String,
- @RequestParam(value = "sceneTypeId") sceneTypeId: String
+ @RequestParam(value = "sceneTypeId") sceneTypeId: String,
) = evaluationService.autoScore3(tGuid, sceneTypeId)
@PostMapping("/autoScore")
fun autoScore2(@RequestParam(value = "subTaskId") subTaskId: String) = evaluationService.autoScore2(subTaskId)
@GetMapping("/byInspection")
- fun findByInspectionId(@RequestParam("inspectionId") inspectionId: String) = evaluationService.findByInspectionId(inspectionId)
+ fun findByInspectionId(@RequestParam("inspectionId") inspectionId: String) =
+ evaluationService.findByInspectionId(inspectionId)
+
+ @ApiOperation(value = "鏍规嵁鍖哄煙鑼冨洿鑷姩璇勪及")
+ @PostMapping("/auto")
+ fun autoEvaluate(@RequestBody areaVo: AreaVo) = resPack { evaluationService.autoEvaluate(areaVo) }
+
+ @ApiOperation(value = "鏍规嵁鍖哄煙鑼冨洿鑾峰彇鑷姩璇勪及鍘嗗彶璁板綍")
+ @PostMapping("/auto/record")
+ fun findAutoEvaluation(@RequestBody areaVo: AreaVo) = resPack { evaluationService.findAutoEvaluation(areaVo) }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationruleController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationruleController.kt
index 6ce62ef..1f72cd9 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationruleController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationruleController.kt
@@ -2,6 +2,8 @@
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
import cn.flightfeather.supervision.lightshare.service.EvaluationruleService
+import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
import org.springframework.web.bind.annotation.*
@@ -23,4 +25,7 @@
@DeleteMapping("/{id}")
fun delete (@PathVariable id: String) = evaluationruleService.delete(id)
+
+ @PostMapping("/find")
+ fun find(@RequestBody areaVo: AreaEvaVo) = resPack { evaluationruleService.find(areaVo) }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt
index 5920dda..fcc2943 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt
@@ -2,6 +2,7 @@
import cn.flightfeather.supervision.domain.ds1.entity.Task
import cn.flightfeather.supervision.lightshare.service.TaskService
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
import org.springframework.web.bind.annotation.*
@@ -61,4 +62,7 @@
fun getRank(@RequestParam(value = "id", required = true) id: String,
@RequestParam(value = "curSceneTypeId", required = true) sceneTypeId: String,
@RequestParam(value = "sceneId", required = false) sceneId: String?) = taskService.getRank(id, sceneTypeId, sceneId)
+
+ @PostMapping("/find")
+ fun findTask(@RequestBody areaVo: AreaVo) = resPack { taskService.findTask(areaVo) }
}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index f03bef2..89c651c 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -1,3 +1,16 @@
+spring:
+ datasource:
+ ds1:
+ #-鏈湴娴嬭瘯鏈嶅姟鍣�-
+ url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ username: root
+ password: 123456
+ ds2:
+ # 鏈湴娴嬭瘯
+ url: jdbc:mysql://localhost:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ username: root
+ password: 123456
+
springfox:
documentation:
swagger:
diff --git a/src/main/resources/application-pro.yml b/src/main/resources/application-pro.yml
index 135277d..3aafb8b 100644
--- a/src/main/resources/application-pro.yml
+++ b/src/main/resources/application-pro.yml
@@ -1,7 +1,14 @@
-springfox:
- documentation:
- swagger:
- v2:
- enabled: false
+spring:
+ datasource:
+ ds1:
+ #-鍙戝竷鏈嶅姟鍣�-
+ url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ username: supervision
+ password: supervision_feiyu2021
+ ds2:
+ #-鍙戝竷鏈嶅姟鍣�-
+ url: jdbc:mysql://localhost:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ username: ledger
+ password: ledger_fxxchackxr
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
new file mode 100644
index 0000000..69cabda
--- /dev/null
+++ b/src/main/resources/application-test.yml
@@ -0,0 +1,28 @@
+spring:
+ datasource:
+ ds1:
+ #-灞�鍩熺綉鏈嶅姟鍣�-
+ # url: jdbc:mysql://192.168.0.200:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ # username: root
+ # password: cn.FLIGHTFEATHER
+
+ #-鐜鐫e療娴嬭瘯鏈嶅姟鍣�-
+ # url: jdbc:mysql://192.168.0.200:3306/supervision_ii?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ # username: root
+ # password: cn.FLIGHTFEATHER
+
+ #-杩滅▼娴嬭瘯鏈嶅姟鍣�-
+ url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ username: remoteU1
+ password: eSoF8DnzfGTlhAjE
+ ds2:
+ #-杩滅▼娴嬭瘯鏈嶅姟鍣�-
+ url: jdbc:mysql://47.100.191.150:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ username: remoteU1
+ password: eSoF8DnzfGTlhAjE
+
+springfox:
+ documentation:
+ swagger:
+ v2:
+ enabled: true
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index cf2f525..fe97bae 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -3,31 +3,6 @@
ds1:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
- #-鏈湴娴嬭瘯鏈嶅姟鍣�-
- # username: root
- # password: 123456
- # url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-
- #-灞�鍩熺綉鏈嶅姟鍣�-
- # url: jdbc:mysql://192.168.0.200:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
- # username: root
- # password: cn.FLIGHTFEATHER
-
- #-杩滅▼娴嬭瘯鏈嶅姟鍣�-
- url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
- username: remoteU1
- password: eSoF8DnzfGTlhAjE
-
- #-鍙戝竷鏈嶅姟鍣�-
-# url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-# username: supervision
-# password: supervision_feiyu2021
-
- #-鐜鐫e療娴嬭瘯鏈嶅姟鍣�-
-# url: jdbc:mysql://192.168.0.200:3306/supervision_ii?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-# username: root
-# password: cn.FLIGHTFEATHER
-
initialSize: 5
minIdle: 5
maxWait: 60000
@@ -45,17 +20,6 @@
ds2:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
-
- #-鍙戝竷鏈嶅姟鍣�-
-# url: jdbc:mysql://localhost:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-# username: ledger
-# password: ledger_fxxchackxr
-
- # 寮�鍙戣繙绋嬫湇鍔″櫒
- url: jdbc:mysql://47.100.191.150:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
- username: remoteU1
- password: eSoF8DnzfGTlhAjE
-
initialSize: 5
minIdle: 5
maxWait: 60000
@@ -100,7 +64,7 @@
request-timeout: 20s
profiles:
- active: '@profileActive@'
+ active: @profileActive@
jmx:
default-domain: ETSupervision
@@ -125,5 +89,5 @@
documentation:
swagger:
v2:
- enabled: true
+ enabled: false
diff --git a/src/main/resources/generator/generatorConfig4ds1.xml b/src/main/resources/generator/generatorConfig4ds1.xml
index ab95faf..4056ebf 100644
--- a/src/main/resources/generator/generatorConfig4ds1.xml
+++ b/src/main/resources/generator/generatorConfig4ds1.xml
@@ -41,31 +41,6 @@
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 瑕佺敓鎴愮殑琛� tableName鏄暟鎹簱涓殑琛ㄥ悕鎴栬鍥惧悕 domainObjectName鏄疄浣撶被鍚�-->
- <!--<table tableName="adm_dept" domainObjectName="Department" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="adm_group" domainObjectName="UserGroup" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="adm_groupuserright" domainObjectName="GroupUserRight" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="adm_user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="usertable" domainObjectName="UserTable" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="adm_groupuser" domainObjectName="GroupUser" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="adm_rights" domainObjectName="Rights" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="province" domainObjectName="Province" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="city" domainObjectName="City" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="town" domainObjectName="Town" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="projectinfo" domainObjectName="ProjectInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="siteinfo" domainObjectName="SiteInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="station_alertvalue_config" domainObjectName="StationAlertvalueConfig" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="company" domainObjectName="Company" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="vprinfo" domainObjectName="Vprinfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="devinfo" domainObjectName="Devinfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="frontendconfig_new" domainObjectName="FrontendConfig" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="munitevalue" domainObjectName="MuniteValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="hourvalue" domainObjectName="HourValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="dayvalue" domainObjectName="DayValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="t_stationgroup" domainObjectName="StationGroup" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="t_addressee" domainObjectName="Addressee" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="t_smstemplate" domainObjectName="SMSTemplate" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="t_smsrecord" domainObjectName="SMSRecord" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
- <!--<table tableName="t_user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!--<table tableName="sm_t_changeadvice" domainObjectName="ChangeAdvice" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!--<table tableName="sm_t_changeeffect" domainObjectName="ChangeEffect" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
<!--<table tableName="sm_t_monitorobjectversion" domainObjectName="Monitorobjectversion" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>-->
@@ -79,7 +54,9 @@
<!-- <table tableName="sm_t_score" domainObjectName="Score" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!-- <table tableName="sm_t_scense" domainObjectName="Scense" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!-- <table tableName="ea_t_mediafile" domainObjectName="LedgerMediaFile" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
- <table tableName="ea_t_dust_data_result" domainObjectName="DustDataResult" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
+<!-- <table tableName="ea_t_dust_data_result" domainObjectName="DustDataResult" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
+<!-- enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+ <table tableName="ea_t_evaluation" domainObjectName="Evaluation" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false"/>
</context>
</generatorConfiguration>
\ No newline at end of file
diff --git a/src/main/resources/generator/generatorConfig4ds3.xml b/src/main/resources/generator/generatorConfig4ds3.xml
index 62b3f23..0492f17 100644
--- a/src/main/resources/generator/generatorConfig4ds3.xml
+++ b/src/main/resources/generator/generatorConfig4ds3.xml
@@ -43,8 +43,20 @@
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 瑕佺敓鎴愮殑琛� tableName鏄暟鎹簱涓殑琛ㄥ悕鎴栬鍥惧悕 domainObjectName鏄疄浣撶被鍚�-->
- <table tableName="fm_web_analysis_data" domainObjectName="FumeDailyAnalysis" enableCountByExample="false"
- enableUpdateByExample="false" enableDeleteByExample="false"
- enableSelectByExample="false" selectByExampleQueryId="false"/>
+<!-- <table tableName="fm_web_analysis_data" domainObjectName="FumeDailyAnalysis" enableCountByExample="false"-->
+<!-- enableUpdateByExample="false" enableDeleteByExample="false"-->
+<!-- enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+<!-- <table tableName="fu_xh_t_site_map" domainObjectName="FumeSiteMap" enableCountByExample="false"-->
+<!-- enableUpdateByExample="false" enableDeleteByExample="false"-->
+<!-- enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+ <table tableName="abnormal_data" domainObjectName="FumeExceptionData" enableCountByExample="false"
+ enableUpdateByExample="false" enableDeleteByExample="false"
+ enableSelectByExample="false" selectByExampleQueryId="false"/>
+<!-- <table tableName="ja_t_dust_site_data_info" domainObjectName="JSDustData" enableCountByExample="false"-->
+<!-- enableUpdateByExample="false" enableDeleteByExample="false"-->
+<!-- enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+<!-- <table tableName="du_js_t_site_map" domainObjectName="JSDustSiteMap" enableCountByExample="false"-->
+<!-- enableUpdateByExample="false" enableDeleteByExample="false"-->
+<!-- enableSelectByExample="false" selectByExampleQueryId="false"/>-->
</context>
</generatorConfiguration>
\ No newline at end of file
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index 2230703..b996538 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -63,10 +63,10 @@
<appender-ref ref="Console"/>
</logger>
<logger name="org.mybatis" level="DEBUG">
- <appender-ref ref="Console"/>
+<!-- <appender-ref ref="Console"/>-->
</logger>
<logger name="org.apache.ibatis" level="DEBUG">
- <appender-ref ref="Console"/>
+<!-- <appender-ref ref="Console"/>-->
</logger>
<logger name="cn.flightfeather.supervision" level="INFO" includeLocation="true" additivity="false">
diff --git a/src/main/resources/mapper/ds1/EvaluationMapper.xml b/src/main/resources/mapper/ds1/EvaluationMapper.xml
new file mode 100644
index 0000000..cc53dd8
--- /dev/null
+++ b/src/main/resources/mapper/ds1/EvaluationMapper.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.EvaluationMapper">
+ <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Evaluation">
+ <!--
+ WARNING - @mbg.generated
+ -->
+ <id column="E_GUID" jdbcType="VARCHAR" property="guid" />
+ <result column="I_GUID" jdbcType="VARCHAR" property="iguid" />
+ <result column="ST_GUID" jdbcType="VARCHAR" property="stguid" />
+ <result column="S_GUID" jdbcType="VARCHAR" property="sguid" />
+ <result column="E_ScenseTypeID" jdbcType="TINYINT" property="scensetypeid" />
+ <result column="E_ScenseType" jdbcType="VARCHAR" property="scensetype" />
+ <result column="E_SubScenseTypeID" jdbcType="TINYINT" property="subscensetypeid" />
+ <result column="E_SubScenseType" jdbcType="VARCHAR" property="subscensetype" />
+ <result column="E_ERType" jdbcType="TINYINT" property="ertype" />
+ <result column="E_ProvinceCode" jdbcType="VARCHAR" property="provincecode" />
+ <result column="E_ProvinceName" jdbcType="VARCHAR" property="provincename" />
+ <result column="E_CityCode" jdbcType="VARCHAR" property="citycode" />
+ <result column="E_CityName" jdbcType="VARCHAR" property="cityname" />
+ <result column="E_DistrictCode" jdbcType="VARCHAR" property="districtcode" />
+ <result column="E_DistrictName" jdbcType="VARCHAR" property="districtname" />
+ <result column="E_TownCode" jdbcType="VARCHAR" property="towncode" />
+ <result column="E_TownName" jdbcType="VARCHAR" property="townname" />
+ <result column="E_ScenseName" jdbcType="VARCHAR" property="scensename" />
+ <result column="E_ScenseAddress" jdbcType="VARCHAR" property="scenseaddress" />
+ <result column="E_EvaluateTime" jdbcType="TIMESTAMP" property="evaluatetime" />
+ <result column="E_EvaluatorGUID" jdbcType="VARCHAR" property="evaluatorguid" />
+ <result column="E_EvaluatoruserName" jdbcType="VARCHAR" property="evaluatorusername" />
+ <result column="E_EvaluatorRealName" jdbcType="VARCHAR" property="evaluatorrealname" />
+ <result column="E_ResultStandardBef" jdbcType="VARCHAR" property="resultstandardbef" />
+ <result column="E_ResultScoreBef" jdbcType="VARCHAR" property="resultscorebef" />
+ <result column="E_PromissedNum" jdbcType="INTEGER" property="promissednum" />
+ <result column="E_ChangedNum" jdbcType="INTEGER" property="changednum" />
+ <result column="ResultStandardAft" jdbcType="VARCHAR" property="resultstandardaft" />
+ <result column="E_ResultScoreAft" jdbcType="VARCHAR" property="resultscoreaft" />
+ <result column="E_CreateDate" jdbcType="TIMESTAMP" property="createdate" />
+ <result column="E_UpdateDate" jdbcType="TIMESTAMP" property="updatedate" />
+ <result column="E_Extension1" jdbcType="VARCHAR" property="extension1" />
+ <result column="E_Extension2" jdbcType="VARCHAR" property="extension2" />
+ <result column="E_Extension3" jdbcType="VARCHAR" property="extension3" />
+ <result column="E_Remark" jdbcType="VARCHAR" property="remark" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--
+ WARNING - @mbg.generated
+ -->
+ E_GUID, I_GUID, ST_GUID, S_GUID, E_ScenseTypeID, E_ScenseType, E_SubScenseTypeID,
+ E_SubScenseType, E_ERType, E_ProvinceCode, E_ProvinceName, E_CityCode, E_CityName,
+ E_DistrictCode, E_DistrictName, E_TownCode, E_TownName, E_ScenseName, E_ScenseAddress,
+ E_EvaluateTime, E_EvaluatorGUID, E_EvaluatoruserName, E_EvaluatorRealName, E_ResultStandardBef,
+ E_ResultScoreBef, E_PromissedNum, E_ChangedNum, ResultStandardAft, E_ResultScoreAft,
+ E_CreateDate, E_UpdateDate, E_Extension1, E_Extension2, E_Extension3, E_Remark
+ </sql>
+
+ <resultMap id="AutoScoreResultMap" type="cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo">
+ <result column="userId" jdbcType="VARCHAR" property="userId"/>
+ <result column="userName" jdbcType="VARCHAR" property="userName"/>
+ <result column="sceneId" jdbcType="VARCHAR" property="sceneId"/>
+ <result column="sceneName" jdbcType="VARCHAR" property="sceneName"/>
+ <result column="pName" jdbcType="VARCHAR" property="pName"/>
+ <result column="cName" jdbcType="VARCHAR" property="cName"/>
+ <result column="dName" jdbcType="VARCHAR" property="dName"/>
+ <result column="tName" jdbcType="VARCHAR" property="tName"/>
+ <result column="subTaskId" jdbcType="VARCHAR" property="subTaskId"/>
+ <result column="planstarttime" property="subTaskTime" jdbcType="TIMESTAMP" />
+ <association property="evaluation" resultMap="BaseResultMap" />
+ </resultMap>
+
+ <select id="findEvaluation" resultMap="AutoScoreResultMap">
+ SELECT
+ c.UI_GUID AS userId,
+ c.UI_RealName AS userName,
+ b.S_GUID AS sceneId,
+ b.S_Name AS sceneName,
+ b.S_ProvinceName AS pName,
+ b.S_CityName AS cName,
+ b.S_DistrictName AS dName,
+ b.S_TownName AS tName,
+ d.ST_GUID AS subTaskId,
+ d.ST_PlanStartTime AS planstarttime,
+ e.*
+ FROM
+ (SELECT * FROM sm_t_monitorobjectversion WHERE T_ID = #{topTaskId} )AS a
+ LEFT JOIN sm_t_scense AS b ON a.S_GUID = b.S_GUID
+ LEFT JOIN sm_t_userinfo AS c ON b.S_GUID = c.D_GUID
+ LEFT JOIN (SELECT * FROM tm_t_subtask WHERE T_GUID = #{topTaskId}) AS d ON a.S_GUID = d.ST_ScenseID
+ LEFT JOIN ea_t_evaluation AS e ON d.ST_GUID = e.ST_GUID
+ WHERE
+ b.S_TypeID = #{sceneTypeId}
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/ds2/OverallEvaluationMapper.xml b/src/main/resources/mapper/ds2/OverallEvaluationMapper.xml
new file mode 100644
index 0000000..9a85d85
--- /dev/null
+++ b/src/main/resources/mapper/ds2/OverallEvaluationMapper.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.flightfeather.supervision.domain.ds2.mapper.OverallEvaluationMapper">
+ <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds2.entity.OverallEvaluation">
+ <!--
+ WARNING - @mbg.generated
+ -->
+ <id column="OE_GUID" jdbcType="INTEGER" property="oeGuid" />
+ <result column="BI_GUID" jdbcType="VARCHAR" property="biGuid" />
+ <result column="OE_Score" jdbcType="INTEGER" property="oeScore" />
+ <result column="OE_Publish_Time" jdbcType="TIMESTAMP" property="oePublishTime" />
+ <result column="OE_Update_Time" jdbcType="TIMESTAMP" property="oeUpdateTime" />
+ <result column="OE_Scene_Type_Id" jdbcType="TINYINT" property="oeSceneTypeId" />
+ <result column="OE_Scene_Type" jdbcType="VARCHAR" property="oeSceneType" />
+ <result column="OE_Period" jdbcType="VARCHAR" property="oePeriod" />
+ <result column="OE_Code_Level" jdbcType="TINYINT" property="oeCodeLevel" />
+ <result column="OE_Start_Time" jdbcType="DATE" property="oeStartTime" />
+ <result column="OE_End_Time" jdbcType="DATE" property="oeEndTime" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--
+ WARNING - @mbg.generated
+ -->
+ OE_GUID, BI_GUID, OE_Score, OE_Publish_Time, OE_Update_Time, OE_Scene_Type_Id, OE_Scene_Type,
+ OE_Period, OE_Code_Level, OE_Start_Time, OE_End_Time
+ </sql>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/ds3/FumeSiteMapMapper.xml b/src/main/resources/mapper/ds3/FumeSiteMapMapper.xml
new file mode 100644
index 0000000..a963381
--- /dev/null
+++ b/src/main/resources/mapper/ds3/FumeSiteMapMapper.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="cn.flightfeather.supervision.domain.ds3.mapper.FumeSiteMapMapper" >
+ <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds3.entity.FumeSiteMap" >
+ <!--
+ WARNING - @mbg.generated
+ -->
+ <id column="Id" property="id" jdbcType="INTEGER" />
+ <result column="TZ_User_Id" property="tzUserId" jdbcType="VARCHAR" />
+ <result column="TZ_User_Name" property="tzUserName" jdbcType="VARCHAR" />
+ <result column="XH_Device_Code" property="xhDeviceCode" jdbcType="VARCHAR" />
+ <result column="XH_Device_Name" property="xhDeviceName" jdbcType="VARCHAR" />
+ <result column="SV_User_Id" property="svUserId" jdbcType="VARCHAR" />
+ <result column="SV_User_Name" property="svUserName" jdbcType="VARCHAR" />
+ <result column="Create_Time" property="createTime" jdbcType="TIMESTAMP" />
+ </resultMap>
+ <sql id="Base_Column_List" >
+ <!--
+ WARNING - @mbg.generated
+ -->
+ Id, TZ_User_Id, TZ_User_Name, XH_Device_Code, XH_Device_Name, SV_User_Id, SV_User_Name,
+ Create_Time
+ </sql>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/ds3/JSDustDataMapper.xml b/src/main/resources/mapper/ds3/JSDustDataMapper.xml
new file mode 100644
index 0000000..644282b
--- /dev/null
+++ b/src/main/resources/mapper/ds3/JSDustDataMapper.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="cn.flightfeather.supervision.domain.ds3.mapper.JSDustDataMapper" >
+ <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds3.entity.JSDustData" >
+ <!--
+ WARNING - @mbg.generated
+ -->
+ <id column="id" property="id" jdbcType="INTEGER" />
+ <result column="mn_code" property="mnCode" jdbcType="VARCHAR" />
+ <result column="dust_value" property="dustValue" jdbcType="DOUBLE" />
+ <result column="noise_value" property="noiseValue" jdbcType="DOUBLE" />
+ <result column="lst" property="lst" jdbcType="TIMESTAMP" />
+ <result column="quality" property="quality" jdbcType="VARCHAR" />
+ <result column="grade" property="grade" jdbcType="INTEGER" />
+ <result column="flag" property="flag" jdbcType="VARCHAR" />
+ </resultMap>
+ <sql id="Base_Column_List" >
+ <!--
+ WARNING - @mbg.generated
+ -->
+ id, mn_code, dust_value, noise_value, lst, quality, grade, flag
+ </sql>
+
+ <select id="getDataBySceneType" resultMap="BaseResultMap">
+ SELECT a.* FROM
+ (SELECT
+ *
+ FROM
+ ja_t_dust_site_data_info
+ <where>
+ flag = 'N'
+ <if test="st != null">
+ AND lst >= #{st}
+ </if>
+ <if test="et != null">
+ AND lst <= #{et}
+ </if>
+ </where>
+ LIMIT #{startIndex}, #{perPage}
+ ) AS a
+ LEFT JOIN ja_t_dust_site_info AS b ON a.mn_code = b.mn_code
+ WHERE b.type_id = #{sceneType}
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/ds3/JSDustSiteMapMapper.xml b/src/main/resources/mapper/ds3/JSDustSiteMapMapper.xml
new file mode 100644
index 0000000..47a014a
--- /dev/null
+++ b/src/main/resources/mapper/ds3/JSDustSiteMapMapper.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper" >
+ <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap" >
+ <!--
+ WARNING - @mbg.generated
+ -->
+ <id column="Id" property="id" jdbcType="INTEGER" />
+ <result column="TZ_User_Id" property="tzUserId" jdbcType="VARCHAR" />
+ <result column="TZ_User_Name" property="tzUserName" jdbcType="VARCHAR" />
+ <result column="JS_Device_Code" property="jsDeviceCode" jdbcType="VARCHAR" />
+ <result column="JS_Device_Name" property="jsDeviceName" jdbcType="VARCHAR" />
+ <result column="SV_User_Id" property="svUserId" jdbcType="VARCHAR" />
+ <result column="SV_User_Name" property="svUserName" jdbcType="VARCHAR" />
+ <result column="Create_Time" property="createTime" jdbcType="TIMESTAMP" />
+ </resultMap>
+ <sql id="Base_Column_List" >
+ <!--
+ WARNING - @mbg.generated
+ -->
+ Id, TZ_User_Id, TZ_User_Name, JS_Device_Code, JS_Device_Name, SV_User_Id, SV_User_Name,
+ Create_Time
+ </sql>
+</mapper>
\ No newline at end of file
diff --git a/src/test/kotlin/cn/flightfeather/supervision/business/QRCodeTest.kt b/src/test/kotlin/cn/flightfeather/supervision/business/QRCodeTest.kt
index 6a1c3f1..3ce47bd 100644
--- a/src/test/kotlin/cn/flightfeather/supervision/business/QRCodeTest.kt
+++ b/src/test/kotlin/cn/flightfeather/supervision/business/QRCodeTest.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.business
+import cn.flightfeather.supervision.common.executor.TaskStatus
import cn.flightfeather.supervision.common.utils.QRCodeUtil
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import org.junit.Test
@@ -243,4 +244,11 @@
metadata.mergeTree("javax_imageio_1.0", root)
}
+
+ @Test
+ fun foo1() {
+ val s = TaskStatus.WAITING
+ println(s.name)
+ println(s.ordinal)
+ }
}
\ No newline at end of file
diff --git a/src/test/kotlin/cn/flightfeather/supervision/business/autooutput/AopEvaluationTest.kt b/src/test/kotlin/cn/flightfeather/supervision/business/autooutput/AopEvaluationTest.kt
index c5b741d..07b51cc 100644
--- a/src/test/kotlin/cn/flightfeather/supervision/business/autooutput/AopEvaluationTest.kt
+++ b/src/test/kotlin/cn/flightfeather/supervision/business/autooutput/AopEvaluationTest.kt
@@ -1,7 +1,14 @@
package cn.flightfeather.supervision.business.autooutput
import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
-import cn.flightfeather.supervision.business.autooutput.score.construction.JADataAnalysis
+import cn.flightfeather.supervision.business.autooutput.dataanalysis.JACsDataAnalysis
+import cn.flightfeather.supervision.business.autooutput.dataanalysis.JSCsDataAnalysis
+import cn.flightfeather.supervision.business.autooutput.dataanalysis.JSMpDataAnalysis
+import cn.flightfeather.supervision.business.autooutput.dataanalysis.XHFuDataAnalysis
+import cn.flightfeather.supervision.business.autooutput.dataanalysis.JSWhDataAnalysis
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
+import cn.flightfeather.supervision.business.autooutput.score.AopCreditCode
+import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.lightshare.service.SearchService
import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
import org.junit.Test
@@ -21,38 +28,113 @@
lateinit var aopEvaluation: AopEvaluation
@Autowired
+ lateinit var aopCreditCode: AopCreditCode
+
+ @Autowired
lateinit var searchService: SearchService
@Autowired
- lateinit var jaDataAnalysis: JADataAnalysis
+ lateinit var jaCsDataAnalysis: JACsDataAnalysis
+
+ @Autowired
+ lateinit var xhFuDataAnalysis: XHFuDataAnalysis
+
+ @Autowired
+ lateinit var jsCsDataAnalysis: JSCsDataAnalysis
+
+ @Autowired
+ lateinit var jsMpDataAnalysis: JSMpDataAnalysis
+
+ @Autowired
+ lateinit var jsWhDataAnalysis: JSWhDataAnalysis
/**
- * 缁熻鐩戞祴鏁版嵁缁撴灉
+ * 闈欏畨宸ュ湴鑷瘎
*/
@Test
fun test1() {
- jaDataAnalysis.setResource("VHXHS1dHsykTNUf2", 1, 2023, 8)
- jaDataAnalysis.execute()
+ val taskId = "tTbZIUg7nQJ1MRgE"
+ val districtCode = "310106"
+ val year = 2023
+ val month = 12
+ val sceneType = Constant.SceneType.TYPE1.value.toInt()
+ jaCsDataAnalysis.setResource(taskId, sceneType, year, month)
+ jaCsDataAnalysis.execute(0.124)
+
+ aopEvaluation.executeByTopTask(taskId, sceneType)
+
+ val mode = 9
+ searchService.writeToFile(ExcelConfigVo(
+ taskId,
+ districtCode = districtCode,
+ sceneType = sceneType), mode)
}
/**
- * 鑷姩璇勪及
+ * 寰愭眹椁愰ギ鑷瘎
*/
@Test
fun test() {
- aopEvaluation.setResource("VHXHS1dHsykTNUf2", 1)
- aopEvaluation.execute()
+ val taskId = "88wgq9l5gm9cUMg1"
+ val districtCode = "310104"
+ val districtName = "寰愭眹鍖�"
+ val year = 2023
+ val month = 11
+ val sceneType = Constant.SceneType.TYPE5.value.toInt()
+ xhFuDataAnalysis.setResource(taskId, sceneType, year, month)
+ xhFuDataAnalysis.execute()
+
+ aopEvaluation.executeByTopTask(taskId, sceneType)
+
+ val mode = 9
+ searchService.writeToFile(ExcelConfigVo(
+ taskId,
+ districtCode = districtCode,
+ sceneType = sceneType), mode)
+ aopCreditCode.execute(AopDataConfig(
+ year = year,
+ month = month,
+ districtName = districtName,
+ sceneType = sceneType,
+ period = 1
+ ))
}
/**
- * 瀵煎嚭鑷姩璇勪及缁撴灉
+ * 閲戝北宸ュ湴銆佺爜澶淬�佹悈鎷岀珯鑷瘎
*/
@Test
fun test2() {
+ val taskId = "rXtm0AozZYJqoEpW"
+ val districtCode = "310116"
+ val year = 2023
+ val month = 11
+// val sceneType = Constant.SceneType.TYPE1.value.toInt()
+// val sceneType = Constant.SceneType.TYPE2.value.toInt()
+ val sceneType = Constant.SceneType.TYPE3.value.toInt()
+// val sceneType = Constant.SceneType.TYPE14.value.toInt()
+
+ when (sceneType) {
+ Constant.SceneType.TYPE1.value.toInt()->{
+ jsCsDataAnalysis.setResource(taskId, sceneType, year, month)
+ jsCsDataAnalysis.execute()
+ }
+ Constant.SceneType.TYPE2.value.toInt()->{
+ jsWhDataAnalysis.setResource(taskId, sceneType, year, month)
+ jsWhDataAnalysis.execute()
+ }
+ Constant.SceneType.TYPE3.value.toInt()->{
+ jsMpDataAnalysis.setResource(taskId, sceneType, year, month)
+ jsMpDataAnalysis.execute()
+ }
+ }
+
+ aopEvaluation.executeByTopTask(taskId, sceneType)
+
val mode = 9
searchService.writeToFile(ExcelConfigVo(
- "VHXHS1dHsykTNUf2",
- districtCode = "310106",
- sceneType = 1), mode)
+ taskId,
+ districtCode = districtCode,
+ sceneType = sceneType), mode)
}
}
\ No newline at end of file
diff --git a/src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt b/src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt
deleted file mode 100644
index bfe6945..0000000
--- a/src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt
+++ /dev/null
@@ -1,59 +0,0 @@
-package cn.flightfeather.supervision.business.fume
-
-import cn.flightfeather.supervision.business.storage.StAutoScore
-import cn.flightfeather.supervision.common.utils.Constant
-import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper
-import cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper
-import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper
-import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
-import org.junit.Test
-import org.junit.jupiter.api.extension.ExtendWith
-import org.junit.runner.RunWith
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.test.context.junit.jupiter.SpringExtension
-import org.springframework.test.context.junit4.SpringRunner
-
-@RunWith(SpringRunner::class)
-@ExtendWith(SpringExtension::class)
-@SpringBootTest
-class AutoScoreTest {
- @Autowired
- lateinit var autoScore: StAutoScore
-
- @Autowired
- lateinit var autoScore3: AutoScore3
-
- @Autowired
- lateinit var userInfoMapper: UserinfoMapper
-
- @Autowired
- lateinit var ledgerSubTypeMapper: LedgerSubTypeMapper
-
- @Autowired
- lateinit var problemlistMapper: ProblemlistMapper
-
- @Autowired
- lateinit var subtaskMapper: SubtaskMapper
-
- @Test
- fun go() {
-// val s = "abcdefg"
-// val t = s.substring(0, s.length - 2)
-// println(t)
-
- autoScore.sceneType = Constant.ScenseType.TYPE1
- autoScore.topTaskGrade("BdSm7KhSYWar3BSp")
-// val subtask = subtaskMapper.selectByPrimaryKey("YoKxHlojS1wIlFoQ")
-// autoScore.sceneGrade(subtask)
-// autoScore.sceneGradeToFile(subtask)
-
-// autoScore3.go(2022, 9, 1)
-
-// val t = problemlistMapper.getStatisticalResult("310116", "2021-09-01 00:00:00", "2021-09-30 00:00:00", "1")
-// println()
-
-// val a = "01"
-// println(a.toInt())
- }
-}
\ No newline at end of file
diff --git a/src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt b/src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt
index 046ce9f..a45e020 100644
--- a/src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt
+++ b/src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt
@@ -24,27 +24,29 @@
// val b = LocationRoadNearby.BasePlace("", Pair(121.378346, 30.84923), Pair(121.378296, 30.861472))
// locationRoadNearby.search(b, 1000.0)
val bList = listOf(
- LocationRoadNearby.BasePlace("骞查挶璺�-閲戠煶鍖楄矾-閲戝紶鍏矾", Pair(121.218411,30.826654), Pair(121.227142,30.828403)),
- LocationRoadNearby.BasePlace("閲戝粖鍏矾-寤轰箰璺�-鏈卞悤鍏矾", Pair(121.18409,30.835699), Pair(121.183811,30.831636)),
- LocationRoadNearby.BasePlace("閲戝紶鍏矾-鐢版柊璺�-骞查挶璺�", Pair(121.219555,30.829319), Pair(121.227142,30.828403)),
- LocationRoadNearby.BasePlace("澶ц尗涓績璺�-鏈卞钩鍏矾-鏈卞璺�", Pair(121.147448,30.858481), Pair(121.149312,30.857804)),
- LocationRoadNearby.BasePlace("澶ц尗涓績璺�-寤哄瘜璺�-鏈卞钩鍏矾", Pair(121.141819,30.858344), Pair(121.147448,30.858481)),
- LocationRoadNearby.BasePlace("鏈卞悤鍏矾-閲戝紶鍏矾-搴峰叴璺�", Pair(121.177261,30.83326), Pair(121.18053,30.830751)),
- LocationRoadNearby.BasePlace("鏈卞悤鍏矾-閲戝粖鍏矾-搴峰叴璺�", Pair(121.183811,30.831636), Pair(121.18053,30.830751)),
- LocationRoadNearby.BasePlace("鍚曟柊璺�-寤轰箰璺�-鏈卞悤鍏矾", Pair(121.191766,30.835612), Pair(121.196591,30.831604)),
- LocationRoadNearby.BasePlace("婧寳璺�-鏈卞悤鍏矾-鏂颁笢琛�", Pair(121.171163,30.832014), Pair(121.174958,30.827349)),
- LocationRoadNearby.BasePlace("涓滄柟绾腑蹇冭矾-鍐滃缓璺�-鏈卞钩鍏矾", Pair(121.141617,30.870365), Pair(121.145145,30.870635)),
- LocationRoadNearby.BasePlace("涓滄柟绾腑蹇冭矾-鏈卞钩鍏矾-鏈卞璺�", Pair(121.145145,30.870635), Pair(121.155051,30.870966)),
- LocationRoadNearby.BasePlace("鏈卞悤鍏矾-閲戝粖鍏矾-鐢版璺�", Pair(121.183811,30.831636), Pair(121.18989,30.831606)),
- LocationRoadNearby.BasePlace("鏈卞钩鍏矾-涓滃瘜璺�-澶ц尗涓績璺�", Pair(121.146281,30.864199), Pair(121.147448,30.858481)),
- LocationRoadNearby.BasePlace("鏈卞钩鍏矾-涓滄柟绾腑蹇冭矾-涓滃瘜璺�", Pair(121.145404,30.869592), Pair(121.146281,30.864199)),
- LocationRoadNearby.BasePlace("閲戝紶鍏矾-閲戠煶鍖楄矾-鐢版柊璺�", Pair(121.215668,30.830838), Pair(121.219555,30.829319)),
- LocationRoadNearby.BasePlace("鏈卞钩鍏矾-鍚曢潚璺�-钄疯崥璺�", Pair(121.148479,30.836083), Pair(121.14842,30.842135)),
- LocationRoadNearby.BasePlace("鏈辨尘鍐滃缓璺�-寤哄瘜璺�-鏈卞钩鍏矾", Pair(121.142609,30.863955), Pair(121.146407,30.864167)),
- LocationRoadNearby.BasePlace("鏈辨尘鍐滃缓璺�-鏈卞钩鍏矾-鏈卞璺�", Pair(121.146407,30.864167), Pair(121.153675,30.864075)),
- LocationRoadNearby.BasePlace("鍚曢潚璺�-鏈卞悤鍏矾-鏈卞钩鍏矾", Pair(121.136318,30.833325), Pair(121.148624,30.836094)),
- LocationRoadNearby.BasePlace("娉栨咕鏀矾-鍚曢潚璺�-鏈卞钩鍏矾", Pair(121.155048,30.835229), Pair(121.148659,30.829861)),
+// LocationRoadNearby.BasePlace("骞查挶璺�-閲戠煶鍖楄矾-閲戝紶鍏矾", Pair(121.218411,30.826654), Pair(121.227142,30.828403)),
+// LocationRoadNearby.BasePlace("閲戝粖鍏矾-寤轰箰璺�-鏈卞悤鍏矾", Pair(121.18409,30.835699), Pair(121.183811,30.831636)),
+// LocationRoadNearby.BasePlace("閲戝紶鍏矾-鐢版柊璺�-骞查挶璺�", Pair(121.219555,30.829319), Pair(121.227142,30.828403)),
+// LocationRoadNearby.BasePlace("澶ц尗涓績璺�-鏈卞钩鍏矾-鏈卞璺�", Pair(121.147448,30.858481), Pair(121.149312,30.857804)),
+// LocationRoadNearby.BasePlace("澶ц尗涓績璺�-寤哄瘜璺�-鏈卞钩鍏矾", Pair(121.141819,30.858344), Pair(121.147448,30.858481)),
+// LocationRoadNearby.BasePlace("鏈卞悤鍏矾-閲戝紶鍏矾-搴峰叴璺�", Pair(121.177261,30.83326), Pair(121.18053,30.830751)),
+// LocationRoadNearby.BasePlace("鏈卞悤鍏矾-閲戝粖鍏矾-搴峰叴璺�", Pair(121.183811,30.831636), Pair(121.18053,30.830751)),
+// LocationRoadNearby.BasePlace("鍚曟柊璺�-寤轰箰璺�-鏈卞悤鍏矾", Pair(121.191766,30.835612), Pair(121.196591,30.831604)),
+// LocationRoadNearby.BasePlace("婧寳璺�-鏈卞悤鍏矾-鏂颁笢琛�", Pair(121.171163,30.832014), Pair(121.174958,30.827349)),
+// LocationRoadNearby.BasePlace("涓滄柟绾腑蹇冭矾-鍐滃缓璺�-鏈卞钩鍏矾", Pair(121.141617,30.870365), Pair(121.145145,30.870635)),
+// LocationRoadNearby.BasePlace("涓滄柟绾腑蹇冭矾-鏈卞钩鍏矾-鏈卞璺�", Pair(121.145145,30.870635), Pair(121.155051,30.870966)),
+// LocationRoadNearby.BasePlace("鏈卞悤鍏矾-閲戝粖鍏矾-鐢版璺�", Pair(121.183811,30.831636), Pair(121.18989,30.831606)),
+// LocationRoadNearby.BasePlace("鏈卞钩鍏矾-涓滃瘜璺�-澶ц尗涓績璺�", Pair(121.146281,30.864199), Pair(121.147448,30.858481)),
+// LocationRoadNearby.BasePlace("鏈卞钩鍏矾-涓滄柟绾腑蹇冭矾-涓滃瘜璺�", Pair(121.145404,30.869592), Pair(121.146281,30.864199)),
+// LocationRoadNearby.BasePlace("閲戝紶鍏矾-閲戠煶鍖楄矾-鐢版柊璺�", Pair(121.215668,30.830838), Pair(121.219555,30.829319)),
+// LocationRoadNearby.BasePlace("鏈卞钩鍏矾-鍚曢潚璺�-钄疯崥璺�", Pair(121.148479,30.836083), Pair(121.14842,30.842135)),
+// LocationRoadNearby.BasePlace("鏈辨尘鍐滃缓璺�-寤哄瘜璺�-鏈卞钩鍏矾", Pair(121.142609,30.863955), Pair(121.146407,30.864167)),
+// LocationRoadNearby.BasePlace("鏈辨尘鍐滃缓璺�-鏈卞钩鍏矾-鏈卞璺�", Pair(121.146407,30.864167), Pair(121.153675,30.864075)),
+// LocationRoadNearby.BasePlace("鍚曢潚璺�-鏈卞悤鍏矾-鏈卞钩鍏矾", Pair(121.136318,30.833325), Pair(121.148624,30.836094)),
+// LocationRoadNearby.BasePlace("娉栨咕鏀矾-鍚曢潚璺�-鏈卞钩鍏矾", Pair(121.155048,30.835229), Pair(121.148659,30.829861)),
+
+ LocationRoadNearby.BasePlace("寰愭眹涓婂笀澶�", Pair(121.416643,31.163531), Pair(121.416643,31.163531)),
)
- locationRoadNearby.searchList(bList, 1000.0)
+ locationRoadNearby.searchList(bList, 2000.0)
}
}
\ No newline at end of file
--
Gitblit v1.9.3