From 0392c333ed3d987cb2ab3dac4e1a972cff405f21 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 25 四月 2024 17:42:08 +0800 Subject: [PATCH] 1. 新增后台任务关联模块 2. 新增自动评分后台任务; 3. 修复部分bug --- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt | 149 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 140 insertions(+), 9 deletions(-) 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 d104301..2326646 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,18 +1,24 @@ package cn.flightfeather.supervision.lightshare.service.impl -import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule -import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule +import cn.flightfeather.supervision.domain.ds1.entity.* 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.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 org.springframework.stereotype.Service import tk.mybatis.mapper.entity.Example @Service -class EvaluationsubruleServiceImpl ( - val evaluationsubruleMapper: EvaluationsubruleMapper, - val evaluationruleMapper: EvaluationruleMapper -):EvaluationsubruleService { +class EvaluationsubruleServiceImpl( + val evaluationsubruleMapper: EvaluationsubruleMapper, + val evaluationruleMapper: EvaluationruleMapper, + private val evaluationRep: EvaluationRep, + private val evaluationRuleRep: EvaluationRuleRep, +) : EvaluationsubruleService { override fun findOne(id: String): Evaluationsubrule = evaluationsubruleMapper.selectByPrimaryKey(id) @@ -20,7 +26,8 @@ override fun save(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.insert(evaluationsubrule) - override fun update(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule) + override fun update(evaluationsubrule: Evaluationsubrule): Int = + evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule) override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id) @@ -36,8 +43,8 @@ val result = mutableListOf<Evaluationsubrule>() evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { createCriteria().andEqualTo("districtcode", districtCode) - .andEqualTo("scensetypeid", sceneTypeId) - }).takeIf { it.isNotEmpty() }?.get(0)?.let {rule -> + .andEqualTo("scensetypeid", sceneTypeId) + }).takeIf { it.isNotEmpty() }?.get(0)?.let { rule -> evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule::class.java).apply { createCriteria().andEqualTo("erguid", rule.guid) }) @@ -47,4 +54,128 @@ return result } + + override fun getAutoScore(subTaskId: String): List<EvaluationVo> { + //瀛愯鍒欓�愭潯寰楀垎 + val subRuleScores = evaluationRep.findItemEvaluation(subTaskId) + //鎬昏鍒檌d + val ruleId = mutableListOf<Evaluation>() + //璇勫垎鎬昏鍒� + val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) + //鎬昏鍒欏搴旂殑璇勫垎瀛愯鍒� + val subRules = mutableListOf<Evaluationsubrule2>() + //鏌ヨ缁撴灉 + val resultList = mutableListOf<EvaluationVo>() + + var _group = 0 + subRules.forEach { + when (it.ertype) { + 2 -> resultList.add(EvaluationVo().apply { + id = it.guid + title1 = it.itemname + scoreMode = it.extension1 + gradeMode = it.extension2 + 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 + } + 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.sub1.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.sub1.isEmpty()) { + r.sub1.add(SubEvaluationVo().apply { + placeholder = true + id = it.guid + title2 = r.title1 + score = r.score + gradeMode = r.gradeMode + selectMode = r.selectMode + group = _group++ + }) + } + r.sub1[0].sub2.add(ThirdEvaluationVo().apply { + id = it.guid + content = it.itemname + score = when (r.sub1[0].gradeMode) { + "minus_mode" -> r.score.plus(it.maxscore ?: 0) + "add_mode" -> it.maxscore ?: 0 + else -> r.score.plus(it.maxscore ?: 0) + } + //濡傛灉鏈夊緱鍒嗚褰曪紝鍒欐敼鍙樼姸鎬佷负閫変腑 + for (s in subRuleScores) { + if (it.guid == s.esrguid) { + select = s.extension1 == "true" + break + } + } + }) + } else { + r.sub1.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 + } + } + }) + } + } + } + } + } + } + } + + return resultList + + } } \ No newline at end of file -- Gitblit v1.9.3