feiyu02
2024-09-27 72a384981ec78139dbe919597b54efedcc7f33aa
1. 新增评估结果批量修改相关接口
已修改9个文件
已添加1个文件
104 ■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/file/TemplateScore.kt 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
@@ -79,7 +79,7 @@
            val name = "${districtName}${Constant.SceneType.getDes(sceneType)}自动评分"
            val bgTask = backgroundTaskCtrl.startNewTask(BgTaskType.AUTO_SCORE, id, name) {
                // ç›‘测数据分析入库
                dataAnalysis(districtCode, sceneType, taskId, year, month)
//                dataAnalysis(districtCode, sceneType, taskId, year, month)
                // è‡ªåŠ¨è¯„ä¼°è®¡ç®—å…¥åº“
                aopEvaluation.executeByTopTask(taskId, sceneType)
                // çŽ¯ä¿¡ç ç»“æžœè½¬æ¢å…¥åº“
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -94,14 +94,10 @@
        //1. æŸ¥æ‰¾ç‰¹å®šçš„巡查任务或者所有的计划巡查任务
        var taskSceneIdList = listOf<String>()
        val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true ||
            (config.startTime != null || config.endTime != null)
        ) {
        val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true) {
            dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().apply {
                    if (config.subTaskIdList?.isNotEmpty() == true) {
                        andIn("stguid", config.subTaskIdList)
                    }
                    andIn("stguid", config.subTaskIdList)
                    config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
                    config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
                    config.districtCode?.let { andEqualTo("districtcode", it) }
@@ -112,8 +108,9 @@
            taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config
                .sceneType, config.townCode).map { it.guid ?: "" }
            dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().andIn("scenseid", taskSceneIdList)
                    .andEqualTo("tguid", config.topTaskGuid)
                createCriteria().apply {
                    if (taskSceneIdList.isNotEmpty()) andIn("scenseid", taskSceneIdList)
                }.andEqualTo("tguid", config.topTaskGuid)
            })
        }
src/main/kotlin/cn/flightfeather/supervision/business/report/file/TemplateScore.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package cn.flightfeather.supervision.business.report.file
import cn.flightfeather.supervision.business.report.BaseExcel
import cn.flightfeather.supervision.business.report.BaseTemplate
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.business.report.template.ScoreAnalysisSummary
import cn.flightfeather.supervision.business.report.template.ScoreDetailSummary
/**
 * è‡ªåŠ¨è¯„ä¼°ç»“æžœä¸Šä¼ æ¨¡æ¿
 * @date 2024/9/27
 * @author feiyu02
 */
class TemplateScore(dataSource: DataSource) : BaseExcel(dataSource) {
    override val templates: List<BaseTemplate> = listOf(ScoreDetailSummary(dataSource), ScoreAnalysisSummary(dataSource))
    override val fileName: String = "规范性评估模板"
}
src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt
@@ -84,7 +84,7 @@
    }
    /**
     * è‡ªåŠ¨å¤„ç†è¡Œåˆå¹¶æ•°æ®
     * å†™å…¥excel
     */
    fun write(heads: List<Array<Any>>, contents: MutableList<Array<Any>>, workbook: HSSFWorkbook, sheetName: String
    = "sheet1") {
@@ -274,7 +274,7 @@
    }
    /**
     * è‡ªåŠ¨å¤„ç†è¡Œåˆå¹¶æ•°æ®
     * å†™å…¥excel
     */
    fun write2(out: OutputStream, heads: List<Array<Any>>, contents: MutableList<Array<Any>>, sheetName: String = "sheet1") {
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
@@ -7,6 +7,7 @@
import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo
import cn.flightfeather.supervision.lightshare.vo.BaseResponse
import cn.flightfeather.supervision.lightshare.vo.EvaluateResVo
import org.springframework.web.multipart.MultipartFile
import springfox.documentation.annotations.ApiIgnore
import javax.servlet.http.HttpServletResponse
@@ -43,4 +44,8 @@
    fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>?
    fun downloadAutoEvaluation(areaVo: AreaVo, forceUpdate: Boolean, response: HttpServletResponse): Boolean
    fun downloadAutoEvaTemplate(areaVo: AreaVo, response: HttpServletResponse)
    fun uploadAutoEvaluation(areaVo: AreaVo, file: MultipartFile): Boolean
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
@@ -1,24 +1,23 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.lightshare.vo.ScoreDetail
interface EvaluationsubruleService {
    fun findOne(id:String): Evaluationsubrule
    fun findOne(id:String): Evaluationsubrule2
    fun findAll(): MutableList<Evaluationsubrule>
    fun findAll(): MutableList<Evaluationsubrule2>
    fun save(evaluationsubrule: Evaluationsubrule): Int
    fun save(evaluationsubrule: Evaluationsubrule2): Int
    fun update(evaluationsubrule: Evaluationsubrule): Int
    fun update(evaluationsubrule: Evaluationsubrule2): Int
    fun delete(id:String): Int
    fun findByRuleId(erguid: String): List<Evaluationsubrule2>
    fun search(districtCode: String, sceneTypeId: String, version: String? = null): List<Evaluationsubrule>
    fun search(districtCode: String, sceneTypeId: String, version: String? = null): List<Evaluationsubrule2>
    fun getAutoScore(subTaskId: String): ScoreDetail
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
@@ -27,6 +27,7 @@
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
import org.springframework.web.multipart.MultipartFile
import tk.mybatis.mapper.entity.Example
import java.io.File
import java.util.*
@@ -326,4 +327,12 @@
            return true
        }
    }
    override fun downloadAutoEvaTemplate(areaVo: AreaVo, response: HttpServletResponse) {
        TODO("Not yet implemented")
    }
    override fun uploadAutoEvaluation(areaVo: AreaVo, file: MultipartFile): Boolean {
        TODO("Not yet implemented")
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
@@ -2,10 +2,10 @@
import cn.flightfeather.supervision.common.exception.BizException
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.mapper.EvaluationsubruleMapper2
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRuleRep
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
@@ -16,20 +16,20 @@
@Service
class EvaluationsubruleServiceImpl(
    val evaluationsubruleMapper: EvaluationsubruleMapper,
    val evaluationsubruleMapper: EvaluationsubruleMapper2,
    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)
    override fun findOne(id: String): Evaluationsubrule2 = evaluationsubruleMapper.selectByPrimaryKey(id)
    override fun findAll(): MutableList<Evaluationsubrule> = evaluationsubruleMapper.selectAll()
    override fun findAll(): MutableList<Evaluationsubrule2> = evaluationsubruleMapper.selectAll()
    override fun save(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.insert(evaluationsubrule)
    override fun save(evaluationsubrule: Evaluationsubrule2): Int = evaluationsubruleMapper.insert(evaluationsubrule)
    override fun update(evaluationsubrule: Evaluationsubrule): Int =
    override fun update(evaluationsubrule: Evaluationsubrule2): Int =
        evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule)
    override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id)
