1. 修改自评逻辑中,问题整改的判断方式为已整改并且整改审核通过;
2. 新增评估详情获取接口;
已修改19个文件
已删除1个文件
已重命名2个文件
479 ■■■■■ 文件已修改
pom.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem1.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JAScore.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem1.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem8.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/storage/StScoreItem1.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem1.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrl.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/datasource/TestBean.kt 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt 168 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScoreVo.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrlTest.kt 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -34,6 +34,17 @@
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-quartz</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>spring-boot-starter-logging</artifactId>
                    <groupId>org.springframework.boot</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
            <exclusions>
                <exclusion>
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/XHFuDataAnalysis.kt
@@ -45,7 +45,11 @@
        val map = mutableMapOf<String?, MutableList<FumeDailyAnalysis?>>()
        fumeDailyAnalysisMapper.selectByExample(Example(FumeDailyAnalysis::class.java).apply {
            createCriteria().andBetween("fumeDate", evaluationScene.config?.startTime, evaluationScene.config?.endTime)
                .andIn("fumeDevId", deviceCodeList)
                .apply {
                    if (deviceCodeList.isNotEmpty()) {
                        andIn("fumeDevId", deviceCodeList)
                    }
                }
        }).forEach {
            if (!map.containsKey(it?.fumeDevId)) {
                map[it?.fumeDevId] = mutableListOf()
@@ -66,7 +70,9 @@
        } else {
            val code = deviceCodeList[0]
            fumeExceptionDataMapper.selectByExample(Example(FumeExceptionData::class.java).apply {
                createCriteria().andBetween("beginTime", evaluationScene.config?.startTime, evaluationScene.config?.endTime)
                createCriteria().andBetween("beginTime",
                    evaluationScene.config?.startTime,
                    evaluationScene.config?.endTime)
                    .andEqualTo("devId", code)
                    .andEqualTo("exception", "数据异常")
                    .andEqualTo("exceptionType", "0")
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/CsScoreItem1.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.business.autooutput.score.construction
import cn.flightfeather.supervision.business.autooutput.score.ScoreItem
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
@@ -44,7 +45,7 @@
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
            if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) {
                changed++
            }
        }
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/construction/JAScore.kt
@@ -48,7 +48,7 @@
     */
    private fun transform(oldS: Int): Int {
        return when {
            // åŸºæœ¬è§„范
            // åŸºæœ¬è§„范(90..94)和规范(>=95)
            oldS >= 90 -> 50
            // ä¸è§„范
            oldS >= 50 -> 30
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/mixingplant/MpScoreItem1.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.business.autooutput.score.mixingplant
import cn.flightfeather.supervision.business.autooutput.score.ScoreItem
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
@@ -44,7 +45,7 @@
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
            if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) {
                changed++
            }
        }
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/restaurant/ReScoreItem8.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.business.autooutput.score.restaurant
import cn.flightfeather.supervision.business.autooutput.score.ScoreItem
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
@@ -44,7 +45,7 @@
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
            if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) {
                changed++
            }
        }
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/storage/StScoreItem1.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.business.autooutput.score.storage
import cn.flightfeather.supervision.business.autooutput.score.ScoreItem
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
@@ -44,7 +45,7 @@
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
            if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) {
                changed++
            }
        }
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/wharf/WhScoreItem1.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.business.autooutput.score.wharf
import cn.flightfeather.supervision.business.autooutput.score.ScoreItem
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
@@ -44,7 +45,7 @@
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
            if (it.ischanged == true && it.extension3 == Constant.CHANGE_CHECK_PASS) {
                changed++
            }
        }
src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrl.kt
ÎļþÃû´Ó src/main/kotlin/cn/flightfeather/supervision/business/bgtask/JingAnScoreTaskCtrl.kt ÐÞ¸Ä
@@ -11,7 +11,7 @@
 * é™å®‰åŒº50分制评分转换任务
 */
