feiyu02
2024-09-25 0516cba27e632f20efac2752787f38f0c87baafa
1. 新增自动评估添加和更新接口
已修改39个文件
已删除1个文件
已添加5个文件
1630 ■■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/business/AutoScore2.kt 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopOutput.kt 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopEvaluation.kt 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreItem.kt 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/ScoreUtil.kt 166 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem5.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem7.kt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluation.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Itemevaluation.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SceneDeviceMapper.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/InspectionRep.kt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ItemevaluationService.kt 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/MediafileService.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt 140 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationSubRuleVo.kt 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt 284 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionVo.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemEvaluationVo.kt 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemevaluationVo.kt 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MediaFileVo.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreDetail.kt 169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ItemevaluationController.kt 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImplTest.kt 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 @@
    }
    //按照父id查找子评分项
    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 {
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) {
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 }
        // åœºæ™¯å’Œç›‘测点的匹配关系
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)
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()
        }
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopEvaluation.kt
@@ -122,8 +122,20 @@
    /**
     * æ‰§è¡Œè¯„分逻辑
     */
    private fun execute(source: AopDataSource) {
        //获取数据源(待评估的场景)
    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)
                }
            }
        }
        // å½“针对场景进行评估时,要包括该场景当月可能存在的复核巡查情况
        else {
        //循环处理每个场景
        source.loop { index, evaluationScene ->
            if (evaluationScene.noRecord()) return@loop
@@ -134,16 +146,17 @@
            }
        }
    }
    }
    /**
     * æ¡ç›®æ‰“分
     */
    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 {
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()
    }
}
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 è¯„估表中选中的评估条目主键id集合(必须是最深一层的评估条目)
     */
    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) {
//                // å‡åˆ†æ¨¡å¼ï¼Œè®°å½•为扣分(负数)
//                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
        return Pair(evaluation, itemList)
            }
            rule.extension1 = s.toString()
    /**
     * æ›´æ–°è¯„估记录结果
     * @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()
        }
    /**
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.*
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
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 {
        //问题审核
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
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]类型,
 * ç›®å‰ä¸»è¦å½±å“äº†å®‰å“APP程序,将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
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
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>
interface SceneDeviceMapper : MyMapper<SceneDevice?>
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)
    }
}
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)
        })
    }
}
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)
    }
    /**
     * èŽ·å–å„åœºæ™¯çš„é—®é¢˜å’Œæ•´æ”¹æ•°é‡ç»Ÿè®¡
     */
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)
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?> {
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)
        })
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
}
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 ä½¿ç”¨çš„评估规则id
     */
    fun createItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean
    fun updateItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean
}
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?>
}
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?>
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 }
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
            it.ertype ?: return@forEach
            result.addDetail(result.details, it, it.ertype!! - 1, subRuleScores, false)
                    }
                    selectMode = it.extension3
        result.calScore()
                    //如果有得分记录,则改变状态为选中
                    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
                                            }
                                        }
                                    })
                                }
                            }
                        }
                    }
                }
            }
        }
        return resultList
        return result
    }
}
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 @@
    }
    //根据子任务ID获取单项评估列表
    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("出现系统内部错误")
        }
    }
}
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和巡查任务id至少填写其中一个")
        }
        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
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转object
        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\\第三方监管app\\自动评分\\餐饮\\"
            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> {
        //根据子任务ID获取问题列表
        val problemListVo = mutableListOf<ProblemListVo>()
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}")
        }
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 }
            }
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) {
                    // å‡åˆ†æ¨¡å¼ï¼Œè®°å½•为扣分(负数)
                    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) {
            // å‡åˆ†æ¨¡å¼ï¼Œè®°å½•为扣分(负数)
            Constant.EvaGradeMode.MINUS_MODE.value -> {
                (0 - (maxscore ?: 0))
            }
            // åŠ åˆ†æ¨¡å¼ï¼Œè®°å½•ä¸ºå¾—åˆ†ï¼ˆæ­£æ•°ï¼‰
            Constant.EvaGradeMode.ADD_MODE.value -> {
                maxscore ?: 0
            }
            // é»˜è®¤å‡åˆ†æ¨¡å¼
            else -> {
                (0 - (maxscore ?: 0))
            }
        }
    }
    /**
     * èŽ·å–æœ€ç»ˆå¾—åˆ†ï¼ˆæ­£æ•°ï¼‰
     * ä¸€èˆ¬ç”¨äºŽè®¡ç®—总分时(总分通常情况下都为正数)
     */
    fun getFinalScore(): Int {
        return when (extension2) {
            // å‡åˆ†æ¨¡å¼ä¸‹ï¼Œè®°å½•为扣分,所以得分为总分减去扣分
            Constant.EvaGradeMode.MINUS_MODE.value -> {
                maxscore?.minus(abs(score)) ?: 0
            }
            // åŠ åˆ†æ¨¡å¼ï¼Œè®°å½•ä¸ºå¾—åˆ†ï¼Œç›´æŽ¥åŠ å…¥æ€»åˆ†
            Constant.EvaGradeMode.ADD_MODE.value -> {
                score
            }
            // é»˜è®¤å‡åˆ†æ¨¡å¼
            else -> {
                maxscore?.minus(abs(score)) ?: 0
            }
        }
    }
}
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: å‡åˆ†æ¨¡å¼ï¼›add_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: å‡åˆ†æ¨¡å¼ï¼›add_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: å‡åˆ†æ¨¡å¼ï¼›add_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
}
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
}
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()
            }
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ItemevaluationVo.kt
ÎļþÒÑɾ³ý
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MediaFileVo.kt
@@ -13,6 +13,7 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
class MediaFileVo : Mediafile() {
    companion object {
        /**
         * ç”Ÿæˆä¸€ä¸ªé—®é¢˜å›¾ç‰‡
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: å‡åˆ†æ¨¡å¼ï¼›add_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
                    }
                }
            }
        }
    }
}
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("新增场景设备信息")
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("评估总规则主键id") @RequestParam id: String
    ) = resPack { evaluationsubruleService.findByRuleId(id) }
    @ApiOperation("根据区县和场景类型查询评分子规则")
    @GetMapping("/search")
    fun search(
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,目前无需传入此参数,本接口统一为自动评估规则")
        @RequestParam(required = false) ruleId: String?,
        @ApiParam(value = "具体扣分条目主键(只传最小级别的评估项)") @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,目前无需传入此参数,本接口统一为自动评估规则")
        @RequestParam(required = false) ruleId: String?,
        @ApiParam(value = "具体扣分条目主键(只传最小级别的评估项)") @RequestBody itemList: List<String>,
    ) = resPack { itemevaluationService.updateItemEvaluation(subTaskId, ruleId, itemList) }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt
@@ -3,6 +3,8 @@
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
@@ -22,14 +24,28 @@
    @GetMapping("/{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或巡查任务id获取对应的所有任意拍图片,两个参数任选其一即可")
    @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)
    @PostMapping("/add")
    fun addProblem(@RequestParam("mediafileVoList") mediafileVoList: String, @RequestPart("Photos") files: Array<MultipartFile>) {
    fun addProblem(
        @RequestParam("mediafileVoList") mediafileVoList: String,
        @RequestPart("Photos") files: Array<MultipartFile>,
    ) {
        mediafileService.addMedifile(mediafileVoList,files)
    }
}
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("删除的问题图片id") @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("删除的整改图片id") @RequestParam("deleteImg") deleteImg: List<String>,
        @ApiParam("新增整改图片") @RequestPart("images") images: Array<MultipartFile>,
    ) = resPack { problemlistService.updateChange(problemId, deleteImg, images) }
    @ApiOperation(value = "通过任务查找问题")
    @GetMapping("/subtask")
    fun getBySubTask(
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()
        }
    }
}