@@ -38,13 +38,13 @@
        return evaluationRuleRep.findSubRule(erguid)
    }
    override fun search(districtCode: String, sceneTypeId: String, version: String?): List<Evaluationsubrule> {
        val result = mutableListOf<Evaluationsubrule>()
    override fun search(districtCode: String, sceneTypeId: String, version: String?): List<Evaluationsubrule2> {
        val result = mutableListOf<Evaluationsubrule2>()
        evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
            createCriteria().andEqualTo("districtcode", districtCode)
                .andEqualTo("scensetypeid", sceneTypeId)
        }).takeIf { it.isNotEmpty() }?.get(0)?.let { rule ->
            evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule::class.java).apply {
            evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule2::class.java).apply {
                createCriteria().andEqualTo("erguid", rule.guid)
            })
        }?.also {
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
@@ -5,7 +5,9 @@
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 org.springframework.web.multipart.MultipartFile
import springfox.documentation.annotations.ApiIgnore
import javax.servlet.http.HttpServletResponse
@@ -71,7 +73,22 @@
    @ApiOperation(value = "下载自动评估结果")
    @PostMapping("/auto/record/download")
    fun downloadAutoEvaluation(
        @RequestBody areaVo: AreaVo, @RequestParam forceUpdate: Boolean,
        @ApiParam("区域条件信息") @RequestBody areaVo: AreaVo,
        @ApiParam("是否强制生成新的报告") @RequestParam forceUpdate: Boolean,
        @ApiIgnore response: HttpServletResponse,
    ) = resPack { evaluationService.downloadAutoEvaluation(areaVo, forceUpdate, response) }
    @ApiOperation(value = "下载自动评估结果导入模板")
    @PostMapping("/auto/record/template")
    fun downloadAutoEvaTemplate(
        @ApiParam("区域条件信息") @RequestBody areaVo: AreaVo,
        @ApiIgnore response: HttpServletResponse,
    ) = resPack { evaluationService.downloadAutoEvaTemplate(areaVo, response) }
    @ApiOperation(value = "上传自动评估结果")
    @PutMapping("/auto/record/upload")
    fun uploadAutoEvaluation(
        @ApiParam("区域条件信息") @RequestBody areaVo: AreaVo,
        @ApiParam("excel文件") @RequestPart("excel") file: MultipartFile,
    ) = resPack { evaluationService.uploadAutoEvaluation(areaVo, file) }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt
@@ -1,6 +1,6 @@
package cn.flightfeather.supervision.lightshare.web
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
@@ -15,10 +15,10 @@
    fun getAll() = evaluationsubruleService.findAll()
    @PutMapping
    fun add(@RequestBody evaluationsubrule: Evaluationsubrule) = evaluationsubruleService.save(evaluationsubrule)
    fun add(@RequestBody evaluationsubrule: Evaluationsubrule2) = evaluationsubruleService.save(evaluationsubrule)
    @PostMapping
    fun update(@RequestBody evaluationsubrule: Evaluationsubrule) = evaluationsubruleService.update(evaluationsubrule)
    fun update(@RequestBody evaluationsubrule: Evaluationsubrule2) = evaluationsubruleService.update(evaluationsubrule)
    @GetMapping("/{id}")
    fun getById(@PathVariable id: String) = evaluationsubruleService.findOne(id)