@Component
class JingAnScoreTaskCtrl(
class JinAnScoreTaskCtrl(
    private val backgroundTaskCtrl: BackgroundTaskCtrl,
    private val jaScore: JAScore,
    private val evaluationRep: EvaluationRep
@@ -20,7 +20,7 @@
    /**
     * é™å®‰å·¥åœ°åˆ†æ•°è½¬æ¢ä»»åŠ¡
     */
    fun startTaskJingAn(startTime: LocalDateTime) {
    fun startTaskJinAn(startTime: LocalDateTime) {
        startTask("31", "3100", "310106", startTime)
    }
src/main/kotlin/cn/flightfeather/supervision/datasource/TestBean.kt
ÎļþÒÑɾ³ý
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt
@@ -2,7 +2,9 @@
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper2
import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
@@ -13,12 +15,14 @@
@Repository
class EvaluationRuleRep(
    private val evaluationruleMapper: EvaluationruleMapper,
    private val evaluationsubruleMapper2: EvaluationsubruleMapper2,
    private val sceneRep: SceneRep,
) {
    /**
     * æ ¹æ®å‚数查询总规则
     * @param areaEvaVo æŸ¥è¯¢å‚æ•°
     * @return
     */
    fun findBaseRule(areaEvaVo: AreaEvaVo): List<Evaluationrule?> {
        return evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
@@ -32,11 +36,22 @@
        })
    }
    /**
     * æ ¹æ®å·¡æŸ¥ä»»åŠ¡id找到对应自动评估规则
     * @param subTaskId
     * @return
     */
    fun findAutoEvaluationRule(subTaskId:String): Evaluationrule? {
        val scene = sceneRep.findBySubTask(subTaskId)
        return findAutoEvaluationRule(Constant.SceneType.getByValue(scene?.typeid.toString()))
    }
    /**
     * æ ¹æ®åœºæ™¯ç±»åž‹æ‰¾åˆ°è‡ªåŠ¨è¯„ä¼°è§„åˆ™
     * è‡ªåŠ¨è¯„ä¼°è§„åˆ™å‚æ•°[Evaluationrule.tasktypeid] = 99
     * @param sceneType
     * @return
     */
    fun findAutoEvaluationRule(sceneType: Constant.SceneType): Evaluationrule? {
        return evaluationruleMapper.selectOne(Evaluationrule().apply {
            scensetypeid = sceneType.value.toByteOrNull()
@@ -44,4 +59,16 @@
        })
    }
    /**
     * æ ¹æ®æ€»è§„则id找到子规则
     * @param ruleId
     * @return
     */
    fun findSubRule(ruleId: String?): List<Evaluationsubrule2> {
        return evaluationsubruleMapper2.selectByExample(Example(Evaluationsubrule2::class.java).apply {
            createCriteria().andEqualTo("erguid", ruleId)
            orderBy("ertype").orderBy("displayid")
        })
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt
@@ -24,4 +24,6 @@
    fun searchSubTaskByKeyword(userId: String, keyword: String, page: Int, perPage: Int): BaseResponse<List<SubtaskVo>>
    fun getDailyReport(config: ExcelConfigVo): BaseTableVo
    fun getScoreDetail(subTaskId: String): ScoreDetail
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
@@ -1,5 +1,6 @@
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.mapper.EvaluationruleMapper
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper
@@ -58,12 +59,10 @@
    override fun getAutoScore(subTaskId: String): List<EvaluationVo> {
        //子规则逐条得分
        val subRuleScores = evaluationRep.findItemEvaluation(subTaskId)
        //总规则id
        val ruleId = mutableListOf<Evaluation>()
        //评分总规则
        val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId)
        val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) ?: throw BizException("未找到相关自动评估规则")
        //总规则对应的评分子规则
        val subRules = mutableListOf<Evaluationsubrule2>()
        val subRules = evaluationRuleRep.findSubRule(rule.guid)
        //查询结果
        val resultList = mutableListOf<EvaluationVo>()
@@ -72,10 +71,10 @@
            when (it.ertype) {
                2 -> resultList.add(EvaluationVo().apply {
                    id = it.guid
                    title1 = it.itemname
                    title = it.itemname
                    scoreMode = it.extension1
                    gradeMode = it.extension2
                    score = when (gradeMode) {
                    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
@@ -93,7 +92,7 @@
                3 -> {
                    for (r in resultList) {
                        if (it.fatherid == r.id) {
                            r.sub1.add(SubEvaluationVo().apply {
                            r.subList.add(SubEvaluationVo().apply {
                                id = it.guid
                                title2 = it.itemname
                                gradeMode = it.extension2
@@ -121,24 +120,24 @@
                    resultList.forEach{ r ->
                        //4级的评估项直接附属于2级评估项
                        if (r.id == it.fatherid) {
                            if (r.sub1.isEmpty()) {
                                r.sub1.add(SubEvaluationVo().apply {
                            if (r.subList.isEmpty()) {
                                r.subList.add(SubEvaluationVo().apply {
                                    placeholder = true
                                    id = it.guid
                                    title2 = r.title1
                                    score = r.score
                                    title2 = r.title
                                    score = r.maxScore
                                    gradeMode = r.gradeMode
                                    selectMode = r.selectMode
                                    group = _group++
                                })
                            }
                            r.sub1[0].sub2.add(ThirdEvaluationVo().apply {
                            r.subList[0].sub2.add(ThirdEvaluationVo().apply {
                                id = it.guid
                                content = it.itemname
                                score = when (r.sub1[0].gradeMode) {
                                    "minus_mode" -> r.score.plus(it.maxscore ?: 0)
                                score = when (r.subList[0].gradeMode) {
                                    "minus_mode" -> r.maxScore.plus(it.maxscore ?: 0)
                                    "add_mode" -> it.maxscore ?: 0
                                    else -> r.score.plus(it.maxscore ?: 0)
                                    else -> r.maxScore.plus(it.maxscore ?: 0)
                                }
                                //如果有得分记录,则改变状态为选中
                                for (s in subRuleScores) {
@@ -149,7 +148,7 @@
                                }
                            })
                        } else {
                            r.sub1.forEach { sr ->
                            r.subList.forEach { sr ->
                                if (sr.id == it.fatherid){
                                    sr.sub2.add(ThirdEvaluationVo().apply {
                                        id = it.guid
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt
@@ -434,6 +434,7 @@
    override fun createOneScene(scense: Scense) {
        //1. æ’入场景表
        scense.townname = scense.townname?.trim()
        sceneRep.insert(scense)
        //2. ç”Ÿæˆå¯¹åº”账户信息
        val userInfo = userinfoService.createAccount(scense)
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
@@ -6,9 +6,12 @@
import cn.flightfeather.supervision.business.report.file.ReportThree
import cn.flightfeather.supervision.business.report.file.ReportTwo
import cn.flightfeather.supervision.business.report.template.*
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.*
import cn.flightfeather.supervision.domain.ds1.entity.*
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.ds2.mapper.LedgerRecordMapper
import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
@@ -57,8 +60,10 @@
        val ledgerRecordMapper: LedgerRecordMapper,
        val userMapMapper: UserMapMapper,
        val taskService: TaskService,
    private val evaluationRep: EvaluationRep,
    private val evaluationRuleRep: EvaluationRuleRep,
        @Value("\${filePath}") var filePath: String,
        @Value("\${imgPath}") var imgPath: String
    @Value("\${imgPath}") var imgPath: String,
) : SearchService {
    private val dateUtil = DateUtil()
@@ -252,7 +257,8 @@
        //建立第一层目录,包含所有的任务
        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
        var basePath =
            Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + "temp" + File.separator + time
        var file = File(basePath)
        var i = 1
        while (file.exists() && i <= 100) {
@@ -303,7 +309,8 @@
                mediafileMapper.selectByExample(Example(Mediafile::class.java).apply {
                    createCriteria().andEqualTo("businessguid", p.guid)
                }).forEach { m ->
                    val picPath = Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + m.extension1 + m.guid + ".jpg"
                    val picPath =
                        Constant.DEFAULT_FILE_PATH + File.separator + "images" + 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)
@@ -343,7 +350,8 @@
        //建立第一层目录,包含所有的任务
        val topTask = taskMapper.selectByPrimaryKey(topTaskId)
        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
        val basePath =
            Constant.DEFAULT_FILE_PATH + File.separator + "images" + File.separator + "temp" + File.separator + topTask.name
        val file = File(basePath)
        if (!file.exists()) {
            file.mkdirs()
@@ -452,7 +460,13 @@
        return response
    }
    override fun searchScore4JingAn(token: String, year: Int, month: Int, page: Int?, perPage: Int?): BaseResponse<List<ScoreVo>> {
    override fun searchScore4JingAn(
        token: String,
        year: Int,
        month: Int,
        page: Int?,
        perPage: Int?,
    ): BaseResponse<List<ScoreVo>> {
        if (token != "jingan") {
            return BaseResponse(false)
        }
@@ -475,7 +489,12 @@
        return BaseResponse(true, head = DataHead(p.pageNum, p.pages), data = result)
    }
    override fun searchSubTaskByKeyword(userId: String, keyword: String, page: Int, perPage: Int): BaseResponse<List<SubtaskVo>> {
    override fun searchSubTaskByKeyword(
        userId: String,
        keyword: String,
        page: Int,
        perPage: Int,
    ): BaseResponse<List<SubtaskVo>> {
        val userInfo = userinfoMapper.selectByPrimaryKey(userId)
        if (userInfo.usertypeid?.toInt() == 3) return BaseResponse(false, "企业用户无查询权限")//企业用户无法查询
        val result = mutableListOf<SubtaskVo>()
@@ -517,7 +536,8 @@
            evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper,
            ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper
        )
        val task = taskService.getByDistrictCode(config.districtCode, config.startTime)?.takeIf { it.isNotEmpty() }?.get(0)
        val task =
            taskService.getByDistrictCode(config.districtCode, config.startTime)?.takeIf { it.isNotEmpty() }?.get(0)
        config.topTaskGuid = task?.tguid ?: ""
        val dataSource = mutableListOf<DataSource>()
        config.sceneType = Constant.SceneType.TYPE1.value.toInt()
@@ -538,4 +558,23 @@
        return BaseTableVo(result.first, result.second)
    }
    override fun getScoreDetail(subTaskId: String): ScoreDetail {
        //子规则逐条得分
        val subRuleScores = evaluationRep.findItemEvaluation(subTaskId)
        //评分总规则
        val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) ?: throw BizException("未找到相关自动评估规则")
        //总规则对应的评分子规则
        val subRules = evaluationRuleRep.findSubRule(rule.guid)
        //查询结果
        val result = ScoreDetail()
        subRules.forEach {
            it.ertype ?: return@forEach
            result.addDetail(result.details, it, it.ertype!! - 1, subRuleScores, true)
        }
        result.calScore()
        return result
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
@@ -596,89 +596,19 @@
            }
        }
//        val example = Example(Subtask::class.java).apply {
//            createCriteria().andEqualTo("districtcode", _districtCode)
//                    .andGreaterThanOrEqualTo("planstarttime", _startTime)
//                    .andLessThanOrEqualTo("planendtime", _endTime)
//        }
//
//        var counts = 0
//
//        val  p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30)
//
//        subtaskMapper.selectByExample(example).forEach { s ->
//
//            val scene = scenseMapper.selectByPrimaryKey(s.scenseid)
//            val inspection = inspectionMapper.selectByExample(Example(Inspection::class.java).apply {
//                createCriteria().andEqualTo("stguid", s.stguid)
//            }).takeIf { it.isNotEmpty() }?.get(0)
//            val evaluation = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply {
//                createCriteria().andEqualTo("stguid", s.stguid)
//            }).takeIf { it.isNotEmpty() }?.get(0)
//
//            if (scene.typeid != _sceneType.toByte()) {
//                return@forEach
//            } else {
//                counts++
//            }
//
//
//            val subtaskSearchResultVo = SubtaskSearchResultVo().apply {
//                this.subTaskId = s.stguid
//                this.districtName = scene.districtname
//                this.townName = scene.townname
//                this.sceneName = scene.name
//                this.sceneAddress = scene.location
//                this.planStartTime = s.planstarttime
//                this.planEndTime = s.planendtime
//                this.status = s.status
//                this.path= inspection?.extension1
//                this.score = evaluation?.resultscorebef?.toIntOrNull()
//                this.level = when {
//                    score == null -> null
//                    score!! >= 54 -> "合格"
//                    else -> "不合格"
//                }
//            }
//            tempResult.data.add(subtaskSearchResultVo)
//
//            problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
//                createCriteria().andEqualTo("stguid", s.stguid)
//            }).forEach { p ->
//                val problem = ProblemDetail().apply {
//                    this.problemId = p.guid
//                    this.problemName = p.problemname
//                    this.longitude = p.longitude?.toDouble()
//                    this.latitude = p.latitude?.toDouble()
//                    this.location = p.location
//                    this.rectification = p.ischanged
//                    this.rectificationTime = p.changedtime
//                }
//                subtaskSearchResultVo.problemList.add(problem)
//
//                mediafileMapper.selectByExample(Example(Mediafile::class.java).apply {
//                    createCriteria().andEqualTo("businessguid", p.guid)
//                }).forEach { m ->
//                    val url = m.extension1 + m.guid + ".jpg"
//                    if (m.ischanged == true) {
//                        problem.rectificationPics.add(url)
//                    } else {
//                        problem.problemPics.add(url)
//                    }
//                }
//            }
//        }
//
//        tempResult.head = DataHead().apply {
//            this.page = p.pageNum
//            this.totalPage = p.pages
//        }
        return result
    }
    override fun searchSubTask2(token: String, updateTime: String?, sceneType: Int?, districtCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<BaseSearchResultVo> {
    override fun searchSubTask2(
        token: String,
        updateTime: String?,
        sceneType: Int?,
        districtCode: String?,
        startTime: String?,
        endTime: String?,
        page: Int?,
        perPage: Int?,
    ): BaseResponse<BaseSearchResultVo> {
        if (token != "jinshan") {
            return BaseResponse(false, "请求token错误")
        }
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt
@@ -116,7 +116,7 @@
        scence.let {
            // åˆ¤æ–­è¯¥åœºæ™¯æ˜¯å¦å·²æœ‰å¯¹åº”账户
            val user = userInfoSVRep.findUser(it.guid)
            if (user != null) return Userinfo()
            if (user != null) return user
            val sceneName = it.name ?: return Userinfo()
            val uName = getUName(sceneName)
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt
@@ -1,44 +1,203 @@
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
/**
 * è¯„分规则及得分
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
class ScoreDetail {
    // æ€»åˆ†
    var totalScore: Int = 0
    // å¾—分
    var score: Int = 0
    // å¾—分细则
    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
            if (it.gradeMode == "minus_mode") {
                score += (it.score + it.maxScore)
            } else if (it.gradeMode == "add_mode") {
                score += it.score
            }
        }
    }
}
@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
                    }
                }
            }
        }
    }
}
@JsonInclude(JsonInclude.Include.NON_NULL)
class EvaluationVo {
    //规则id
    var id: String? = null
    //规则描述
    var title1: 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 sub1: MutableList<SubEvaluationVo> = mutableListOf()
    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()
}
@@ -46,10 +205,13 @@
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/ScoreVo.kt
@@ -2,6 +2,8 @@
class ScoreVo {
    var sceneId: String? = null
    var sceneName: String? = null
    var year: Int? = null
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt
@@ -5,6 +5,7 @@
import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*
import springfox.documentation.annotations.ApiIgnore
@@ -42,6 +43,12 @@
        @RequestParam("per_page", required = false) perPage: Int?
    ) = searchService.searchScore4JingAn(token, year, month, page, perPage)
    @ApiOperation(value = "查找巡查任务自动评估的评分细节")
    @GetMapping("/score/detail")
    fun getAutoScore(
        @ApiParam(value = "巡查任务id") @RequestParam subTaskId: String,
    ) = resPack { searchService.getScoreDetail(subTaskId) }
    @GetMapping("/subtask/jinshan")
    fun searchSubTask2(
        @RequestParam("token") token: String,
src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JinAnScoreTaskCtrlTest.kt
ÎļþÃû´Ó src/test/kotlin/cn/flightfeather/supervision/business/bgtask/JingAnScoreTaskCtrlTest.kt ÐÞ¸Ä
@@ -1,7 +1,6 @@
package cn.flightfeather.supervision.business.bgtask
import org.junit.Test
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
@@ -13,15 +12,15 @@
@RunWith(SpringRunner::class)
@ExtendWith(SpringExtension::class)
@SpringBootTest
class JingAnScoreTaskCtrlTest() {
class JinAnScoreTaskCtrlTest() {
    @Autowired
    lateinit var jingAnScoreTaskCtrl: JingAnScoreTaskCtrl
    lateinit var jinAnScoreTaskCtrl: JinAnScoreTaskCtrl
    @Test
    fun startTask() {
        var time = LocalDateTime.of(2023, 10, 1, 0, 0, 0)
        repeat(4) {
            jingAnScoreTaskCtrl.startTaskJingAn(time)
        var time = LocalDateTime.of(2024, 2, 1, 0, 0, 0)
        repeat(3) {
            jinAnScoreTaskCtrl.startTaskJinAn(time)
            time = time.plusMonths(1)
        }
    }
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt
@@ -44,26 +44,8 @@
    @Test
    fun createTZUserInfo() {
        val sId = listOf("lMqvVUjDrcAfb5l9",
            "iRn69RgMMJVCnvVy",
            "BHkeYXhWBIN7dpm4",
            "moT0gClykLAgTedp",
            "9tNfxmcUBspynqOB",
            "dXcHOIqFvFRSeKhg",
            "XNoilpfLZESw5DP0",
            "f4fOMCcBAtrmqDO7",
            "GyOZyyiouI15lfdZ",
            "k2FSexhq1Yj3GXAA",
            "K7FTWRkLFrfenq4G",
            "0nPo3EoR7K0JHq6d",
            "YHYxGucNfjkMjSLI",
            "ppzbVvgaqTbHLMFL",
            "eJcnnfg6joXLUlYN",
            "dSuH4hr66NAfflti",
            "Ba8jWakmIYexMxvK",
            "jYRzLMfB81qfOaec",
            "L5ABNgmzgqDLGWnw",
            "yYy88ocNnnZDreIK",
        val sId = listOf(
            "9jqhywmfvpgvxrT2"
        )
        sId.forEach {
            val scene = sceneRep.findScene(sceneId = it) ?: return@forEach