feiyu02
2025-09-17 8c15c9cc0d6474ed77e313258f9b09f7f2d6366e
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt
@@ -9,7 +9,10 @@
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.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.lightshare.service.ItemevaluationService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.EvaluationUpdateVo
import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo
import org.springframework.beans.BeanUtils
import org.springframework.stereotype.Service
@@ -22,6 +25,7 @@
    private val aopOutput: AopOutput,
    private val aopSceneTypeCheck: AopSceneTypeCheck,
    private val subTaskRep: SubTaskRep,
    private val taskRep: TaskRep,
) : ItemevaluationService {
    //批量修改单项评估
@@ -84,7 +88,7 @@
            }
            return true
        } catch (e: Exception) {
            throw BizException("出现系统内部错误")
            throw BizException(e.message, e.cause)
        }
    }
@@ -103,7 +107,32 @@
            }
            return true
        } catch (e: Exception) {
            throw BizException("出现系统内部错误")
            throw BizException(e.message, e.cause)
        }
    }
    override fun updateMonitorDataEva(evaVo: EvaluationUpdateVo): Boolean {
        val task = taskRep.findOneTask(evaVo)
        val taskId = task?.tguid
        val sceneType = evaVo.scensetypeid?.toInt() ?: throw BizException("场景类型未设置,无法更新分数")
        val source = AopDataSource(aopDbMapper, aopSceneTypeCheck)
        source.setResource(taskId, sceneType, null, null)
        try {
            source.loop() { _, evaluationScene ->
                if (evaluationScene.noRecord()) return@loop
                evaVo.subTaskEvaList?.find {
                    it.subTaskId == evaluationScene.subTask.value?.stguid
                }?.let {stEva ->
                    // 将分数赋值到对应的评估规则下,并且自动计算其余规则的得分
                    ScoreUtil.scoreAssignSelected(evaluationScene, stEva.subRule)
                    // 获取总分和子项得分数据库表结构体,并入库
                    ScoreUtil.updateEvaRecord(evaluationScene)?.let { aopOutput.updateDbEvaluation(evaluationScene, it) }
                }
            }
            return true
        } catch (e: Exception) {
            throw BizException(e.message, e.cause)
        }
    }
}