feiyu02
2024-09-10 6c7f45871b93ef26d353a5a3596701ac2f39ed9c
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
@@ -12,6 +12,7 @@
import cn.flightfeather.supervision.domain.ds1.mapper.*
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.domain.ds2.mapper.LedgerRecordMapper
import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
@@ -62,11 +63,10 @@
    val taskService: TaskService,
    private val evaluationRep: EvaluationRep,
    private val evaluationRuleRep: EvaluationRuleRep,
    private val sceneRep: SceneRep,
    @Value("\${filePath}") var filePath: String,
    @Value("\${imgPath}") var imgPath: String,
) : SearchService {
    private val dateUtil = DateUtil()
    override fun writeToFile(config: ExcelConfigVo, mode: Int) {
        val dbMapper = DbMapper(
@@ -256,9 +256,9 @@
        }
        //建立第一层目录,包含所有的任务
        val time = dateUtil.DateToString(Date(), "yyyy-MM-dd_HH-mm-ss")
        val time = DateUtil.DateToString(Date(), "yyyy-MM-dd_HH-mm-ss")
        var basePath =
            Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + "temp" + File.separator + time
            imgPath + File.separator + "temp" + File.separator + time
        var file = File(basePath)
        var i = 1
        while (file.exists() && i <= 100) {
@@ -310,7 +310,7 @@
                    createCriteria().andEqualTo("businessguid", p.guid)
                }).forEach { m ->
                    val picPath =
                        Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + m.extension1 + m.guid + ".jpg"
                        imgPath + File.separator + m.extension1 + m.guid + ".jpg"
                    val fromFile = File(picPath)
                    val picName = p.problemname + "_" + p.location + "($y).jpg"
                    val toFile = File(pPath + File.separator + picName)
@@ -349,9 +349,9 @@
    override fun downloadPic2(sceneType: Int, topTaskId: String, response: HttpServletResponse): HttpServletResponse {
        //建立第一层目录,包含所有的任务
        val topTask = taskMapper.selectByPrimaryKey(topTaskId)
        val time = dateUtil.DateToString(Date(), "yyyy-MM-dd_HH-mm-ss")
        val time = DateUtil.DateToString(Date(), "yyyy-MM-dd_HH-mm-ss")
        val basePath =
            Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + "temp" + File.separator + topTask.name
            imgPath + File.separator + "temp" + File.separator + topTask.name
        val file = File(basePath)
        if (!file.exists()) {
            file.mkdirs()
@@ -370,7 +370,7 @@
                //建立一个子任务文件夹
                var subTaskFilePath = "${basePath}${File.separator}(${
                    dateUtil.DateToString(
                    DateUtil.DateToString(
                        it.planstarttime,
                        DateUtil.DateStyle.YYYY_MM_DD_CN
                    )
@@ -420,7 +420,7 @@
                        u.forEach { f ->
                            val picPath =
                                Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + f.extension1 + f.guid + ".jpg"
                                imgPath + File.separator + f.extension1 + f.guid + ".jpg"
                            val fromFile = File(picPath)
                            val picName = f.description
                            val toFile = File(pPath + File.separator + picName)
@@ -560,15 +560,22 @@
    }
    override fun getScoreDetail(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 result = ScoreDetail()
        result.status = if (scene?.extension1.equals("1")) "在建" else "完工"
        result.updateTime = evaluation?.updatedate
        subRules.forEach {
            it.ertype ?: return@forEach
            result.addDetail(result.details, it, it.ertype!! - 1, subRuleScores, true)