From 0516cba27e632f20efac2752787f38f0c87baafa Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期三, 25 九月 2024 09:24:05 +0800
Subject: [PATCH] 1. 新增自动评估添加和更新接口
---
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SceneDeviceMapper.kt | 2
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ItemevaluationController.kt | 23
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreUtil.kt | 168 +++++
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt | 21
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt | 1
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/MediafileService.kt | 7
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopOutput.kt | 9
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt | 64 ++
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt | 10
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MediaFileVo.kt | 1
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt | 7
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt | 9
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionVo.kt | 2
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopEvaluation.kt | 62 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt | 286 ++--------
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreDetail.kt | 169 ++++++
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationSubRuleVo.kt | 88 +++
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt | 4
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt | 18
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt | 51 +
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt | 16
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt | 2
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImplTest.kt | 30 +
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluation.kt | 2
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt | 93 +-
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt | 2
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt | 47 +
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt | 2
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5.kt | 5
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt | 22
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Itemevaluation.kt | 2
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt | 140 ----
src/main/kotlin/cn/flightfeather/supervision/business/AutoScore2.kt | 20
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem7.kt | 3
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ItemevaluationService.kt | 13
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt | 8
/dev/null | 75 --
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreItem.kt | 19
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt | 28
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt | 6
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt | 2
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt | 2
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemEvaluationVo.kt | 37 +
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt | 54 +
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/InspectionRep.kt | 22
45 files changed, 1,034 insertions(+), 620 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/AutoScore2.kt b/src/main/kotlin/cn/flightfeather/supervision/business/AutoScore2.kt
index 1b2a38f..f718ce3 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/AutoScore2.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/AutoScore2.kt
@@ -16,7 +16,7 @@
* @author riku
* Date: 2020/8/7
*/
-
+@Deprecated("2024.9.25 姝よ嚜鍔ㄨ瘎鍒嗚垗寮�")
@Component
class AutoScore2 {
@@ -42,7 +42,7 @@
private var problems: ArrayList<ProblemListVo> = ArrayList()
- private var allRules: ArrayList<Evaluationsubrule> = ArrayList()
+ private var allRules = listOf<Evaluationsubrule2>()
private var inspection = InspectionVo()
@@ -81,12 +81,12 @@
if (evaluationrule === null) return
this.evaluationrule = evaluationrule
//鑾峰彇瀵瑰簲鐨勫叿浣撹瘎鍒嗙粏鍒�
- allRules = autoScore.evaluationsubruleService.findByRuleId(evaluationrule.guid!!) as ArrayList<Evaluationsubrule>
+ allRules = autoScore.evaluationsubruleService.findByRuleId(evaluationrule.guid!!)
//鑾峰彇宸℃煡淇℃伅
inspection = autoScore.inspectionService.findBySubTaskID(subtask.stguid!!)
- val titleRule = Evaluationsubrule()
+ val titleRule = Evaluationsubrule2()
val titleOptionRange = ArrayList<Int>()
val titleIsGood = true
@@ -106,7 +106,7 @@
* @param rule 褰撳墠璇勫垎椤�
* @param maxScore 鐖堕」鐨勬渶澶у垎
*/
- fun autoGeneration(rule: Evaluationsubrule, maxScore: Int): Int? {
+ fun autoGeneration(rule: Evaluationsubrule2, maxScore: Int): Int? {
val nextSubRules = getSubRulesByFatherId(allRules, rule.guid)
//鏃犲瓙椤圭殑鏈�灏忚瘎鍒嗛」锛岀粰鍑哄緱鍒�
@@ -139,7 +139,7 @@
}
//濉啓璇︾粏璇勫垎椤圭殑鍒嗘暟
- fun writeScore4th(rule: Evaluationsubrule, maxScore: Int): Pair<Int, Boolean> {
+ fun writeScore4th(rule: Evaluationsubrule2, maxScore: Int): Pair<Int, Boolean> {
problems.forEach {
if (it.guid != null) {
@@ -153,8 +153,8 @@
}
//鎸夌収鐖秈d鏌ユ壘瀛愯瘎鍒嗛」
- fun getSubRulesByFatherId(rules: ArrayList<Evaluationsubrule>, fatherId: String?): List<Evaluationsubrule> {
- val subRules = mutableListOf<Evaluationsubrule>()
+ fun getSubRulesByFatherId(rules: List<Evaluationsubrule2>, fatherId: String?): List<Evaluationsubrule2> {
+ val subRules = mutableListOf<Evaluationsubrule2>()
rules.forEach {
if (it.fatherid == fatherId
|| (fatherId.isNullOrBlank() && it.fatherid.isNullOrBlank())) {
@@ -166,7 +166,7 @@
}
//鍒涘缓鍗曢」璇勫垎瀵硅薄
- fun createNewChildScore(subRule: Evaluationsubrule, score: Int, isSelected: Boolean): Int? {
+ fun createNewChildScore(subRule: Evaluationsubrule2, score: Int, isSelected: Boolean): Int? {
val itemevaluation = Itemevaluation()
itemevaluation.ieguid = UUIDGenerator.generate16ShortUUID()
itemevaluation.iguid = inspection.guid
@@ -218,7 +218,7 @@
}
//鑾峰彇鎬诲垎
- fun getTotalPoint(rules: ArrayList<Evaluationsubrule>, fatherId: String?): Int {
+ fun getTotalPoint(rules: List<Evaluationsubrule2>, fatherId: String?): Int {
val rules1 = getSubRulesByFatherId(rules, fatherId)
var point = 0
rules1.forEach {
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopOutput.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopOutput.kt
index c9928e3..a285f4b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopOutput.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopOutput.kt
@@ -1,6 +1,5 @@
package cn.flightfeather.supervision.business.autooutput
-import cn.flightfeather.supervision.business.Info
import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource
import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
@@ -39,6 +38,14 @@
}
/**
+ * 灏嗚瘎鍒嗚褰曟洿鏂拌嚦鏁版嵁搴�
+ */
+ fun updateDbEvaluation(evaluationScene: AopDataSource.EvaluationScene, p: Pair<Evaluation, List<Itemevaluation>>) {
+ evaluationMapper.updateByPrimaryKey(p.first)
+ p.second.forEach { il -> itemevaluationMapper.updateByPrimaryKey(il) }
+ }
+
+ /**
* 灏嗙洃娴嬫暟鎹粺璁$粨鏋滃叆搴�
*/
fun toDbDataResult(dustDataResult: DustDataResult) {
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt
index bf7c41a..290de1e 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt
@@ -92,7 +92,7 @@
// 鐩戠鎬讳换鍔�
val task = taskRep.findOneTask(areaVo) ?: throw BizException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
// 鎬讳换鍔″寘鍚搴旂被鍨嬬殑鍦烘櫙
- val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
+ val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
val sceneIds = scenes.map { it?.guid }
val userIdList = userInfoSVRep.findUser(sceneIds).map { it?.guid }
// 鍦烘櫙鍜岀洃娴嬬偣鐨勫尮閰嶅叧绯�
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt
index 42f8c01..9c2af53 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt
@@ -64,6 +64,8 @@
if (dustSiteMaps.isEmpty()) return emptyList()
val mnCodeList = dustSiteMaps.map { it?.jaMnCode }
+ if (mnCodeList.isEmpty()) return emptyList()
+
val map = mutableMapOf<String?, MutableList<HourDustData?>>()
hourDustDataMapper.selectByExample(Example(HourDustData::class.java).apply {
createCriteria().andBetween("lst", evaluationScene.config?.startTime, evaluationScene.config?.endTime)
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 a19472f..23bcf93 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
@@ -7,6 +7,8 @@
import cn.flightfeather.supervision.domain.ds2.entity.LedgerSubType
import cn.flightfeather.supervision.domain.ds2.entity.UserMap
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
+import cn.flightfeather.supervision.lightshare.vo.EvaluationSubRuleVo
+import org.springframework.beans.BeanUtils
import tk.mybatis.mapper.entity.Example
import java.time.LocalDateTime
import java.time.ZoneId
@@ -73,6 +75,31 @@
do {
callback(i, evaluationScene)
} while (evaluationScene.gotoNextSubTask())
+ }
+ }
+ 1 -> {
+ userSourceList.forEachIndexed { i, user ->
+ evaluationScene.clear()
+ evaluationScene.index = i
+ evaluationScene.setDefaultUserTZ(user)
+ callback(i, evaluationScene)
+ }
+ }
+ }
+ }
+
+ /**
+ * 鏍规嵁瀛愪换鍔″彧杞涓�娆�
+ * 褰撴暟鎹簮鏄�氳繃[setResource]浼犲叆[Subtask]鏃跺喅瀹氭椂
+ */
+ fun runBySubTask(callback: (index: Int, evaluationScene: EvaluationScene) -> Unit) {
+ when (mode) {
+ 0 -> {
+ sceneSourceList.forEachIndexed { i, scene ->
+ evaluationScene.clear()
+ evaluationScene.index = i
+ evaluationScene.setDefaultScene(scene)
+ callback(i, evaluationScene)
}
}
1 -> {
@@ -248,9 +275,9 @@
val totalScore = InfoProxy<Int>()
//鑷姩璇勫垎瑙勫垯涓�绾у垎绫�
- val topItems = InfoProxy<MutableList<Evaluationsubrule2>>(config?.sceneType.toString()) { _, cacheMap ->
- val _topItems = mutableListOf<Evaluationsubrule2>()
- val _rules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>()
+ val topRules = InfoProxy<MutableList<EvaluationSubRuleVo>>(config?.sceneType.toString()) { _, cacheMap ->
+ val _topItems = mutableListOf<EvaluationSubRuleVo>()
+ val _rules = mutableListOf<Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>>()
val rule = aopDbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
createCriteria()
.andEqualTo("tasktypeid", 99)
@@ -264,7 +291,11 @@
val rules =
aopDbMapper.evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule2::class.java).apply {
createCriteria().andEqualTo("erguid", ruleId)
- })
+ }).map {
+ val vo = EvaluationSubRuleVo()
+ BeanUtils.copyProperties(it, vo)
+ vo
+ }
rules.forEach {
if (it.ertype == 2) {
_topItems.add(it)
@@ -275,7 +306,7 @@
var t = 0
_topItems.forEach {
t += it.maxscore ?: 0
- val tempRules = mutableListOf<Evaluationsubrule2>()
+ val tempRules = mutableListOf<EvaluationSubRuleVo>()
for (i in rules) {
if (i.fatherid == it.guid && i.ertype == 3) {
tempRules.add(i)
@@ -287,7 +318,7 @@
}
tempRules.sortBy { t -> t.displayid }
tempRules.forEach { temp ->
- val tempSubRules = mutableListOf<Evaluationsubrule2>()
+ val tempSubRules = mutableListOf<EvaluationSubRuleVo>()
for (i in rules) {
if (i.fatherid == temp.guid && i.ertype == 4) {
tempSubRules.add(i)
@@ -308,7 +339,7 @@
// FIXME: 2023/8/9 瀛愯鍒欑殑鑾峰彇蹇呴』鍦╗topItems]璋冪敤涔嬪悗锛屽惁鍒欎负绌�
//鑷姩璇勫垎瑙勫垯浜岀骇鍜屼笁绾у垎绫�
- val rules = InfoProxy<MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>>()
+ val rules = InfoProxy<MutableList<Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>>>()
//蹇呭~鍙拌处鏁伴噺
val ledgerCount = InfoProxy<Int>(config?.sceneType.toString()) {_, cacheMap ->
@@ -374,7 +405,7 @@
evaluation.clear()
itemevaluationList.clear()
totalScore.clear()
- topItems.clear()
+ topRules.clear()
baseRule.clear()
rules.clear()
}
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 3c0ae96..ccfac49 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
@@ -122,15 +122,28 @@
/**
* 鎵ц璇勫垎閫昏緫
*/
- private fun execute(source: AopDataSource) {
- //鑾峰彇鏁版嵁婧愶紙寰呰瘎浼扮殑鍦烘櫙锛�
- //寰幆澶勭悊姣忎釜鍦烘櫙
- source.loop { index, evaluationScene ->
- if (evaluationScene.noRecord()) return@loop
+ private fun execute(source: AopDataSource, isBySubtask: Boolean = false) {
+ // 褰撻渶瑕佸彧閽堝鍗曡瘝宸℃煡浠诲姟杩涜璇勪及鏃�
+ if (isBySubtask) {
+ source.runBySubTask { index, evaluationScene ->
+ if (evaluationScene.noRecord()) return@runBySubTask
- itemGrade(index, evaluationScene)
- totalGrade(index, evaluationScene)?.run {
- aopOutput.toDbEvaluation(evaluationScene, this)
+ itemGrade(index, evaluationScene)
+ totalGrade(index, evaluationScene)?.run {
+ aopOutput.toDbEvaluation(evaluationScene, this)
+ }
+ }
+ }
+ // 褰撻拡瀵瑰満鏅繘琛岃瘎浼版椂锛岃鍖呮嫭璇ュ満鏅綋鏈堝彲鑳藉瓨鍦ㄧ殑澶嶆牳宸℃煡鎯呭喌
+ else {
+ //寰幆澶勭悊姣忎釜鍦烘櫙
+ source.loop { index, evaluationScene ->
+ if (evaluationScene.noRecord()) return@loop
+
+ itemGrade(index, evaluationScene)
+ totalGrade(index, evaluationScene)?.run {
+ aopOutput.toDbEvaluation(evaluationScene, this)
+ }
}
}
}
@@ -140,10 +153,10 @@
*/
private fun itemGrade(index: Int, evaluationScene: AopDataSource.EvaluationScene) {
// 瑙勫垯鏉$洰寰楀垎鍒濆鍖�
- evaluationScene.topItems.value?.forEach { s -> s.extension1 = null }
+ evaluationScene.topRules.value?.forEach { s -> s.clear() }
evaluationScene.rules.value?.forEach { p ->
- p.first.extension1 = null
- p.second.forEach { e -> e.extension1 = null }
+ p.first.clear()
+ p.second.forEach { e -> e.clear() }
}
/** 1. 鏍规嵁璇勫垎瑙勫垯瀵瑰簲鐨勯棶棰樿嚜鍔ㄥ垽鏂槸鍚︽墸鍒�***************************************************************/
@@ -159,7 +172,7 @@
// 瀛樺湪澶氫釜璇勫垎椤瑰拰鍚屼竴涓棶棰樺叧鑱旓紝鍥犳蹇呴』鍏ㄩ儴璇勫垎椤归兘鍒ゅ畾涓�閬�
sr.problemlist?.split(",")?.forEach { pId ->
if (pList.contains(pId)) {
- sr.extension1 = (0 - (sr.maxscore ?: 0)).toString()
+ sr.setMaxScore()
}
}
}
@@ -169,18 +182,21 @@
/** 2.閮ㄥ垎鏈夌壒娈婅瘎鍒嗛�昏緫鐨勮鍒欒繘琛岃绠�*************************************************************************/
itemList.forEach { item -> item.execute(evaluationScene) }
- /** 3. 琛ュ叏鍚勪笂绾ц瘎鍒嗛」鐨勮鍒�*************************************************************************/
+ /** 3. 琛ュ厖鍚勪笂绾ц瘎鍒嗛」鐨勮鍒�*************************************************************************/
evaluationScene.rules.value?.forEach { r ->
val fatherId = r.first.fatherid
- for (t in (evaluationScene.topItems.value ?: emptyList())) {
+ for (t in (evaluationScene.topRules.value ?: emptyList())) {
if (t.guid == fatherId) {
- var s = t.extension1?.toIntOrNull() ?: 0
- s += r.first.extension1?.toIntOrNull() ?: 0
+ var s = t.score
+ s += r.first.score
// 闄愬埗鏈�楂樻墸鍒�
- if (abs(s) > (t.maxscore ?: 0)) {
- s = 0 - (t.maxscore ?: 0)
- }
- t.extension1 = s.toString()
+// if (abs(s) > (t.maxscore ?: 0)) {
+//// s = 0 - (t.maxscore ?: 0)
+// t.setMaxScore()
+// } else {
+// t.score = s
+// }
+ t.score = s
break
}
}
@@ -195,15 +211,15 @@
evaluationScene: AopDataSource.EvaluationScene,
): Pair<Evaluation, List<Itemevaluation>>? {
val scene = evaluationScene.scene.value ?: return null
- val topItems = evaluationScene.topItems.value ?: return null
+ val topItems = evaluationScene.topRules.value ?: return null
val rules = evaluationScene.rules.value ?: return null
val subTask = evaluationScene.subTask.value
val inspection = evaluationScene.inspection.value
val totalScore = evaluationScene.totalScore.value ?: return null
var total = 0//鎬绘墸闄ょ殑鍒嗘暟
- evaluationScene.topItems.value?.forEach top@{ top ->
- total += top.extension1?.toIntOrNull() ?: 0
+ evaluationScene.topRules.value?.forEach top@{ top ->
+ total += top.score
}
val evaluation = Evaluation().apply {
evaluationScene.baseRule.value?.let {
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 a394739..266c0a3 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
@@ -1,13 +1,10 @@
package cn.flightfeather.supervision.business.autooutput.score
import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource
-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 cn.flightfeather.supervision.lightshare.vo.EvaluationSubRuleVo
import org.springframework.beans.factory.annotation.Autowired
-import tk.mybatis.mapper.entity.Example
-import kotlin.math.abs
/**
* 鑷姩璇勫垎鏉$洰
@@ -28,7 +25,7 @@
lateinit var evaluationScene: AopDataSource.EvaluationScene
- private var rulePair: Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>? = null
+ private var rulePair: Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>? = null
@Autowired
lateinit var problemlistMapper: ProblemlistMapper
@@ -39,6 +36,7 @@
fun execute(evaluationScene: AopDataSource.EvaluationScene) {
this.evaluationScene = evaluationScene
if (!exemption && !evaluationScene.noRecord()) {
+ val a = evaluationScene.topRules.value
getRule(evaluationScene.rules.value)
calScore()
}
@@ -47,7 +45,7 @@
/**
* 鑾峰彇璇勫垎瑙勫垯
*/
- private fun getRule(eList: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>?) {
+ private fun getRule(eList: MutableList<Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>>?) {
if (eList == null) return
for (e in eList) {
if (e.first.guid == id) {
@@ -77,16 +75,9 @@
}
otherProblem(rulePair?.second!!.size)?.let { it.forEach {i ->
- rulePair?.second!![i].getScore()
+ rulePair?.second!![i].setMaxScore()
} }
ScoreUtil.subRuleCal(rulePair)
- }
-
- /**
- * 鍑忓垎妯″紡涓嬶紝璁$畻鍏蜂綋閫夐」鐨勫緱鍒�
- */
- fun Evaluationsubrule2.getScore() {
- extension1 = (0 - (maxscore ?: 0)).toString()
}
}
\ No newline at end of file
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 05d102d..12df325 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
@@ -1,52 +1,170 @@
package cn.flightfeather.supervision.business.autooutput.score
-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.Evaluation
+import cn.flightfeather.supervision.lightshare.vo.EvaluationSubRuleVo
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
-import org.apache.poi.hssf.util.HSSFColor
-import kotlin.math.abs
+import cn.flightfeather.supervision.lightshare.vo.EvaluationVo
+import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo
+import java.util.*
/**
* 寰楀垎璁$畻宸ュ叿
* 璇勫垎琛ㄦ牸鍒嗕负涓変釜灞傜骇
* 绗竴灞備负澶у垎绫伙紝绗簩灞備负璇勪及鏍囧噯锛岀涓夊眰涓烘爣鍑嗗搴旂殑涓嶅悓绋嬪害鐨勮瘎浼扮粨鏋�
*/
+// FIXME: 2024/9/23 鐩墠鏆傛寜鐓т笁灞傝瘎浼拌鍒欒繘琛岃瘎浼帮紝鍚庣画搴旇浼樺寲涓轰笉闄愬眰鏁�
object ScoreUtil {
/**
- * 璁$畻鏌愪竴鍏蜂綋璇勫垎鏍囧噯鐨勫緱鍒�
- * 閽堝鍑忓垎妯″紡
+ * 鏍规嵁鎵�閫夋渶娣卞眰璇勪及閫夐」锛岀粰瑙勫垯璧嬪�煎搴斿垎鏁板強鑷姩璁$畻鍏朵綑鎵�鏈夋潯鐩緱鍒�
+ * @param evaluationScene 闇�瑕佽瘎浼扮殑瀵硅薄
+ * @param selected 璇勪及琛ㄤ腑閫変腑鐨勮瘎浼版潯鐩富閿甶d闆嗗悎锛堝繀椤绘槸鏈�娣变竴灞傜殑璇勪及鏉$洰锛�
*/
- fun subRuleCal(rulePair: Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>?) {
+ fun scoreAssign(evaluationScene: AopDataSource.EvaluationScene, selected: List<String>) {
+ val topRules = evaluationScene.topRules.value
+ val subRules = evaluationScene.rules.value
+ subRules?.forEach { r ->
+ // 鏍规嵁浼犲叆鐨勯�変腑璇勪及鏉$洰涓婚敭id锛屼慨鏀瑰叾寰楀垎
+ r.second.forEach { e ->
+ if (selected.contains(e.guid)) {
+ e.setMaxScore()
+ }
+ }
+ // 鏍规嵁瀛愰」鐨勯�夋嫨鎯呭喌锛岃嚜鍔ㄨ绠楄鏉¤瘎浼扮殑鎬诲緱鍒�
+ subRuleCal(r)
+
+ // 琛ュ厖鍚勬渶涓婄骇璇勫垎椤圭殑璁″垎
+ val fatherId = r.first.fatherid
+ for (t in (evaluationScene.topRules.value ?: emptyList())) {
+ if (t.guid == fatherId) {
+ t.score += r.first.score
+ break
+ }
+ }
+ }
+ }
+
+ /**
+ * 璁$畻鏌愪竴鍏蜂綋璇勫垎鏍囧噯鐨勫緱鍒嗭紝骞朵笖鏍规嵁閫夐」鍜屽垎鏁颁笂闄愯绠楁渶缁堝緱鍒�
+ * @param rulePair 浜岀骇鍜屼笁绾ц瘎鍒嗚鍒欑殑瀵瑰簲缁撴瀯
+ */
+ fun subRuleCal(rulePair: Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>?) {
val rule = rulePair?.first
val itemList = rulePair?.second
- var total: Int? = null
+ var total = 0
itemList?.forEach {
- if (!it.extension1.isNullOrBlank()) {
- total = (total ?: 0) + it.extension1!!.toInt()
+ total += it.score
+ }
+// val s = if (abs(total) > rule?.maxscore!!) {
+// when (rule.extension2) {
+// // 鍑忓垎妯″紡锛岃褰曚负鎵e垎锛堣礋鏁帮級
+// Constant.EvaGradeMode.MINUS_MODE.value -> {
+// 0 - rule.maxscore!!
+// }
+// // 鍔犲垎妯″紡锛岃褰曚负寰楀垎锛堟鏁帮級
+// Constant.EvaGradeMode.ADD_MODE.value -> {
+// rule.maxscore!!
+// }
+// // 榛樿鍑忓垎妯″紡
+// else -> {
+// 0 - rule.maxscore!!
+// }
+// }
+// } else {
+// total
+// }
+// rule.score = s
+ rule?.score = total
+ }
+
+ /**
+ * 鐢熸垚璇勪及璁板綍缁撴灉
+ * @param evaluationScene 闇�瑕佽瘎浼扮殑瀵硅薄
+ * @return 璇勪及鎬诲垎鍜屽搴旂粏鍒欏緱鍒嗙殑鏁版嵁搴撶粨鏋�
+ */
+ fun genEvaRecord(evaluationScene: AopDataSource.EvaluationScene): Pair<Evaluation, List<Itemevaluation>>? {
+ val scene = evaluationScene.scene.value ?: return null
+ val topRules = evaluationScene.topRules.value ?: return null
+ val baseRule = evaluationScene.baseRule.value
+ val rules = evaluationScene.rules.value ?: return null
+ val subTask = evaluationScene.subTask.value
+ val inspection = evaluationScene.inspection.value
+
+ var total = 0 //鎬诲緱鍒�
+ topRules.forEach top@{ top ->
+ total += top.getFinalScore()
+ }
+ val evaluation = EvaluationVo.newAutoEvaluation(inspection, subTask, scene, baseRule, total)
+ //瀛愰」鍏蜂綋寰楀垎
+ val itemList = mutableListOf<Itemevaluation>()
+ topRules.forEach { subRule ->
+ val item = ItemEvaluationVo.newItemEvaluation(baseRule, subTask, inspection, subRule)
+ itemList.add(item)
+ }
+ rules.forEach { p ->
+ if (p.first.ertype != 2) {
+ val item = ItemEvaluationVo.newItemEvaluation(baseRule, subTask, inspection, p.first)
+ itemList.add(item)
+ }
+ p.second.forEach { r ->
+ val item1 = ItemEvaluationVo.newItemEvaluation(baseRule, subTask, inspection, r)
+ itemList.add(item1)
}
}
- if (total == null) {
- rule?.extension1 = "0"
- } else {
- val s = if (abs(total!!) > rule?.maxscore!!) {
- 0 - rule.maxscore!!
- } else {
- total
- }
- rule.extension1 = s.toString()
+ return Pair(evaluation, itemList)
+ }
+
+ /**
+ * 鏇存柊璇勪及璁板綍缁撴灉
+ * @param evaluationScene 闇�瑕佽瘎浼扮殑瀵硅薄
+ * @return 璇勪及鎬诲垎鍜屽搴旂粏鍒欏緱鍒嗙殑鏁版嵁搴撶粨鏋�
+ */
+ fun updateEvaRecord(evaluationScene: AopDataSource.EvaluationScene): Pair<Evaluation, List<Itemevaluation>>? {
+ val topRules = evaluationScene.topRules.value ?: return null
+ val rules = evaluationScene.rules.value ?: return null
+
+ val evaluation = evaluationScene.evaluation.value ?: return null
+ val itemevaluationList = evaluationScene.itemevaluationList.value ?: return null
+
+ var total = 0 //鎬诲緱鍒�
+ topRules.forEach top@{ top ->
+ total += top.getFinalScore()
}
+ evaluation.apply {
+ resultscorebef = total.toString()
+ updatedate = Date()
+ }
+ //瀛愰」鍏蜂綋寰楀垎
+ topRules.forEach { subRule ->
+ itemevaluationList.find { it.esrguid == subRule.guid }?.let {
+ it.value = subRule.score.toString()
+ it.extension1 = subRule.selected.toString()
+ }
+ }
+ rules.forEach { p ->
+ // 鍙兘瀛樺湪绗竴灞傜骇涓嬪睘鐩存帴涓虹涓夊眰绾х殑鎯呭喌
+ if (p.first.ertype != 2) {
+ itemevaluationList.find { it.esrguid == p.first.guid }?.let {
+ it.value = p.first.score.toString()
+ it.extension1 = p.first.selected.toString()
+ }
+ }
+ p.second.forEach { r ->
+ itemevaluationList.find { it.esrguid == r.guid }?.let {
+ it.value = r.score.toString()
+ it.extension1 = r.selected.toString()
+ }
+ }
+ }
+ return Pair(evaluation, itemevaluationList)
}
/**
* 鐢熸垚鏂扮殑涓�鏉¤瘎鍒嗚褰�
*/
- fun newItemEvaluation(evaluationScene: AopDataSource.EvaluationScene, itemRule: Evaluationsubrule2) =
+ fun newItemEvaluation(evaluationScene: AopDataSource.EvaluationScene, itemRule: EvaluationSubRuleVo) =
Itemevaluation().apply {
val rule = evaluationScene.baseRule.value
val subTask = evaluationScene.subTask.value
@@ -62,8 +180,8 @@
ertype = itemRule.ertype
esrguid = itemRule.guid
name = itemRule.itemname
- value = itemRule.extension1 ?: "0"
- extension1 = (itemRule.extension1 != null).toString()
+ value = itemRule.score.toString()
+ extension1 = itemRule.selected.toString()
}
/**
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 9200e28..a00adc1 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
@@ -2,15 +2,10 @@
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.*
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 c6bd1c4..965ba77 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
@@ -1,8 +1,6 @@
package cn.flightfeather.supervision.business.autooutput.score.restaurant
import cn.flightfeather.supervision.business.autooutput.score.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
@@ -12,7 +10,6 @@
import tk.mybatis.mapper.entity.Example
import java.time.LocalDateTime
import java.time.ZoneId
-import javax.annotation.PostConstruct
@Deprecated(level = DeprecationLevel.HIDDEN, message = "鍙拌处鐨勮瘎浼伴�氳繃宸℃煡闂鑷姩瀵瑰簲")
@Component
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 f6c61e5..830d9ed 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
@@ -146,6 +146,60 @@
}
}
+ // 澶氬獟浣撴枃浠�
+ enum class MediaFileType(val value: Int, val des: String){
+ Problem(1, "闂"),
+ TechnicalPrevention(2, "鎶�闃叉帾鏂�"),
+
+ MonitorDevice(3, "鐩戞祴璁惧"),
+ TreatmentDevice(4, "娌荤悊璁惧"),
+
+ RoutineRecord(5, "甯歌璁板綍"),
+ Signature(6, "绛惧瓧"),
+ Nameplate(7, "閾墝"),
+
+ TYPE_1(51, "鎵╁睍绫讳竴"),
+ TYPE_2(52, "鎵╁睍绫讳簩"),
+ TYPE_3(53, "鎵╁睍绫讳笁"),
+ TYPE_4(54, "鎵╁睍绫诲洓"),
+ TYPE_5(55, "鎵╁睍绫讳簲"),
+ TYPE_6(56, "鎵╁睍绫诲叚"),
+ TYPE_7(57, "鎵╁睍绫讳竷"),
+ TYPE_8(58, "鎵╁睍绫诲叓"),
+ TYPE_9(59, "鎵╁睍绫讳節"),
+ TYPE_10(60, "鎵╁睍绫诲崄");
+
+ companion object {
+ fun getList(sceneTypeId: Byte?): List<MediaFileType> {
+ val type = SceneType.getByValue(sceneTypeId?.toString())
+ return getList(type)
+ }
+ fun getList(sceneType: SceneType) = when (sceneType) {
+ SceneType.TYPE5 -> listOf(RoutineRecord, TYPE_1, TYPE_2, TYPE_3, TYPE_4, TYPE_5,
+ TYPE_6, TYPE_7, TYPE_8, TYPE_9, TYPE_10)
+ else -> listOf(RoutineRecord, MonitorDevice, Nameplate)
+ }
+ }
+ }
+
+ // 璇勫垎鏉$洰绫诲瀷
+ enum class EvaScoreMode(val value: String, val des: String){
+ BASIC_SCORE("basic_score", "鍩虹鍒�"),
+ ADDITION_SCORE("addition_score", "闄勫姞鍒�"),
+ }
+
+ // 寰楀垎妯″紡
+ enum class EvaGradeMode(val value: String, val des: String){
+ MINUS_MODE("minus_mode", "鍑忓垎妯″紡"),
+ ADD_MODE("add_mode", "鍔犲垎妯″紡"),
+ }
+
+ // 璇勪及閫夋嫨妯″紡
+ enum class EvaSelectMode(val value: String, val des: String){
+ SINGLE_MODE("single_mode", "鍗曢�夋ā寮�"),
+ MULTI_MODE("multi_mode", "澶氶�夋ā寮�"),
+ }
+
companion object {
//闂瀹℃牳
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluation.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluation.kt
index bdb10e1..03f125d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluation.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluation.kt
@@ -8,7 +8,7 @@
@Table(name = "ea_t_evaluation")
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Evaluation {
+open class Evaluation {
@Id
@Column(name = "E_GUID")
var guid: String? = null
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt
index 4aadb7c..73d9b4b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt
@@ -9,12 +9,12 @@
/**
* @date 2024.4.25
* 鐢ㄤ簬鏆傛椂鏇夸唬[Evaluationsubrule]鐨勭被
- * 鍥犱负鍙傛暟[Evaluationsubrule.ertype]琚敊璇殑璁惧畾涓篬Boolean]绫诲瀷锛屽疄闄呭簲涓篬Int]绫诲瀷锛�
+ * 鍥犱负鍙傛暟[Evaluationsubrule.ertype]琚敊璇殑璁惧畾涓篬Boolean]绫诲瀷锛屽疄闄匸ertype]搴斾负[Int]绫诲瀷锛�
* 鐩墠涓昏褰卞搷浜嗗畨鍗揂PP绋嬪簭锛屽皢APP绋嬪簭瀵瑰簲鍙傛暟璋冩暣鍚庢湰绫诲彲瀹屽叏鏇挎崲[Evaluationsubrule]
*/
@Table(name = "sm_t_evaluationsubrule")
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Evaluationsubrule2 {
+open class Evaluationsubrule2 {
@Id
@Column(name = "ESR_GUID")
var guid: String? = null
@@ -103,12 +103,29 @@
@Column(name = "ESR_UpdateDate")
var updatedate: Date? = null
+ /**
+ * 瑙勫垯绫诲瀷
+ * basic_score: 鍩虹鍒嗭紝蹇呴��
+ * addition_score: 闄勫姞鍒嗭紝鍙��
+ */
@Column(name = "ESR_Extension1")
var extension1: String? = null
+ /**
+ * 璇勫垎妯″紡
+ * minus_mode: 鍑忓垎妯″紡
+ * add_mode: 鍔犲垎妯″紡
+ * null: 璇存槑璇ユ潯璇勪及瑙勫垯宸茬粡鏄渶鍏蜂綋鐨勬潯鐩紝娌℃湁瀛愰」
+ */
@Column(name = "ESR_Extension2")
var extension2: String? = null
+ /**
+ * 閫夋嫨妯″紡
+ * single_mode: 鍗曢�夋ā寮�
+ * multi_mode: 澶氶�夋ā寮�
+ * null: 璇存槑璇ユ潯璇勪及瑙勫垯宸茬粡鏄渶鍏蜂綋鐨勬潯鐩紝娌℃湁瀛愰」
+ */
@Column(name = "ESR_Extension3")
var extension3: String? = null
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Itemevaluation.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Itemevaluation.kt
index dfc4a1a..c8d0311 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Itemevaluation.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Itemevaluation.kt
@@ -7,7 +7,7 @@
@Table(name = "ea_t_itemevaluation")
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Itemevaluation {
+open class Itemevaluation {
@Id
@Column(name = "IE_GUID")
var ieguid: String? = null
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SceneDeviceMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SceneDeviceMapper.kt
index 7485917..fb232fe 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SceneDeviceMapper.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SceneDeviceMapper.kt
@@ -5,4 +5,4 @@
import org.apache.ibatis.annotations.Mapper
@Mapper
-interface SceneDeviceMapper : MyMapper<SceneDevice>
\ No newline at end of file
+interface SceneDeviceMapper : MyMapper<SceneDevice?>
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/InspectionRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/InspectionRep.kt
new file mode 100644
index 0000000..6df9c91
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/InspectionRep.kt
@@ -0,0 +1,22 @@
+package cn.flightfeather.supervision.domain.ds1.repository
+
+import cn.flightfeather.supervision.domain.ds1.entity.Inspection
+import cn.flightfeather.supervision.domain.ds1.mapper.InspectionMapper
+import org.springframework.stereotype.Repository
+
+/**
+ * 宸℃煡璁板綍鏁版嵁搴撴搷浣�
+ * @date 2024/9/12
+ * @author feiyu02
+ */
+@Repository
+class InspectionRep(private val inspectionMapper: InspectionMapper) {
+
+ fun findOne(primaryKey: String): Inspection? {
+ return inspectionMapper.selectByPrimaryKey(primaryKey)
+ }
+
+ fun findOne(inspection: Inspection): Inspection? {
+ return inspectionMapper.selectOne(inspection)
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt
index 65eb3a5..c3d8226 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt
@@ -1,12 +1,10 @@
package cn.flightfeather.supervision.domain.ds1.repository
-import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Mediafile
import cn.flightfeather.supervision.domain.ds1.mapper.MediafileMapper
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
-import java.io.File
/**
* 澶氬獟浣撴枃浠舵暟鎹簱鎿嶄綔
@@ -16,13 +14,29 @@
@Repository
class MediaFileRep(private val mediaFileMapper: MediafileMapper, @Value("\${imgPath}") var imgPath: String,) {
+ /**
+ * 鏍规嵁涓婚敭鍒犻櫎
+ */
fun deleteOne(guid: String?): Int {
return mediaFileMapper.deleteByPrimaryKey(guid)
}
- fun findList(idList: List<String>): List<Mediafile?> {
+ /**
+ * 鏍规嵁涓婚敭鏌ヨ
+ */
+ fun findList(primaryKeyList: List<String>): List<Mediafile?> {
return mediaFileMapper.selectByExample(Example(Mediafile::class.java).apply {
- createCriteria().andIn("guid", idList)
+ createCriteria().andIn("guid", primaryKeyList)
+ })
+ }
+
+ /**
+ * 鏍规嵁宸℃煡璁板綍鍜屾枃浠朵笟鍔$被鍨嬫煡璇�
+ */
+ fun findList(iGuid: String?, typeList: List<Int>): List<Mediafile?> {
+ return mediaFileMapper.selectByExample(Example(Mediafile::class.java).apply {
+ createCriteria().andEqualTo("iguid", iGuid)
+ .andIn("businesstypeid", typeList)
})
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt
index a4c9e11..1fe80a5 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt
@@ -8,6 +8,15 @@
@Repository
class ProblemRep(private val problemlistMapper: ProblemlistMapper) {
+
+ fun insert(problemlist: Problemlist): Int {
+ return problemlistMapper.insert(problemlist)
+ }
+
+ fun update(problemlist: Problemlist): Int {
+ return problemlistMapper.updateByPrimaryKey(problemlist)
+ }
+
/**
* 鑾峰彇鍚勫満鏅殑闂鍜屾暣鏀规暟閲忕粺璁�
*/
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt
index d5f3c14..7db939a 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt
@@ -26,13 +26,6 @@
return scenseMapper.insertSelective(scene)
}
- /**
- * 鏌ユ壘鍦烘櫙
- */
- fun findScene(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<Scense?> {
- return scenseMapper.getSceneByType(topTaskId, sceneTypeId, townCode)
- }
-
fun findScene(userId: String?): Scense? {
val user = userinfoMapper.selectByPrimaryKey(userId) ?: throw BizException("鐢ㄦ埛id涓嶅瓨鍦�")
return scenseMapper.selectByPrimaryKey(user.dGuid)
@@ -45,12 +38,19 @@
})
}
- fun findScenes(nameList: List<String?>): List<Scense?> {
+ fun findSceneList(nameList: List<String?>): List<Scense?> {
return scenseMapper.selectByExample(Example(Scense::class.java).apply {
createCriteria().andIn("name", nameList)
})
}
+ /**
+ * 鏌ユ壘鍦烘櫙
+ */
+ fun findSceneList(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<Scense?> {
+ return scenseMapper.getSceneByType(topTaskId, sceneTypeId, townCode)
+ }
+
fun findBySubTask(subTaskId: String): Scense? {
val subtask = subTaskRep.findOne(subTaskId)
return scenseMapper.selectByPrimaryKey(subtask?.scenseid)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt
index b541b19..ccaa109 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt
@@ -16,8 +16,8 @@
return subtaskMapper.updateByPrimaryKey(subtask)
}
- fun findOne(id:String): Subtask? {
- return subtaskMapper.selectByPrimaryKey(id)
+ fun findOne(primaryKey:String): Subtask? {
+ return subtaskMapper.selectByPrimaryKey(primaryKey)
}
fun findAll(subtask: Subtask): List<Subtask?> {
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
index fba609a..d3bc67d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
@@ -18,6 +18,7 @@
* 鏌ユ壘鐢ㄦ埛
*/
fun findUser(sceneIdList: List<String?>): List<Userinfo?> {
+ if (sceneIdList.isEmpty()) return emptyList()
return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
createCriteria().andIn("dGuid", sceneIdList)
})
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
index a7cd514..e8c050c 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
@@ -1,7 +1,8 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
-import cn.flightfeather.supervision.lightshare.vo.EvaluationVo
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
+import cn.flightfeather.supervision.lightshare.vo.ScoreDetail
interface EvaluationsubruleService {
@@ -15,10 +16,10 @@
fun delete(id:String): Int
- fun findByRuleId(erguid: String): List<Evaluationsubrule>
+ fun findByRuleId(erguid: String): List<Evaluationsubrule2>
fun search(districtCode: String, sceneTypeId: String, version: String? = null): List<Evaluationsubrule>
- fun getAutoScore(subTaskId: String): List<EvaluationVo>
+ fun getAutoScore(subTaskId: String): ScoreDetail
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ItemevaluationService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ItemevaluationService.kt
index 42e85f1..48c0bf3 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ItemevaluationService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ItemevaluationService.kt
@@ -1,7 +1,7 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
-import cn.flightfeather.supervision.lightshare.vo.ItemevaluationVo
+import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo
interface ItemevaluationService {
@@ -17,7 +17,16 @@
fun delete(id: String): Int
- fun findBySubTaskID(subTaskID: String): List<ItemevaluationVo>
+ fun findBySubTaskID(subTaskID: String): List<ItemEvaluationVo>
fun savelist(itemevaluationlist: List<Itemevaluation>): Int
+
+ /**
+ * 鏂板涓�涓贰鏌ヤ换鍔$殑瀵瑰簲璇勫垎
+ * @param subTaskId 宸℃煡浠诲姟id
+ * @param ruleId 浣跨敤鐨勮瘎浼拌鍒檌d
+ */
+ fun createItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean
+
+ fun updateItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/MediafileService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/MediafileService.kt
index ded5657..fefebf0 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/MediafileService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/MediafileService.kt
@@ -12,6 +12,11 @@
fun save(mediafile: Mediafile): Int
+ /**
+ * 淇濆瓨鍥剧墖
+ */
+ fun saveMediaFile(files: Array<MultipartFile>, getMediaFile: () -> Mediafile): Int
+
fun update(mediafile: Mediafile): Int
fun delete(id: String): Int
@@ -25,4 +30,6 @@
fun findByProblemID(id: String): List<MediaFileVo>
fun findBysubtaskbtid(id: String, btid: String): MutableList<Mediafile>?
+
+ fun getRoutineRecord(iGuid: String?, stGuid: String?): List<Mediafile?>
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt
index a3731a9..c872fee 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt
@@ -1,9 +1,6 @@
package cn.flightfeather.supervision.lightshare.service
-import cn.flightfeather.supervision.domain.ds1.entity.Inspection
-import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
-import cn.flightfeather.supervision.domain.ds1.entity.Scense
-import cn.flightfeather.supervision.domain.ds1.entity.Subtask
+import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.lightshare.vo.*
import org.springframework.web.multipart.MultipartFile
@@ -48,16 +45,13 @@
fun updateProblem(problem: ProblemListVo, deleteImg: List<String>, files: Array<MultipartFile>): String
- /**
- * 淇濆瓨闂鍥剧墖
- */
- fun saveProFile(
- problemlist: Problemlist, inspection: Inspection,
- scene: Scense, files: Array<MultipartFile>,
- ): Int
-
fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String>
+ /**
+ * 鏇存柊鏁存敼
+ */
+ fun updateChange(problemId: String, deleteImg: List<String>, files: Array<MultipartFile>): String
+
fun getBySubTask(stGuid: String, all:Boolean?): List<ProblemListVo>
fun getSceneByProType(areaVo: AreaVo, pType:String):List<Subtask?>
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt
index 30e48da..7d90b17 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt
@@ -33,7 +33,7 @@
//浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋
2 -> {
val task = taskRep.findOneTask(areaVo) ?: throw BizException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
- val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
+ val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
.map { it?.guid }
val idList = userInfoSVRep.findUser(scenes).map { it?.guid }
userMapRep.findBySVUserId(idList).map { it?.tzUserId }
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
index e9d5732..e972031 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
@@ -1,15 +1,16 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.common.exception.BizException
-import cn.flightfeather.supervision.domain.ds1.entity.*
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRuleRep
+import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService
-import cn.flightfeather.supervision.lightshare.vo.EvaluationVo
-import cn.flightfeather.supervision.lightshare.vo.SubEvaluationVo
-import cn.flightfeather.supervision.lightshare.vo.ThirdEvaluationVo
+import cn.flightfeather.supervision.lightshare.vo.ScoreDetail
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
@@ -19,6 +20,7 @@
val evaluationruleMapper: EvaluationruleMapper,
private val evaluationRep: EvaluationRep,
private val evaluationRuleRep: EvaluationRuleRep,
+ private val sceneRep: SceneRep,
) : EvaluationsubruleService {
override fun findOne(id: String): Evaluationsubrule = evaluationsubruleMapper.selectByPrimaryKey(id)
@@ -32,12 +34,8 @@
override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id)
- override fun findByRuleId(erguid: String): List<Evaluationsubrule> {
- val example = Example(Evaluationsubrule::class.java)
- val criteria = example.createCriteria()
- criteria.andEqualTo("erguid", erguid)
- example.orderBy("extension1").desc()
- return evaluationsubruleMapper.selectByExample(example)
+ override fun findByRuleId(erguid: String): List<Evaluationsubrule2> {
+ return evaluationRuleRep.findSubRule(erguid)
}
override fun search(districtCode: String, sceneTypeId: String, version: String?): List<Evaluationsubrule> {
@@ -56,125 +54,29 @@
return result
}
- override fun getAutoScore(subTaskId: String): List<EvaluationVo> {
+ override fun getAutoScore(subTaskId: String): ScoreDetail {
+ //鍦烘櫙淇℃伅
+ val scene = sceneRep.findBySubTask(subTaskId)
+ //鎬诲垎
+ val evaluation = evaluationRep.findBySubtask(subTaskId)
//瀛愯鍒欓�愭潯寰楀垎
val subRuleScores = evaluationRep.findItemEvaluation(subTaskId)
+ if (subRuleScores.isEmpty()) throw BizException("鏃犺瘎浼拌褰�")
//璇勫垎鎬昏鍒�
val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) ?: throw BizException("鏈壘鍒扮浉鍏宠嚜鍔ㄨ瘎浼拌鍒�")
//鎬昏鍒欏搴旂殑璇勫垎瀛愯鍒�
val subRules = evaluationRuleRep.findSubRule(rule.guid)
//鏌ヨ缁撴灉
- val resultList = mutableListOf<EvaluationVo>()
+ val result = ScoreDetail()
+ result.status = if (scene?.extension1.equals("1")) "鍦ㄥ缓" else "瀹屽伐"
- var _group = 0
+ result.updateTime = evaluation?.updatedate
subRules.forEach {
- when (it.ertype) {
- 2 -> resultList.add(EvaluationVo().apply {
- id = it.guid
- title = it.itemname
- scoreMode = it.extension1
- gradeMode = it.extension2
- maxScore = when (gradeMode) {
- "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
- "add_mode" -> it.maxscore ?: 0
- else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
- }
- selectMode = it.extension3
-
- //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
- for (s in subRuleScores) {
- if (it.guid == s.esrguid) {
- select = s.extension1 == "true"
- break
- }
- }
- })
- 3 -> {
- for (r in resultList) {
- if (it.fatherid == r.id) {
- r.subList.add(SubEvaluationVo().apply {
- id = it.guid
- title2 = it.itemname
- gradeMode = it.extension2
- selectMode = it.extension3
- score = when (gradeMode) {
- "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
- "add_mode" -> it.maxscore ?: 0
- else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
- }
- group = _group++
-
- //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
- for (s in subRuleScores) {
- if (it.guid == s.esrguid) {
- select = s.extension1 == "true"
- break
- }
- }
- })
- break
- }
- }
- }
- 4 -> {
- resultList.forEach{ r ->
- //4绾х殑璇勪及椤圭洿鎺ラ檮灞炰簬2绾ц瘎浼伴」
- if (r.id == it.fatherid) {
- if (r.subList.isEmpty()) {
- r.subList.add(SubEvaluationVo().apply {
- placeholder = true
- id = it.guid
- title2 = r.title
- score = r.maxScore
- gradeMode = r.gradeMode
- selectMode = r.selectMode
- group = _group++
- })
- }
- r.subList[0].sub2.add(ThirdEvaluationVo().apply {
- id = it.guid
- content = it.itemname
- score = when (r.subList[0].gradeMode) {
- "minus_mode" -> r.maxScore.plus(it.maxscore ?: 0)
- "add_mode" -> it.maxscore ?: 0
- else -> r.maxScore.plus(it.maxscore ?: 0)
- }
- //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
- for (s in subRuleScores) {
- if (it.guid == s.esrguid) {
- select = s.extension1 == "true"
- break
- }
- }
- })
- } else {
- r.subList.forEach { sr ->
- if (sr.id == it.fatherid){
- sr.sub2.add(ThirdEvaluationVo().apply {
- id = it.guid
- content = it.itemname
- score = when (sr.gradeMode) {
- "minus_mode" -> sr.score.plus(it.maxscore ?: 0)
- "add_mode" -> it.maxscore ?: 0
- else -> sr.score.plus(it.maxscore ?: 0)
- }
- //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
- for (s in subRuleScores) {
- if (it.guid == s.esrguid) {
- select = s.extension1 == "true"
- break
- }
- }
- })
- }
- }
- }
- }
- }
- }
+ it.ertype ?: return@forEach
+ result.addDetail(result.details, it, it.ertype!! - 1, subRuleScores, false)
}
+ result.calScore()
- return resultList
-
+ return result
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt
index 4c1645c..4ea547f 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt
@@ -1,15 +1,28 @@
package cn.flightfeather.supervision.lightshare.service.impl
+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.ScoreUtil
+import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
import cn.flightfeather.supervision.domain.ds1.mapper.ItemevaluationMapper
+import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
import cn.flightfeather.supervision.lightshare.service.ItemevaluationService
-import cn.flightfeather.supervision.lightshare.vo.ItemevaluationVo
+import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo
import org.springframework.beans.BeanUtils
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
@Service
-class ItemevaluationServiceImpl(val itemevaluationMapper: ItemevaluationMapper) : ItemevaluationService {
+class ItemevaluationServiceImpl(
+ private val itemevaluationMapper: ItemevaluationMapper,
+ private val aopDbMapper: AopDbMapper,
+ private val aopOutput: AopOutput,
+ private val aopSceneTypeCheck: AopSceneTypeCheck,
+ private val subTaskRep: SubTaskRep,
+) : ItemevaluationService {
//鎵归噺淇敼鍗曢」璇勪及
@Transactional
@@ -32,13 +45,13 @@
}
//鏍规嵁瀛愪换鍔D鑾峰彇鍗曢」璇勪及鍒楄〃
- override fun findBySubTaskID(subTaskID: String): List<ItemevaluationVo> {
- val itemvaluationVoList = mutableListOf<ItemevaluationVo>()
+ override fun findBySubTaskID(subTaskID: String): List<ItemEvaluationVo> {
+ val itemvaluationVoList = mutableListOf<ItemEvaluationVo>()
val itemvaluation = Itemevaluation()
itemvaluation.stguid = subTaskID
val itemvaluationList = itemevaluationMapper.select(itemvaluation)
itemvaluationList.forEach {
- val itemvaluationVo = ItemevaluationVo()
+ val itemvaluationVo = ItemEvaluationVo()
BeanUtils.copyProperties(it, itemvaluationVo)
itemvaluationVoList.add(itemvaluationVo)
}
@@ -51,7 +64,46 @@
override fun save(itemevaluation: Itemevaluation): Int = itemevaluationMapper.insert(itemevaluation)
- override fun update(itemevaluation: Itemevaluation): Int = itemevaluationMapper.updateByPrimaryKeySelective(itemevaluation)
+ override fun update(itemevaluation: Itemevaluation): Int =
+ itemevaluationMapper.updateByPrimaryKeySelective(itemevaluation)
override fun delete(id: String): Int = itemevaluationMapper.deleteByPrimaryKey(id)
+
+ @Transactional
+ override fun createItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean {
+ val source = AopDataSource(aopDbMapper, aopSceneTypeCheck)
+ val subTask = subTaskRep.findOne(subTaskId) ?: throw BizException("宸℃煡浠诲姟涓嶅瓨鍦�")
+ source.setResource(subTask)
+ try {
+ source.runBySubTask { _, evaluationScene ->
+ if (evaluationScene.noRecord()) throw BizException("宸℃煡浠诲姟涓嶅瓨鍦�")
+ // 灏嗗垎鏁拌祴鍊煎埌瀵瑰簲鐨勮瘎浼拌鍒欎笅锛屽苟涓旇嚜鍔ㄨ绠楀叾浣欒鍒欑殑寰楀垎
+ ScoreUtil.scoreAssign(evaluationScene, itemList)
+ // 鑾峰彇鎬诲垎鍜屽瓙椤瑰緱鍒嗘暟鎹簱琛ㄧ粨鏋勪綋锛屽苟鍏ュ簱
+ ScoreUtil.genEvaRecord(evaluationScene)?.let { aopOutput.toDbEvaluation(evaluationScene, it) }
+ }
+ return true
+ } catch (e: Exception) {
+ throw BizException("鍑虹幇绯荤粺鍐呴儴閿欒")
+ }
+ }
+
+ @Transactional
+ override fun updateItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean {
+ val source = AopDataSource(aopDbMapper, aopSceneTypeCheck)
+ val subTask = subTaskRep.findOne(subTaskId) ?: throw BizException("宸℃煡浠诲姟涓嶅瓨鍦�")
+ source.setResource(subTask)
+ try {
+ source.runBySubTask { _, evaluationScene ->
+ if (evaluationScene.noRecord()) throw BizException("宸℃煡浠诲姟涓嶅瓨鍦�")
+ // 灏嗗垎鏁拌祴鍊煎埌瀵瑰簲鐨勮瘎浼拌鍒欎笅锛屽苟涓旇嚜鍔ㄨ绠楀叾浣欒鍒欑殑寰楀垎
+ ScoreUtil.scoreAssign(evaluationScene, itemList)
+ // 鑾峰彇鎬诲垎鍜屽瓙椤瑰緱鍒嗘暟鎹簱琛ㄧ粨鏋勪綋锛屽苟鍏ュ簱
+ ScoreUtil.updateEvaRecord(evaluationScene)?.let { aopOutput.updateDbEvaluation(evaluationScene, it) }
+ }
+ return true
+ } catch (e: Exception) {
+ throw BizException("鍑虹幇绯荤粺鍐呴儴閿欒")
+ }
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt
index 27ca9c2..4081cf9 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt
@@ -1,10 +1,15 @@
package cn.flightfeather.supervision.lightshare.service.impl
+import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.entity.Mediafile
import cn.flightfeather.supervision.domain.ds1.mapper.MediafileMapper
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.FileUtil
+import cn.flightfeather.supervision.domain.ds1.entity.Inspection
+import cn.flightfeather.supervision.domain.ds1.repository.InspectionRep
import cn.flightfeather.supervision.domain.ds1.repository.MediaFileRep
+import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
+import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
import cn.flightfeather.supervision.lightshare.service.MediafileService
import cn.flightfeather.supervision.lightshare.vo.MediaFileVo
import com.fasterxml.jackson.core.type.TypeReference
@@ -22,6 +27,9 @@
class MediafileServiceImpl(
val mediafileMapper: MediafileMapper,
private val mediaFileRep: MediaFileRep,
+ private val inspectionRep: InspectionRep,
+ private val subTaskRep: SubTaskRep,
+ private val sceneRep: SceneRep,
@Value("\${filePath}") var filePath: String,
@Value("\${imgPath}") var imgPath: String,
) : MediafileService {
@@ -36,6 +44,28 @@
val mediafilelist = mediafileMapper.select(mediafile)
mediafilelist.sortBy { it.savetime }
return mediafilelist
+ }
+
+ /**
+ * 鑾峰彇鎵�鏈変换鎰忔媿甯歌璁板綍鍥剧墖
+ * @param iGuid
+ */
+ override fun getRoutineRecord(iGuid: String?, stGuid: String?): List<Mediafile?> {
+ var inspectionGuid = iGuid
+ val sceneId = if (iGuid != null) {
+ inspectionRep.findOne(iGuid)?.sguid
+ } else if (stGuid != null) {
+ val s = subTaskRep.findOne(stGuid)
+ val ins = inspectionRep.findOne(Inspection().apply { stguid = stGuid })
+ inspectionGuid = ins?.guid
+ s?.scenseid
+ } else {
+ throw BizException("宸℃煡璁板綍id鍜屽贰鏌ヤ换鍔d鑷冲皯濉啓鍏朵腑涓�涓�")
+ }
+ sceneId ?: throw BizException("璁板綍瀵瑰簲鐨勫満鏅笉瀛樺湪")
+ val sceneInfo = sceneRep.findScene(sceneId = sceneId)
+ val mediaFileTypeList = Constant.MediaFileType.getList(sceneInfo?.typeid).map { it.value }
+ return mediaFileRep.findList(inspectionGuid, mediaFileTypeList)
}
//鏍规嵁闂id鑾峰彇濯掍綋鏂囦欢
@@ -115,6 +145,26 @@
override fun save(mediafile: Mediafile): Int = mediafileMapper.updateByPrimaryKey(mediafile)
+ override fun saveMediaFile(files: Array<MultipartFile>, getMediaFile: () -> Mediafile): Int {
+ var res = 0
+ // 淇濆瓨鍥剧墖
+ for (image in files) {
+ val mediaFile = getMediaFile()
+ res += mediafileMapper.insert(mediaFile)
+
+ val path = mediaFile.extension1
+ val fileName = mediaFile.guid + ".jpg"
+ val filePath = "${imgPath}/$path/"
+ try {
+ //璋冪敤鏂囦欢淇濆瓨鏂规硶
+ FileUtil.uploadFile(image.bytes, filePath, fileName)
+ } catch (e: Exception) {
+ // TODO: handle exception
+ }
+ }
+ return res
+ }
+
override fun update(mediafile: Mediafile): Int = mediafileMapper.updateByPrimaryKey(mediafile)
//鍒犻櫎濯掍綋鏂囦欢
@@ -133,6 +183,7 @@
override fun deleteList(idList: List<String>): Int {
var res = 0
+ if (idList.isEmpty()) return res
mediaFileRep.findList(idList).forEach {
//鏈嶅姟鍣ㄤ繚瀛樿矾寰�
val path = it?.extension1
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt
index e84b05a..0a1dca0 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt
@@ -459,20 +459,17 @@
}
override fun newProblem(problem: String, files: Array<MultipartFile>): BaseResponse<String> {
- val mapper = ObjectMapper()
-
//json杞琽bject
- val problemVo = mapper.readValue(problem, object : TypeReference<ProblemVo>() {})
+ val problemVo = ObjectMapper().readValue(problem, object : TypeReference<ProblemVo>() {})
val inspection = inspectionMapper.selectByPrimaryKey(problemVo.insGuid) ?: return BaseResponse(false, "宸℃煡璁板綍涓嶅瓨鍦�")
val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: return BaseResponse(false, "宸℃煡璁板綍瀵瑰簲鍦烘櫙涓嶅瓨鍦�")
-
// 淇濆瓨闂
val problemlist = ProblemListVo.newPro(inspection, problemVo, scene)
problemlistMapper.insert(problemlist)
// 淇濆瓨鍥剧墖
- saveProFile(problemlist, inspection, scene, files)
+ mediafileService.saveMediaFile(files) { MediaFileVo.newProFile(inspection, problemlist, scene) }
//鏇存柊宸℃煡淇℃伅鐨勯棶棰樻暟
if (inspection.problemcount != null) {
@@ -491,41 +488,25 @@
override fun updateProblem(problem: ProblemListVo, deleteImg: List<String>, files: Array<MultipartFile>): String {
problemRep.findOne(problem.guid) ?: throw BizException("璇ラ棶棰樹笉瀛樺湪")
- val inspection = inspectionMapper.selectByPrimaryKey(problem.guid) ?: throw BizException("宸℃煡璁板綍涓嶅瓨鍦�")
+ problemRep.update(problem)
+ val inspection = inspectionMapper.selectByPrimaryKey(problem.iguid) ?: throw BizException("宸℃煡璁板綍涓嶅瓨鍦�")
val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: throw BizException("宸℃煡璁板綍瀵瑰簲鍦烘櫙涓嶅瓨鍦�")
- saveProFile(problem, inspection, scene, files)
+ mediafileService.saveMediaFile(files) { MediaFileVo.newProFile(inspection, problem, scene) }
mediafileService.deleteList(deleteImg)
return "success"
}
- override fun saveProFile(
- problemlist: Problemlist,
- inspection: Inspection,
- scene: Scense,
- files: Array<MultipartFile>,
- ): Int {
- var res = 0
- // 淇濆瓨鍥剧墖
- for (image in files) {
- val mediaFile = MediaFileVo.newProFile(inspection, problemlist, scene)
- res += mediafileMapper.insert(mediaFile)
-
- val path = mediaFile.extension1
- val fileName = mediaFile.guid + ".jpg"
- val filePath = "${imgPath}/$path/"
- try {
- //璋冪敤鏂囦欢淇濆瓨鏂规硶
- FileUtil.uploadFile(image.bytes, filePath, fileName)
- } catch (e: Exception) {
- // TODO: handle exception
- }
- }
- return res
- }
-
override fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> {
- // 鏇存柊闂
+ // 闂鍜岄棶棰樺浘鐗囧悎娉曟�ф鏌�
val p = problemlistMapper.selectByPrimaryKey(problemId) ?: return BaseResponse(false, "闂涓嶅瓨鍦�")
+ val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply {
+ createCriteria().andEqualTo("businessguid", p.guid)
+ .andEqualTo("businesstypeid", 1)
+ .andEqualTo("ischanged", false)
+ })
+ if (mediaFiles.isEmpty()) return BaseResponse(false, "闂涓嶅瓨鍦ㄦ垨宸叉暣鏀癸紝鏃犳硶閲嶅鏁存敼")
+
+ // 鏇存柊闂
p.apply {
ischanged = true
changedtime = Date()
@@ -544,41 +525,43 @@
}
problemlistMapper.updateByPrimaryKey(p)
- // 淇濆瓨鍥剧墖
- val now = LocalDateTime.now()
- val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply {
- createCriteria().andEqualTo("businessguid", p.guid)
- .andEqualTo("businesstypeid", 1)
- .andEqualTo("ischanged", false)
- })
- if (mediaFiles.isEmpty()) return BaseResponse(false, "鍦烘櫙闂鏁伴噺涓�0锛屾棤娉曟暣鏀�")
+ // 淇濆瓨鏁存敼鍥剧墖
val m = mediaFiles[0]
m.path = m.path + "鏁存敼/"
m.savetime = Date()
m.ischanged = true
-
- for (image in files) {
+ mediafileService.saveMediaFile(files) {
m.apply {
guid = UUIDGenerator.generate16ShortUUID()
description = p.problemname + " " + p.location + " 鏁存敼 " + UUIDGenerator.generateUUID(4) + ".jpg"
}
- mediafileMapper.insert(m)
-
- val path = m.extension1
- val fileName = m.guid + ".jpg"
-// val filePath = "E:\\work\\绗笁鏂圭洃绠pp\\鑷姩璇勫垎\\椁愰ギ\\"
- val filePath = "${imgPath}/$path"
- try {
- //璋冪敤鏂囦欢淇濆瓨鏂规硶
- FileUtil.uploadFile(image.bytes, filePath, fileName)
- } catch (e: Exception) {
- println(e)
- }
}
return BaseResponse(true)
}
+ override fun updateChange(problemId: String, deleteImg: List<String>, files: Array<MultipartFile>): String {
+ val p = problemRep.findOne(problemId) ?: throw BizException("璇ラ棶棰樹笉瀛樺湪")
+ val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply {
+ createCriteria().andEqualTo("businessguid", problemId)
+ .andEqualTo("businesstypeid", 1)
+ .andEqualTo("ischanged", true)
+ })
+ if (mediaFiles.isEmpty()) throw BizException("闂杩樻湭鏁存敼锛屾棤娉曚慨鏀规暣鏀�")
+
+ // 淇濆瓨鏂扮殑鏁存敼鍥剧墖
+ val m = mediaFiles[0]
+ m.savetime = Date()
+ mediafileService.saveMediaFile(files) {
+ m.apply {
+ guid = UUIDGenerator.generate16ShortUUID()
+ description = p.problemname + " " + p.location + " 鏁存敼 " + UUIDGenerator.generateUUID(4) + ".jpg"
+ }
+ }
+ mediafileService.deleteList(deleteImg)
+ return "success"
+ }
+
override fun getBySubTask(stGuid: String, all: Boolean?): List<ProblemListVo> {
//鏍规嵁瀛愪换鍔D鑾峰彇闂鍒楄〃
val problemListVo = mutableListOf<ProblemListVo>()
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 726afa8..8bf1dba 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
@@ -278,10 +278,10 @@
override fun getSceneDetail(sceneId: String): BaseResponse<SceneDetail> {
val sceneDetail = SceneDetail()
- val scene = scenseMapper.selectByPrimaryKey(sceneId)
+ val scene = sceneRep.findScene(sceneId = sceneId)
sceneDetail.scense = scene
- val mapper = when (scene.typeid.toString()) {
+ val mapper = when (scene?.typeid.toString()) {
Constant.SceneType.TYPE1.value -> sceneConstructionSiteMapper
Constant.SceneType.TYPE2.value -> sceneWharfMapper
Constant.SceneType.TYPE3.value -> sceneMixingPlantMapper
@@ -411,7 +411,7 @@
val scenes = sceneImport.readFromFile(f)
// 鏌ユ壘鍦烘櫙鍚嶇О鏄惁閲嶅
val names = scenes.map { it.name }
- sceneRep.findScenes(names).map { it?.name }.ifNotEmpty {
+ sceneRep.findSceneList(names).map { it?.name }.ifNotEmpty {
val str = this.joinToString("锛�")
throw BizException("瀛樺湪閲嶅鍦烘櫙锛屽涓嬶細${str}")
}
@@ -423,7 +423,7 @@
override fun createScene(scense: Scense): Scense {
val names = listOf(scense.name)
- sceneRep.findScenes(names).map { it?.name }.ifNotEmpty {
+ sceneRep.findSceneList(names).map { it?.name }.ifNotEmpty {
val str = this.joinToString("锛�")
throw BizException("瀛樺湪閲嶅鍦烘櫙锛屽涓嬶細${str}")
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
index 44f615a..348af4d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
@@ -107,7 +107,7 @@
//浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋
2 -> {
val task = taskRep.findOneTask(areaVo) ?: throw BizException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
- val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
+ val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
.map { it?.guid }
userInfoSVRep.findUser(scenes).map { it?.guid }
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationSubRuleVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationSubRuleVo.kt
new file mode 100644
index 0000000..052f337
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationSubRuleVo.kt
@@ -0,0 +1,88 @@
+package cn.flightfeather.supervision.lightshare.vo
+
+import cn.flightfeather.supervision.common.utils.Constant
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
+import kotlin.math.abs
+
+/**
+ * @date 2024.9.24
+ * 璇勪及璇︾粏瑙勫垯
+ */
+class EvaluationSubRuleVo : Evaluationsubrule2() {
+ // 寰楀垎璁板綍(鏍规嵁鏉$洰鐨勮瘎鍒嗘ā寮忥紝鍔犲垎鎴栧噺鍒嗭紝瀛樺偍寰楀垎鎴栬�呮墸鍒�)
+ var score: Int = 0
+ // 寰楀垎鍦ㄨ祴鍊兼椂锛屼笉鑳借秴杩囧緱鍒嗕笂闄�
+ set(value) {
+ field = if (maxscore != null && abs(value) > maxscore!!) {
+ when (extension2) {
+ // 鍑忓垎妯″紡锛岃褰曚负鎵e垎锛堣礋鏁帮級
+ Constant.EvaGradeMode.MINUS_MODE.value -> {
+ (0 - (maxscore ?: 0))
+ }
+ // 鍔犲垎妯″紡锛岃褰曚负寰楀垎锛堟鏁帮級
+ Constant.EvaGradeMode.ADD_MODE.value -> {
+ maxscore ?: 0
+ }
+ // 榛樿鍑忓垎妯″紡
+ else -> {
+ (0 - (maxscore ?: 0))
+ }
+ }
+ } else {
+ value
+ }
+ selected = true
+ }
+
+ // 鏄惁閫変腑鏈瘎浼版潯鐩�
+ var selected: Boolean = false
+
+ /**
+ * 鎯呭喌寰楀垎鍜岄�変腑鐘舵��
+ */
+ fun clear() {
+ score = 0
+ selected = false
+ }
+
+ /**
+ * 鐩存帴鏍规嵁鏉$洰鐨勬�诲垎鍜屽緱鍒嗘ā寮忚幏鍙栨渶缁堝緱鍒�
+ */
+ fun setMaxScore() {
+ score = when (extension2) {
+ // 鍑忓垎妯″紡锛岃褰曚负鎵e垎锛堣礋鏁帮級
+ Constant.EvaGradeMode.MINUS_MODE.value -> {
+ (0 - (maxscore ?: 0))
+ }
+ // 鍔犲垎妯″紡锛岃褰曚负寰楀垎锛堟鏁帮級
+ Constant.EvaGradeMode.ADD_MODE.value -> {
+ maxscore ?: 0
+ }
+ // 榛樿鍑忓垎妯″紡
+ else -> {
+ (0 - (maxscore ?: 0))
+ }
+ }
+ }
+
+ /**
+ * 鑾峰彇鏈�缁堝緱鍒嗭紙姝f暟锛�
+ * 涓�鑸敤浜庤绠楁�诲垎鏃讹紙鎬诲垎閫氬父鎯呭喌涓嬮兘涓烘鏁帮級
+ */
+ fun getFinalScore(): Int {
+ return when (extension2) {
+ // 鍑忓垎妯″紡涓嬶紝璁板綍涓烘墸鍒嗭紝鎵�浠ュ緱鍒嗕负鎬诲垎鍑忓幓鎵e垎
+ Constant.EvaGradeMode.MINUS_MODE.value -> {
+ maxscore?.minus(abs(score)) ?: 0
+ }
+ // 鍔犲垎妯″紡锛岃褰曚负寰楀垎锛岀洿鎺ュ姞鍏ユ�诲垎
+ Constant.EvaGradeMode.ADD_MODE.value -> {
+ score
+ }
+ // 榛樿鍑忓垎妯″紡
+ else -> {
+ maxscore?.minus(abs(score)) ?: 0
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt
index ca80a1d..8dbc046 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt
@@ -1,242 +1,80 @@
package cn.flightfeather.supervision.lightshare.vo
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
-import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
-import com.fasterxml.jackson.annotation.JsonInclude
+import cn.flightfeather.supervision.common.utils.UUIDGenerator
+import cn.flightfeather.supervision.domain.ds1.entity.*
import java.util.*
/**
- * 璇勫垎瑙勫垯鍙婂緱鍒�
+ * 璇勪及鎬诲垎
+ * @date 2024/9/24
+ * @author feiyu02
*/
-@JsonInclude(JsonInclude.Include.NON_NULL)
-class ScoreDetail {
- // 宸ュ湴鐘舵�侊紙鍦ㄥ缓鎴栧畬宸ワ級
- var status: String? = null
-
- // 鎬诲垎
- var totalScore: Int = 0
-
- // 寰楀垎
- var score: Int = 0
-
- // 瑙勮寖鎬х瓑绾�
- var grade: String? = null
-
- // 鏇存柊鏃堕棿
- var updateTime: Date? = null
-
- // 寰楀垎缁嗗垯
- var details = mutableListOf<ScoreItem>()
+class EvaluationVo : Evaluation() {
/**
- * 鏂板涓�鏉¤瘎浼拌鍒欒褰�
- * 璇勪及瑙勫垯鐨勪紶鍏ユ湁椤哄簭瑕佹眰锛屽繀椤绘槸鎸夌収娴呭眰绾ц嚦娣卞眰绾х殑椤哄簭浼犲叆锛岃瘎浼板眰绾� @see [Evaluationsubrule2.ertype]
- * @param details 缁撴灉
- * @param rule 璇勪及瑙勫垯
- * @param level 璇勪及瑙勫垯瀵瑰簲鐨勫眰绾ф繁搴︼紝浠�1寮�濮嬮�掑锛�1涓烘渶椤跺眰
- * @param resList 鍚勬潯瑙勫垯瀵瑰簲鐨勮瘎浼扮粨鏋�
- * @param onlyShowSelected 鍙坊鍔犻�変腑鐨勯�夐」
+ * 鏇存柊寰楀垎
*/
- fun addDetail(
- details: MutableList<ScoreItem>,
- rule: Evaluationsubrule2,
- level: Int,
- resList: List<Itemevaluation>,
- onlyShowSelected: Boolean = false,
- ) {
- if (level == 1) {
- val scoreItem = ScoreItem.fromRule(rule, resList)
- if (onlyShowSelected) {
- if (scoreItem.select) details.add(scoreItem)
- } else {
- details.add(scoreItem)
- }
- } else if (level > 1) {
- var isFind = false
- // 鍒ゆ柇鎻掑叆瑙勫垯鏄惁鏄綋鍓嶅眰绾ц瘎浼伴泦鍚堜腑鏌愪竴椤圭殑瀛愯瘎浼�
- for (d in details) {
- if (rule.fatherid == d.id) {
- if (d.subList == null) d.subList = mutableListOf()
- addDetail(d.subList!!, rule, 1, resList, onlyShowSelected)
- isFind = true
- break
- }
- }
- // 鑻ユ湭鎵惧埌锛屽垯寰�涓嬩竴灞傜骇缁х画鏌ユ壘
- if (!isFind && (level - 1 > 1)) {
- details.forEach { d ->
- d.subList?.let {
- addDetail(it, rule, level - 1, resList, onlyShowSelected)
- }
- }
- }
- }
+ fun updateScore(score: Int) {
+
}
-
- /**
- * 璁$畻鎬诲垎鍜屽緱鍒�
- */
- fun calScore() {
- details.forEach {
- totalScore += it.maxScore
- score += when (it.gradeMode) {
- "minus_mode" -> {
- (it.score + it.maxScore)
- }
- "add_mode" -> {
- it.score
- }
- else -> {
- (it.score + it.maxScore)
- }
- }
- }
- grade = when {
- score >= 95 -> "瑙勮寖"
- // 鍩烘湰瑙勮寖(90..94)鍜岃鑼冿紙>=95锛�
- score >= 90 -> "鍩烘湰瑙勮寖"
- // 涓嶈鑼�
- score >= 50 -> "涓嶈鑼�"
- // 涓ラ噸涓嶈鑼�
- else -> "涓ラ噸涓嶈鑼�"
- }
- }
-}
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-class ScoreItem {
- //鎺掑簭绱㈠紩
- var index: Int? = null
-
- //璇勪及瑙勫垯绾у埆锛�2锛�3锛�4)锛屽�艰秺澶х骇鍒秺浣�
- var level: Int? = null
-
- //瑙勫垯id
- var id: String? = null
-
- //瑙勫垯鎻忚堪
- var title: String? = null
-
- //鎬诲垎鍊�
- var maxScore: Int = 0
-
- //瀹為檯寰楀垎
- var score: Int = 0
-
- //鏄惁閫変腑
- var select: Boolean = false
-
- //basic_score: 鍩虹鍒嗭紝蹇呴�夛紱addition_score锛氶檮鍔犲垎锛屽彲閫夛紱null锛氶粯璁ゅ熀纭�鍒�
- var scoreMode: String? = null
-
- //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯
- var gradeMode: String? = null
-
- //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯
- var selectMode: String? = null
-
- //浜岀骇瀛愯鍒�
- var subList: MutableList<ScoreItem>? = null
companion object {
/**
- * 鏍规嵁瑙勫垯鍜屽緱鍒嗙粨鏋滅敓鎴愬緱鍒嗛」
- * @param rule
- * @param resList
+ * 鏂板涓�鏉¤嚜鍔ㄨ瘎鍒嗙殑鎬诲緱鍒嗚褰�
+ * @param inspection 宸℃煡璁板綍
+ * @param subTask 宸℃煡瀛愪换鍔�
+ * @param scene 琚贰鏌ュ満鏅�
+ * @param rule 浣跨敤鐨勮瘎鍒嗚鍒�
+ * @param totalScore 鎬诲緱鍒�
*/
- fun fromRule(rule: Evaluationsubrule2, resList: List<Itemevaluation>): ScoreItem {
- return ScoreItem().apply {
- index = rule.displayid?.toInt()
- level = rule.ertype
- id = rule.guid
- title = rule.itemname
- scoreMode = rule.extension1
- gradeMode = rule.extension2
- maxScore = rule.maxscore ?: 0
- selectMode = rule.extension3
+ fun newAutoEvaluation(
+ inspection: Inspection?, subTask: Subtask?, scene: Scense, rule: Evaluationrule?,
+ totalScore: Int,
+ ) = newEvaluation(inspection, subTask, scene, rule, totalScore, Userinfo().apply {
+ guid = "admin"
+ acountname = "admin"
+ realname = "admin"
+ })
- //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
- for (s in resList) {
- if (rule.guid == s.esrguid) {
- score = s.value?.toInt() ?: 0
- select = s.extension1 == "true"
- break
- }
- }
- }
+ /**
+ * 鏂板涓�鏉¤瘎鍒嗙殑鎬诲緱鍒嗚褰�
+ * @param inspection 宸℃煡璁板綍
+ * @param subTask 宸℃煡瀛愪换鍔�
+ * @param scene 琚贰鏌ュ満鏅�
+ * @param rule 浣跨敤鐨勮瘎鍒嗚鍒�
+ * @param totalScore 鎬诲緱鍒�
+ * @param userinfo 璇勪及鐢ㄦ埛
+ */
+ fun newEvaluation(
+ inspection: Inspection?, subTask: Subtask?, scene: Scense,
+ rule: Evaluationrule?, totalScore: Int, userinfo: Userinfo,
+ ) = Evaluation().apply {
+ guid = UUIDGenerator.generate16ShortUUID()
+ iguid = inspection?.guid
+ stguid = subTask?.stguid
+ sguid = subTask?.scenseid
+ scensetypeid = scene.typeid
+ scensetype = scene.type
+ subscensetypeid = scene.scensesubtypeid
+ subscensetype = scene.scensesubtype
+ ertype = rule?.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 = userinfo.guid
+ evaluatorusername = userinfo.acountname
+ evaluatorrealname = userinfo.realname
+ resultscorebef = totalScore.toString()
+ createdate = subTask?.planstarttime
+ updatedate = Date()
}
}
-}
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-class EvaluationVo {
- //瑙勫垯id
- var id: String? = null
-
- //瑙勫垯鎻忚堪
- var title: String? = null
-
- //鎬诲垎鍊�
- var maxScore: Int = 0
-
- //瀹為檯寰楀垎
- var score: Int = 0
-
- //鏄惁閫変腑
- var select: Boolean = false
-
- //basic_score: 鍩虹鍒嗭紝蹇呴�夛紱addition_score锛氶檮鍔犲垎锛屽彲閫夛紱null锛氶粯璁ゅ熀纭�鍒�
- var scoreMode: String? = "basic_score"
-
- //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯
- var gradeMode: String? = "minus_mode"
-
- //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯
- var selectMode: String? = "single_mode"
-
- //浜岀骇瀛愯鍒�
- var subList: MutableList<SubEvaluationVo> = mutableListOf()
-}
-
-class SubEvaluationVo {
- //鏈夋椂鍊欎竴绾х殑瑙勫垯涓嬮潰鐩存帴鏄笁绾ц鍒欙紝娌℃湁浜岀骇瑙勫垯锛屽洜姝ゆ鏃剁殑浜岀骇瑙勫垯鍙槸涓轰簡缁撴瀯瀹屾暣鎬ц�屽嚭鐜扮殑
- var placeholder: Boolean = false
-
- //瑙勫垯id
- var id: String? = null
-
- //瑙勫垯鎻忚堪
- var title2: String? = null
-
- //鍒嗗��
- var score: Int = 0
-
- //鏄惁閫変腑
- var select: Boolean = false
-
- //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱
- var gradeMode: String? = "minus_mode"
-
- //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱
- var selectMode: String? = "single_mode"
-
- //浜岀骇瑙勫垯鍒嗙粍
- var group: Int? = null
-
- //涓夌骇瀛愯鍒�
- var sub2: MutableList<ThirdEvaluationVo> = mutableListOf()
-}
-
-class ThirdEvaluationVo {
- //瑙勫垯id
- var id: String? = null
-
- //瑙勫垯鎻忚堪
- var content: String? = null
-
- //鍒嗗��
- var score: Int = 0
-
- //鏄惁閫変腑
- var select: Boolean = false
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionVo.kt
index 56eae4c..322b538 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionVo.kt
@@ -85,5 +85,5 @@
var gitList:List<GitlistVo> ?= null
//鍗曢」璇勫垎椤�
- var itemevaluationList:List<ItemevaluationVo> ?= null
+ var itemevaluationList:List<ItemEvaluationVo> ?= null
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemEvaluationVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemEvaluationVo.kt
new file mode 100644
index 0000000..8a56542
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemEvaluationVo.kt
@@ -0,0 +1,37 @@
+package cn.flightfeather.supervision.lightshare.vo
+
+import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource
+import cn.flightfeather.supervision.common.utils.UUIDGenerator
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
+import cn.flightfeather.supervision.domain.ds1.entity.Inspection
+import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
+import cn.flightfeather.supervision.domain.ds1.entity.Subtask
+import com.fasterxml.jackson.annotation.JsonInclude
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+class ItemEvaluationVo : Itemevaluation() {
+
+ companion object {
+ /**
+ * 鐢熸垚鏂扮殑涓�鏉¤瘎鍒嗚褰�
+ */
+ fun newItemEvaluation(
+ rule: Evaluationrule?, subTask: Subtask?, inspection: Inspection?,
+ itemRule: EvaluationSubRuleVo,
+ ) = Itemevaluation().apply {
+ ieguid = UUIDGenerator.generate16ShortUUID()
+ iguid = inspection?.guid
+ stguid = subTask?.stguid
+ sguid = subTask?.scenseid
+ sensename = subTask?.scensename
+ erguid = rule?.guid
+ rulename = rule?.rulename
+ ruletype = rule?.ruletype?.toInt()
+ ertype = itemRule.ertype
+ esrguid = itemRule.guid
+ name = itemRule.itemname
+ value = itemRule.score.toString()
+ extension1 = itemRule.selected.toString()
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemevaluationVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemevaluationVo.kt
deleted file mode 100644
index 4d44ff9..0000000
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemevaluationVo.kt
+++ /dev/null
@@ -1,75 +0,0 @@
-package cn.flightfeather.supervision.lightshare.vo
-
-import com.fasterxml.jackson.annotation.JsonInclude
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class ItemevaluationVo {
- var ieguid: String? = null
-
- var iguid: String? = null
-
- var stguid: String? = null
-
- var sguid: String? = null
-
- var sensename: String? = null
-
- /**
- * 寮曠敤鑷�冩牳瑙勮寖琛�
- */
- var erguid: String? = null
-
- /**
- * 寮曠敤鑷�冩牳瑙勮寖琛�
- */
- var rulename: String? = null
-
- /**
- * 1瑙勮寖鎬� 2璇勫垎
- */
- var ruletype: Int? = null
-
- /**
- * 1瑙勮寖鑰冩牳椤� 4 鏈�灏忚瘎鍒嗛」
- */
- var ertype: Int? = null
-
- /**
- * 寮曠敤鑷�冩牳瑙勮寖椤瑰瓙琛�
- */
- var esrguid: String? = null
-
- /**
- * 寮曠敤鑷�冩牳瑙勮寖椤瑰瓙琛�
- */
- var name: String? = null
-
- /**
- * 瑙勮寖璇勪及鍒欎负锛氣垰 脳 鈥�
- * 璇勫垎鍒欎负锛氭暟鍊�
- * 涓嶄负绌�
- */
- var value: String? = null
-
- /**
- * 瑙勮寖璇勪及鍒欎负锛氣垰 脳 鈥�
- * 璇勫垎鍒欎负锛氭暟鍊�
- * 涓嶄负绌�
- */
- var resultafter: String? = null
-
- /**
- * 瑙勮寖璇勪及鍒欎负锛氣垰 脳 鈥�
- * 璇勫垎鍒欎负锛氭暟鍊�
- * 涓嶄负绌�
- */
- var vecheckvalue: String? = null
-
- var extension1: String? = null
-
- var extension2: String? = null
-
- var extension3: String? = null
-
- var remark: String? = null
-}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MediaFileVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MediaFileVo.kt
index d5b4291..dd4f8c8 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MediaFileVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MediaFileVo.kt
@@ -13,6 +13,7 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
class MediaFileVo : Mediafile() {
+
companion object {
/**
* 鐢熸垚涓�涓棶棰樺浘鐗�
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreDetail.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreDetail.kt
new file mode 100644
index 0000000..f4d6244
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreDetail.kt
@@ -0,0 +1,169 @@
+package cn.flightfeather.supervision.lightshare.vo
+
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
+import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
+import com.fasterxml.jackson.annotation.JsonInclude
+import java.util.*
+
+/**
+ * 璇勫垎瑙勫垯鍙婂緱鍒�
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+class ScoreDetail {
+ // 宸ュ湴鐘舵�侊紙鍦ㄥ缓鎴栧畬宸ワ級
+ var status: String? = null
+
+ // 鎬诲垎
+ var totalScore: Int = 0
+
+ // 寰楀垎
+ var score: Int = 0
+
+ // 瑙勮寖鎬х瓑绾�
+ var grade: String? = null
+
+ // 鏇存柊鏃堕棿
+ var updateTime: Date? = null
+
+ // 寰楀垎缁嗗垯
+ var details = mutableListOf<ScoreItem>()
+
+ /**
+ * 鏂板涓�鏉¤瘎浼拌鍒欒褰�
+ * 璇勪及瑙勫垯鐨勪紶鍏ユ湁椤哄簭瑕佹眰锛屽繀椤绘槸鎸夌収娴呭眰绾ц嚦娣卞眰绾х殑椤哄簭浼犲叆锛岃瘎浼板眰绾� @see [Evaluationsubrule2.ertype]
+ * @param details 缁撴灉
+ * @param rule 璇勪及瑙勫垯
+ * @param level 璇勪及瑙勫垯瀵瑰簲鐨勫眰绾ф繁搴︼紝浠�1寮�濮嬮�掑锛�1涓烘渶椤跺眰
+ * @param resList 鍚勬潯瑙勫垯瀵瑰簲鐨勮瘎浼扮粨鏋�
+ * @param onlyShowSelected 鍙坊鍔犻�変腑鐨勯�夐」
+ */
+ fun addDetail(
+ details: MutableList<ScoreItem>,
+ rule: Evaluationsubrule2,
+ level: Int,
+ resList: List<Itemevaluation>,
+ onlyShowSelected: Boolean = false,
+ ) {
+ if (level == 1) {
+ val scoreItem = ScoreItem.fromRule(rule, resList)
+ if (onlyShowSelected) {
+ if (scoreItem.select) details.add(scoreItem)
+ } else {
+ details.add(scoreItem)
+ }
+ } else if (level > 1) {
+ var isFind = false
+ // 鍒ゆ柇鎻掑叆瑙勫垯鏄惁鏄綋鍓嶅眰绾ц瘎浼伴泦鍚堜腑鏌愪竴椤圭殑瀛愯瘎浼�
+ for (d in details) {
+ if (rule.fatherid == d.id) {
+ if (d.subList == null) d.subList = mutableListOf()
+ addDetail(d.subList!!, rule, 1, resList, onlyShowSelected)
+ isFind = true
+ break
+ }
+ }
+ // 鑻ユ湭鎵惧埌锛屽垯寰�涓嬩竴灞傜骇缁х画鏌ユ壘
+ if (!isFind && (level - 1 > 1)) {
+ details.forEach { d ->
+ d.subList?.let {
+ addDetail(it, rule, level - 1, resList, onlyShowSelected)
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * 璁$畻鎬诲垎鍜屽緱鍒�
+ */
+ fun calScore() {
+ details.forEach {
+ totalScore += it.maxScore
+ score += when (it.gradeMode) {
+ "minus_mode" -> {
+ (it.score + it.maxScore)
+ }
+ "add_mode" -> {
+ it.score
+ }
+ else -> {
+ (it.score + it.maxScore)
+ }
+ }
+ }
+ grade = when {
+ score >= 95 -> "瑙勮寖"
+ // 鍩烘湰瑙勮寖(90..94)鍜岃鑼冿紙>=95锛�
+ score >= 90 -> "鍩烘湰瑙勮寖"
+ // 涓嶈鑼�
+ score >= 50 -> "涓嶈鑼�"
+ // 涓ラ噸涓嶈鑼�
+ else -> "涓ラ噸涓嶈鑼�"
+ }
+ }
+}
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+class ScoreItem {
+ //鎺掑簭绱㈠紩
+ var index: Int? = null
+
+ //璇勪及瑙勫垯绾у埆锛�2锛�3锛�4)锛屽�艰秺澶х骇鍒秺浣�
+ var level: Int? = null
+
+ //瑙勫垯id
+ var id: String? = null
+
+ //瑙勫垯鎻忚堪
+ var title: String? = null
+
+ //鎬诲垎鍊�
+ var maxScore: Int = 0
+
+ //瀹為檯寰楀垎
+ var score: Int = 0
+
+ //鏄惁閫変腑
+ var select: Boolean = false
+
+ //basic_score: 鍩虹鍒嗭紝蹇呴�夛紱addition_score锛氶檮鍔犲垎锛屽彲閫夛紱null锛氶粯璁ゅ熀纭�鍒�
+ var scoreMode: String? = null
+
+ //minus_mode: 鍑忓垎妯″紡锛沘dd_mode锛氬姞鍒嗘ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯
+ var gradeMode: String? = null
+
+ //single_mode: 鍗曢�夋ā寮忥紱multi_mode锛氬閫夋ā寮忥紱null锛氫笉鍋氳瀹氾紝璇存槑鍏跺瓙椤逛笉鏄叿浣撶殑璇勪及缁嗗垯
+ var selectMode: String? = null
+
+ //浜岀骇瀛愯鍒�
+ var subList: MutableList<ScoreItem>? = null
+
+ companion object {
+ /**
+ * 鏍规嵁瑙勫垯鍜屽緱鍒嗙粨鏋滅敓鎴愬緱鍒嗛」
+ * @param rule
+ * @param resList
+ */
+ fun fromRule(rule: Evaluationsubrule2, resList: List<Itemevaluation>): ScoreItem {
+ return ScoreItem().apply {
+ index = rule.displayid?.toInt()
+ level = rule.ertype
+ id = rule.guid
+ title = rule.itemname
+ scoreMode = rule.extension1
+ gradeMode = rule.extension2
+ maxScore = rule.maxscore ?: 0
+ selectMode = rule.extension3
+
+ //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑
+ for (s in resList) {
+ if (rule.guid == s.esrguid) {
+ score = s.value?.toInt() ?: 0
+ select = s.extension1 == "true"
+ break
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt
index e402b35..c20ade5 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt
@@ -18,7 +18,7 @@
@GetMapping
fun fetchDevice(
@ApiParam("鍦烘櫙id") @RequestParam sceneId: String,
- @ApiParam("璁惧绫诲瀷id") @RequestParam deviceTypeId: Byte,
+ @ApiParam("璁惧绫诲瀷id", allowableValues = "0,1,2") @RequestParam deviceTypeId: Byte,
) = resPack { deviceService.findDevices(sceneId, Constant.DeviceType.fromValue(deviceTypeId)) }
@ApiOperation("鏂板鍦烘櫙璁惧淇℃伅")
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt
index c61a8b0..f19a551 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt
@@ -26,6 +26,12 @@
@DeleteMapping("/{id}")
fun delete(@PathVariable id: String) = evaluationsubruleService.delete(id)
+ @ApiOperation("鏍规嵁璇勪及鎬昏鍒欐煡璇笅灞炵殑瀛愯鍒�")
+ @GetMapping("/byRule")
+ fun getByBaseRule(
+ @ApiParam("璇勪及鎬昏鍒欎富閿甶d") @RequestParam id: String
+ ) = resPack { evaluationsubruleService.findByRuleId(id) }
+
@ApiOperation("鏍规嵁鍖哄幙鍜屽満鏅被鍨嬫煡璇㈣瘎鍒嗗瓙瑙勫垯")
@GetMapping("/search")
fun search(
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ItemevaluationController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ItemevaluationController.kt
index 30a9726..bd4c0fd 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ItemevaluationController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ItemevaluationController.kt
@@ -2,8 +2,13 @@
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
import cn.flightfeather.supervision.lightshare.service.ItemevaluationService
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
+import springfox.documentation.annotations.ApiIgnore
+import javax.servlet.http.HttpServletResponse
@Api(tags = ["ItemevaluationController"], description = "璇勪及瀛愰」寰楀垎API鎺ュ彛")
@RestController
@@ -32,4 +37,22 @@
@DeleteMapping("/{id}")
fun delete (@PathVariable id: String) = itemevaluationService.delete(id)
+
+ @ApiOperation(value = "鏂板鍏蜂綋璇勪及缁撴灉")
+ @PostMapping("/create")
+ fun createItemEvaluation(
+ @ApiParam(value = "宸℃煡浠诲姟涓婚敭id") @RequestParam subTaskId: String,
+ @ApiParam(value = "璇勪及瑙勫垯涓婚敭id", name = "2024.9.24锛岀洰鍓嶆棤闇�浼犲叆姝ゅ弬鏁帮紝鏈帴鍙g粺涓�涓鸿嚜鍔ㄨ瘎浼拌鍒�")
+ @RequestParam(required = false) ruleId: String?,
+ @ApiParam(value = "鍏蜂綋鎵e垎鏉$洰涓婚敭锛堝彧浼犳渶灏忕骇鍒殑璇勪及椤癸級") @RequestBody itemList: List<String>,
+ ) = resPack { itemevaluationService.createItemEvaluation(subTaskId, ruleId, itemList) }
+
+ @ApiOperation(value = "鏇存柊鍏蜂綋璇勪及缁撴灉")
+ @PostMapping("/update")
+ fun updateItemEvaluation(
+ @ApiParam(value = "宸℃煡浠诲姟涓婚敭id") @RequestParam subTaskId: String,
+ @ApiParam(value = "璇勪及瑙勫垯涓婚敭id", name = "2024.9.24锛岀洰鍓嶆棤闇�浼犲叆姝ゅ弬鏁帮紝鏈帴鍙g粺涓�涓鸿嚜鍔ㄨ瘎浼拌鍒�")
+ @RequestParam(required = false) ruleId: String?,
+ @ApiParam(value = "鍏蜂綋鎵e垎鏉$洰涓婚敭锛堝彧浼犳渶灏忕骇鍒殑璇勪及椤癸級") @RequestBody itemList: List<String>,
+ ) = resPack { itemevaluationService.updateItemEvaluation(subTaskId, ruleId, itemList) }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt
index 45a8e1f..19ba7c5 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt
@@ -3,13 +3,15 @@
import cn.flightfeather.supervision.domain.ds1.entity.Mediafile
import cn.flightfeather.supervision.lightshare.service.MediafileService
import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
@Api(tags = ["MediafileController"], description = "澶氬獟浣撴枃浠禔PI鎺ュ彛")
@RestController
@RequestMapping("/mediafile")
-class MediafileController (val mediafileService: MediafileService){
+class MediafileController(val mediafileService: MediafileService) {
@GetMapping
fun getAll() = mediafileService.findAll()
@@ -20,16 +22,30 @@
fun update(@RequestBody mediafile: Mediafile) = mediafileService.update(mediafile)
@GetMapping("/{id}")
- fun getById(@PathVariable id:String) = mediafileService.findOne(id)
+ fun getById(@PathVariable id: String) = mediafileService.findOne(id)
+ @ApiOperation("鏍规嵁涓氬姟绫诲瀷鑾峰彇鏂囦欢")
@GetMapping("/{id}/{btid}")
- fun getBySubtaskId(@PathVariable id:String,@PathVariable btid:String) = mediafileService.findBysubtaskbtid(id,btid)
+ fun getBySubtaskId(
+ @ApiParam("宸℃煡id") @PathVariable iGuid: String,
+ @ApiParam("鏂囦欢涓氬姟绫诲瀷id", allowableValues = "") @PathVariable btid: String,
+ ) = mediafileService.findBysubtaskbtid(iGuid, btid)
+
+ @ApiOperation("鑾峰彇鎵�鏈変换鎰忔媿甯歌璁板綍鍥剧墖", notes = "閫氳繃宸℃煡璁板綍id鎴栧贰鏌ヤ换鍔d鑾峰彇瀵瑰簲鐨勬墍鏈変换鎰忔媿鍥剧墖锛屼袱涓弬鏁颁换閫夊叾涓�鍗冲彲")
+ @GetMapping("/routine")
+ fun getRoutineRecord(
+ @ApiParam("宸℃煡璁板綍id", required = false) @RequestParam(required = false) iGuid: String?,
+ @ApiParam("宸℃煡浠诲姟id", required = false) @RequestParam(required = false) stGuid: String?,
+ ) = resPack { mediafileService.getRoutineRecord(iGuid, stGuid) }
@DeleteMapping("/{id}")
- fun delete (@PathVariable id: String) = mediafileService.delete(id)
+ fun delete(@PathVariable id: String) = mediafileService.delete(id)
@PostMapping("/add")
- fun addProblem(@RequestParam("mediafileVoList") mediafileVoList: String, @RequestPart("Photos") files: Array<MultipartFile>) {
- mediafileService.addMedifile(mediafileVoList,files)
+ fun addProblem(
+ @RequestParam("mediafileVoList") mediafileVoList: String,
+ @RequestPart("Photos") files: Array<MultipartFile>,
+ ) {
+ mediafileService.addMedifile(mediafileVoList, files)
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt
index 8baf3fa..7b6154b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt
@@ -104,7 +104,7 @@
@ApiOperation("鏇存柊涓�涓棶棰�")
@PostMapping("/updateProblem")
- fun updateDeviceLocation(
+ fun updateProblem(
@ApiParam("闂淇℃伅json") @RequestParam("problem") problem: String,
@ApiParam("鍒犻櫎鐨勯棶棰樺浘鐗噄d") @RequestParam("deleteImg") deleteImg: List<String>,
@ApiParam("闂鍥剧墖") @RequestPart("images") images: Array<MultipartFile>,
@@ -120,6 +120,14 @@
@RequestPart("images") files: Array<MultipartFile>,
) = problemlistService.changeProblem(problemId, files)
+ @ApiOperation("鏇存柊涓�涓棶棰樻暣鏀�")
+ @PostMapping("/updateChange")
+ fun updateChange(
+ @ApiParam("闂id") @RequestParam problemId: String,
+ @ApiParam("鍒犻櫎鐨勬暣鏀瑰浘鐗噄d") @RequestParam("deleteImg") deleteImg: List<String>,
+ @ApiParam("鏂板鏁存敼鍥剧墖") @RequestPart("images") images: Array<MultipartFile>,
+ ) = resPack { problemlistService.updateChange(problemId, deleteImg, images) }
+
@ApiOperation(value = "閫氳繃浠诲姟鏌ユ壘闂")
@GetMapping("/subtask")
fun getBySubTask(
diff --git a/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImplTest.kt b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImplTest.kt
new file mode 100644
index 0000000..b375994
--- /dev/null
+++ b/src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImplTest.kt
@@ -0,0 +1,30 @@
+package cn.flightfeather.supervision.lightshare.service.impl
+
+import cn.flightfeather.supervision.lightshare.service.MediafileService
+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 MediafileServiceImplTest {
+
+ @Autowired
+ lateinit var mediafileService: MediafileService
+
+ @Test
+ fun getRoutineRecord() {
+ val res = mediafileService.getRoutineRecord("CbF8jgcNonfKjo2M", null)
+ res.forEach {
+ print(it?.businesstypeid)
+ print(": ")
+ print(it?.businesstype)
+ println()
+ }
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.3