feiyu02
2024-11-08 d2727f231319a48019bc3b87439136ab49b97b9b
1. 2024.11.08 修复部分bug
已修改29个文件
已添加6个文件
726 ■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/business/location/BasePlace.kt 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/location/LocationDistance.kt 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/location/UtilExcelDistance.kt 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/location/UtilFile.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/template/DailyReportSummary.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProductService.kt 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DomainitemService.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProductServiceImpl.kt 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt 4 ●●● 补丁 | 查看 | 原始文档 | 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 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MonitorObjectVersionVo.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProductController.kt 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DomainitemController.kt 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MenuController.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/location/BasePlace.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package cn.flightfeather.supervision.business.location
/**
 *
 * @date 2024/10/24
 * @author feiyu02
 */
data class BasePlace(
    val name: String,
    val sP: Pair<Double, Double>,
    val eP: Pair<Double, Double>,
)
src/main/kotlin/cn/flightfeather/supervision/business/location/LocationDistance.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,78 @@
package cn.flightfeather.supervision.business.location
import cn.flightfeather.supervision.common.utils.ExcelUtil
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
import kotlin.math.round
/**
 * è·ç¦»è®¡ç®—
 * @date 2024/10/24
 * @author feiyu02
 */
@Component
class LocationDistance(private val scenseMapper: ScenseMapper) {
    private val utilFile = UtilExcelDistance(mutableListOf(
        listOf(
            ExcelUtil.MyCell("监测点", colSpan = 1),
            ExcelUtil.MyCell("距离(公里)", colSpan = 1),
            ExcelUtil.MyCell("唯一序号", colSpan = 1),
            ExcelUtil.MyCell("单位名称", colSpan = 1),
            ExcelUtil.MyCell("类型", colSpan = 1),
            ExcelUtil.MyCell("单位地址", colSpan = 1),
            ExcelUtil.MyCell("经度", colSpan = 1),
            ExcelUtil.MyCell("纬度", colSpan = 1),
            ExcelUtil.MyCell("区县", colSpan = 1),
            ExcelUtil.MyCell("街道", colSpan = 1),
            ExcelUtil.MyCell("常用联系人", colSpan = 1),
            ExcelUtil.MyCell("联系方式", colSpan = 1),
        ).toTypedArray()
    ))
    fun searchList(pList: List<BasePlace>, districtName: String) {
        utilFile.reset()
        pList.forEach {
            val sceneList = findScenes(districtName)
            if (sceneList.isEmpty()) {
                utilFile.addRow(listOf(it.name))
            }
            sceneList.forEachIndexed { index, s ->
                var distance = CoordinateUtil.calculateDistance(
                    it.sP.first, it.sP.second,
                    s.longitude?.toDouble() ?: .0, s.latitude?.toDouble() ?: .0
                )
                distance = round(distance * 1000) / 1000
                utilFile.parseRow(listOf<Any>(
                    "",
                    distance,
                    s.index?.toDouble() ?: "",
                    s.name ?: "",
                    s.type ?: "",
                    s.location ?: "",
                    s.longitude?.toDouble() ?: .0,
                    s.latitude?.toDouble() ?: .0,
                    s.districtname ?: "",
                    s.townname ?: "",
                    s.contacts ?: "",
                    s.contactst ?: ""
                ).toTypedArray())
                if (index == 0) {
                    utilFile.updateLastRow(0, ExcelUtil.MyCell(it.name, sceneList.size))
                }
            }
            utilFile.index = 1
        }
        utilFile.outPutToFile(districtName)
    }
    private fun findScenes(districtName: String): List<Scense> {
        return scenseMapper.selectByExample(Example(Scense::class.java).apply {
            createCriteria().andEqualTo("districtname", districtName)
            and(createCriteria().orNotEqualTo("extension1", "0")
                .orIsNull("extension1"))
        })
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/location/UtilExcelDistance.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package cn.flightfeather.supervision.business.location
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.ExcelUtil
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import java.io.File
import java.io.FileOutputStream
import java.util.*
/**
 *
 * @date 2024/10/24
 * @author feiyu02
 */
class UtilExcelDistance(head: List<Array<Any>>) {
    private val heads = mutableListOf<Array<Any>>()
    private val contents = mutableListOf<Array<Any>>()
    var index = 1
    init {
        heads.addAll(head)
    }
    fun reset() {
        index = 1
        contents.clear()
    }
    fun addRow(row: List<Any>) {
        contents.add(row.toTypedArray())
    }
    fun updateLastRow(index: Int, cell: Any) {
        contents.last()[index] = cell
    }
    /**
     * ç”Ÿæˆä¸€è¡Œexcel数据
     */
    fun parseRow(row: Array<Any>) {
        contents.add(row)
        index++
    }
    fun outPutToFile(districtName: String) {
        val workbook = HSSFWorkbook()
        val fileName = "${districtName}点位距国控点距离-${DateUtil.DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls"
        val filePath = "C:\\work\\工作\\第三方监管\\点位距国控点距离\\$fileName"
        val file = File(filePath)
        if (!file.parentFile.exists()) {
            file.parentFile.mkdirs()
        }
        val out = FileOutputStream(file)
        ExcelUtil.write(heads, contents, workbook)
        workbook.write(out)
        workbook.close()
        out.flush()
        out.close()
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/location/UtilFile.kt
@@ -8,7 +8,7 @@
import java.io.FileOutputStream
import java.util.*
class UtilFile {
class UtilFile(head: List<ExcelUtil.MyCell>? = null) {
    private val heads = mutableListOf<Array<Any>>()
    private val contents = mutableListOf<Array<Any>>()
@@ -25,7 +25,7 @@
//            ExcelUtil.MyCell("守法自测自评", colSpan = 3),
//            ExcelUtil.MyCell("线上监管综合风险分析与对策", colSpan = 3),
//        )
        val h2 = listOf(
        val h2 = head ?: listOf(
            ExcelUtil.MyCell("路段", colSpan = 1),
            ExcelUtil.MyCell("序号", colSpan = 1),
            ExcelUtil.MyCell("单位名称", colSpan = 1),
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt
@@ -19,7 +19,7 @@
    // excel文档
    private var workbook = HSSFWorkbook()
    fun getReportName(): String = "${dataSource.areaName()}-${fileName}.xls"
    fun getReportName(): String = "${dataSource.areaName()}-${fileName}.xlsx"
    fun toFile(path: String) {
        val fileName = getReportName()
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt
@@ -81,19 +81,21 @@
        val c = mutableListOf<Array<Any>>()
        head.forEach { h.add(it.toTypedArray()) }
        contents.forEach { c.add(it.toTypedArray()) }
        val index = c[0][0]
        //按照第一列进行排序
        if (index is Int) {
            c.sortBy {
                if (it[0] is Int) {
                    it[0] as Int
                } else {
                    0
        if (c.isNotEmpty() && c[0].isNotEmpty()) {
            val index = c[0][0]
            //按照第一列进行排序
            if (index is Int) {
                c.sortBy {
                    if (it[0] is Int) {
                        it[0] as Int
                    } else {
                        0
                    }
                }
            }
        } else {
            c.sortBy {
                it[0].toString()
            } else {
                c.sortBy {
                    it[0].toString()
                }
            }
        }
        return Pair(h, c)
@@ -112,19 +114,21 @@
        contents.forEach {
            c.add(it.toTypedArray())
        }
        val index = c[0][0]
        //按照第一列进行排序
        if (index is Int) {
            c.sortBy {
                if (it[0] is Int) {
                    it[0] as Int
                } else {
                    0
        if (c.isNotEmpty() && c[0].isNotEmpty()) {
            val index = c[0][0]
            //按照第一列进行排序
            if (index is Int) {
                c.sortBy {
                    if (it[0] is Int) {
                        it[0] as Int
                    } else {
                        0
                    }
                }
            }
        } else {
            c.sortBy {
                it[0].toString()
            } else {
                c.sortBy {
                    it[0].toString()
                }
            }
        }
        return Pair(h, c)
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -59,7 +59,7 @@
     */
    fun reset() {
        rowData.index = 0
        rowData.subTask = sourceList.first()
        rowData.subTask = if (sourceList.isEmpty()) null else sourceList.first()
        rowData.clear()
    }
@@ -85,7 +85,7 @@
            })?.takeIf { it.isNotEmpty() }?.get(0)?.let { area = it.townname ?: "" }
        }
        dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid).let {
        dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid)?.let {
            val time = LocalDateTime.ofInstant(it.starttime?.toInstant(), ZoneId.systemDefault())
            this.year = time.year
            this.month = time.monthValue
@@ -93,41 +93,44 @@
        }
        //1. æŸ¥æ‰¾ç‰¹å®šçš„巡查任务或者所有的计划巡查任务
        var taskSceneIdList = listOf<String>()
        val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true) {
            dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().apply {
                    andIn("stguid", config.subTaskIdList)
                    config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
                    config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
                    config.districtCode?.let { andEqualTo("districtcode", it) }
//                    andEqualTo("tguid", config.topTaskGuid)
                }
            })
        } else {
            taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config
                .sceneType, config.townCode).map { it.guid ?: "" }
            dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
        val taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config.sceneType,
            config.townCode).map { it.guid ?: "" }
        // ç»Ÿè®¡æ€»ä»»åŠ¡ä¸‹æ‰€æœ‰åœºæ™¯
        if (config.allScene) {
            val subTaskList = dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().apply {
                    if (taskSceneIdList.isNotEmpty()) andIn("scenseid", taskSceneIdList)
                }.andEqualTo("tguid", config.topTaskGuid)
            })
        }
        if (taskSceneIdList.isNotEmpty()) {
            taskSceneIdList.forEach {
                var subtask: Subtask? = null
                for (s in subTaskList) {
                    if (s.scenseid == it) {
                        subtask = s
                        result.add(s)
            // ç»™è¿˜æœªå·¡æŸ¥çš„场景生成空的子任务对象
            if (taskSceneIdList.isNotEmpty()) {
                taskSceneIdList.forEach {
                    var subtask: Subtask? = null
                    for (s in subTaskList) {
                        if (s.scenseid == it) {
                            subtask = s
                            result.add(s)
                        }
                    }
                    if (subtask == null) {
                        result.add(Subtask().apply { scenseid = it })
                    }
                }
                if (subtask == null) {
                    result.add(Subtask().apply { scenseid = it })
                }
            } else {
                result.addAll(subTaskList)
            }
        } else {
        }
        else {
            val subTaskList = dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                    createCriteria().apply {
                        if (config.subTaskIdList?.isNotEmpty() == true) andIn("stguid", config.subTaskIdList)
                        config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
                        config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
                        config.districtCode?.let { andEqualTo("districtcode", it) }
                        andEqualTo("tguid", config.topTaskGuid)
                    }
                })
            result.addAll(subTaskList)
        }
src/main/kotlin/cn/flightfeather/supervision/business/report/template/DailyReportSummary.kt
@@ -14,7 +14,7 @@
        ColSceneName(),
        ColSceneBaseInfo(),
        ColTown(),
        ColInspectionInfo(listOf(2, 3, 4, 5, 7, 8, 9))
        ColInspectionInfo(listOf(0, 2, 3, 4, 5, 7, 8, 9))
    )
    override val templateName: String = "日报统计"
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
@@ -244,5 +244,12 @@
        const val RESTAURANT_LOCATION_ID = "bMpvxuqHlB1CTYfh"
        // æ±½ä¿®é—®é¢˜ä½ç½®
        const val Vehicle_LOCATION_ID = "PuToYNqdSLFQSSYk"
        // ä»»åŠ¡ç±»åž‹
        const val DOMAIN_GUID_TASK_TYPE = "qASRIAjgSfCuvJOi"
        // ä»»åŠ¡æœŸé™ç±»åž‹
        const val DOMAIN_GUID_TASK_DEADLINE_TYPE = "cS9MAkmXN1S37Tbv"
        // ä»»åŠ¡å±‚æ¬¡
        const val DOMAIN_GUID_TASK_LEVEL = "TzbIi3ckPWMzlsH6"
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DataProductService.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
import javax.servlet.http.HttpServletResponse
/**
 *
 * @date 2024/10/18
 * @author feiyu02
 */
interface DataProductService {
    /**
     * ä¸‹è½½æ•°æ®äº§å“æŠ¥å‘Š
     */
    fun downloadProduct(areaVo: AreaVo, type: Int, forceUpdate: Boolean, response: HttpServletResponse): Boolean
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DomainitemService.kt
@@ -22,4 +22,10 @@
    fun findByLogName(name: String): List<DomainitemVo>
    fun getLocation(sceneType: Int): List<Domainitem>
    fun getTaskType(): List<Domainitem>
    fun getDeadlineType(): List<Domainitem>
    fun getLevelType(): List<Domainitem>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
@@ -1,5 +1,6 @@
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
@@ -7,7 +8,7 @@
interface EvaluationsubruleService {
    fun findOne(id:String): Evaluationsubrule2
    fun findAll(): MutableList<Evaluationsubrule2>
    fun findAll(): MutableList<Evaluationsubrule>
    fun save(evaluationsubrule: Evaluationsubrule2): Int
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt
@@ -14,6 +14,12 @@
    fun update(subtask: Subtask): Int
    /**
     * å˜æ›´å·¡æŸ¥ä»»åŠ¡çŠ¶æ€
     * æ‰§è¡Œä»»åŠ¡æˆ–ç»“æŸä»»åŠ¡
     */
    fun changeStatus(subtask: Subtask): Int
    fun delete(id: String): Int
    fun getTaskPackList(date: String, guid: String, type: String): List<TaskPack>
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt
@@ -14,6 +14,8 @@
    fun save(task: Task): Int
    fun create(task: Task): Task
    fun update(task: Task): Int
    fun delete(id: String): Int
@@ -38,7 +40,7 @@
    fun getDayTaskByTaskID(taskid: String): List<TaskVo>
    fun findByDate(date: String): TaskVo
    fun findByDate(topTaskId: String, date: String): TaskVo
    fun getTaskProgress(userid: String): List<TaskVo>//获取顶层任务对应的子任务完成量
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt
@@ -12,7 +12,7 @@
    fun findAll(): MutableList<Userinfo>
    fun findByType(typeId: Byte): List<Userinfo>
    fun findByType(typeId: Byte, enable: Boolean?): List<Userinfo>
    fun save(userinfo: Userinfo): Int
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DataProductServiceImpl.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,81 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.bgtask.ReportTaskCtrl
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.business.report.DbMapper
import cn.flightfeather.supervision.business.report.file.ReportOne
import cn.flightfeather.supervision.business.report.file.ReportThree
import cn.flightfeather.supervision.business.report.file.ReportTwo
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.lightshare.service.DataProductService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.HttpHeaders
import org.springframework.http.MediaType
import org.springframework.stereotype.Service
import java.io.File
import java.util.*
import javax.servlet.http.HttpServletResponse
/**
 *
 * @date 2024/10/18
 * @author feiyu02
 */
@Service
class DataProductServiceImpl(
    private val taskRep: TaskRep,
    private val dbMapper: DbMapper,
    @Value("\${filePath}") private val filePath: String,
    private val reportTaskCtrl: ReportTaskCtrl,
) : DataProductService {
    override fun downloadProduct(
        areaVo: AreaVo, type: Int, forceUpdate: Boolean, response: HttpServletResponse,
    ): Boolean {
        areaVo.scensetypeid ?: throw BizException("必须选择一个场景类型")
        val topTask = taskRep.findOneTask(areaVo) ?: throw BizException("未找到符合条件的顶层任务")
        val config = ExcelConfigVo(
            topTask.tguid ?: "",
            topTask.starttime,
            topTask.endtime,
            topTask.provincecode,
            topTask.citycode,
            topTask.districtcode,
            topTask.towncode,
            areaVo.scensetypeid?.toInt(),
            forceUpdate = forceUpdate
        )
        val dataSource = DataSource(config, dbMapper)
        val t = when (type) {
            1 -> ReportOne(dataSource)
            2 -> ReportTwo(dataSource)
            3 -> ReportThree(dataSource)
            else -> throw BizException("未指定数据产品类型,无法下载")
        }
        val fileName = t.getReportName()
        val p = "$filePath/autoscore/"
        val file = File(p + fileName)
        if (config.forceUpdate || !file.exists()) {
            val downloadUrl = "/autoscore/${fileName}"
            reportTaskCtrl.startTask(t, downloadUrl)
            return false
        } else {
            val fName = Base64.getEncoder().encodeToString(fileName.toByteArray())
            response.apply {
                setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=$fName")
                setHeader("fileName", fName)
                addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "fileName")
                contentType = "application/vnd.ms-excel;charset=UTF-8"
//                contentType = MediaType.APPLICATION_OCTET_STREAM_VALUE
                setHeader(HttpHeaders.PRAGMA, "no-cache")
                setHeader(HttpHeaders.CACHE_CONTROL, "no-cache")
                setDateHeader(HttpHeaders.EXPIRES, 0)
            }
            response.outputStream.write(file.readBytes())
            return true
        }
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt
@@ -96,4 +96,25 @@
            orderBy("index")
        })
    }
    override fun getTaskType(): List<Domainitem> {
        return domainitemMapper.selectByExample(Example(Domainitem::class.java).apply {
            createCriteria().andEqualTo("dcguid", Constant.DOMAIN_GUID_TASK_TYPE)
            orderBy("index")
        })
    }
    override fun getDeadlineType(): List<Domainitem> {
        return domainitemMapper.selectByExample(Example(Domainitem::class.java).apply {
            createCriteria().andEqualTo("dcguid", Constant.DOMAIN_GUID_TASK_DEADLINE_TYPE)
            orderBy("index")
        })
    }
    override fun getLevelType(): List<Domainitem> {
        return domainitemMapper.selectByExample(Example(Domainitem::class.java).apply {
            createCriteria().andEqualTo("dcguid", Constant.DOMAIN_GUID_TASK_LEVEL)
            orderBy("index")
        })
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
@@ -40,7 +40,6 @@
    private val evaluationRep: EvaluationRep,
    private val taskRep: TaskRep,
    private val aopTaskCtrl: AopTaskCtrl,
    private val searchService: SearchService,
    private val dbMapper: DbMapper,
    @Value("\${filePath}") private val filePath: String,
    private val reportTaskCtrl: ReportTaskCtrl,
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
@@ -2,6 +2,7 @@
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
@@ -16,23 +17,24 @@
@Service
class EvaluationsubruleServiceImpl(
    val evaluationsubruleMapper: EvaluationsubruleMapper2,
    val evaluationsubruleMapper2: EvaluationsubruleMapper2,
    val evaluationsubruleMapper: EvaluationsubruleMapper,
    val evaluationruleMapper: EvaluationruleMapper,
    private val evaluationRep: EvaluationRep,
    private val evaluationRuleRep: EvaluationRuleRep,
    private val sceneRep: SceneRep,
) : EvaluationsubruleService {
    override fun findOne(id: String): Evaluationsubrule2 = evaluationsubruleMapper.selectByPrimaryKey(id)
    override fun findOne(id: String): Evaluationsubrule2 = evaluationsubruleMapper2.selectByPrimaryKey(id)
    override fun findAll(): MutableList<Evaluationsubrule2> = evaluationsubruleMapper.selectAll()
    override fun findAll(): MutableList<Evaluationsubrule> = evaluationsubruleMapper.selectAll()
    override fun save(evaluationsubrule: Evaluationsubrule2): Int = evaluationsubruleMapper.insert(evaluationsubrule)
    override fun save(evaluationsubrule: Evaluationsubrule2): Int = evaluationsubruleMapper2.insert(evaluationsubrule)
    override fun update(evaluationsubrule: Evaluationsubrule2): Int =
        evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule)
        evaluationsubruleMapper2.updateByPrimaryKey(evaluationsubrule)
    override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id)
    override fun delete(id: String): Int = evaluationsubruleMapper2.deleteByPrimaryKey(id)
    override fun findByRuleId(erguid: String): List<Evaluationsubrule2> {
        return evaluationRuleRep.findSubRule(erguid)
@@ -44,7 +46,7 @@
            createCriteria().andEqualTo("districtcode", districtCode)
                .andEqualTo("scensetypeid", sceneTypeId)
        }).takeIf { it.isNotEmpty() }?.get(0)?.let { rule ->
            evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule2::class.java).apply {
            evaluationsubruleMapper2.selectByExample(Example(Evaluationsubrule2::class.java).apply {
                createCriteria().andEqualTo("erguid", rule.guid)
            })
        }?.also {
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt
@@ -39,7 +39,8 @@
        val monitorobjectversionlist = monitorobjectversionMapper.select(monitorobjectversion)
        return monitorobjectversionlist.filter {
            val usedCount = it.extension1 ?: "0";it.monitornum.toString().toInt() - usedCount.toInt() > 0
            val usedCount = it.extension1 ?: "0"
            it.monitornum.toString().toInt() - usedCount.toInt() > 0
        }.sortedBy { it.displayid }
    }
@@ -75,6 +76,7 @@
                if (vo.sguid == scene.guid) {
                    vo.sceneTypeId = scene.typeid?.toInt() ?: 0
                    vo.sceneType = scene.type
                    vo.scene = scene
                    return@f
                }
            }
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.bgtask.ReportTaskCtrl
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.business.report.DbMapper
import cn.flightfeather.supervision.business.report.file.ReportOne
@@ -66,6 +67,8 @@
    private val sceneRep: SceneRep,
    @Value("\${filePath}") var filePath: String,
    @Value("\${imgPath}") var imgPath: String,
    private val dbMapper: DbMapper,
    private val reportTaskCtrl: ReportTaskCtrl,
) : SearchService {
    override fun writeToFile(config: ExcelConfigVo, mode: Int) {
@@ -96,20 +99,6 @@
    }
    override fun getExcel(config: ExcelConfigVo, response: HttpServletResponse): Boolean {
        val dbMapper = DbMapper(
            scenseMapper,
            problemlistMapper,
            problemtypeMapper,
            subtaskMapper,
            monitorobjectversionMapper,
            sceneConstructionSiteMapper,
            sceneMixingPlantMapper,
            sceneStorageYardMapper,
            sceneWharfMapper,
            taskMapper,
            evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper,
            ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper
        )
        val dataSource = DataSource(config, dbMapper)
        val t = when (config.mode) {
            1 -> ReportOne(dataSource)
@@ -119,25 +108,26 @@
            else -> ReportOne(dataSource)
        }
        val fileName = t.getReportName()
        val fName = URLEncoder.encode(fileName, "UTF-8")
        response.apply {
            setHeader("Content-Disposition", "attachment;filename=$fName")
            setHeader("fileName", fName)
            addHeader("Access-Control-Expose-Headers", "fileName")
            contentType = "application/vnd.ms-excel;charset=UTF-8"
            setHeader("Pragma", "no-cache")
            setHeader("Cache-Control", "no-cache")
            setDateHeader("Expires", 0)
        }
        val p = "$filePath/autoscore/"
        val file = File(p + fileName)
        if (config.forceUpdate || !file.exists()) {
            t.toFile(p)
            val downloadUrl = "/autoscore/${fileName}"
            reportTaskCtrl.startTask(t, downloadUrl)
            return false
        } else {
            val fName = Base64.getEncoder().encodeToString(fileName.toByteArray())
            response.apply {
                setHeader("Content-Disposition", "attachment;filename=$fName")
                setHeader("fileName", fName)
                addHeader("Access-Control-Expose-Headers", "fileName")
                contentType = "application/vnd.ms-excel;charset=UTF-8"
                setHeader("Pragma", "no-cache")
                setHeader("Cache-Control", "no-cache")
                setDateHeader("Expires", 0)
            }
            response.outputStream.write(file.readBytes())
            return true
        }
        response.outputStream.write(file.readBytes())
        return true
    }
    override fun getSubTaskDetail(config: ExcelConfigVo): SubTaskTableVo {
@@ -537,10 +527,11 @@
            ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper
        )
        val task =
            taskService.getByDistrictCode(config.districtCode, config.startTime)?.takeIf { it.isNotEmpty() }?.get(0)
            taskService.getByDistrictCode(config.districtCode, config.startTime).takeIf { it.isNotEmpty() }?.get(0)
        config.topTaskGuid = task?.tguid ?: ""
        config.allScene = false
        val dataSource = mutableListOf<DataSource>()
        config.sceneType = Constant.SceneType.TYPE1.value.toInt()
//        config.sceneType = Constant.SceneType.TYPE1.value.toInt()
        dataSource.add(DataSource(config, dbMapper))
//        val config2 = config.copy(sceneType = Constant.ScenseType.TYPE2.value.toInt())
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
@@ -149,6 +149,7 @@
    @Transactional
    override fun saveList(subtasklist: List<Subtask>): Int {
        subtasklist.forEach {
            if (it.stguid == null) it.stguid = UUIDGenerator.generate16ShortUUID()
            subtaskMapper.insert(it)
        }
        return subtasklist.size
@@ -383,18 +384,21 @@
    override fun findAll(): MutableList<Subtask> = subtaskMapper.selectAll()
    override fun save(subtask: Subtask): Int = subtaskMapper.insert(subtask)
    override fun save(subtask: Subtask): Int {
        if (subtask.stguid == null) subtask.stguid = UUIDGenerator.generate16ShortUUID()
        return subtaskMapper.insert(subtask)
    }
    //更新子任务
    override fun update(subtask: Subtask): Int {
        var res = 0
        //根据子任务guid获取顶层任务
        val toptaskVo = taskService.findByID(subtask.tguid.toString())
//        //根据日期获取日任务
//        val daytaskVo = taskService.findByDate(DateUtil.getDate(subtask.planstarttime)!!)
        val daytaskVo = taskService.findByDate(subtask.tguid!!, DateUtil.getDate(subtask.planstarttime)!!)
        //应该直接根据子任务的日任务id查询日任务
        val daytaskVo = taskService.findByID(subtask.tsguid!!)
//        val daytaskVo = taskService.findByID(subtask.tsguid!!)
        //判断是否有日任务
        if (StringUtil.isEmpty(daytaskVo.tguid)) {
@@ -407,18 +411,18 @@
            task.name = subtask.name
            task.starttime = DateUtil.StringToDate(DateUtil.getDate(subtask.planstarttime)!!.substring(0, 10))
            task.endtime =
                    DateUtil.StringToDate(DateUtil.getDate(subtask.planstarttime)!!.substring(0, 10) + " 23:59:59")
                DateUtil.StringToDate(DateUtil.getDate(subtask.planstarttime)!!.substring(0, 10) + " 23:59:59")
            //****日任务执行状态继承子任务的状态*(修改)***
            task.runingstatus = subtask.status
            //********************************************
            taskService.save(task)
            subtask.tsguid = guid
            subtaskMapper.updateByPrimaryKeySelective(subtask)
            res = subtaskMapper.updateByPrimaryKeySelective(subtask)
        } else {
//            subtask.tsguid = daytaskVo.tguid
            subtask.tsguid = daytaskVo.tguid
            //*(修改)*日任务正在执行,子任务结束,遍历所有其余子任务,都是结束时才将日任务修改为结束****
            if (subtask.status == Constant.TaskProgress.RUNINGSTATUS3.text
                    && daytaskVo.runingstatus == Constant.TaskProgress.RUNINGSTATUS2.text){
                && daytaskVo.runingstatus == Constant.TaskProgress.RUNINGSTATUS2.text){
                val subtaskVolist = findByDayTaskID(daytaskVo.tguid!!)
                var bool = false
                subtaskVolist.forEach {
@@ -439,9 +443,13 @@
            BeanUtils.copyProperties(daytaskVo, daytask)
            taskMapper.updateByPrimaryKeySelective(daytask)
            //****************************************************************************************
            subtaskMapper.updateByPrimaryKeySelective(subtask)
            res = subtaskMapper.updateByPrimaryKeySelective(subtask)
        }
        return res
    }
    override fun changeStatus(subtask: Subtask): Int {
        val res = update(subtask)
        //对已结束的子任务进行自动评分
        if (subtask.status == Constant.TaskProgress.RUNINGSTATUS3.text) {
            val example = Example(Evaluation::class.java)
@@ -453,7 +461,7 @@
            }
        }
        return 1
        return res
    }
    override fun delete(id: String): Int{
@@ -474,15 +482,13 @@
            createCriteria().andEqualTo("tid", topTaskId).andEqualTo("sguid", sceneId)
        })
        mList.forEach {
            if (it.monitornum == null) {
                it.monitornum = 0
            } else {
                it.monitornum = it.monitornum!! - 1
                if (it.monitornum!! < 0) {
                    it.monitornum = 0
                }
            var count = it.extension1?.toIntOrNull() ?: 0
            count--
            if (count < 0) {
                count = 0
            }
            monitorobjectversionMapper.insert(it)
            it.extension1 = count.toString()
            monitorobjectversionMapper.updateByPrimaryKeySelective(it)
        }
        // åŒæ—¶åˆ é™¤å¯¹åº”问题和巡查记录
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.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.Problemlist
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
import cn.flightfeather.supervision.domain.ds1.entity.Task
@@ -8,6 +9,7 @@
import cn.flightfeather.supervision.domain.ds1.mapper.TaskMapper
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.lightshare.service.*
@@ -104,7 +106,7 @@
                    townRank.standardRate = it.get("standardRate").toString().toFloat()
                } catch (e: Exception) {
                }
                val s =it.get("hasScoredNum").toString()
                val s = it.get("hasScoredNum").toString()
                try {
                    townRank.hasScoredNum = it.get("hasScoredNum").toString().toInt()
                } catch (e: Exception) {
@@ -164,7 +166,7 @@
        if (type == 0)
            return getAllTop()
        //获取未完成顶层任务及对应日任务列表
        else if (type == 1){
        else if (type == 1) {
            val tmp = getAllTop()
            tmp.forEach {
                if (it.runingstatus != Constant.TaskProgress.RUNINGSTATUS3.text) {
@@ -178,13 +180,13 @@
    }
    //根据日期获取日任务
    override fun findByDate(date: String): TaskVo {
    override fun findByDate(topTaskId: String, date: String): TaskVo {
        val taskVo = TaskVo()
        val example = Example(Task::class.java)
        val criteria = example.createCriteria()
        //gsguid不为空为日任务,日任务开始时间和结束时间在同一天,过滤开始时间就ok
        criteria.andEqualTo("starttime", DateUtil.StringToDate(date.substring(0, 10)))
        criteria.andIsNotNull("tsguid")
        criteria.andEqualTo("tsguid", topTaskId)
        val tasklist = taskMapper.selectByExample(example)
        if (tasklist.isNotEmpty()) {
            BeanUtils.copyProperties(tasklist[0], taskVo)
@@ -223,10 +225,10 @@
//                .andEqualTo("districtcode", districtCode)
//                .andLessThanOrEqualTo("endtime", date)
//        example.or(
                example.createCriteria().andIsNull("tsguid")
                        .andEqualTo("districtcode", districtCode)
                        .andLessThanOrEqualTo("starttime", date)
                        .andGreaterThanOrEqualTo("endtime", date)
        example.createCriteria().andIsNull("tsguid")
            .andEqualTo("districtcode", districtCode)
            .andLessThanOrEqualTo("starttime", date)
            .andGreaterThanOrEqualTo("endtime", date)
//        )
        example.orderBy("starttime").desc()
        val tasklist = taskMapper.selectByExample(example)
@@ -341,7 +343,7 @@
            val complete = subtaskMapper.selectCountByExample(exampleComplete)
            var changed = 0
            problemListMapper.findUnchangedCount(it.tguid ?: "").forEach {i ->
            problemListMapper.findUnchangedCount(it.tguid ?: "").forEach { i ->
                //结果表示该子任务未整改问题数
                if (i == 0) {
                    changed++
@@ -354,7 +356,7 @@
                forEach {
                    problemListMapper.selectByExample(Example(Problemlist::class.java).apply {
                        createCriteria().andEqualTo("stguid", it.stguid)
                    }).forEach {problem ->
                    }).forEach { problem ->
                        if (problem.extension3 == Constant.PROBLEM_UNCHECKED) {
                            check = true
                            return@breaking
@@ -363,8 +365,8 @@
                }
            }
           resultList.add(DayTaskProgressVo(
                    it.tguid, it.starttime, taskId, complete, changed, total, check
            resultList.add(DayTaskProgressVo(
                it.tguid, it.starttime, taskId, complete, changed, total, check
            ))
        }
@@ -522,25 +524,25 @@
        val criteria2 = example.createCriteria()
        criteria2.orBetween(
                "endtime",
                startDate,
                endDate
            "endtime",
            startDate,
            endDate
        ).andIsNull("tsguid");
        if (userType == "1") {
            criteria2.andLike("executorguids", "%$guid%")
        } else if (userType == "2"){
        } else if (userType == "2") {
            criteria2.andEqualTo("districtcode", districtCode)
        }
        example.or(criteria2)
        val criteria3 = example.createCriteria()
        criteria3.orLessThan("starttime", startDate).andGreaterThan(
                "endtime",
                endDate
            "endtime",
            endDate
        ).andIsNull("tsguid");
        if (userType == "1") {
            criteria3.andLike("executorguids", "%$guid%")
        } else if (userType == "2"){
        } else if (userType == "2") {
            criteria3.andEqualTo("districtcode", districtCode)
        }
        example.or(criteria3)
@@ -587,7 +589,7 @@
        }
        return taskVoList
    }
    override fun save(task: Task): Int {
        // FIXME: 2021/10/9 æŒ‰ç…§å½“前的逻辑,此函数主要用于新建顶层任务以及日任务,但是日任务内容的生成逻辑目前由前端app完成,因此会出现一个bug:
        // FIXME: 2021/10/9 å½“前端多个用户同时在同一个顶层任务下的新的一天创建任务时,会出现同一天有多个日任务,此时前端后续查看只能看到其中一个日任务下的子任务
@@ -595,6 +597,7 @@
        // FIXME: 2021/10/9 å¦å¤–对于顶层任务也添加类似逻辑,由于顶层任务的任务名称默认系统自动生成,因此暂时只判断同名的顶层任务,当存在同名顶层任务时,不做保存操作
        var result = 0
        if (task.tguid == null) task.tguid = UUIDGenerator.generate16ShortUUID()
        // 1、首先判断是顶层任务还是日任务
        if (task.levelnum == 2) {
            //2.1、 æ˜¯é¡¶å±‚任务时,判断是否已有同名任务
@@ -608,7 +611,7 @@
            }
        } else {
            //3.1、 å½“是日任务时,判断在同一个顶层任务下,是否有同名的日任务
            val r  =taskMapper.selectByExample(Example(Task::class.java).apply {
            val r = taskMapper.selectByExample(Example(Task::class.java).apply {
                createCriteria().andEqualTo("tsguid", task.tsguid)
                    .andEqualTo("name", task.name)
            })
@@ -634,6 +637,14 @@
        return result
    }
    override fun create(task: Task): Task {
        val res = save(task)
        if (res < 1)
            throw BizException("任务创建失败")
        else
            return task
    }
    //修改日任务信息,若有子任务,子任务也修改
    override fun update(task: Task): Int {
        var re = 1
@@ -646,7 +657,7 @@
                BeanUtils.copyProperties(it, subtask)
                subtask.planstarttime = task.starttime
                subtask.planendtime = task.endtime
                subtaskService.update(subtask)
                subtaskService.changeStatus(subtask)
            }
        }
        return re
@@ -665,7 +676,7 @@
        criteria.andIsNull("tsguid")
        example.orderBy("starttime").asc()
        val result = taskMapper.selectByExample(example)
        if (result.isNotEmpty()){
        if (result.isNotEmpty()) {
            result.forEach {
                var mytotalcount = 0
                var mycompletecount = 0
@@ -692,7 +703,7 @@
                    taskProgressVo.mycompletetask = mycompletecount
                    val daytaskVolist = getDayTaskByTaskID(it.tguid!!)
                    val daytasklist = mutableListOf<TaskVo>()
                    if (daytaskVolist.isNotEmpty()){
                    if (daytaskVolist.isNotEmpty()) {
                        daytaskVolist.forEach {
                            var mytotalcount1 = 0
                            var mycompletecount1 = 0
@@ -704,7 +715,7 @@
                                    if (Objects.equals(it.status!!, Constant.TaskProgress.RUNINGSTATUS3.text))
                                        mycompletecount1++
                                }
                                if(Objects.equals(it.status, Constant.TaskProgress.RUNINGSTATUS3.text))
                                if (Objects.equals(it.status, Constant.TaskProgress.RUNINGSTATUS3.text))
                                    completecount1++
                            }
                            val daytaskProgressVo = TaskVo()
@@ -732,7 +743,7 @@
    override fun findTaskProgress(areaVo: AreaVo): List<TaskProgressVo?> {
        val res = mutableListOf<TaskProgressVo?>()
        taskRep.findTasks(areaVo).forEach {t->
        taskRep.findTasks(areaVo).forEach { t ->
            if (t?.tguid == null) return@forEach
            val pro = TaskProgressVo().apply {
                tguid = t.tguid
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt
@@ -47,9 +47,12 @@
        }
    }
    override fun findByType(typeId: Byte): List<Userinfo> {
    override fun findByType(typeId: Byte, enable: Boolean?): List<Userinfo> {
        val result = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
            createCriteria().andEqualTo("usertypeid", typeId)
                .apply {
                    enable?.let { andEqualTo("isenable", it) }
                }
        })
        return result
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt
@@ -8,23 +8,26 @@
 * å¯¼å‡ºå·¡æŸ¥ä»»åŠ¡excel文件 æ¡ä»¶ç±»
 */
data class ExcelConfigVo(
        var topTaskGuid: String = "",
    var topTaskGuid: String = "",
        val startTime: Date? = null,
        val endTime: Date? = null,
    val startTime: Date? = null,
    val endTime: Date? = null,
        val provinceCode: String? = null,
        val cityCode: String? = null,
        val districtCode: String? = null,
        val townCode: String? = null,
    val provinceCode: String? = null,
    val cityCode: String? = null,
    val districtCode: String? = null,
    val townCode: String? = null,
        var sceneType: Int? = null,
    var sceneType: Int? = null,
        val subTaskIdList: List<String>? = null,
    val subTaskIdList: List<String>? = null,
        val problemTypeName: String? = null,
        val problemName: String? = null,
    val problemTypeName: String? = null,
    val problemName: String? = null,
        val mode: Int = 0,
        val forceUpdate: Boolean = false
    val mode: Int = 0,
    val forceUpdate: Boolean = false,
    // å†³å®šæ˜¯å¦ç»Ÿè®¡æ€»ä»»åŠ¡ä¸‹æ‰€æœ‰çš„åœºæ™¯æˆ–åªç»Ÿè®¡ç­›é€‰å‡ºçš„å­ä»»åŠ¡å¯¹åº”çš„åœºæ™¯
    var allScene: Boolean = true,
)
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/MonitorObjectVersionVo.kt
@@ -14,4 +14,5 @@
     */
    var sceneType: String? = null
    var scene: ScenseVo? = null
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DataProductController.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package cn.flightfeather.supervision.lightshare.web
import cn.flightfeather.supervision.lightshare.service.DataProductService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
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.web.bind.annotation.*
import springfox.documentation.annotations.ApiIgnore
import javax.servlet.http.HttpServletResponse
/**
 * æ•°æ®äº§å“ç›¸å…³API接口
 * @date 2024/10/18
 * @author feiyu02
 */
@Api(tags = ["DataProductController"], description = "数据产品相关API接口")
@RestController
@RequestMapping("/dataProduct")
class DataProductController(private val dataProductService: DataProductService) {
    @ApiOperation(value = "下载数据产品报告")
    @PostMapping("/download")
    fun downloadProduct(
        @ApiParam("区域条件信息") @RequestBody areaVo: AreaVo,
        @ApiParam("报告类型", allowableValues = "1:问题与整改汇总分析与动态跟踪清单;2:规范性评估与分析清单;3:问题与整改分布分析清单;")
        @RequestParam type: Int,
        @ApiParam("是否强制生成新的报告") @RequestParam forceUpdate: Boolean,
        @ApiIgnore response: HttpServletResponse,
    ) = resPack { dataProductService.downloadProduct(areaVo, type, forceUpdate, response) }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DomainitemController.kt
@@ -3,6 +3,8 @@
import cn.flightfeather.supervision.domain.ds1.entity.Domainitem
import cn.flightfeather.supervision.lightshare.service.DomainitemService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
@Api(tags = ["DomainitemController"], description = "值域信息API接口")
@@ -25,8 +27,21 @@
    @DeleteMapping("/{id}")
    fun delete (@PathVariable id: String) = domainitemService.delete(id)
    @ApiOperation("获取某类场景的问题位置选项")
    @GetMapping("/location")
    fun getLocation(
        @RequestParam("sceneType") sceneType:Int
        @ApiParam("场景类型id") @RequestParam("sceneType") sceneType:Int
    ) = domainitemService.getLocation(sceneType)
    @ApiOperation("获取巡查任务的类型选项")
    @GetMapping("/taskType")
    fun getTaskType() = domainitemService.getTaskType()
    @ApiOperation("获取巡查任务的期限类型选项")
    @GetMapping("/deadlineType")
    fun getDeadlineType() = domainitemService.getDeadlineType()
    @ApiOperation("获取巡查任务层次类型选项")
    @GetMapping("/level")
    fun getLevelType() = domainitemService.getLevelType()
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MediafileController.kt
@@ -27,9 +27,9 @@
    @ApiOperation("根据业务类型获取文件")
    @GetMapping("/{id}/{btid}")
    fun getBySubtaskId(
        @ApiParam("巡查id") @PathVariable iGuid: String,
        @ApiParam("巡查id") @PathVariable id: String,
        @ApiParam("文件业务类型id", allowableValues = "") @PathVariable btid: String,
    ) = mediafileService.findBysubtaskbtid(iGuid, btid)
    ) = mediafileService.findBysubtaskbtid(id, btid)
    @ApiOperation("获取所有任意拍常规记录图片", notes = "通过巡查记录id或巡查任务id获取对应的所有任意拍图片,两个参数任选其一即可")
    @GetMapping("/routine")
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/MenuController.kt
@@ -272,7 +272,7 @@
        BeanUtils.copyProperties(subtaskVo, subtask)
        //如果guid不为空,那就更新
        if (!StringUtils.isEmpty(subtask.stguid)) {
            subtaskService.update(subtask)
            subtaskService.changeStatus(subtask)
        } else {
            //获取日任务
            val daytask = taskService.findByID(subtaskVo.tsguid!!)
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt
@@ -28,7 +28,7 @@
    @PostMapping
    fun update(@RequestBody subtask: Subtask): Int {
        val res = subtaskService.update(subtask)
        val res = subtaskService.changeStatus(subtask)
        if (subtask.status == Constant.TaskProgress.RUNINGSTATUS3.text) {
            val event = "在${subtask.scensename}结束巡查"
            bizLog.info(WorkStreamLogInfo(subtask.executorguids, subtask.executorrealtimes, event))
@@ -39,6 +39,10 @@
        return res
    }
    @ApiOperation("调整巡查任务信息")
    @PostMapping("/adjust")
    fun adjust(@RequestBody subtask: Subtask) = resPack { subtaskService.update(subtask) }
    @GetMapping("/{id}")
    fun getById(@PathVariable id: String) = subtaskService.findByID(id)
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt
@@ -15,6 +15,9 @@
    @PutMapping
    fun save(@RequestBody task: Task) = taskService.save(task)
    @PutMapping("/create")
    fun create(@RequestBody task: Task) = resPack { taskService.create(task) }
    @PostMapping
    fun update(@RequestBody task: Task) = taskService.update(task)
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt
@@ -19,8 +19,12 @@
    @GetMapping("/{id}")
    fun getById(@PathVariable id: String) = userinfoService.findOne(id)
    @ApiOperation(value = "按用户类型搜索用户信息")
    @GetMapping("/type/get")
    fun getUserByTypeId(@RequestParam typeId: Byte) = userinfoService.findByType(typeId)
    fun getUserByTypeId(
        @ApiParam("用户类型id") @RequestParam typeId: Byte,
        @ApiParam("用户是否可用", required = false, defaultValue = "true") @RequestParam(required = false) enable: Boolean?
    ) = userinfoService.findByType(typeId, enable)
    @PutMapping("")
    fun add(@RequestBody userinfo: Userinfo) = userinfoService.save(userinfo)
src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision
import cn.flightfeather.supervision.business.datafetch.FetchController
import cn.flightfeather.supervision.infrastructure.service.ServerManager
import cn.flightfeather.supervision.common.utils.UUIDGenerator
//import org.junit.Test
@@ -17,6 +18,10 @@
    @Autowired
    private lateinit var manager: ServerManager
    @Autowired
    // é™å®‰åŒºå¤œé—´æ–½å·¥è®¸å¯è¯ä¿¡æ¯èŽ·å–ä»»åŠ¡
    lateinit var fetchController: FetchController
    @Test
    fun contextLoads() {
@@ -25,9 +30,8 @@
    @Test
    @Throws(Exception::class)
    fun test1() {
        //manager.startServer(args[0]);
       val uuid= UUIDGenerator.generateUUID(4)
        print(uuid)
        fetchController.run()
    }
}
src/test/kotlin/cn/flightfeather/supervision/business/location/LocationRoadNearbyTest.kt
@@ -204,4 +204,13 @@
//        val d = CoordinateUtil.calculateDistance(121.436109, 31.178198, 121.426483, 31.177637)
//        println(d)
    }
    @Test
    fun foo3(){
        val locationDistance = LocationDistance(scenseMapper)
        val bList = listOf(
            BasePlace("金山大道2000号", Pair(121.3404, 30.744262), Pair(121.3404, 30.744262)),
        )
        locationDistance.searchList(bList, "金山区")
    }
}