feiyu02
2024-04-25 0392c333ed3d987cb2ab3dac4e1a972cff405f21
1. 新增后台任务关联模块
2. 新增自动评分后台任务;
3. 修复部分bug
已修改74个文件
已删除2个文件
已添加16个文件
已重命名1个文件
4237 ■■■■ 文件已修改
pom.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/import/SceneImport.kt 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/exception/BizException.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/utils/CacheUtil.kt 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/InspectionMapper.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ProblemlistMapper.kt 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/RegionRep.kt 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/BaseInfo.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/BaseInfoRep.kt 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteInfo.java 1102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteInfoMapper.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/InspectionService.kt 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ScenseService.kt 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt 157 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceSiteVo.kt 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/InspectionInfoVo.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDetail.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDeviceVo.kt 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneProblemSummary.kt 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ScenseController.kt 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ds1/InspectionMapper.xml 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ds1/ProblemlistMapper.xml 347 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ds1/SubtaskMapper.xml 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ds2/BaseInfoMapper.xml 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ds3/JSDustSiteInfoMapper.xml 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMapTest.kt 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml
@@ -283,6 +283,13 @@
            <version>4.1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
        <dependency>
            <groupId>com.google.zxing</groupId>
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataAnalysis.kt
@@ -147,7 +147,13 @@
    /**
     * è¶…月均值百分比
     */
    abstract fun overAvgRate(avg: Double, dAvg: Double?): Double?
    open fun overAvgRate(avg: Double, dAvg: Double?): Double? {
        return if (dAvg != null && dAvg != .0) {
            round(((avg - dAvg) / dAvg) * 1000) / 1000
        } else {
            .0
        }
    }
    /**
     * æ•°æ®ä¸ªæ•°
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMap.kt
@@ -1,21 +1,32 @@
package cn.flightfeather.supervision.business.autooutput.dataanalysis
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds2.repository.JADustSiteMapRep
import cn.flightfeather.supervision.domain.ds3.repository.JSDustSiteMapRep
import cn.flightfeather.supervision.common.utils.ExcelUtil
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep
import cn.flightfeather.supervision.domain.ds2.repository.JADustSiteRep
import cn.flightfeather.supervision.domain.ds3.repository.JSDustSiteRep
import cn.flightfeather.supervision.domain.ds3.repository.XHFumeSiteMapRep
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
import cn.flightfeather.supervision.lightshare.vo.*
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import org.springframework.stereotype.Component
import java.io.FileOutputStream
import java.util.*
/**
 * ç›‘测数据和系统用户的映射管理
 */
@Component
class AopDataDeviceMap(
    private val jaDustSiteMapRep: JADustSiteMapRep,
    private val jsDustSiteMapRep: JSDustSiteMapRep,
    private val jaDustSiteRep: JADustSiteRep,
    private val jsDustSiteRep: JSDustSiteRep,
    private val xhFumeSiteMapRep: XHFumeSiteMapRep,
    private val taskRep: TaskRep,
    private val sceneRep: SceneRep,
    private val userInfoSVRep: UserInfoSVRep,
) {
    /**
@@ -50,7 +61,7 @@
            //静安区
            "310106" -> when (areaVo.scensetypeid) {
                //工地
                Constant.SceneType.TYPE1.value -> jaDustSiteMapRep.findBySVUserId(userIdList)
                Constant.SceneType.TYPE1.value -> jaDustSiteRep.findMapBySVUserId(userIdList)
                else -> emptyList()
            }
            //金山区
@@ -59,7 +70,7 @@
                Constant.SceneType.TYPE1.value,
                Constant.SceneType.TYPE2.value,
                Constant.SceneType.TYPE3.value,
                -> jsDustSiteMapRep.findBySVUserId(userIdList)
                -> jsDustSiteRep.findMapBySVUserId(userIdList)
                else -> emptyList()
            }
            //徐汇区
@@ -72,4 +83,96 @@
        }
    }
    /**
     * è¾“出监测点位和监测设备的对应匹配关系
     * @param areaVo åŒºåŸŸæ¡ä»¶
     */
    fun outputMapSet(areaVo: AreaVo) {
        // ç›‘管总任务
        val task = taskRep.findOneTask(areaVo) ?: throw BizException("当前查询条件下未找到对应顶层任务")
        // æ€»ä»»åŠ¡åŒ…å«å¯¹åº”ç±»åž‹çš„åœºæ™¯
        val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
        val sceneIds = scenes.map { it?.guid }
        val userIdList = userInfoSVRep.findUser(sceneIds).map { it?.guid }
        // åœºæ™¯å’Œç›‘测点的匹配关系
        val mapSet = this.findMapSet(areaVo, userIdList)
        // ç›‘测设备信息
        val deviceSiteList = when (areaVo.districtcode) {
            //静安区
            "310106" -> when (areaVo.scensetypeid) {
                //工地
                Constant.SceneType.TYPE1.value -> jaDustSiteRep.findSiteInfo()
                else -> emptyList()
            }
            //金山区
            "310116" -> when (areaVo.scensetypeid) {
                //工地,码头水泥搅拌站
                Constant.SceneType.TYPE1.value,
                Constant.SceneType.TYPE2.value,
                Constant.SceneType.TYPE3.value,
                -> jsDustSiteRep.findSiteInfo()
                else -> emptyList()
            }
            //徐汇区
            "310104" -> when (areaVo.scensetypeid) {
                //餐饮
                Constant.SceneType.TYPE5.value -> emptyList()
                else -> emptyList()
            }
            else -> emptyList()
        }
        outputMapSetToFile(areaVo, scenes, mapSet, deviceSiteList)
    }
    /**
     * è¾“出监测点位和监测设备的对应匹配关系到文件中
     * @param scenes åœºæ™¯ä¿¡æ¯åˆ—表
     * @param mapSet åœºæ™¯å’Œç›‘测点对应关系
     * @param siteList ç›‘测点信息列表
     */
    private fun outputMapSetToFile(areaVo: AreaVo, scenes: List<Scense?>, mapSet: List<DeviceMapVo>, siteList:
    List<DeviceSiteVo>) {
        val _scenes = mutableListOf<Scense?>().also { it.addAll(scenes) }
        val _siteList = mutableListOf<DeviceSiteVo>().also { it.addAll(siteList) }
        val sceneDeviceList = mutableListOf<SceneDeviceVo>()
        //表头
        val head = sceneDeviceList.tableHead()
        scenes.forEach {
            val sceneDeviceVo = SceneDeviceVo()
            sceneDeviceVo.scene = it
            val user = userInfoSVRep.findUser(it?.guid)
            mapSet.findBySVUserId(user?.guid).forEach { map ->
                val site = siteList.findByMNCode(map.deviceCode)
                sceneDeviceVo.deviceList.add(site)
                _siteList.remove(site)
            }
            sceneDeviceList.add(sceneDeviceVo)
        }
        //内容
        val contents = sceneDeviceList.tableContent()
        val workbook = HSSFWorkbook()
        ExcelUtil.write(head, contents, workbook, sheetName = "场景设备匹配")
        val head2 = sceneDeviceList.tableHeadDevice()
        val contents2 = mutableListOf<Array<Any>>()
        _siteList.forEach {
            contents2.add(arrayOf(it.id ?: "", it.mnCode ?: "", it.name ?: "", it.address ?: "", it.beginDate ?: "", it
                .dutyCompany ?: "", it.groupName ?: ""))
        }
        ExcelUtil.write(head2, contents2, workbook, sheetName = "未匹配设备")
        val path = "target/"
        val fileName = "${areaVo.districtname}-场景设备信息-${Date().time}.xls"
        val out = FileOutputStream(path + fileName)
        workbook.write(out)
        workbook.close()
        out.flush()
        out.close()
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JACsDataAnalysis.kt
@@ -117,11 +117,7 @@
    }
    override fun overAvgRate(avg: Double, dAvg: Double?): Double? {
        return if (dAvg != null) {
            round(((avg - dAvg) / dAvg) * 1000) / 1000
        } else {
            null
        }
        return super.overAvgRate(avg, dAvg)
    }
    override fun count(dataList: List<List<HourDustData?>>): Int {
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/JSDustDataAnalysis.kt
@@ -116,11 +116,7 @@
    }
    override fun overAvgRate(avg: Double, dAvg: Double?): Double? {
        return if (dAvg != null) {
            round(((avg - dAvg) / dAvg) * 1000) / 1000
        } else {
            null
        }
        return super.overAvgRate(avg, dAvg)
    }
    override fun effectiveRate(
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
@@ -1,6 +1,6 @@
package cn.flightfeather.supervision.business.autooutput.datasource
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord
@@ -86,7 +86,7 @@
    // ä»Žç›‘管系统获取场景
    private fun initSceneSource(config: AopDataConfig) {
        config.topTaskGuid ?: throw ResponseErrorException("顶层任务id不能为null")
        config.topTaskGuid ?: throw BizException("顶层任务id不能为null")
        this.config = config
        this.mode = 0
        sceneSourceList.clear()
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
@@ -1,7 +1,7 @@
package cn.flightfeather.supervision.business.autooutput.score
import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
@@ -23,7 +23,7 @@
) {
    fun execute(config: AopDataConfig) {
        if (config.year == null || config.month == null) throw ResponseErrorException("环信码评估时必须传递时间条件!")
        if (config.year == null || config.month == null) throw BizException("环信码评估时必须传递时间条件!")
        // æ‰¾åˆ°é£žç¾½çŽ¯å¢ƒä¸­éœ€è¦ç”ŸæˆçŽ¯ä¿¡ç çš„æ‰€æœ‰ç«™ç‚¹
        val sceneType = Constant.SceneType.getByValue(config.sceneType.toString())
        val userList = findUsers(config.districtName, sceneType)
src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
@@ -4,7 +4,7 @@
import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
import cn.flightfeather.supervision.business.autooutput.score.AopCreditCode
import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
import cn.flightfeather.supervision.common.executor.BgTaskStatus
import cn.flightfeather.supervision.common.executor.BgTaskType
@@ -46,10 +46,10 @@
            val districtCode = areaVo.districtcode
            val districtName = areaVo.districtname
//            val d = LocalDateTime.parse(areaVo.starttime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
            val d = areaVo.starttime ?: throw ResponseErrorException("自动评估任务必须设定时间")
            val d = areaVo.starttime ?: throw BizException("自动评估任务必须设定时间")
            val year = d.year
            val month = d.monthValue
            val sceneType = areaVo.scensetypeid?.toInt() ?: throw ResponseErrorException("场景类型未设置,无法评估")
            val sceneType = areaVo.scensetypeid?.toInt() ?: throw BizException("场景类型未设置,无法评估")
            val id = "${BgTaskType.AUTO_SCORE.name}-${districtCode}-${sceneType}"
            val name = "${districtName}${Constant.SceneType.getDes(sceneType)}自动评分"
@@ -69,7 +69,7 @@
            }
            return bgTask.taskStatus
        } else {
            throw ResponseErrorException("巡查总任务不存在,无法评估")
            throw BizException("巡查总任务不存在,无法评估")
        }
    }
src/main/kotlin/cn/flightfeather/supervision/business/import/SceneImport.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,93 @@
package cn.flightfeather.supervision.business.import
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.ExcelUtil
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.repository.RegionRep
import org.apache.poi.ss.usermodel.CellType
import org.springframework.stereotype.Component
import java.io.InputStream
import java.util.*
/**
 * åœºæ™¯ä¿¡æ¯å¯¼å…¥å·¥å…·
 */
@Component
class SceneImport(
    private val regionRep: RegionRep,
) {
    private val headers =
        listOf(
            ExcelUtil.MyHeader("编号(若不填写,则按照顺序自动添加)", CellType.NUMERIC),
            ExcelUtil.MyHeader("名称", CellType.STRING),
            ExcelUtil.MyHeader("类型", CellType.STRING),
            ExcelUtil.MyHeader("地址", CellType.STRING),
            ExcelUtil.MyHeader("经度(高德)", CellType.NUMERIC),
            ExcelUtil.MyHeader("纬度(高德)", CellType.NUMERIC),
            ExcelUtil.MyHeader("省", CellType.STRING),
            ExcelUtil.MyHeader("市", CellType.STRING),
            ExcelUtil.MyHeader("区", CellType.STRING),
            ExcelUtil.MyHeader("街镇", CellType.STRING),
            ExcelUtil.MyHeader("联系人", CellType.STRING),
            ExcelUtil.MyHeader("联系电话", CellType.STRING)
        )
    /**
     * é€šè¿‡æ–‡ä»¶è¯»å–场景信息
     */
    fun readFromFile(file: InputStream): List<Scense> {
        val result = mutableListOf<Scense>()
        try {
            ExcelUtil.readXLXS(file, headers) {
                val data = Scense().apply {
                    guid = null
                    name = it.getCell(1)?.stringCellValue?.trim()
                    typeid = null
                    type = it.getCell(2)?.stringCellValue?.trim()
                    scensesubtypeid = null
                    scensesubtype = null
                    location = it.getCell(3)?.stringCellValue?.trim()
                    longitude = it.getCell(4)?.numericCellValue?.toBigDecimal()
                    latitude = it.getCell(5)?.numericCellValue?.toBigDecimal()
                    provincecode = null
                    provincename = it.getCell(6)?.stringCellValue?.trim()
                    citycode = null
                    cityname = it.getCell(7)?.stringCellValue?.trim()
                    districtcode = null
                    districtname = it.getCell(8)?.stringCellValue?.trim()
                    towncode = null
                    townname = it.getCell(9)?.stringCellValue?.trim()
                    contactst = it.getCell(11)?.stringCellValue?.trim()
                    contactswx = null
                    contacts = it.getCell(10)?.stringCellValue?.trim()
                    createdate = Date()
                    updatedate = Date()
                    extension1 = "1"
                    extension2 = null
                    index = it.getCell(5)?.stringCellValue?.trim()?.toInt()
                    remark = null
                }
                data.typeid = Constant.SceneType.getByName(data.type)?.value?.toByte()
                    ?: throw BizException(errorStr(it.rowNum + 1, 2, "场景类型不存在"))
                data.provincecode = regionRep.findProvince(data.provincename)?.provincecode
                    ?: throw BizException(errorStr(it.rowNum + 1, 6, "省份错误或系统未曾配置"))
                data.citycode = regionRep.findCity(data.cityname)?.citycode
                    ?: throw BizException(errorStr(it.rowNum + 1, 7, "城市错误或系统未曾配置"))
                data.districtcode = regionRep.findDistrict(data.districtname)?.districtcode
                    ?: throw BizException(errorStr(it.rowNum + 1, 8, "区县错误或系统未曾配置"))
                data.towncode = regionRep.findTown(data.townname)?.towncode
                    ?: throw BizException(errorStr(it.rowNum + 1, 9, "街镇错误或系统未曾配置"))
                result.add(data)
            }
        } catch (e: IllegalStateException) {
            throw BizException("excel文件内容错误,数据转换失败!", e)
        }
        return result
    }
    private fun errorStr(row: Int, col: Int, str: String): String {
        return "第${row}行,第${col}列单元格错误,${str}"
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt
@@ -1,12 +1,8 @@
package cn.flightfeather.supervision.business.report
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.ExcelUtil
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import tk.mybatis.mapper.entity.Example
import java.io.FileOutputStream
import java.io.OutputStream
import java.util.*
@@ -32,7 +28,7 @@
    open fun execute() {
        if (dataSourceList.isEmpty()) throw ResponseErrorException("${templateName}: æ•°æ®æºä¸ºç©º")
        if (dataSourceList.isEmpty()) throw BizException("${templateName}: æ•°æ®æºä¸ºç©º")
        //合成表头
        cols.forEach {
            it.combineHead(head, dataSourceList[0])
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -182,19 +182,19 @@
        private var _baseScene: BaseScene? = null
        //具体的问题
        val problems: MutableList<Problemlist>
        val problems: List<Problemlist>
            get() {
                if (noRecord()) return mutableListOf()
                if (_problems.isEmpty()) {
                if (_problems == null) {
                    val r = dbMapper.problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
                        createCriteria().andEqualTo("stguid", subTask?.stguid)
                    })
                    _problems.addAll(r)
                    _problems = r
                }
                return _problems
                return _problems ?: emptyList()
            }
        private var _problems = mutableListOf<Problemlist>()
        private var _problems: List<Problemlist>? = null
        //评估总分
        val evaluation: Evaluation?
@@ -211,38 +211,40 @@
        private var _evaluation: Evaluation? = null
        //评估细则得分
        val itemevaluationList: MutableList<Itemevaluation>
        val itemevaluationList: List<Itemevaluation>
            get() {
                if (_itemevaluationList.isEmpty()) {
                if (_itemevaluationList == null) {
                    val r = dbMapper.itemevaluationMapper.selectByExample(Example(Itemevaluation::class.java).apply {
                        createCriteria().andEqualTo("stguid", subTask?.stguid)
                    })
                    _itemevaluationList.addAll(r)
                    _itemevaluationList = r
                    println("-------------------itemevaluationList--------------------------------")
                }
                return _itemevaluationList
                return _itemevaluationList ?: emptyList()
            }
        private var _itemevaluationList = mutableListOf<Itemevaluation>()
        private var _itemevaluationList: List<Itemevaluation>? = null
        //问题类型
        val problemTypes: MutableList<Problemtype>
        val problemTypes: List<Problemtype>
            get() {
                if (_problemTypes.isEmpty()) {
                if (_problemTypes == null) {
                    val r = dbMapper.problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply {
                        createCriteria().andEqualTo("scensetypeid", scene?.typeid)
                            .andEqualTo("districtcode", scene?.districtcode)
                        orderBy("extension1")
                    })
                    _problemTypes.addAll(r)
                    _problemTypes = r
                }
                return _problemTypes
                return _problemTypes ?: emptyList()
            }
        private var _problemTypes = mutableListOf<Problemtype>()
        private var _problemTypes: List<Problemtype>? = null
        //自动评分规则一级分类
        val topItems: MutableList<Evaluationsubrule2>
        val topItems: List<Evaluationsubrule2>
            get() {
                if (_topItems.isEmpty()) {
                if (_topItems == null) {
                    val tempTopItems = mutableListOf<Evaluationsubrule2>()
                    val secRules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>()
                    val rule = dbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
                        createCriteria()
                            .andEqualTo("tasktypeid", 99)
@@ -255,13 +257,13 @@
                        })
                        rules.forEach {
                            if (it.ertype == 2) {
                                _topItems.add(it)
                                tempTopItems.add(it)
                            }
                        }
                        _topItems.sortBy { it.displayid }
                        tempTopItems.sortBy { it.displayid }
                        var t = 0
                        _topItems.forEach {
                        tempTopItems.forEach {
                            t += it.maxscore ?: 0
                            val tempRules = mutableListOf<Evaluationsubrule2>()
                            for (i in rules) {
@@ -282,24 +284,26 @@
                                    }
                                }
                                tempSubRules.sortBy { ts -> ts.displayid }
                                this._rules.add(Pair(temp, tempSubRules))
                                secRules.add(Pair(temp, tempSubRules))
                            }
                        }
                    }
                    this._rules = secRules
                    _topItems = tempTopItems
                }
                return _topItems
                return _topItems ?: emptyList()
            }
        private var _topItems = mutableListOf<Evaluationsubrule2>()
        private var _topItems: List<Evaluationsubrule2>? = null
        //自动评分规则二级和三级分类
        val rules: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>
        val rules: List<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>
            get() {
                if (_rules.isEmpty()) {
                if (_rules == null) {
                    this.topItems
                }
                return _rules
                return _rules ?: emptyList()
            }
        private var _rules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>()
        private var _rules: List<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>? = null
        //必填台账数量
        val ledgerCount: Int
@@ -371,14 +375,14 @@
        fun clear() {
            _scene = null
            _baseScene = null
            _problems.clear()
            _problems = null
            _evaluation = null
            _itemevaluationList.clear()
            _itemevaluationList = null
            _ledgerRecordNum = null
            if (lastScene != null && lastScene?.typeid != scene?.typeid) {
                _problemTypes.clear()
                _topItems.clear()
                _rules.clear()
                _problemTypes = null
                _topItems = null
                _rules = null
                _ledgerCount = -1
            }
            recordLastScene()
src/main/kotlin/cn/flightfeather/supervision/common/exception/BizException.kt
ÎļþÃû´Ó src/main/kotlin/cn/flightfeather/supervision/common/exception/ResponseErrorException.kt ÐÞ¸Ä
@@ -1,9 +1,9 @@
package cn.flightfeather.supervision.common.exception
/**
 * å…è®¸æŽ¥å£è¿”回的业务层面的错误
 * å…è®¸æŽ¥å£è¿”回的业务层面错误
 */
class ResponseErrorException : Exception {
class BizException : Exception {
    constructor():super()
    constructor(message: String) : super(message)
    constructor(message: String, cause: Throwable) : super(message, cause)
src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt
@@ -1,8 +1,7 @@
package cn.flightfeather.supervision.common.executor
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.exception.BizException
import org.springframework.stereotype.Component
import java.time.LocalDateTime
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.Executors
import kotlin.jvm.Throws
@@ -21,13 +20,23 @@
    /**
     * æ–°å¢žä»»åŠ¡
     */
    @Throws(ResponseErrorException::class)
    @Throws(BizException::class)
    fun newTask(type: BgTaskType, id: String, name: String, task: () -> Boolean): BgTask {
        if (!taskCollection.containsKey(type)) {
            taskCollection[type] = ConcurrentHashMap<String, BgTask>()
        }
        val taskSet = taskCollection[type]!!
        if (taskSet.containsKey(id)) throw ResponseErrorException("无法创建任务, ä»»åŠ¡[${name}]的id重复")
        // åˆ¤æ–­ä»»åŠ¡id是否存在
        if (taskSet.containsKey(id)) {
            val oldTask = taskSet[id]
            // å½“任务已经结束时,直接删除,替换为新任务
            if (oldTask?.taskStatus?.status != TaskStatus.WAITING || oldTask.taskStatus.status != TaskStatus.RUNNING) {
                taskSet.remove(id)
            }
            else {
                throw BizException("无法重复创建任务")
            }
        }
        val t = BgTask(type, id, name, task)
        taskSet[id] = t
        return t
@@ -36,20 +45,20 @@
    /**
     * å¼€å§‹ä»»åŠ¡
     */
    @Throws(ResponseErrorException::class)
    @Throws(BizException::class)
    fun startTask(type: BgTaskType, id: String): BgTask {
        val taskSet = taskCollection[type] ?: throw throw ResponseErrorException("无法开启任务,该任务类型[${type.des}]不存在")
        val t = taskSet[id] ?: throw ResponseErrorException("无法开启任务,该任务[${id}]不存在")
        val taskSet = taskCollection[type] ?: throw throw BizException("无法开启任务,该任务类型[${type.des}]不存在")
        val t = taskSet[id] ?: throw BizException("无法开启任务,该任务[${id}]不存在")
        return startTask(t)
    }
    @Throws(ResponseErrorException::class)
    @Throws(BizException::class)
    fun startTask(task: BgTask): BgTask {
        if (task.taskStatus.status != TaskStatus.WAITING) {
            if (task.taskStatus.status == TaskStatus.RUNNING) {
                throw ResponseErrorException("无法开启任务,任务[${task.name}]正在执行")
                throw BizException("无法开启任务,任务[${task.name}]正在执行")
            } else {
                throw ResponseErrorException("无法开启任务,任务[${task.name}]已结束")
                throw BizException("无法开启任务,任务[${task.name}]已结束")
            }
        } else {
            task.ready()
@@ -61,7 +70,7 @@
    /**
     * æ–°å¢žå¹¶å¼€å§‹ä»»åŠ¡
     */
    @Throws(ResponseErrorException::class)
    @Throws(BizException::class)
    fun startNewTask(type: BgTaskType, id: String, name: String, task: () -> Boolean): BgTask {
        val t = newTask(type, id, name, task)
        return startTask(t)
@@ -96,11 +105,11 @@
    /**
     * å¼ºåˆ¶å…³é—­ä»»åŠ¡
     */
    @Throws(ResponseErrorException::class)
    @Throws(BizException::class)
    fun shutDownTask(type: BgTaskType, id: String?): List<BgTaskStatus?> {
        val taskMap = taskCollection[type] ?: throw ResponseErrorException("无法关闭任务,任务类型[${type.des}]未创建")
        val taskMap = taskCollection[type] ?: throw BizException("无法关闭任务,任务类型[${type.des}]未创建")
        return if (id != null) {
            val task = taskMap[id] ?: throw ResponseErrorException("无法关闭任务,任务[${id}]不存在")
            val task = taskMap[id] ?: throw BizException("无法关闭任务,任务[${id}]不存在")
            task.shutdown()
            listOf(task.taskStatus)
        } else {
@@ -113,11 +122,11 @@
        }
    }
    @Throws(ResponseErrorException::class)
    @Throws(BizException::class)
    fun removeTask(type: BgTaskType, id: String): Boolean {
        val statusList = shutDownTask(type, id)
        if (statusList.isNotEmpty()) {
            val s = statusList.first() ?: throw ResponseErrorException("无法移除任务,任务不存在")
            val s = statusList.first() ?: throw BizException("无法移除任务,任务不存在")
            taskCollection[s.type]?.remove(s.id)
            return true
        }
src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTask.kt
@@ -1,6 +1,5 @@
package cn.flightfeather.supervision.common.executor
import org.springframework.scheduling.annotation.Async
import java.time.LocalDateTime
import java.util.concurrent.Future
@@ -22,8 +21,13 @@
    }
    fun execute() {
        val res = task()
        if (res) success() else fail()
        try {
            val res = task()
            if (res) success() else fail()
        } catch (e: Exception) {
            fail()
            taskStatus.extra = e.message
        }
    }
    fun success() {
@@ -39,9 +43,9 @@
    fun shutdown() {
        if (future?.isCancelled == false && !future!!.isDone) {
            future!!.cancel(true)
            taskStatus.status = TaskStatus.SHUTDOWN
            complete()
        }
        taskStatus.status = TaskStatus.SHUTDOWN
        complete()
    }
    fun complete() {
src/main/kotlin/cn/flightfeather/supervision/common/utils/CacheUtil.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package cn.flightfeather.supervision.common.utils
import org.springframework.stereotype.Component
/**
 * ç¼“存变量管理工具
 * å…è®¸æ•°æ®åº“常用的变量在内存中缓存一段时间,提高访问速度
 * åŽç»­åº”该使用redis等NOSQL数据库替代
 */
@Component
class CacheUtil {
    /**
     * æ·»åŠ å˜é‡
     *
     */
    fun addParams(p:Any?) {
    }
}
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
@@ -45,23 +45,8 @@
                else -> sceneTypeId
            }
            fun getDes(value: Int?) = when (value.toString()) {
                "1" -> TYPE1.text
                "2" -> TYPE2.text
                "3" -> TYPE3.text
                "4" -> TYPE4.text
                "5" -> TYPE5.text
                "6" -> TYPE6.text
                "7" -> TYPE7.text
                "8" -> TYPE8.text
                "9" -> TYPE9.text
                "10" -> TYPE10.text
                "11" -> TYPE11.text
                "12" -> TYPE12.text
                "13" -> TYPE13.text
                "14" -> TYPE14.text
                "99" -> TYPE99.text
                else -> ""
            fun getDes(value: Int?): String {
                return getByValue(value?.toString()).text
            }
            fun getByValue(value: String?) = when (value.toString()) {
@@ -82,6 +67,25 @@
                "99" -> TYPE99
                else -> TYPE99
            }
            fun getByName(name: String?) = when (name) {
                TYPE1.text -> TYPE1
                TYPE2.text -> TYPE2
                TYPE3.text -> TYPE3
                TYPE4.text -> TYPE4
                TYPE5.text -> TYPE5
                TYPE6.text -> TYPE6
                TYPE7.text -> TYPE7
                TYPE8.text -> TYPE8
                TYPE9.text -> TYPE9
                TYPE10.text -> TYPE10
                TYPE11.text -> TYPE11
                TYPE12.text -> TYPE12
                TYPE13.text -> TYPE13
                TYPE14.text -> TYPE14
                TYPE99.text -> TYPE99
                else -> null
            }
        }
    }
src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt
@@ -1,7 +1,12 @@
package cn.flightfeather.supervision.common.utils
import cn.flightfeather.supervision.common.exception.BizException
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import org.apache.poi.ss.usermodel.CellType
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.ss.util.CellRangeAddress
import org.apache.poi.xssf.usermodel.XSSFWorkbook
import java.io.InputStream
import java.io.OutputStream
import java.time.LocalDate
import java.util.*
@@ -14,6 +19,9 @@
 */
object ExcelUtil {
    /**
     * å•元格
     */
    class MyCell(
        var text: String,
        var rowSpan: Int = 1,
@@ -23,9 +31,63 @@
    )
    /**
     * è¡¨å¤´å®šä¹‰
     */
    class MyHeader(
        var name: String,
        val type: CellType,
    )
    private fun cellTypeName(type: CellType): String = when (type) {
        CellType.NUMERIC -> "数字"
        CellType.STRING -> "文本"
        CellType.FORMULA -> "FORMULA"
        CellType.BLANK -> "空白"
        CellType.BOOLEAN -> "布尔值"
        else -> "未定义"
    }
    /**
     * åŒ…括 .xlsx æ–‡ä»¶
     */
    fun readXLXS(input: InputStream, headers: List<MyHeader>, onRow: (row: Row) -> Unit) {
        val workbook = XSSFWorkbook(input)
        val sheet1 = workbook.getSheetAt(0)
        val header = sheet1.getRow(sheet1.topRow.toInt())
        // æ£€æŸ¥ä¼ å…¥çš„æ–‡ä»¶è¡¨å¤´æ˜¯å¦ç¬¦åˆè¦æ±‚
        val cellIterator = header.cellIterator()
        val headIterator = headers.iterator()
        while (headIterator.hasNext()) {
            val head = headIterator.next()
            if (cellIterator.hasNext()) {
                val cellText = cellIterator.next().stringCellValue
                if (!cellText.equals(head.name)) {
                    throw BizException("文件格式错误, è¡¨å¤´[${head}]应该为[${cellText}]")
                }
            } else {
                throw BizException("文件格式错误, è¡¨å¤´[${head}]缺失")
            }
        }
        // èŽ·å–è¿­ä»£å™¨å¹¶åŽ»é™¤ç¬¬ä¸€è¡Œæ ‡é¢˜
        val iterator = sheet1.rowIterator().also { it.next() }
        iterator.forEach {
            // æ£€æŸ¥å½“前行每个单元格类型是否与表头定义匹配
            headers.forEachIndexed { i, h ->
                val t = it.getCell(i + 1).cellType
                if (t != CellType.BLANK || t != h.type) {
                    throw BizException("第${it.rowNum + 1}行,第${i + 1}列单元格格式错误,应该为${cellTypeName(h.type)}")
                }
            }
            onRow(it)
        }
    }
    /**
     * è‡ªåŠ¨å¤„ç†è¡Œåˆå¹¶æ•°æ®
     */
    fun write(heads: List<Array<Any>>, contents: MutableList<Array<Any>>, workbook: HSSFWorkbook, sheetName: String = "sheet1") {
    fun write(heads: List<Array<Any>>, contents: MutableList<Array<Any>>, workbook: HSSFWorkbook, sheetName: String
    = "sheet1") {
        val sheet = workbook.createSheet(sheetName)
@@ -226,7 +288,7 @@
        out.close()
    }
    private fun getMaxRows(rowArray: Array<Any>): Int {
    private fun getMaxRows(rowArray: Array<out Any>): Int {
        var maxRows = 1
        rowArray.forEach {
            if (it is Array<*>) {
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/entity/Evaluationsubrule2.kt
@@ -6,6 +6,12 @@
import javax.persistence.Id
import javax.persistence.Table
/**
 * @date 2024.4.25
 * ç”¨äºŽæš‚时替代[Evaluationsubrule]的类
 * å› ä¸ºå‚æ•°[Evaluationsubrule.ertype]被错误的设定为[Boolean]类型,实际应为[Int]类型,
 * ç›®å‰ä¸»è¦å½±å“äº†å®‰å“APP程序,将APP程序对应参数调整后本类可完全替换[Evaluationsubrule]
 */
@Table(name = "sm_t_evaluationsubrule")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Evaluationsubrule2 {
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/InspectionMapper.kt
@@ -2,6 +2,7 @@
import cn.flightfeather.supervision.domain.ds1.entity.Inspection
import cn.flightfeather.supervision.domain.util.MyMapper
import cn.flightfeather.supervision.lightshare.vo.InspectionInfoVo
import cn.flightfeather.supervision.lightshare.vo.InspectionStatisticVo
import org.apache.ibatis.annotations.Mapper
import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType
@@ -10,7 +11,7 @@
interface InspectionMapper:MyMapper<Inspection> {
    //获取污染场景版本主页的监管情况展示内容
    fun getInspectionInfoByScene(sceneId: String, topTaskId: String): List<Map<String, JvmType.Object>>
    fun getInspectionInfoByScene(sceneId: String, topTaskId: String): List<InspectionInfoVo?>
    //获取月任务巡查统计信息
    fun getStatistic(topTaskId: String, sceneTypeId: String): List<InspectionStatisticVo>
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt
@@ -1,10 +1,11 @@
package cn.flightfeather.supervision.domain.ds1.mapper
import cn.flightfeather.supervision.domain.ds1.entity.Monitorobjectversion
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.util.MyMapper
import org.apache.ibatis.annotations.Mapper
import org.apache.ibatis.annotations.Select
@Mapper
interface MonitorobjectversionMapper:MyMapper<Monitorobjectversion>
interface MonitorobjectversionMapper : MyMapper<Monitorobjectversion> {
    fun findMonitorListByScene(taskId: String, sceneTypeId: String?): List<Monitorobjectversion>
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ProblemlistMapper.kt
@@ -2,22 +2,29 @@
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import cn.flightfeather.supervision.domain.util.MyMapper
import cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary
import cn.flightfeather.supervision.lightshare.vo.StatisticsVo
import cn.flightfeather.supervision.lightshare.vo.UnChangedPro
import org.apache.ibatis.annotations.Mapper
import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType
@Mapper
interface ProblemlistMapper:MyMapper<Problemlist> {
interface ProblemlistMapper : MyMapper<Problemlist> {
    /**
     * èŽ·å–æŸæ—¶é—´æ®µå†…ã€æŸä¸ªåŒºåŽ¿çš„æŸç§åœºæ™¯ä¸‹ï¼Œå„ç±»åž‹çš„é—®é¢˜æ•°é‡ç»Ÿè®¡
     * @param districtcode åŒºåŽ¿è¡Œæ”¿ç¼–ç 
     * @param starttime å¼€å§‹æ—¶é—´
     * @param endtime ç»“束时间
     * @param districtCode åŒºåŽ¿è¡Œæ”¿ç¼–ç 
     * @param startTime å¼€å§‹æ—¶é—´
     * @param endTime ç»“束时间
     * @param sceneType åœºæ™¯ç±»åž‹
     */
    fun getStatisticalResult(districtcode:String?, starttime:String?, endtime:String?, sceneType:String?): List<Map<String, JvmType.Object>>
//    fun getStatisticalResult(): List<Map<String, JvmType.Object>>
    fun getStatisticalResult(
        districtCode: String?,
        startTime: String?,
        endTime: String?,
        sceneType: String?,
        sceneId: String?,
    ): List<StatisticsVo>
    fun getStatisticalResultById(topTaskId: String?, sceneTypeId: String?): List<Map<String, JvmType.Object>>
@@ -26,9 +33,9 @@
     * @param topTaskId é¡¶å±‚任务主键id
     * @param sceneType åœºæ™¯ç±»åž‹id
     */
    fun getChangeResult(topTaskId:String?, sceneType:String?): List<Map<String, JvmType.Object>>
    fun getChangeResult(topTaskId: String?, sceneType: String?): List<Map<String, JvmType.Object>>
    fun getScoreResult(topTaskId:String?, sceneType:String?): List<Map<String, JvmType.Object>>
    fun getScoreResult(topTaskId: String?, sceneType: String?): List<Map<String, JvmType.Object>>
    fun selectSE(sql: String): String
@@ -39,7 +46,7 @@
    /**
     * é€šè¿‡ID查找 æœˆé—®é¢˜åˆ—表
     */
    fun findMonthProblemById(taskId: String,sceneType: Int?): List<Map<String, JvmType.Object?>>
    fun findMonthProblemById(taskId: String, sceneType: Int?): List<Map<String, JvmType.Object?>>
    /**
     * é€šè¿‡æ—¥ä»»åŠ¡id查找未整改完成的子任务数,返回的是每个子任务未完成整改的问题数
@@ -50,4 +57,14 @@
     * æŸ¥æ‰¾é—®é¢˜ç”Ÿæˆæ—¶é—´åœ¨ç»™å®šæ—¶é—´ä¹‹å‰çš„æ‰€æœ‰é—®é¢˜
     */
    fun getUnChangedProblem(deadLine: String): List<UnChangedPro>
    /**
     * èŽ·å–æ€»ä»»åŠ¡
     */
    fun getSceneProSummary(
        topTaskId: String,
        sceneTypeId: String?,
        sort: String?,
        sortBy: String,
    ): List<SceneProblemSummary>
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.domain.ds1.mapper
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
import cn.flightfeather.supervision.domain.util.MyMapper
import cn.flightfeather.supervision.lightshare.vo.SubTaskSearchResultVo2
@@ -7,6 +8,7 @@
import cn.flightfeather.supervision.lightshare.vo.SubtaskSearchResultVo
import cn.flightfeather.supervision.lightshare.vo.SubtaskVo
import org.apache.ibatis.annotations.Mapper
import java.time.LocalDateTime
import java.util.*
@Mapper
@@ -21,4 +23,8 @@
    fun selectByTopTask2(topTaskId: String, sceneTypeId: Int? = null): List<Subtask>
    fun getSummary(topTaskId: String, sceneTypeId: Int?): List<SubTaskSummary>
    fun getSummaryByScene(sceneId: String, startTime: LocalDateTime?, endTime: LocalDateTime?): List<SubTaskSummary>
    fun findSubTasksByProType(topTaskId: String, sceneTypeId: String, proType: String): List<Subtask>
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRep.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.domain.ds1.repository
import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationMapper
import cn.flightfeather.supervision.domain.ds1.mapper.ItemevaluationMapper
import cn.flightfeather.supervision.lightshare.vo.AreaVo
@@ -32,6 +33,7 @@
        return if (res.isNotEmpty()) res[0] else null
    }
    /**
     * æŸ¥æ‰¾è‡ªåŠ¨è¯„åˆ†ç»“æžœ
     */
@@ -40,4 +42,13 @@
        val task = taskRep.findOneTask(areaVo) ?: return null
        return evaluationMapper.findEvaluation(task.tguid!!, areaVo.scensetypeid!!)
    }
    /**
     * æŸ¥æ‰¾å·¡æŸ¥ä»»åŠ¡çš„å…·ä½“è¯„åˆ†
     */
    fun findItemEvaluation(subTaskId: String): List<Itemevaluation> {
        return itemevaluationMapper.selectByExample(Example(Itemevaluation::class.java).apply {
            createCriteria().andEqualTo("stguid", subTaskId)
        })
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.domain.ds1.repository
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo
@@ -10,7 +11,10 @@
 * è¯„估规则数据库相关操作
 */
@Repository
class EvaluationRuleRep(private val evaluationruleMapper: EvaluationruleMapper) {
class EvaluationRuleRep(
    private val evaluationruleMapper: EvaluationruleMapper,
    private val sceneRep: SceneRep,
) {
    /**
     * æ ¹æ®å‚数查询总规则
@@ -27,4 +31,17 @@
            and(createCriteria().orEqualTo("towncode", areaEvaVo.towncode).orIsNull("towncode"))
        })
    }
    fun findAutoEvaluationRule(subTaskId:String): Evaluationrule? {
        val scene = sceneRep.findBySubTask(subTaskId)
        return findAutoEvaluationRule(Constant.SceneType.getByValue(scene?.typeid.toString()))
    }
    fun findAutoEvaluationRule(sceneType: Constant.SceneType): Evaluationrule? {
        return evaluationruleMapper.selectOne(Evaluationrule().apply {
            scensetypeid = sceneType.value.toByteOrNull()
            tasktypeid = 99
        })
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/ProblemRep.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package cn.flightfeather.supervision.domain.ds1.repository
import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper
import cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary
import org.springframework.stereotype.Repository
@Repository
class ProblemRep(private val problemlistMapper: ProblemlistMapper) {
    fun getSceneProSummary(topTaskId: String, sceneTypeId: String?, sort: String?, sortBy: String):
            List<SceneProblemSummary> {
        return problemlistMapper.getSceneProSummary(topTaskId, sceneTypeId, sort, sortBy)
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/RegionRep.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
package cn.flightfeather.supervision.domain.ds1.repository
import cn.flightfeather.supervision.common.utils.CacheUtil
import cn.flightfeather.supervision.domain.ds1.entity.City
import cn.flightfeather.supervision.domain.ds1.entity.District
import cn.flightfeather.supervision.domain.ds1.entity.Province
import cn.flightfeather.supervision.domain.ds1.entity.Town
import cn.flightfeather.supervision.domain.ds1.mapper.CityMapper
import cn.flightfeather.supervision.domain.ds1.mapper.DistrictMapper
import cn.flightfeather.supervision.domain.ds1.mapper.ProvinceMapper
import cn.flightfeather.supervision.domain.ds1.mapper.TownMapper
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
/**
 * åœ°åŸŸä¿¡æ¯ç›¸å…³æ•°æ®åº“操作
 */
@Repository
class RegionRep(
    private val provinceMapper: ProvinceMapper,
    private val cityMapper: CityMapper,
    private val districtMapper: DistrictMapper,
    private val townMapper: TownMapper,
    private val cacheUtil: CacheUtil,
) {
    private val cacheMap = mutableMapOf<String, Any?>()
    private fun<T : Any?> findCache(key: String?, findDb: () -> T?): T? {
        key ?: return null
        val s = cacheMap[key]
        return if (s == null) {
            val value = findDb()
            cacheMap[key] = value
            value
        } else {
            try {
                s as T
            } catch (e: Exception) {
                null
            }
        }
    }
    fun findProvince(name: String?): Province? {
        return findCache(name) {
            provinceMapper.selectOne(Province().apply { provincename = name })
        }
    }
    fun findCity(name: String?): City? {
        return findCache(name) {
            cityMapper.selectOne(City().apply { cityname = name })
        }
    }
    fun findDistrict(name: String?): District? {
        return findCache(name) {
            districtMapper.selectOne(District().apply { districtname = name })
        }
    }
    fun findTown(name: String?): Town? {
        return findCache(name) {
            townMapper.selectOne(Town().apply { townname = name })
        }
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt
@@ -1,8 +1,14 @@
package cn.flightfeather.supervision.domain.ds1.repository
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper
import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper
import javafx.scene.Scene
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
import java.util.*
/**
 * åœºæ™¯ä¿¡æ¯æ•°æ®åº“相关操作
@@ -10,7 +16,16 @@
@Repository
class SceneRep(
    private val scenseMapper: ScenseMapper,
    private val userinfoMapper: UserinfoMapper,
    private val subTaskRep: SubTaskRep,
) {
    fun insert(scense: Scense?):Int {
        scense ?: return 0
        if (scense.guid == null) scense.guid = UUIDGenerator.generate16ShortUUID()
        scense.createdate = Date()
        return scenseMapper.insertSelective(scense)
    }
    /**
     * æŸ¥æ‰¾åœºæ™¯
@@ -18,4 +33,27 @@
    fun findScene(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<Scense?> {
        return scenseMapper.getSceneByType(topTaskId, sceneTypeId, townCode)
    }
    fun findScene(userId: String?): Scense? {
        val user = userinfoMapper.selectByPrimaryKey(userId) ?: throw BizException("用户id不存在")
        return scenseMapper.selectByPrimaryKey(user.dGuid)
    }
    fun findScene(sceneId: String? = null, sceneName: String? = null): Scense? {
        return scenseMapper.selectOne(Scense().apply {
            guid = sceneId
            name = sceneName
        })
    }
    fun findScenes(nameList: List<String?>): List<Scense?> {
        return scenseMapper.selectByExample(Example(Scense::class.java).apply {
            createCriteria().andIn("name", nameList)
        })
    }
    fun findBySubTask(subTaskId: String): Scense? {
        val subtask = subTaskRep.find(subTaskId)
        return scenseMapper.selectByPrimaryKey(subtask?.scenseid)
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SubTaskRep.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package cn.flightfeather.supervision.domain.ds1.repository
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
import cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper
import org.springframework.stereotype.Repository
@Repository
class SubTaskRep(private val subtaskMapper: SubtaskMapper) {
    fun find(id:String): Subtask? {
        return subtaskMapper.selectByPrimaryKey(id)
    }
    /**
     * æ ¹æ®æ€»ä»»åŠ¡ã€åœºæ™¯ç±»åž‹ã€é—®é¢˜ç±»åž‹ï¼ŒèŽ·å–å‘çŽ°è¯¥ç§ç±»é—®é¢˜çš„åœºæ™¯ä¿¡æ¯
     */
    fun findSubtasks(topTaskId: String, sceneTypeId:String, proType: String): List<Subtask?> {
        return subtaskMapper.findSubTasksByProType(topTaskId, sceneTypeId, proType)
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt
@@ -1,17 +1,16 @@
package cn.flightfeather.supervision.domain.ds1.repository
import cn.flightfeather.supervision.domain.ds1.entity.Monitorobjectversion
import cn.flightfeather.supervision.domain.ds1.entity.Task
import cn.flightfeather.supervision.domain.ds1.mapper.MonitorobjectversionMapper
import cn.flightfeather.supervision.domain.ds1.mapper.TaskMapper
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import org.springframework.stereotype.Repository
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.*
@Repository
class TaskRep(private val taskMapper: TaskMapper) {
class TaskRep(private val taskMapper: TaskMapper, private val monitorobjectversionMapper: MonitorobjectversionMapper) {
    private fun exampleTask(areaVo: AreaVo): Task?{
        areaVo.starttime ?: return null
@@ -37,4 +36,12 @@
        val example = exampleTask(areaVo) ?: return emptyList()
        return taskMapper.select(example)
    }
    /**
     * èŽ·å–æ€»ä»»åŠ¡å¯¹åº”çš„ç›‘ç®¡ç‰ˆæœ¬
     */
    fun findMonitorList(taskId: String, sceneTypeId:String?): List<Monitorobjectversion> {
        val monitorList = monitorobjectversionMapper.findMonitorListByScene(taskId, sceneTypeId)
        return monitorList.sortedBy { it.displayid }
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
@@ -15,7 +15,7 @@
) {
    /**
     * æŸ¥æ‰¾åœºæ™¯
     * æŸ¥æ‰¾ç”¨æˆ·
     */
    fun findUser(sceneIdList: List<String?>): List<Userinfo?> {
        return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
@@ -23,9 +23,11 @@
        })
    }
    fun findUser(sceneId: String): List<Userinfo?> {
        return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
            createCriteria().andEqualTo("dGuid", sceneId)
        })
    fun findUser(sceneId: String?): Userinfo? {
        return try {
            userinfoMapper.selectOne(Userinfo().apply { dGuid = sceneId })
        } catch (e: Exception) {
            null
        }
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/entity/BaseInfo.java
@@ -21,6 +21,12 @@
    private String biName;
    /**
     * ç”¨æˆ·ç®€ç§°
     */
    @Column(name = "BI_Nick_Name")
    private String biNickName;
    /**
     * æ‰€å±žå…¬å¸id
     */
    @Column(name = "CI_GUID")
@@ -31,6 +37,36 @@
     */
    @Column(name = "CI_Name")
    private String ciName;
    @Column(name = "BI_Province_Code")
    private String biProvinceCode;
    @Column(name = "BI_Province_Name")
    private String biProvinceName;
    @Column(name = "BI_City_Code")
    private String biCityCode;
    @Column(name = "BI_City_Name")
    private String biCityName;
    @Column(name = "BI_District_Code")
    private String biDistrictCode;
    @Column(name = "BI_District_Name")
    private String biDistrictName;
    @Column(name = "BI_Town_Code")
    private String biTownCode;
    @Column(name = "BI_Town_Name")
    private String biTownName;
    @Column(name = "BI_Area_Code")
    private String biAreaCode;
    @Column(name = "BI_Area")
    private String biArea;
    /**
     * æ‰€å±žç‰©ä¸šå…¬å¸åç§°id
@@ -117,6 +153,24 @@
    }
    /**
     * èŽ·å–ç”¨æˆ·ç®€ç§°
     *
     * @return BI_Nick_Name - ç”¨æˆ·ç®€ç§°
     */
    public String getBiNickName() {
        return biNickName;
    }
    /**
     * è®¾ç½®ç”¨æˆ·ç®€ç§°
     *
     * @param biNickName ç”¨æˆ·ç®€ç§°
     */
    public void setBiNickName(String biNickName) {
        this.biNickName = biNickName == null ? null : biNickName.trim();
    }
    /**
     * èŽ·å–æ‰€å±žå…¬å¸id
     *
     * @return CI_GUID - æ‰€å±žå…¬å¸id
@@ -153,6 +207,146 @@
    }
    /**
     * @return BI_Province_Code
     */
    public String getBiProvinceCode() {
        return biProvinceCode;
    }
    /**
     * @param biProvinceCode
     */
    public void setBiProvinceCode(String biProvinceCode) {
        this.biProvinceCode = biProvinceCode == null ? null : biProvinceCode.trim();
    }
    /**
     * @return BI_Province_Name
     */
    public String getBiProvinceName() {
        return biProvinceName;
    }
    /**
     * @param biProvinceName
     */
    public void setBiProvinceName(String biProvinceName) {
        this.biProvinceName = biProvinceName == null ? null : biProvinceName.trim();
    }
    /**
     * @return BI_City_Code
     */
    public String getBiCityCode() {
        return biCityCode;
    }
    /**
     * @param biCityCode
     */
    public void setBiCityCode(String biCityCode) {
        this.biCityCode = biCityCode == null ? null : biCityCode.trim();
    }
    /**
     * @return BI_City_Name
     */
    public String getBiCityName() {
        return biCityName;
    }
    /**
     * @param biCityName
     */
    public void setBiCityName(String biCityName) {
        this.biCityName = biCityName == null ? null : biCityName.trim();
    }
    /**
     * @return BI_District_Code
     */
    public String getBiDistrictCode() {
        return biDistrictCode;
    }
    /**
     * @param biDistrictCode
     */
    public void setBiDistrictCode(String biDistrictCode) {
        this.biDistrictCode = biDistrictCode == null ? null : biDistrictCode.trim();
    }
    /**
     * @return BI_District_Name
     */
    public String getBiDistrictName() {
        return biDistrictName;
    }
    /**
     * @param biDistrictName
     */
    public void setBiDistrictName(String biDistrictName) {
        this.biDistrictName = biDistrictName == null ? null : biDistrictName.trim();
    }
    /**
     * @return BI_Town_Code
     */
    public String getBiTownCode() {
        return biTownCode;
    }
    /**
     * @param biTownCode
     */
    public void setBiTownCode(String biTownCode) {
        this.biTownCode = biTownCode == null ? null : biTownCode.trim();
    }
    /**
     * @return BI_Town_Name
     */
    public String getBiTownName() {
        return biTownName;
    }
    /**
     * @param biTownName
     */
    public void setBiTownName(String biTownName) {
        this.biTownName = biTownName == null ? null : biTownName.trim();
    }
    /**
     * @return BI_Area_Code
     */
    public String getBiAreaCode() {
        return biAreaCode;
    }
    /**
     * @param biAreaCode
     */
    public void setBiAreaCode(String biAreaCode) {
        this.biAreaCode = biAreaCode == null ? null : biAreaCode.trim();
    }
    /**
     * @return UC_Area
     */
    public String getBiArea() {
        return biArea;
    }
    /**
     * @param biArea
     */
    public void setBiArea(String biArea) {
        this.biArea = biArea == null ? null : biArea.trim();
    }
    /**
     * èŽ·å–æ‰€å±žç‰©ä¸šå…¬å¸åç§°id
     *
     * @return BI_Management_Company_Id - æ‰€å±žç‰©ä¸šå…¬å¸åç§°id
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/BaseInfoRep.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
package cn.flightfeather.supervision.domain.ds2.repository
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds2.entity.BaseInfo
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
import cn.flightfeather.supervision.domain.ds2.mapper.BaseInfoMapper
import org.springframework.stereotype.Repository
import java.util.*
@Repository
class BaseInfoRep(
    private val baseInfoMapper: BaseInfoMapper,
) {
    fun create(info: UserinfoTZ, scense: Scense): BaseInfo {
        val baseInfo = BaseInfo().apply {
            biGuid = info.guid
            biName = info.realname
            biProvinceCode = scense.provincecode
            biProvinceName = scense.provincename
            biCityCode = scense.citycode
            biCityName = scense.cityname
            biDistrictCode = scense.districtcode
            biDistrictName = scense.districtname
            biTownCode = scense.towncode
            biTownName = scense.townname
            biContact = scense.contacts
            biTelephone = scense.contactst
            biAddress = scense.location
            biCreateTime = Date()
            biExtension1 = info.acountname
        }
        baseInfoMapper.insert(baseInfo)
        return baseInfo
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt
@@ -11,7 +11,7 @@
import java.util.*
/**
     * ä¿¡è®¿æŠ•诉和行政处罚数据库相关操作
 * ä¿¡è®¿æŠ•诉和行政处罚数据库相关操作
 */
@Repository
class ComplaintAndPunishmentRep(
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteMapRep.kt
ÎļþÒÑɾ³ý
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/JADustSiteRep.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
package cn.flightfeather.supervision.domain.ds2.repository
import cn.flightfeather.supervision.domain.ds2.entity.DustSiteMap
import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteInfoMapper
import cn.flightfeather.supervision.domain.ds2.mapper.DustSiteMapMapper
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
/**
 * é™å®‰å·¥åœ°æ‰¬å°˜ç›‘测点位数据库相关操作
 */
@Repository
class JADustSiteRep(
    private val dustSiteMapMapper: DustSiteMapMapper,
    private val dustSiteInfoMapper: DustSiteInfoMapper,
) {
    /**
     * æ ¹æ®é£žç¾½ç›‘管用户id查询场景和监测设备的匹配关系
     * @param idList ç›‘管场景对应的用户id列表
     * @return åŒ¹é…å…³ç³»åˆ—表
     */
    fun findMapBySVUserId(idList: List<String?>): List<DeviceMapVo> {
        val res = dustSiteMapMapper.selectByExample(Example(DustSiteMap::class.java).apply {
            createCriteria().andIn("svUserId", idList)
        })
        return DeviceMapVo.fromJADustSiteMap(res)
    }
    /**
     * èŽ·å–é™å®‰å·¥åœ°ç‚¹ä½åŸºæœ¬ä¿¡æ¯
     * @return ç›‘测点信息列表
     */
    fun findSiteInfo(): List<DeviceSiteVo> {
        val res = dustSiteInfoMapper.selectAll()
        return DeviceSiteVo.fromJADustSiteInfo(res)
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserInfoTZRep.kt
@@ -1,10 +1,12 @@
package cn.flightfeather.supervision.domain.ds2.repository
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
import cn.flightfeather.supervision.domain.ds2.mapper.UserinfoTZMapper
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
import java.util.*
@Repository
class UserInfoTZRep(private val userinfoTZMapper: UserinfoTZMapper) {
@@ -33,4 +35,16 @@
            and(createCriteria().orIsNull("workno").orNotEqualTo("workno", "test"))
        })
    }
    fun findOne(userinfoTZ: UserinfoTZ): UserinfoTZ? {
        return userinfoTZMapper.selectOne(userinfoTZ)
    }
    fun insert(userinfoTZ: UserinfoTZ): Int {
        if (userinfoTZ.guid == null) userinfoTZ.guid = UUIDGenerator.generate16ShortUUID()
        if (userinfoTZ.headIconUrl == null) userinfoTZ.headIconUrl = ""
        userinfoTZ.uiCreateTime = Date()
        return userinfoTZMapper.insert(userinfoTZ)
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/UserMapRep.kt
@@ -8,6 +8,7 @@
import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
import java.util.*
@Repository
class UserMapRep(
@@ -22,15 +23,15 @@
     * @return
     */
    fun findFromSupervision(userinfoTZ: UserinfoTZ?): Scense? {
        return findFromSupervision(userinfoTZ?.guid)
    }
    fun findFromSupervision(guid: String?): Scense? {
        val userMap = UserMap().apply {
            tzUserId = userinfoTZ?.guid
            tzUserId = guid
        }
        // æ‰¾åˆ°ä¸¤ä¸ªç³»ç»Ÿç”¨æˆ·çš„对应关系
        val uMap = userMapMapper.selectOne(userMap)
        if (uMap == null) {
            println("${userinfoTZ?.guid}, ${userinfoTZ?.realname}")
            return null
        }
        val uMap = userMapMapper.selectOne(userMap) ?: return null
        // æ‰¾åˆ°é£žç¾½ç›‘管中的用户信息
        val userInfoSp = userinfoMapper.selectByPrimaryKey(uMap.svUserId)
        // æ‰¾åˆ°é£žç¾½ç›‘管中的场景信息
@@ -45,4 +46,9 @@
            createCriteria().andIn("svUserId", idList)
        })
    }
    fun insert(userMap: UserMap): Int {
        if (userMap.umCreateTime == null) userMap.umCreateTime = Date()
        return userMapMapper.insert(userMap)
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/entity/JSDustSiteInfo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1102 @@
package cn.flightfeather.supervision.domain.ds3.entity;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
@Table(name = "ja_t_dust_site_info")
public class JSDustSiteInfo {
    @Id
    private Integer id;
    /**
     * è®¾å¤‡ç¼–码
     */
    @Column(name = "mn_code")
    private String mnCode;
    /**
     * å®‰è£…地址
     */
    private String address;
    /**
     * ç«™ç‚¹åç§°
     */
    private String name;
    /**
     * ç«™ç‚¹ç¼–码
     */
    private String code;
    /**
     * å¼€å·¥æ—¶é—´
     */
    @Column(name = "begin_date")
    private Date beginDate;
    /**
     * è¿ç»´å•†
     */
    @Column(name = "duty_company")
    private String dutyCompany;
    /**
     * è¿ç»´å•†id
     */
    @Column(name = "duty_company_id")
    private String dutyCompanyId;
    /**
     * ç»“束时间
     */
    @Column(name = "end_date")
    private Date endDate;
    /**
     * å½“前施工阶段
     */
    @Column(name = "engineering_stage")
    private String engineeringStage;
    /**
     * æ‰€å±žåŒºåŽ¿ä»£ç 
     */
    @Column(name = "group_id")
    private String groupId;
    /**
     * æ‰€å±žåŒºåŽ¿
     */
    @Column(name = "group_name")
    private String groupName;
    /**
     * æ˜¯å¦åœ¨çº¿
     */
    @Column(name = "is_online")
    private String isOnline;
    /**
     * è®¾å¤‡æ˜¯å¦å¼‚常
     */
    @Column(name = "is_trouble")
    private String isTrouble;
    /**
     * æ›´æ–°æ—¶é—´
     */
    @Column(name = "jhpt_update_time")
    private String jhptUpdateTime;
    private String kindex;
    /**
     * çº¬åº¦
     */
    private String latitude;
    /**
     * è”系人
     */
    private String linkman;
    /**
     * ç»åº¦
     */
    private String longitude;
    /**
     * è”系人电话
     */
    private String phone;
    /**
     * æ‰€å±žçœä»½
     */
    private String province;
    /**
     * å†…中外环编码
     */
    @Column(name = "ring_id")
    private String ringId;
    /**
     * å†…中外环
     */
    @Column(name = "ring_name")
    private String ringName;
    /**
     * ç±»åž‹ç¼–码
     */
    @Column(name = "type_id")
    private String typeId;
    /**
     * ç±»åž‹åç§°
     */
    private String typename;
    /**
     * åœæ­¢æ—¶é—´
     */
    @Column(name = "stop_time")
    private Date stopTime;
    private String active;
    /**
     * æ•…障次数
     */
    @Column(name = "trouble_num")
    private Integer troubleNum;
    /**
     * æ–°å¢žæ—¶é—´
     */
    @Column(name = "insert_time")
    private Date insertTime;
    /**
     * é˜¶æ®µå¼€å§‹æ—¥æœŸ
     */
    @Column(name = "stage_begin_date")
    private Date stageBeginDate;
    /**
     * tsp浓度
     */
    private Double tsp;
    /**
     * ç»Ÿè®¡ç±»åž‹ç¼–码
     */
    @Column(name = "union_type_id")
    private String unionTypeId;
    /**
     * å›´å¢™é«˜åº¦
     */
    @Column(name = "wall_height")
    private String wallHeight;
    /**
     * ä¸šåŠ¡æ—¶é—´
     */
    @Column(name = "ywsj_date")
    private Date ywsjDate;
    /**
     * å»ºç­‘面积
     */
    @Column(name = "build_area")
    private String buildArea;
    /**
     * æ–½å·¥å•位
     */
    @Column(name = "construction_unit")
    private String constructionUnit;
    /**
     * ç‚¹ä½æŽ§åˆ¶çº§
     */
    @Column(name = "control_level")
    private String controlLevel;
    /**
     * å¼€å‘商
     */
    private String developers;
    /**
     * æ‰§è¡Œæ—¶é—´
     */
    @Column(name = "do_time")
    private Date doTime;
    /**
     * æ˜¯å¦æœ‰ç›‘测
     */
    @Column(name = "has_monitor")
    private String hasMonitor;
    /**
     * é‡‡é›†æ—¶é—´
     */
    @Column(name = "data_time")
    private Date dataTime;
    /**
     * å½“前施工阶段编码
     */
    @Column(name = "engineering_stage_code")
    private String engineeringStageCode;
    /**
     * è®¾å¤‡ç¼–码
     */
    @Column(name = "equipment_code")
    private String equipmentCode;
    /**
     * å åœ°é¢ç§¯
     */
    @Column(name = "floor_area")
    private String floorArea;
    /**
     * åˆ é™¤æ ‡å¿—位
     */
    @Column(name = "jhpt_delete")
    private String jhptDelete;
    /**
     * å™ªå£°åŠŸèƒ½åŒº
     */
    @Column(name = "noise_region")
    private String noiseRegion;
    /**
     * è´Ÿè´£äºº
     */
    private String responsible;
    /**
     * @return id
     */
    public Integer getId() {
        return id;
    }
    /**
     * @param id
     */
    public void setId(Integer id) {
        this.id = id;
    }
    /**
     * èŽ·å–è®¾å¤‡ç¼–ç 
     *
     * @return mn_code - è®¾å¤‡ç¼–码
     */
    public String getMnCode() {
        return mnCode;
    }
    /**
     * è®¾ç½®è®¾å¤‡ç¼–码
     *
     * @param mnCode è®¾å¤‡ç¼–码
     */
    public void setMnCode(String mnCode) {
        this.mnCode = mnCode == null ? null : mnCode.trim();
    }
    /**
     * èŽ·å–å®‰è£…åœ°å€
     *
     * @return address - å®‰è£…地址
     */
    public String getAddress() {
        return address;
    }
    /**
     * è®¾ç½®å®‰è£…地址
     *
     * @param address å®‰è£…地址
     */
    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }
    /**
     * èŽ·å–ç«™ç‚¹åç§°
     *
     * @return name - ç«™ç‚¹åç§°
     */
    public String getName() {
        return name;
    }
    /**
     * è®¾ç½®ç«™ç‚¹åç§°
     *
     * @param name ç«™ç‚¹åç§°
     */
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }
    /**
     * èŽ·å–ç«™ç‚¹ç¼–ç 
     *
     * @return code - ç«™ç‚¹ç¼–码
     */
    public String getCode() {
        return code;
    }
    /**
     * è®¾ç½®ç«™ç‚¹ç¼–码
     *
     * @param code ç«™ç‚¹ç¼–码
     */
    public void setCode(String code) {
        this.code = code == null ? null : code.trim();
    }
    /**
     * èŽ·å–å¼€å·¥æ—¶é—´
     *
     * @return begin_date - å¼€å·¥æ—¶é—´
     */
    public Date getBeginDate() {
        return beginDate;
    }
    /**
     * è®¾ç½®å¼€å·¥æ—¶é—´
     *
     * @param beginDate å¼€å·¥æ—¶é—´
     */
    public void setBeginDate(Date beginDate) {
        this.beginDate = beginDate;
    }
    /**
     * èŽ·å–è¿ç»´å•†
     *
     * @return duty_company - è¿ç»´å•†
     */
    public String getDutyCompany() {
        return dutyCompany;
    }
    /**
     * è®¾ç½®è¿ç»´å•†
     *
     * @param dutyCompany è¿ç»´å•†
     */
    public void setDutyCompany(String dutyCompany) {
        this.dutyCompany = dutyCompany == null ? null : dutyCompany.trim();
    }
    /**
     * èŽ·å–è¿ç»´å•†id
     *
     * @return duty_company_id - è¿ç»´å•†id
     */
    public String getDutyCompanyId() {
        return dutyCompanyId;
    }
    /**
     * è®¾ç½®è¿ç»´å•†id
     *
     * @param dutyCompanyId è¿ç»´å•†id
     */
    public void setDutyCompanyId(String dutyCompanyId) {
        this.dutyCompanyId = dutyCompanyId == null ? null : dutyCompanyId.trim();
    }
    /**
     * èŽ·å–ç»“æŸæ—¶é—´
     *
     * @return end_date - ç»“束时间
     */
    public Date getEndDate() {
        return endDate;
    }
    /**
     * è®¾ç½®ç»“束时间
     *
     * @param endDate ç»“束时间
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }
    /**
     * èŽ·å–å½“å‰æ–½å·¥é˜¶æ®µ
     *
     * @return engineering_stage - å½“前施工阶段
     */
    public String getEngineeringStage() {
        return engineeringStage;
    }
    /**
     * è®¾ç½®å½“前施工阶段
     *
     * @param engineeringStage å½“前施工阶段
     */
    public void setEngineeringStage(String engineeringStage) {
        this.engineeringStage = engineeringStage == null ? null : engineeringStage.trim();
    }
    /**
     * èŽ·å–æ‰€å±žåŒºåŽ¿ä»£ç 
     *
     * @return group_id - æ‰€å±žåŒºåŽ¿ä»£ç 
     */
    public String getGroupId() {
        return groupId;
    }
    /**
     * è®¾ç½®æ‰€å±žåŒºåŽ¿ä»£ç 
     *
     * @param groupId æ‰€å±žåŒºåŽ¿ä»£ç 
     */
    public void setGroupId(String groupId) {
        this.groupId = groupId == null ? null : groupId.trim();
    }
    /**
     * èŽ·å–æ‰€å±žåŒºåŽ¿
     *
     * @return group_name - æ‰€å±žåŒºåŽ¿
     */
    public String getGroupName() {
        return groupName;
    }
    /**
     * è®¾ç½®æ‰€å±žåŒºåŽ¿
     *
     * @param groupName æ‰€å±žåŒºåŽ¿
     */
    public void setGroupName(String groupName) {
        this.groupName = groupName == null ? null : groupName.trim();
    }
    /**
     * èŽ·å–æ˜¯å¦åœ¨çº¿
     *
     * @return is_online - æ˜¯å¦åœ¨çº¿
     */
    public String getIsOnline() {
        return isOnline;
    }
    /**
     * è®¾ç½®æ˜¯å¦åœ¨çº¿
     *
     * @param isOnline æ˜¯å¦åœ¨çº¿
     */
    public void setIsOnline(String isOnline) {
        this.isOnline = isOnline == null ? null : isOnline.trim();
    }
    /**
     * èŽ·å–è®¾å¤‡æ˜¯å¦å¼‚å¸¸
     *
     * @return is_trouble - è®¾å¤‡æ˜¯å¦å¼‚常
     */
    public String getIsTrouble() {
        return isTrouble;
    }
    /**
     * è®¾ç½®è®¾å¤‡æ˜¯å¦å¼‚常
     *
     * @param isTrouble è®¾å¤‡æ˜¯å¦å¼‚常
     */
    public void setIsTrouble(String isTrouble) {
        this.isTrouble = isTrouble == null ? null : isTrouble.trim();
    }
    /**
     * èŽ·å–æ›´æ–°æ—¶é—´
     *
     * @return jhpt_update_time - æ›´æ–°æ—¶é—´
     */
    public String getJhptUpdateTime() {
        return jhptUpdateTime;
    }
    /**
     * è®¾ç½®æ›´æ–°æ—¶é—´
     *
     * @param jhptUpdateTime æ›´æ–°æ—¶é—´
     */
    public void setJhptUpdateTime(String jhptUpdateTime) {
        this.jhptUpdateTime = jhptUpdateTime == null ? null : jhptUpdateTime.trim();
    }
    /**
     * @return kindex
     */
    public String getKindex() {
        return kindex;
    }
    /**
     * @param kindex
     */
    public void setKindex(String kindex) {
        this.kindex = kindex == null ? null : kindex.trim();
    }
    /**
     * èŽ·å–çº¬åº¦
     *
     * @return latitude - çº¬åº¦
     */
    public String getLatitude() {
        return latitude;
    }
    /**
     * è®¾ç½®çº¬åº¦
     *
     * @param latitude çº¬åº¦
     */
    public void setLatitude(String latitude) {
        this.latitude = latitude == null ? null : latitude.trim();
    }
    /**
     * èŽ·å–è”ç³»äºº
     *
     * @return linkman - è”系人
     */
    public String getLinkman() {
        return linkman;
    }
    /**
     * è®¾ç½®è”系人
     *
     * @param linkman è”系人
     */
    public void setLinkman(String linkman) {
        this.linkman = linkman == null ? null : linkman.trim();
    }
    /**
     * èŽ·å–ç»åº¦
     *
     * @return longitude - ç»åº¦
     */
    public String getLongitude() {
        return longitude;
    }
    /**
     * è®¾ç½®ç»åº¦
     *
     * @param longitude ç»åº¦
     */
    public void setLongitude(String longitude) {
        this.longitude = longitude == null ? null : longitude.trim();
    }
    /**
     * èŽ·å–è”ç³»äººç”µè¯
     *
     * @return phone - è”系人电话
     */
    public String getPhone() {
        return phone;
    }
    /**
     * è®¾ç½®è”系人电话
     *
     * @param phone è”系人电话
     */
    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }
    /**
     * èŽ·å–æ‰€å±žçœä»½
     *
     * @return province - æ‰€å±žçœä»½
     */
    public String getProvince() {
        return province;
    }
    /**
     * è®¾ç½®æ‰€å±žçœä»½
     *
     * @param province æ‰€å±žçœä»½
     */
    public void setProvince(String province) {
        this.province = province == null ? null : province.trim();
    }
    /**
     * èŽ·å–å†…ä¸­å¤–çŽ¯ç¼–ç 
     *
     * @return ring_id - å†…中外环编码
     */
    public String getRingId() {
        return ringId;
    }
    /**
     * è®¾ç½®å†…中外环编码
     *
     * @param ringId å†…中外环编码
     */
    public void setRingId(String ringId) {
        this.ringId = ringId == null ? null : ringId.trim();
    }
    /**
     * èŽ·å–å†…ä¸­å¤–çŽ¯
     *
     * @return ring_name - å†…中外环
     */
    public String getRingName() {
        return ringName;
    }
    /**
     * è®¾ç½®å†…中外环
     *
     * @param ringName å†…中外环
     */
    public void setRingName(String ringName) {
        this.ringName = ringName == null ? null : ringName.trim();
    }
    /**
     * èŽ·å–ç±»åž‹ç¼–ç 
     *
     * @return type_id - ç±»åž‹ç¼–码
     */
    public String getTypeId() {
        return typeId;
    }
    /**
     * è®¾ç½®ç±»åž‹ç¼–码
     *
     * @param typeId ç±»åž‹ç¼–码
     */
    public void setTypeId(String typeId) {
        this.typeId = typeId == null ? null : typeId.trim();
    }
    /**
     * èŽ·å–ç±»åž‹åç§°
     *
     * @return typename - ç±»åž‹åç§°
     */
    public String getTypename() {
        return typename;
    }
    /**
     * è®¾ç½®ç±»åž‹åç§°
     *
     * @param typename ç±»åž‹åç§°
     */
    public void setTypename(String typename) {
        this.typename = typename == null ? null : typename.trim();
    }
    /**
     * èŽ·å–åœæ­¢æ—¶é—´
     *
     * @return stop_time - åœæ­¢æ—¶é—´
     */
    public Date getStopTime() {
        return stopTime;
    }
    /**
     * è®¾ç½®åœæ­¢æ—¶é—´
     *
     * @param stopTime åœæ­¢æ—¶é—´
     */
    public void setStopTime(Date stopTime) {
        this.stopTime = stopTime;
    }
    /**
     * @return active
     */
    public String getActive() {
        return active;
    }
    /**
     * @param active
     */
    public void setActive(String active) {
        this.active = active == null ? null : active.trim();
    }
    /**
     * èŽ·å–æ•…éšœæ¬¡æ•°
     *
     * @return trouble_num - æ•…障次数
     */
    public Integer getTroubleNum() {
        return troubleNum;
    }
    /**
     * è®¾ç½®æ•…障次数
     *
     * @param troubleNum æ•…障次数
     */
    public void setTroubleNum(Integer troubleNum) {
        this.troubleNum = troubleNum;
    }
    /**
     * èŽ·å–æ–°å¢žæ—¶é—´
     *
     * @return insert_time - æ–°å¢žæ—¶é—´
     */
    public Date getInsertTime() {
        return insertTime;
    }
    /**
     * è®¾ç½®æ–°å¢žæ—¶é—´
     *
     * @param insertTime æ–°å¢žæ—¶é—´
     */
    public void setInsertTime(Date insertTime) {
        this.insertTime = insertTime;
    }
    /**
     * èŽ·å–é˜¶æ®µå¼€å§‹æ—¥æœŸ
     *
     * @return stage_begin_date - é˜¶æ®µå¼€å§‹æ—¥æœŸ
     */
    public Date getStageBeginDate() {
        return stageBeginDate;
    }
    /**
     * è®¾ç½®é˜¶æ®µå¼€å§‹æ—¥æœŸ
     *
     * @param stageBeginDate é˜¶æ®µå¼€å§‹æ—¥æœŸ
     */
    public void setStageBeginDate(Date stageBeginDate) {
        this.stageBeginDate = stageBeginDate;
    }
    /**
     * èŽ·å–tsp浓度
     *
     * @return tsp - tsp浓度
     */
    public Double getTsp() {
        return tsp;
    }
    /**
     * è®¾ç½®tsp浓度
     *
     * @param tsp tsp浓度
     */
    public void setTsp(Double tsp) {
        this.tsp = tsp;
    }
    /**
     * èŽ·å–ç»Ÿè®¡ç±»åž‹ç¼–ç 
     *
     * @return union_type_id - ç»Ÿè®¡ç±»åž‹ç¼–码
     */
    public String getUnionTypeId() {
        return unionTypeId;
    }
    /**
     * è®¾ç½®ç»Ÿè®¡ç±»åž‹ç¼–码
     *
     * @param unionTypeId ç»Ÿè®¡ç±»åž‹ç¼–码
     */
    public void setUnionTypeId(String unionTypeId) {
        this.unionTypeId = unionTypeId == null ? null : unionTypeId.trim();
    }
    /**
     * èŽ·å–å›´å¢™é«˜åº¦
     *
     * @return wall_height - å›´å¢™é«˜åº¦
     */
    public String getWallHeight() {
        return wallHeight;
    }
    /**
     * è®¾ç½®å›´å¢™é«˜åº¦
     *
     * @param wallHeight å›´å¢™é«˜åº¦
     */
    public void setWallHeight(String wallHeight) {
        this.wallHeight = wallHeight == null ? null : wallHeight.trim();
    }
    /**
     * èŽ·å–ä¸šåŠ¡æ—¶é—´
     *
     * @return ywsj_date - ä¸šåŠ¡æ—¶é—´
     */
    public Date getYwsjDate() {
        return ywsjDate;
    }
    /**
     * è®¾ç½®ä¸šåŠ¡æ—¶é—´
     *
     * @param ywsjDate ä¸šåŠ¡æ—¶é—´
     */
    public void setYwsjDate(Date ywsjDate) {
        this.ywsjDate = ywsjDate;
    }
    /**
     * èŽ·å–å»ºç­‘é¢ç§¯
     *
     * @return build_area - å»ºç­‘面积
     */
    public String getBuildArea() {
        return buildArea;
    }
    /**
     * è®¾ç½®å»ºç­‘面积
     *
     * @param buildArea å»ºç­‘面积
     */
    public void setBuildArea(String buildArea) {
        this.buildArea = buildArea == null ? null : buildArea.trim();
    }
    /**
     * èŽ·å–æ–½å·¥å•ä½
     *
     * @return construction_unit - æ–½å·¥å•位
     */
    public String getConstructionUnit() {
        return constructionUnit;
    }
    /**
     * è®¾ç½®æ–½å·¥å•位
     *
     * @param constructionUnit æ–½å·¥å•位
     */
    public void setConstructionUnit(String constructionUnit) {
        this.constructionUnit = constructionUnit == null ? null : constructionUnit.trim();
    }
    /**
     * èŽ·å–ç‚¹ä½æŽ§åˆ¶çº§
     *
     * @return control_level - ç‚¹ä½æŽ§åˆ¶çº§
     */
    public String getControlLevel() {
        return controlLevel;
    }
    /**
     * è®¾ç½®ç‚¹ä½æŽ§åˆ¶çº§
     *
     * @param controlLevel ç‚¹ä½æŽ§åˆ¶çº§
     */
    public void setControlLevel(String controlLevel) {
        this.controlLevel = controlLevel == null ? null : controlLevel.trim();
    }
    /**
     * èŽ·å–å¼€å‘å•†
     *
     * @return developers - å¼€å‘商
     */
    public String getDevelopers() {
        return developers;
    }
    /**
     * è®¾ç½®å¼€å‘商
     *
     * @param developers å¼€å‘商
     */
    public void setDevelopers(String developers) {
        this.developers = developers == null ? null : developers.trim();
    }
    /**
     * èŽ·å–æ‰§è¡Œæ—¶é—´
     *
     * @return do_time - æ‰§è¡Œæ—¶é—´
     */
    public Date getDoTime() {
        return doTime;
    }
    /**
     * è®¾ç½®æ‰§è¡Œæ—¶é—´
     *
     * @param doTime æ‰§è¡Œæ—¶é—´
     */
    public void setDoTime(Date doTime) {
        this.doTime = doTime;
    }
    /**
     * èŽ·å–æ˜¯å¦æœ‰ç›‘æµ‹
     *
     * @return has_monitor - æ˜¯å¦æœ‰ç›‘测
     */
    public String getHasMonitor() {
        return hasMonitor;
    }
    /**
     * è®¾ç½®æ˜¯å¦æœ‰ç›‘测
     *
     * @param hasMonitor æ˜¯å¦æœ‰ç›‘测
     */
    public void setHasMonitor(String hasMonitor) {
        this.hasMonitor = hasMonitor == null ? null : hasMonitor.trim();
    }
    /**
     * èŽ·å–é‡‡é›†æ—¶é—´
     *
     * @return data_time - é‡‡é›†æ—¶é—´
     */
    public Date getDataTime() {
        return dataTime;
    }
    /**
     * è®¾ç½®é‡‡é›†æ—¶é—´
     *
     * @param dataTime é‡‡é›†æ—¶é—´
     */
    public void setDataTime(Date dataTime) {
        this.dataTime = dataTime;
    }
    /**
     * èŽ·å–å½“å‰æ–½å·¥é˜¶æ®µç¼–ç 
     *
     * @return engineering_stage_code - å½“前施工阶段编码
     */
    public String getEngineeringStageCode() {
        return engineeringStageCode;
    }
    /**
     * è®¾ç½®å½“前施工阶段编码
     *
     * @param engineeringStageCode å½“前施工阶段编码
     */
    public void setEngineeringStageCode(String engineeringStageCode) {
        this.engineeringStageCode = engineeringStageCode == null ? null : engineeringStageCode.trim();
    }
    /**
     * èŽ·å–è®¾å¤‡ç¼–ç 
     *
     * @return equipment_code - è®¾å¤‡ç¼–码
     */
    public String getEquipmentCode() {
        return equipmentCode;
    }
    /**
     * è®¾ç½®è®¾å¤‡ç¼–码
     *
     * @param equipmentCode è®¾å¤‡ç¼–码
     */
    public void setEquipmentCode(String equipmentCode) {
        this.equipmentCode = equipmentCode == null ? null : equipmentCode.trim();
    }
    /**
     * èŽ·å–å åœ°é¢ç§¯
     *
     * @return floor_area - å åœ°é¢ç§¯
     */
    public String getFloorArea() {
        return floorArea;
    }
    /**
     * è®¾ç½®å åœ°é¢ç§¯
     *
     * @param floorArea å åœ°é¢ç§¯
     */
    public void setFloorArea(String floorArea) {
        this.floorArea = floorArea == null ? null : floorArea.trim();
    }
    /**
     * èŽ·å–åˆ é™¤æ ‡å¿—ä½
     *
     * @return jhpt_delete - åˆ é™¤æ ‡å¿—位
     */
    public String getJhptDelete() {
        return jhptDelete;
    }
    /**
     * è®¾ç½®åˆ é™¤æ ‡å¿—位
     *
     * @param jhptDelete åˆ é™¤æ ‡å¿—位
     */
    public void setJhptDelete(String jhptDelete) {
        this.jhptDelete = jhptDelete == null ? null : jhptDelete.trim();
    }
    /**
     * èŽ·å–å™ªå£°åŠŸèƒ½åŒº
     *
     * @return noise_region - å™ªå£°åŠŸèƒ½åŒº
     */
    public String getNoiseRegion() {
        return noiseRegion;
    }
    /**
     * è®¾ç½®å™ªå£°åŠŸèƒ½åŒº
     *
     * @param noiseRegion å™ªå£°åŠŸèƒ½åŒº
     */
    public void setNoiseRegion(String noiseRegion) {
        this.noiseRegion = noiseRegion == null ? null : noiseRegion.trim();
    }
    /**
     * èŽ·å–è´Ÿè´£äºº
     *
     * @return responsible - è´Ÿè´£äºº
     */
    public String getResponsible() {
        return responsible;
    }
    /**
     * è®¾ç½®è´Ÿè´£äºº
     *
     * @param responsible è´Ÿè´£äºº
     */
    public void setResponsible(String responsible) {
        this.responsible = responsible == null ? null : responsible.trim();
    }
}
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/mapper/JSDustSiteInfoMapper.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
package cn.flightfeather.supervision.domain.ds3.mapper
import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteInfo
import cn.flightfeather.supervision.domain.util.MyMapper
import org.apache.ibatis.annotations.Mapper
@Mapper
interface JSDustSiteInfoMapper : MyMapper<JSDustSiteInfo?>
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteMapRep.kt
ÎļþÒÑɾ³ý
src/main/kotlin/cn/flightfeather/supervision/domain/ds3/repository/JSDustSiteRep.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
package cn.flightfeather.supervision.domain.ds3.repository
import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteMap
import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteInfoMapper
import cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteMapMapper
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
import cn.flightfeather.supervision.lightshare.vo.DeviceSiteVo
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
/**
 * é‡‘山扬尘监测点位和系统用户映射关系数据库相关操作
 */
@Repository
class JSDustSiteRep(
    private val jsDustSiteMapMapper: JSDustSiteMapMapper,
    private val jsDustSiteInfoMapper: JSDustSiteInfoMapper,
) {
    /**
     * æ ¹æ®é£žç¾½ç›‘管用户id查询场景和监测设备的匹配关系
     * @param idList ç›‘管场景对应的用户id列表
     * @return åŒ¹é…å…³ç³»åˆ—表
     */
    fun findMapBySVUserId(idList: List<String?>): List<DeviceMapVo> {
        val res = jsDustSiteMapMapper.selectByExample(Example(JSDustSiteMap::class.java).apply {
            createCriteria().andIn("svUserId", idList)
        })
        return DeviceMapVo.fromJSDustSiteMap(res)
    }
    /**
     * èŽ·å–é‡‘å±±ç›‘æµ‹ç‚¹ä½åŸºæœ¬ä¿¡æ¯
     * @return ç›‘测点信息列表
     */
    fun findSiteInfo(): List<DeviceSiteVo> {
        val res = jsDustSiteInfoMapper.selectAll()
        return DeviceSiteVo.fromJSDustSiteInfo(res)
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
@@ -42,5 +42,5 @@
    fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>?
    fun downloadAutoEvaluation(areaVo: AreaVo, response: HttpServletResponse): Boolean
    fun downloadAutoEvaluation(areaVo: AreaVo, forceUpdate: Boolean, response: HttpServletResponse): Boolean
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
import cn.flightfeather.supervision.lightshare.vo.EvaluationVo
interface EvaluationsubruleService {
@@ -18,4 +19,6 @@
    fun search(districtCode: String, sceneTypeId: String, version: String? = null): List<Evaluationsubrule>
    fun getAutoScore(subTaskId: String): List<EvaluationVo>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/InspectionService.kt
@@ -24,8 +24,11 @@
    fun findGitListById(id: String): List<GitlistVo>
    fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo
    fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo?
    //获取月任务巡查统计信息
    fun getStatistic(topTaskId: String, sceneTypeId: String): BaseResponse<List<InspectionStatisticVo>>
    fun getStatistic(topTaskId: String, sceneTypeId: String): List<InspectionStatisticVo>
    //获取月任务巡查统计信息
    fun getStatistic(areaVo: AreaVo): List<InspectionStatisticVo>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
import cn.flightfeather.supervision.lightshare.vo.*
import org.springframework.web.multipart.MultipartFile
@@ -45,5 +46,10 @@
    fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String>
    fun getBySubTask(stGuid: String): List<ProblemlistVo>
    fun getBySubTask(stGuid: String, all:Boolean?): List<ProblemlistVo>
    fun getSceneByProType(areaVo: AreaVo, pType:String):List<Subtask?>
    fun getSceneProSummary(areaVo: AreaVo, sortBy: String, page: Int, per_page: Int): Pair<DataHead?,
            List<SceneProblemSummary>?>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ScenseService.kt
@@ -2,7 +2,9 @@
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.entity.Task
import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
import cn.flightfeather.supervision.lightshare.vo.*
import org.springframework.web.multipart.MultipartFile
interface ScenseService {
@@ -43,4 +45,18 @@
    fun searchScene(areaVo: AreaVo, page: Int?, perPage: Int?): BaseResponse<List<Scense>>
    fun searchByCoordinate(lng: Double, lat: Double, radius: Double): List<Scense>
    /**
     * é€šè¿‡æ–‡ä»¶æ‰¹é‡å¯¼å…¥åœºæ™¯ä¿¡æ¯
     */
    fun importSceneInfo(file: MultipartFile): Boolean
    /**
     * åˆ›å»ºåœºæ™¯ä¿¡æ¯
     */
    fun createScene(scense: Scense): Scense
    fun createOneScene(scense: Scense)
    fun createTZUserInfo(userInfo: Userinfo, scense: Scense)
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SubtaskService.kt
@@ -2,6 +2,7 @@
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
import cn.flightfeather.supervision.lightshare.vo.*
import java.time.LocalDateTime
interface SubtaskService {
@@ -45,4 +46,8 @@
    fun getByTopTaskAndDate(topTaskId: String, startTime: String?, endTime: String?, sceneTypeId: Int? = null): List<Subtask>
    fun getSummary(topTaskId: String, sceneTypeId: Int? = null): List<SubTaskSummary>
    fun getSummaryByArea(areaVo: AreaVo): List<TaskProgressVo>
    fun getByScene(sceneId: String, startTime: LocalDateTime?, endTime: LocalDateTime?): List<SubTaskSummary>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TaskService.kt
@@ -52,4 +52,10 @@
    fun findTask(areaVo: AreaVo):List<Task?>
    /**
     * æŸ¥æ‰¾æ€»ä»»åŠ¡å®Œæˆæƒ…å†µ
     * @param areaVo ç­›é€‰æ¡ä»¶
     */
    fun findTaskProgress(areaVo: AreaVo): List<TaskProgressVo?>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds2.entity.UserMap
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
@@ -11,6 +12,11 @@
     */
    fun getTZIdBySceneId(sceneId: String): UserMap
    /**
     * æ ¹æ®é£žç¾½çŽ¯å¢ƒç³»ç»Ÿä¸­çš„åœºæ™¯id,获取与飞羽监管系统中的关联用户
     */
    fun getSceneByTZId(tzUserId: String): Scense?
    fun autoCreateMap()
    fun fetchDeviceMap(areaVo: AreaVo): List<DeviceMapVo?>
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt
@@ -1,6 +1,8 @@
package cn.flightfeather.supervision.lightshare.service
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
interface UserinfoService {
    fun findOne(id: String): Userinfo?
@@ -21,5 +23,11 @@
    fun findByScene(sceneId: String): Userinfo?
    fun getUName(sceneName: String): String
    fun autoCreateAccount()
    fun createAccount(scence: Scense):Userinfo
    fun createAccountTZ(userinfo: Userinfo, scence: Scense): UserinfoTZ
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt
@@ -1,6 +1,6 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
import cn.flightfeather.supervision.common.executor.BgTaskConditionVo
import cn.flightfeather.supervision.common.executor.BgTaskStatus
@@ -16,21 +16,21 @@
    }
    override fun startTask(condition: BgTaskConditionVo): BgTaskStatus? {
        condition.type ?: throw ResponseErrorException("任务类型不能为空")
        condition.id ?: throw ResponseErrorException("任务id不能为空")
        condition.type ?: throw BizException("任务类型不能为空")
        condition.id ?: throw BizException("任务id不能为空")
        val task = backgroundTaskCtrl.startTask(condition.type!!, condition.id!!)
        return task.taskStatus
    }
    override fun shutDownTask(condition: BgTaskConditionVo): List<BgTaskStatus?> {
        condition.type ?: throw ResponseErrorException("任务类型不能为空")
        condition.type ?: throw BizException("任务类型不能为空")
        return backgroundTaskCtrl.shutDownTask(condition.type!!, condition.id)
    }
    override fun removeTask(condition: BgTaskConditionVo): Boolean {
        condition.type ?: throw ResponseErrorException("任务类型不能为空")
        condition.id ?: throw ResponseErrorException("任务id不能为空")
        condition.type ?: throw BizException("任务类型不能为空")
        condition.id ?: throw BizException("任务id不能为空")
        return backgroundTaskCtrl.removeTask(condition.type!!, condition.id!!)
    }
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt
@@ -1,18 +1,13 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep
import cn.flightfeather.supervision.domain.ds2.entity.Complaint
import cn.flightfeather.supervision.domain.ds2.entity.Punishment
import cn.flightfeather.supervision.domain.ds2.mapper.ComplaintMapper
import cn.flightfeather.supervision.domain.ds2.mapper.PunishmentMapper
import cn.flightfeather.supervision.domain.ds2.repository.ComplaintAndPunishmentRep
import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep
import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep
import cn.flightfeather.supervision.lightshare.service.ComplaintService
import cn.flightfeather.supervision.lightshare.service.UserinfoService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.ComplaintVo
import cn.flightfeather.supervision.lightshare.vo.PunishmentVo
@@ -37,7 +32,7 @@
            }
            //以飞羽监管系统中的用户为主体
            2 -> {
                val task = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("当前查询条件下未找到对应顶层任务")
                val task = taskRep.findOneTask(areaVo) ?: throw BizException("当前查询条件下未找到对应顶层任务")
                val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
                    .map { it?.guid }
                val idList = userInfoSVRep.findUser(scenes).map { it?.guid }
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
@@ -6,10 +6,8 @@
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.ResponseErrorException
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.executor.BgTaskStatus
import cn.flightfeather.supervision.domain.ds1.entity.Domainitem
import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
@@ -31,7 +29,6 @@
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
import java.io.File
import java.net.URLEncoder
import java.util.*
import javax.servlet.http.HttpServletResponse
import kotlin.Comparator
@@ -290,9 +287,9 @@
        return evaluationRep.findAutoScore(areaVo)
    }
    override fun downloadAutoEvaluation(areaVo: AreaVo, response: HttpServletResponse): Boolean {
        areaVo.scensetypeid ?: throw ResponseErrorException("必须选择一个场景类型")
        val topTask = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("未找到符合条件的顶层任务")
    override fun downloadAutoEvaluation(areaVo: AreaVo, forceUpdate: Boolean, response: HttpServletResponse): Boolean {
        areaVo.scensetypeid ?: throw BizException("必须选择一个场景类型")
        val topTask = taskRep.findOneTask(areaVo) ?: throw BizException("未找到符合条件的顶层任务")
        val config = ExcelConfigVo(
            topTask.tguid ?: "",
            topTask.starttime,
@@ -301,7 +298,8 @@
            topTask.citycode,
            topTask.districtcode,
            topTask.towncode,
            areaVo.scensetypeid?.toInt()
            areaVo.scensetypeid?.toInt(),
            forceUpdate = forceUpdate
        )
        val dataSource = DataSource(config, dbMapper)
@@ -310,8 +308,8 @@
        val p = "$filePath/autoscore/"
        val file = File(p + fileName)
        if (config.forceUpdate || !file.exists()) {
//            val downloadUrl = "/autoscore/${fileName}"
//            reportTaskCtrl.startTask(t, downloadUrl)
            val downloadUrl = "/autoscore/${fileName}"
            reportTaskCtrl.startTask(t, downloadUrl)
            return false
        } else {
            val fName = Base64.getEncoder().encodeToString(fileName.toByteArray())
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
@@ -1,18 +1,24 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRuleRep
import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService
import cn.flightfeather.supervision.lightshare.vo.EvaluationVo
import cn.flightfeather.supervision.lightshare.vo.SubEvaluationVo
import cn.flightfeather.supervision.lightshare.vo.ThirdEvaluationVo
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
@Service
class EvaluationsubruleServiceImpl (
        val evaluationsubruleMapper: EvaluationsubruleMapper,
        val evaluationruleMapper: EvaluationruleMapper
):EvaluationsubruleService {
class EvaluationsubruleServiceImpl(
    val evaluationsubruleMapper: EvaluationsubruleMapper,
    val evaluationruleMapper: EvaluationruleMapper,
    private val evaluationRep: EvaluationRep,
    private val evaluationRuleRep: EvaluationRuleRep,
) : EvaluationsubruleService {
    override fun findOne(id: String): Evaluationsubrule = evaluationsubruleMapper.selectByPrimaryKey(id)
@@ -20,7 +26,8 @@
    override fun save(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.insert(evaluationsubrule)
    override fun update(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule)
    override fun update(evaluationsubrule: Evaluationsubrule): Int =
        evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule)
    override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id)
@@ -36,8 +43,8 @@
        val result = mutableListOf<Evaluationsubrule>()
        evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
            createCriteria().andEqualTo("districtcode", districtCode)
                    .andEqualTo("scensetypeid", sceneTypeId)
        }).takeIf { it.isNotEmpty() }?.get(0)?.let {rule ->
                .andEqualTo("scensetypeid", sceneTypeId)
        }).takeIf { it.isNotEmpty() }?.get(0)?.let { rule ->
            evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule::class.java).apply {
                createCriteria().andEqualTo("erguid", rule.guid)
            })
@@ -47,4 +54,128 @@
        return result
    }
    override fun getAutoScore(subTaskId: String): List<EvaluationVo> {
        //子规则逐条得分
        val subRuleScores = evaluationRep.findItemEvaluation(subTaskId)
        //总规则id
        val ruleId = mutableListOf<Evaluation>()
        //评分总规则
        val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId)
        //总规则对应的评分子规则
        val subRules = mutableListOf<Evaluationsubrule2>()
        //查询结果
        val resultList = mutableListOf<EvaluationVo>()
        var _group = 0
        subRules.forEach {
            when (it.ertype) {
                2 -> resultList.add(EvaluationVo().apply {
                    id = it.guid
                    title1 = it.itemname
                    scoreMode = it.extension1
                    gradeMode = it.extension2
                    score = when (gradeMode) {
                        "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
                        "add_mode" -> it.maxscore ?: 0
                        else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
                    }
                    selectMode = it.extension3
                    //如果有得分记录,则改变状态为选中
                    for (s in subRuleScores) {
                        if (it.guid == s.esrguid) {
                            select = s.extension1 == "true"
                            break
                        }
                    }
                })
                3 -> {
                    for (r in resultList) {
                        if (it.fatherid == r.id) {
                            r.sub1.add(SubEvaluationVo().apply {
                                id = it.guid
                                title2 = it.itemname
                                gradeMode = it.extension2
                                selectMode = it.extension3
                                score = when (gradeMode) {
                                    "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
                                    "add_mode" -> it.maxscore ?: 0
                                    else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0
                                }
                                group = _group++
                                //如果有得分记录,则改变状态为选中
                                for (s in subRuleScores) {
                                    if (it.guid == s.esrguid) {
                                        select = s.extension1 == "true"
                                        break
                                    }
                                }
                            })
                            break
                        }
                    }
                }
                4 -> {
                    resultList.forEach{ r ->
                        //4级的评估项直接附属于2级评估项
                        if (r.id == it.fatherid) {
                            if (r.sub1.isEmpty()) {
                                r.sub1.add(SubEvaluationVo().apply {
                                    placeholder = true
                                    id = it.guid
                                    title2 = r.title1
                                    score = r.score
                                    gradeMode = r.gradeMode
                                    selectMode = r.selectMode
                                    group = _group++
                                })
                            }
                            r.sub1[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)
                                    "add_mode" -> it.maxscore ?: 0
                                    else -> r.score.plus(it.maxscore ?: 0)
                                }
                                //如果有得分记录,则改变状态为选中
                                for (s in subRuleScores) {
                                    if (it.guid == s.esrguid) {
                                        select = s.extension1 == "true"
                                        break
                                    }
                                }
                            })
                        } else {
                            r.sub1.forEach { sr ->
                                if (sr.id == it.fatherid){
                                    sr.sub2.add(ThirdEvaluationVo().apply {
                                        id = it.guid
                                        content = it.itemname
                                        score = when (sr.gradeMode) {
                                            "minus_mode" -> sr.score.plus(it.maxscore ?: 0)
                                            "add_mode" -> it.maxscore ?: 0
                                            else -> sr.score.plus(it.maxscore ?: 0)
                                        }
                                        //如果有得分记录,则改变状态为选中
                                        for (s in subRuleScores) {
                                            if (it.guid == s.esrguid) {
                                                select = s.extension1 == "true"
                                                break
                                            }
                                        }
                                    })
                                }
                            }
                        }
                    }
                }
            }
        }
        return resultList
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/InspectionServiceImpl.kt
@@ -1,9 +1,11 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.entity.Inspection
import cn.flightfeather.supervision.domain.ds1.mapper.InspectionMapper
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.lightshare.service.*
import cn.flightfeather.supervision.lightshare.vo.*
import org.springframework.beans.BeanUtils
@@ -12,7 +14,10 @@
import tk.mybatis.mapper.entity.Example
@Service
class InspectionServiceImpl(val inspectionMapper: InspectionMapper) : InspectionService {
class InspectionServiceImpl(
    val inspectionMapper: InspectionMapper,
    private val taskRep: TaskRep,
) : InspectionService {
    @Autowired
    lateinit var problemlistService: ProblemlistService
@@ -32,32 +37,9 @@
    private val dateUtil = DateUtil()
    //获取污染场景版本主页的监管情况展示内容
    override fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo {
        val maps = inspectionMapper.getInspectionInfoByScene(sceneId, topTaskId)
        val inspectionInfoVo = InspectionInfoVo()
        if (maps.isNotEmpty()) {
            val map = maps[0]
            if (map.isNotEmpty()) {
                inspectionInfoVo.topTaskid = map["topTaskId"].toString()
                inspectionInfoVo.topTaskName = map["topTaskName"].toString()
                inspectionInfoVo.sceneId = map["sceneId"].toString()
                inspectionInfoVo.sceneName = map["sceneName"].toString()
                inspectionInfoVo.inspectionId = map["inspectionId"].toString()
                inspectionInfoVo.subtaskId = map["subtaskId"].toString()
                inspectionInfoVo.inspected = map["isInspected"].toString().equals("1")
                map["inspectionTime"]?.let {
                    val time = it.toString()
                    inspectionInfoVo.inspectionTime = dateUtil.StringToString(time, DateUtil.DateStyle.YYYY_MM_DD)
                }
                inspectionInfoVo.inspectionTimes = map["inspectionTimes"].toString().toInt()
                inspectionInfoVo.promised = map["isPromised"].toString().equals("1")
                inspectionInfoVo.changed = map["isChanged"].toString().equals("1")
                inspectionInfoVo.unChangedCount = map["unChangedCount"].toString().toInt()
                inspectionInfoVo.changedCount = map["changedCount"].toString().toInt()
                inspectionInfoVo.promisedTime = map["promisedTime"].toString()
            }
        }
        return inspectionInfoVo
    override fun getInspectionInfoByScene(sceneId: String, topTaskId: String): InspectionInfoVo? {
        val resList = inspectionMapper.getInspectionInfoByScene(sceneId, topTaskId)
        return if (resList.isNotEmpty()) resList[0] else InspectionInfoVo()
    }
    //根据巡查ID获取问题列表
@@ -241,12 +223,14 @@
    override fun delete(id: String): Int = inspectionMapper.deleteByPrimaryKey(id)
    override fun getStatistic(topTaskId: String, sceneTypeId: String): BaseResponse<List<InspectionStatisticVo>> {
    override fun getStatistic(topTaskId: String, sceneTypeId: String): List<InspectionStatisticVo> {
        val result = inspectionMapper.getStatistic(topTaskId, sceneTypeId)
        return if (result.isNotEmpty()) {
            BaseResponse(true, data = result)
        } else {
            BaseResponse(false)
        }
        return result.ifEmpty { throw BizException("无巡查记录") }
    }
    override fun getStatistic(areaVo: AreaVo): List<InspectionStatisticVo> {
        areaVo.scensetypeid ?: throw BizException("请求参数requestBody中场景类型scensetypeid不能为空")
        val topTask = taskRep.findOneTask(areaVo) ?: throw BizException("未找到相关巡查总任务")
        return getStatistic(topTask.tguid!!, areaVo.scensetypeid!!)
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt
@@ -16,7 +16,7 @@
    override fun updatelist(itemevaluationlist: List<Itemevaluation>): Int {
        //循环修改
        itemevaluationlist.forEach {
            itemevaluationMapper.updateByPrimaryKey(it)
            itemevaluationMapper.updateByPrimaryKeySelective(it)
        }
        return itemevaluationlist.size
    }
@@ -51,7 +51,7 @@
    override fun save(itemevaluation: Itemevaluation): Int = itemevaluationMapper.insert(itemevaluation)
    override fun update(itemevaluation: Itemevaluation): Int = itemevaluationMapper.updateByPrimaryKey(itemevaluation)
    override fun update(itemevaluation: Itemevaluation): Int = itemevaluationMapper.updateByPrimaryKeySelective(itemevaluation)
    override fun delete(id: String): Int = itemevaluationMapper.deleteByPrimaryKey(id)
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MonitorobjectversionServiceImpl.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.entity.Monitorobjectversion
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.mapper.MonitorobjectversionMapper
@@ -46,6 +47,7 @@
    @Transactional
    override fun saveList(monitorobjectversionlist: List<Monitorobjectversion>): Int {
        monitorobjectversionlist.forEach {
            if (it.movid == null) it.movid = UUIDGenerator.generate16ShortUUID()
            monitorobjectversionMapper.insert(it)
        }
        return monitorobjectversionlist.size
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt
@@ -1,18 +1,24 @@
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.Scense
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.FileUtil
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.entity.Mediafile
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
import cn.flightfeather.supervision.domain.ds1.mapper.*
import cn.flightfeather.supervision.domain.ds1.repository.ProblemRep
import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.lightshare.service.MediafileService
import cn.flightfeather.supervision.lightshare.service.ProblemlistService
import cn.flightfeather.supervision.lightshare.service.TaskService
import cn.flightfeather.supervision.lightshare.vo.*
import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.pagehelper.PageHelper
import org.springframework.beans.BeanUtils
import org.springframework.stereotype.Service
import org.springframework.web.multipart.MultipartFile
@@ -32,17 +38,24 @@
class ProblemlistServiceImpl(
    val problemlistMapper: ProblemlistMapper,
    val inspectionMapper: InspectionMapper,
    val mediafileMapper: MediafileMapper
    val mediafileMapper: MediafileMapper,
    private val taskRep: TaskRep,
    private val subTaskRep: SubTaskRep,
    private val problemRep: ProblemRep,
) : ProblemlistService {
    @Resource
    lateinit var scenseMapper: ScenseMapper
    @Resource
    lateinit var problemtypeMapper: ProblemtypeMapper
    @Resource
    lateinit var taskMapper: TaskMapper
    @Resource
    lateinit var taskService: TaskService
    @Resource
    lateinit var mediafileService: MediafileService
@@ -118,24 +131,7 @@
        val sceneType = areaVo.scensetypeid
        val startTime = areaVo.starttime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
        val endTime = areaVo.endtime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
        val maps = problemlistMapper.getStatisticalResult(districtcode,startTime, endTime, sceneType)
        val statisticsVos = mutableListOf<StatisticsVo>()
        maps.forEach {
            if (!it.isEmpty() && it.get("name") != null) {
                val statisticsVo = StatisticsVo()
                statisticsVo.name = it.get("name").toString()
                try {
                    statisticsVo.count = it.get("count").toString().toInt()
                } catch (e: Exception) {
                }
                try {
                    statisticsVo.changeCount = it.get("changeCount").toString().toInt()
                } catch (e: Exception) {
                }
                statisticsVos.add(statisticsVo)
            }
        }
        return statisticsVos
        return problemlistMapper.getStatisticalResult(districtcode, startTime, endTime, sceneType, areaVo.sceneId)
    }
    override fun getChargeResult(areaVo: AreaVo): ChargeInfoVo {
@@ -172,7 +168,7 @@
            } catch (e: Exception) {
            }
            try {
                sceneInfo.changeCount  =it.get("changeCount").toString().toInt()
                sceneInfo.changeCount = it.get("changeCount").toString().toInt()
            } catch (e: Exception) {
            }
            chargeInfoVo.sceneInfos.add(sceneInfo)
@@ -191,16 +187,16 @@
                var curScore = -1
                if (it.get("scoreAft") != null) {
                    curScore = it.get("scoreAft").toString().toInt()
                }else if (it.get("scoreBef") != null) {
                } else if (it.get("scoreBef") != null) {
                    curScore = it.get("scoreBef").toString().toInt()
                }
                if (curScore >= 100) {
                    scoreInfo1.count++
                }else if (curScore >= 78 && curScore < 100) {
                } else if (curScore >= 78 && curScore < 100) {
                    scoreInfo2.count++
                }else if (curScore >= 54 && curScore < 78) {
                } else if (curScore >= 54 && curScore < 78) {
                    scoreInfo3.count++
                }else if (curScore < 54 && curScore >= 0) {
                } else if (curScore < 54 && curScore >= 0) {
                    scoreInfo4.count++
                }
            }
@@ -214,7 +210,7 @@
    }
    //根据地域获取问题
    override fun getByArea(areaVo: AreaVo):List<ProblemlistVo> {
    override fun getByArea(areaVo: AreaVo): List<ProblemlistVo> {
        val problemlist = mutableListOf<ProblemlistVo>()
//        val tmpproblemlsit = mutableListOf<Problemlist>()
        val example = Example(Scense::class.java)
@@ -230,8 +226,8 @@
            criteria.andEqualTo("towncode", areaVo.towncode)
        criteria.andEqualTo("typeid", areaVo.scensetypeid)
        val result1 = scenseMapper.selectByExample(example)
        if (result1.isNotEmpty()){
            result1.forEach{
        if (result1.isNotEmpty()) {
            result1.forEach {
                val tmpexample = Example(Problemlist::class.java)
                val tmpcriteria = tmpexample.createCriteria()
                //对于确定的每个场景,根据时间查询问题
@@ -345,23 +341,35 @@
    override fun findMonthProblemById(taskId: String, sceneId: Int?): List<MonthProblemVo> {
        val monthProblemlistVoList = mutableListOf<MonthProblemVo>()
        var map = problemlistMapper.findMonthProblemById(taskId,sceneId)
        var map = problemlistMapper.findMonthProblemById(taskId, sceneId)
        map.forEach { m ->
            val monthProblemVo = MonthProblemVo()
            monthProblemVo.townCode =if(m.get("towncode")!= null) BigDecimal(m.get("towncode").toString()).toString() else null
            monthProblemVo.townCode =
                if (m.get("towncode") != null) BigDecimal(m.get("towncode").toString()).toString() else null
            monthProblemVo.townName = if (m.get("townname") != null) m.get("townname").toString() else null
            monthProblemVo.scenetype =if (m.get("scenetype") != null) m.get("scenetype").toString().toInt()else null
            monthProblemVo.scenetypename =if(m.get("scenetypename") != null)m.get("scenetypename").toString()else null
            monthProblemVo.totalscenecount =if(m.get("totalscenecount") != null)m.get("totalscenecount").toString().toInt()else null
            monthProblemVo.problemscenes =if(m.get("problemscenes") != null)m.get("problemscenes").toString().toInt()else null
            monthProblemVo.totalproblems =if(m.get("totalproblems") != null)m.get("totalproblems").toString().toInt()else null
            monthProblemVo.changedproblems =if(m.get("changedproblems") != null)m.get("changedproblems").toString().toInt()else null
            monthProblemVo.scenetype = if (m.get("scenetype") != null) m.get("scenetype").toString().toInt() else null
            monthProblemVo.scenetypename =
                if (m.get("scenetypename") != null) m.get("scenetypename").toString() else null
            monthProblemVo.totalscenecount =
                if (m.get("totalscenecount") != null) m.get("totalscenecount").toString().toInt() else null
            monthProblemVo.problemscenes =
                if (m.get("problemscenes") != null) m.get("problemscenes").toString().toInt() else null
            monthProblemVo.totalproblems =
                if (m.get("totalproblems") != null) m.get("totalproblems").toString().toInt() else null
            monthProblemVo.changedproblems =
                if (m.get("changedproblems") != null) m.get("changedproblems").toString().toInt() else null
            monthProblemlistVoList.add(monthProblemVo)
        }
        return monthProblemlistVoList;
    }
    override fun check(pId: String, action: Byte, remark: String, userId: String, userName: String): BaseResponse<String> {
    override fun check(
        pId: String,
        action: Byte,
        remark: String,
        userId: String,
        userName: String,
    ): BaseResponse<String> {
        if (action !in 0..3) {
            return BaseResponse(false, "非法的操作指令")
        }
@@ -375,22 +383,24 @@
                    0.toByte() -> extension3 = Constant.PROBLEM_CHECK_PASS
                    1.toByte() -> extension3 = Constant.PROBLEM_CHECK_FAIL
                    2.toByte(),
                    3.toByte() -> {
                    3.toByte(),
                    -> {
                        response.success = false
                        response.message = "问题提交还未审核,无法进行整改审核!"
                    }
                }
            }else if (extension3 == Constant.PROBLEM_CHECK_PASS || extension3 == Constant.PROBLEM_CHECK_FAIL) {
            } else if (extension3 == Constant.PROBLEM_CHECK_PASS || extension3 == Constant.PROBLEM_CHECK_FAIL) {
                when (action) {
                    0.toByte() -> extension3 = Constant.PROBLEM_CHECK_PASS
                    1.toByte() -> extension3 = Constant.PROBLEM_CHECK_FAIL
                    2.toByte(),
                    3.toByte() -> {
                    3.toByte(),
                    -> {
                        if (ischanged == true && extension3 == Constant.PROBLEM_CHECK_PASS) {
                            response.success = true
                            extension3 = if (action == 2.toByte()) {
                                Constant.CHANGE_CHECK_PASS
                            }else{
                            } else {
                                Constant.CHANGE_CHECK_FAIL
                            }
                        } else {
@@ -399,20 +409,22 @@
                        }
                    }
                }
            }else if (extension3 == Constant.CHANGE_UNCHECKED) {
            } else if (extension3 == Constant.CHANGE_UNCHECKED) {
                when (action) {
                    0.toByte(),
                    1.toByte() -> {
                    1.toByte(),
                    -> {
                        response.success = false
                        response.message = "问题提交已审核,并且已被整改。操作无效"
                    }
                    2.toByte() -> extension3 = Constant.CHANGE_CHECK_PASS
                    3.toByte() -> extension3 = Constant.CHANGE_CHECK_FAIL
                }
            }else if (extension3 == Constant.CHANGE_CHECK_PASS || extension3 == Constant.CHANGE_CHECK_FAIL) {
            } else if (extension3 == Constant.CHANGE_CHECK_PASS || extension3 == Constant.CHANGE_CHECK_FAIL) {
                when (action) {
                    0.toByte(),
                    1.toByte() -> {
                    1.toByte(),
                    -> {
                        response.success = false
                        response.message = "问题提交已审核,并且已被整改。操作无效"
                    }
@@ -476,11 +488,14 @@
                filetype = 1
                businesstype = "问题"
                businesstypeid = 1
                path = "FlightFeather/Photo/" + scene.districtname + "/" + now.year + "å¹´" + now.monthValue + "月/" + now.monthValue + "月" + now.dayOfMonth + "日/" + scene.name + "/"
                description = problemlist.problemname + " " + problemlist.location + " " + UUIDGenerator.generateUUID(4) + ".jpg"
                path =
                    "FlightFeather/Photo/" + scene.districtname + "/" + now.year + "å¹´" + now.monthValue + "月/" + now.monthValue + "月" + now.dayOfMonth + "日/" + scene.name + "/"
                description =
                    problemlist.problemname + " " + problemlist.location + " " + UUIDGenerator.generateUUID(4) + ".jpg"
                savetime = Date()
                ischanged = false
                extension1 = scene.citycode + "/" + scene.districtcode + "/" + now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "/" + scene.guid + "/"
                extension1 =
                    scene.citycode + "/" + scene.districtcode + "/" + now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + "/" + scene.guid + "/"
                remark = "已上传"
            }
            mediafileMapper.insert(mediaFile)
@@ -562,21 +577,47 @@
        return BaseResponse(true)
    }
    override fun getBySubTask(stGuid: String): List<ProblemlistVo> {
    override fun getBySubTask(stGuid: String, all: Boolean?): List<ProblemlistVo> {
        //根据子任务ID获取问题列表
        val problemListVo = findBySubtaskId(stGuid)
        //判断是否有问题列表
        if (!problemListVo.isEmpty()) {
            //根据每个问题,获取媒体文件
            problemListVo.forEach {
                val mediafileVo = mediafileService.findByBusinessGUID(it.guid!!)
                //判断是否有媒体资料
                if (!mediafileVo.isEmpty()) {
                    //赋值
                    it.mediafileList = mediafileVo
        val problemListVo = mutableListOf<ProblemlistVo>()
        if (all == false) {
            //去除未审核以及审核不通过的问题
            findBySubtaskId(stGuid).forEach {
                if (it.extension3 != Constant.PROBLEM_UNCHECKED && it.extension3 != Constant.PROBLEM_CHECK_FAIL) {
                    problemListVo.add(it)
                }
            }
        } else {
            problemListVo.addAll(findBySubtaskId(stGuid))
        }
        //根据每个问题,获取媒体文件
        problemListVo.forEach {
            val mediafileVo = mediafileService.findByBusinessGUID(it.guid!!)
            //判断是否有媒体资料
            if (mediafileVo.isNotEmpty()) {
                //赋值
                it.mediafileList = mediafileVo
            }
        }
        return problemListVo
    }
    override fun getSceneByProType(areaVo: AreaVo, pType: String): List<Subtask?> {
        areaVo.scensetypeid ?: throw BizException("缺少场景类型参数")
        val task = taskRep.findOneTask(areaVo) ?: throw BizException("未找到对应的巡查总任务")
        return subTaskRep.findSubtasks(task.tguid!!, areaVo.scensetypeid!!, pType)
    }
    override fun getSceneProSummary(
        areaVo: AreaVo,
        sortBy: String,
        page: Int,
        per_page: Int,
    ): Pair<DataHead?, List<SceneProblemSummary>?> {
        areaVo.scensetypeid ?: throw BizException("缺少场景类型参数")
        val task = taskRep.findOneTask(areaVo) ?: throw BizException("未找到对应的巡查总任务")
        val p = PageHelper.startPage<SceneProblemSummary>(page, per_page)
        val res = problemRep.getSceneProSummary(task.tguid!!, areaVo.scensetypeid!!, areaVo.sort, sortBy)
        return DataHead(p.pageNum, p.pages, p.total) to res
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImpl.kt
@@ -1,19 +1,30 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.import.SceneImport
import cn.flightfeather.supervision.business.location.LocationRoadNearby
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds1.mapper.*
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
import cn.flightfeather.supervision.domain.ds2.entity.UserMap
import cn.flightfeather.supervision.domain.ds2.repository.BaseInfoRep
import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep
import cn.flightfeather.supervision.lightshare.service.*
import cn.flightfeather.supervision.lightshare.vo.*
import com.github.pagehelper.PageHelper
import com.google.gson.Gson
import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
import org.springframework.beans.BeanUtils
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import org.springframework.web.multipart.MultipartFile
import tk.mybatis.mapper.entity.Example
import tk.mybatis.mapper.util.StringUtil
import java.io.ByteArrayInputStream
import java.util.*
import kotlin.collections.ArrayList
@Service
class ScenseServiceImpl(
@@ -25,6 +36,10 @@
    val sceneWharfMapper: SceneWharfMapper,
    val userinfoService: UserinfoService,
    private val locationRoadNearby: LocationRoadNearby,
    private val sceneImport: SceneImport,
    private val sceneRep: SceneRep,
    private val baseInfoRep: BaseInfoRep,
    private val userMapRep: UserMapRep,
) : ScenseService {
    @Autowired
@@ -132,12 +147,13 @@
    }
    override fun save(scense: Scense): Int {
        // TODO: 2021/7/20 æ–°å¢žåœºæ™¯çš„同时生成账户
        val r = scenseMapper.insert(scense)
        if (r == 1) {
            scense.guid?.let { userinfoService.createAccount(it) }
        return try {
            createScene(scense)
            1
        } catch (e: BizException) {
            println(e.message)
            0
        }
        return r
    }
    override fun update(scense: Scense): Int = scenseMapper.updateByPrimaryKeySelective(scense)
@@ -371,7 +387,6 @@
                areaVo.towncode?.let { andEqualTo("towncode", it) }
                areaVo.scensetypeid?.let { andEqualTo("typeid", it) }
                areaVo.sceneName?.let { andLike("name", "%${it}%") }
            }
            areaVo.online?.let {
                and(createCriteria().apply {
@@ -390,4 +405,53 @@
    override fun searchByCoordinate(lng: Double, lat: Double, radius: Double): List<Scense> {
        return locationRoadNearby.searchByRadius(Pair(lng, lat), radius)
    }
    override fun importSceneInfo(file: MultipartFile): Boolean {
        val f = ByteArrayInputStream(file.bytes)
        val scenes = sceneImport.readFromFile(f)
        // æŸ¥æ‰¾åœºæ™¯åç§°æ˜¯å¦é‡å¤
        val names = scenes.map { it.name }
        sceneRep.findScenes(names).map { it?.name }.ifNotEmpty {
            val str = this.joinToString(",")
            throw BizException("存在重复场景,如下:${str}")
        }
        scenes.forEach {
            createOneScene(it)
        }
        return true
    }
    override fun createScene(scense: Scense): Scense {
        val names = listOf(scense.name)
        sceneRep.findScenes(names).map { it?.name }.ifNotEmpty {
            val str = this.joinToString(",")
            throw BizException("存在重复场景,如下:${str}")
        }
        createOneScene(scense)
        return scense
    }
    override fun createOneScene(scense: Scense) {
        //1. æ’入场景表
        sceneRep.insert(scense)
        //2. ç”Ÿæˆå¯¹åº”账户信息
        val userInfo = userinfoService.createAccount(scense)
        createTZUserInfo(userInfo, scense)
    }
    override fun createTZUserInfo(userInfo: Userinfo, scense: Scense) {
        //1. ç”Ÿæˆé£žç¾½çŽ¯å¢ƒç³»ç»Ÿå¯¹åº”è´¦æˆ·å’ŒåŸºç¡€ä¿¡æ¯
        val userInfoTZ = userinfoService.createAccountTZ(userInfo, scense)
        val baseInfo = baseInfoRep.create(userInfoTZ, scense)
        //2. ç”Ÿæˆç”¨æˆ·åŒ¹é…ä¿¡æ¯
        userMapRep.insert(UserMap().apply {
            tzUserId = userInfoTZ.guid
            tzUserName = userInfoTZ.realname
            svUserId = userInfo.guid
            svUserName = userInfo.realname
            umCreateTime = Date()
        })
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
@@ -1,11 +1,13 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds1.mapper.*
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.TaskRep
import cn.flightfeather.supervision.lightshare.service.SubtaskService
import cn.flightfeather.supervision.lightshare.service.TaskService
import cn.flightfeather.supervision.lightshare.vo.*
@@ -16,6 +18,7 @@
import org.springframework.transaction.annotation.Transactional
import tk.mybatis.mapper.entity.Example
import tk.mybatis.mapper.util.StringUtil
import java.time.LocalDateTime
import java.util.*
import kotlin.math.ceil
@@ -23,6 +26,7 @@
class SubtaskServiceImpl(
    private val subtaskMapper: SubtaskMapper,
    private val aopEvaluation: AopEvaluation,
    private val taskRep: TaskRep,
) : SubtaskService {
    val dateUtil = DateUtil()
@@ -998,67 +1002,45 @@
        return resultList
    }
    override fun getByTopTaskAndDate(topTaskId: String, startTime: String?, endTime: String?, sceneTypeId: Int?): List<Subtask> {
//        val startDate = dateUtil.StringToDate(startTime)
//        val endDate = dateUtil.StringToDate(endTime)
//
//        val cal = Calendar.getInstance().apply { time = startDate }
//        val _startTime = dateUtil.DateToString(cal.time, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS) ?: startTime
//
//        if (endDate == null) {
//            cal.add(Calendar.MONTH, 1)
//            cal.add(Calendar.DAY_OF_MONTH, -1)
//        } else {
//            cal.time = endDate
//        }
//        cal.set(Calendar.HOUR_OF_DAY, 23)
//        cal.set(Calendar.MINUTE, 59)
//        cal.set(Calendar.SECOND, 59)
//        val _endTime = dateUtil.DateToString(cal.time, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS) ?: endTime
    override fun getByTopTaskAndDate(
        topTaskId: String,
        startTime: String?,
        endTime: String?,
        sceneTypeId: Int?
    ): List<Subtask> {
        val resultList = subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId)
        return resultList
        return subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId)
    }
    override fun getSummary(topTaskId: String, sceneTypeId: Int?): List<SubTaskSummary> {
//        val result = mutableListOf<SubTaskSummary>()
//        subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId).forEach {
//            val scene = scenseMapper.selectByPrimaryKey(it.scenseid)
//            var p = 0
//            var c = 0
//            var pc = 0
//            var cc = 0
//            problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
//                createCriteria().andEqualTo("stguid", it.stguid)
//            }).forEach {pro ->
//                p++
//                if (pro.ischanged == true) c++
//                if (pro.extension3 != Constant.PROBLEM_UNCHECKED) pc++
//                if (pro.extension3 == Constant.CHANGE_CHECK_PASS || pro.extension3 == Constant.CHANGE_CHECK_FAIL) cc++
//            }
//            val ins = inspectionMapper.selectByExample(Example(Inspection::class.java).apply {
//                createCriteria().andEqualTo("stguid", it.stguid)
//            })
//            result.add(SubTaskSummary().apply {
//                stGuid = it.stguid
//                stName = it.name
//                if (ins.isNotEmpty()) insGuid = ins[0].guid
//                sceneId = it.scenseid
//                sceneName = scene.name
//                sceneType = scene.type
//                stPlanTime = it.planstarttime
//                proNum = p
//                changeNum = c
//                proCheckedNum = pc
//                changeCheckedNum = cc
//            })
//        }
//        return result
        return subtaskMapper.getSummary(topTaskId, sceneTypeId)
    }
    override fun getSummaryByArea(areaVo: AreaVo): List<TaskProgressVo> {
        areaVo.scensetypeid ?: throw BizException("缺少场景类型参数")
        val res = mutableListOf<TaskProgressVo>()
        taskRep.findTasks(areaVo).forEach {t->
            if (t?.tguid == null) return@forEach
            val pro = TaskProgressVo().apply {
                tguid = t.tguid
                name = t.name
                levelnum = t.levelnum
                provinceCode = t.provincecode
                provinceName = t.provincename
                cityCode = t.citycode
                cityName = t.cityname
                districtCode = t.districtcode
                districtName = t.districtname
                townCode = t.towncode
                townName = t.townname
                subTaskSummary = subtaskMapper.getSummary(t.tguid!!, areaVo.scensetypeid?.toIntOrNull())
            }
            res.add(pro)
        }
        return res
    }
    override fun getByScene(sceneId: String, startTime: LocalDateTime?, endTime: LocalDateTime?): List<SubTaskSummary> {
        return subtaskMapper.getSummaryByScene(sceneId, startTime, endTime)
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
@@ -9,10 +9,7 @@
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.lightshare.service.EvaluationService
import cn.flightfeather.supervision.lightshare.service.SubtaskService
import cn.flightfeather.supervision.lightshare.service.TaskService
import cn.flightfeather.supervision.lightshare.service.UserinfoService
import cn.flightfeather.supervision.lightshare.service.*
import cn.flightfeather.supervision.lightshare.vo.*
import org.springframework.beans.BeanUtils
import org.springframework.beans.factory.annotation.Autowired
@@ -22,7 +19,10 @@
import kotlin.collections.ArrayList
@Service
class TaskServiceImpl(val taskMapper: TaskMapper, private val taskRep: TaskRep,) : TaskService {
class TaskServiceImpl(
    val taskMapper: TaskMapper,
    private val taskRep: TaskRep,
) : TaskService {
    @Autowired
    lateinit var subtaskService: SubtaskService
@@ -729,4 +729,33 @@
    override fun findTask(areaVo: AreaVo): List<Task?> {
        return taskRep.findTasks(areaVo)
    }
    override fun findTaskProgress(areaVo: AreaVo): List<TaskProgressVo?> {
        val res = mutableListOf<TaskProgressVo?>()
        taskRep.findTasks(areaVo).forEach {t->
            if (t?.tguid == null) return@forEach
            val pro = TaskProgressVo().apply {
                tguid = t.tguid
                name = t.name
                levelnum = t.levelnum
                provinceCode = t.provincecode
                provinceName = t.provincename
                cityCode = t.citycode
                cityName = t.cityname
                districtCode = t.districtcode
                districtName = t.districtname
                townCode = t.towncode
                townName = t.townname
                var count = 0
                taskRep.findMonitorList(t.tguid!!, areaVo.scensetypeid).forEach {
                    val c = if (it.extension1 != null) it.extension1!!.toInt() else 1
                    count += c
                }
                totaltask = count
                completetask = subtaskService.getSummary(t.tguid!!, areaVo.scensetypeid?.toIntOrNull()).size
            }
            res.add(pro)
        }
        return res
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
@@ -1,9 +1,9 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.autooutput.dataanalysis.AopDataDeviceMap
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
@@ -14,12 +14,13 @@
import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
import cn.flightfeather.supervision.domain.ds2.mapper.UserinfoTZMapper
import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep
import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep
import cn.flightfeather.supervision.lightshare.service.UserMapService
import cn.flightfeather.supervision.lightshare.service.UserinfoService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.DeviceMapVo
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
import java.util.*
@Service
class UserMapServiceImpl(
@@ -30,23 +31,27 @@
    private val taskRep: TaskRep,
    private val userInfoSVRep: UserInfoSVRep,
    private val userInfoTZRep: UserInfoTZRep,
    private val userMapRep: UserMapRep,
    private val aopDataDeviceMap: AopDataDeviceMap,
) : UserMapService {
    override fun getTZIdBySceneId(sceneId: String): UserMap {
        val list = userInfoSVRep.findUser(sceneId)
        if (list.isEmpty()) return UserMap()
        val userId = list[0]?.guid
        val user = userInfoSVRep.findUser(sceneId)
        val userId = user?.guid
        val result = userMapMapper.selectByExample(Example(UserMap::class.java).apply {
            createCriteria().andEqualTo("svUserId", userId)
        })
        return if (result.isNotEmpty()) result[0] else UserMap()
    }
    override fun getSceneByTZId(tzUserId: String): Scense? {
        return userMapRep.findFromSupervision(tzUserId)
    }
    override fun autoCreateMap() {
        // é€‰æ‹©éœ€è¦å¤„理的账户
        val userList = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
            createCriteria().andEqualTo("remark", "静安区")
            createCriteria().andEqualTo("remark", "徐汇区")
        })
        userList.forEach {
            // æŸ¥æ‰¾æ˜¯å¦å·²ç»æœ‰è´¦æˆ·åŒ¹é…è®°å½•
@@ -81,6 +86,7 @@
                            tzUserName = id
                            svUserId = it.guid
                            svUserName = it.realname
                            umCreateTime = Date()
                        })
                    }
                }
@@ -98,7 +104,7 @@
            }
            //以飞羽监管系统中的用户为主体
            2 -> {
                val task = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("当前查询条件下未找到对应顶层任务")
                val task = taskRep.findOneTask(areaVo) ?: throw BizException("当前查询条件下未找到对应顶层任务")
                val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
                    .map { it?.guid }
                userInfoSVRep.findUser(scenes).map { it?.guid }
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.PinYin
import cn.flightfeather.supervision.common.utils.UUIDGenerator
import cn.flightfeather.supervision.domain.ds1.entity.Scense
@@ -9,9 +10,11 @@
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep
import cn.flightfeather.supervision.lightshare.service.UserinfoService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import org.springframework.beans.BeanUtils
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
import kotlin.random.Random
@@ -21,6 +24,8 @@
class UserinfoServiceImpl(
    val userinfoMapper: UserinfoMapper,
    private val scenseMapper: ScenseMapper,
    private val userInfoSVRep: UserInfoSVRep,
    private val userInfoTZRep: UserInfoTZRep,
) : UserinfoService {
    //根据userinfo条件查询
@@ -68,26 +73,7 @@
        findByScene(sceneId)?.let { return it }
        scenseMapper.selectByPrimaryKey(sceneId)?.let {
            val sceneName = it.name ?: return Userinfo()
            val uName = getUName(sceneName)
            val userInfo = Userinfo().apply {
                guid = UUIDGenerator.generate16ShortUUID()
                acountname = uName
                realname = sceneName
                password = "123456"
                usertypeid = 3
                usertype = "企业"
                dGuid = it.guid
                departmentname = sceneName
                isenable = true
                remark = it.districtname
            }
            val r = userinfoMapper.insert(userInfo)
            if (r == 1) {
                return userInfo
            }
            createAccount(it)
        }
        return Userinfo()
    }
@@ -99,7 +85,7 @@
        return null
    }
    private fun getUName(sceneName: String): String {
    override fun getUName(sceneName: String): String {
        var uName = PinYin.getPinYinHeader(sceneName)
        var suffix = ""
        var repeated: Boolean
@@ -126,11 +112,14 @@
        }
    }
    private fun createAccount(scence: Scense) {
    override fun createAccount(scence: Scense):Userinfo {
        scence.let {
            val sceneName = it.name ?: return
            val uName = getUName(sceneName)
            // åˆ¤æ–­è¯¥åœºæ™¯æ˜¯å¦å·²æœ‰å¯¹åº”账户
            val user = userInfoSVRep.findUser(it.guid)
            if (user != null) return Userinfo()
            val sceneName = it.name ?: return Userinfo()
            val uName = getUName(sceneName)
            val userInfo = Userinfo().apply {
                guid = UUIDGenerator.generate16ShortUUID()
                acountname = uName
@@ -146,8 +135,32 @@
            val r = userinfoMapper.insert(userInfo)
            if (r == 1) {
                println("${userInfo.guid}--${userInfo.acountname}--${userInfo.realname}")
                return userInfo
            } else {
                return Userinfo()
            }
        }
    }
    override fun createAccountTZ(userinfo: Userinfo, scence: Scense): UserinfoTZ {
        val userinfoTZ = UserinfoTZ()
        BeanUtils.copyProperties(userinfo, userinfoTZ)
        // ä½¿ç”¨æ–°çš„id
        userinfoTZ.guid = UUIDGenerator.generate16ShortUUID()
        // æ·»åŠ åŒºåŽ¿æè¿°
        // FIXME: 2024/4/23 ç›®å‰åœ¨BaseInfo基础信息中已存储完整的行政区划,后续应将此处记录去除
        userinfoTZ.extension1 = userinfoTZ.remark
        userinfoTZ.remark = null
        // åœºæ™¯ç±»åž‹è½¬æ¢
        userinfoTZ.extension2 = Constant.SceneType.typeMap(scence.typeid)?.toString()
        // æ ¹æ®acountname和realname进行重复判断
        userInfoTZRep.findOne(UserinfoTZ().apply {
            acountname = userinfoTZ.acountname
            realname = userinfoTZ.realname
        }).takeIf { it == null }.run {
            // å½“没有查询结果时,插入新账户信息
            userInfoTZRep.insert(userinfoTZ)
        }
        return userinfoTZ
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
@@ -25,6 +25,8 @@
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    var endtime: LocalDateTime? = null
    // åœºæ™¯id
    var sceneId: String? = null
    // åœºæ™¯åç§°
    var sceneName: String? = null
    // åœºæ™¯ç±»åž‹
@@ -35,4 +37,8 @@
    // ä¸»æ•°æ®æºï¼Œ1:以飞羽环境系统中的用户为主体;2:以飞羽监管系统中的用户为主体
    var sourceType:Int = 1
    // æŸ¥è¯¢æŽ’序
    var sort:String? = "asc"
    var sortBy: String? = null
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceMapVo.kt
@@ -74,4 +74,29 @@
            return res
        }
    }
}
/**
 * æ ¹æ®è®¾å¤‡mn编码找到对应关系
 */
fun List<DeviceMapVo>.findByDeviceCode(code: String?): DeviceMapVo? {
    this.forEach {
        if (it.deviceCode == code) {
            return it
        }
    }
    return null
}
/**
 * æ ¹æ®é£žç¾½ç›‘管系统用户id找到对应关系
 */
fun List<DeviceMapVo>.findBySVUserId(svUserId: String?): List<DeviceMapVo> {
    val res = mutableListOf<DeviceMapVo>()
    this.forEach {
        if (it.svUserId == svUserId) {
            res.add(it)
        }
    }
    return res
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/DeviceSiteVo.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,127 @@
package cn.flightfeather.supervision.lightshare.vo
import cn.flightfeather.supervision.domain.ds2.entity.DustSiteInfo
import cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteInfo
import java.util.*
/**
 * ç›‘测设备信息
 */
class DeviceSiteVo {
    var id: Int? = null
    var mnCode: String? = null
    var address: String? = null
    var name: String? = null
    var code: String? = null
    var beginDate: Date? = null
    var endDate: Date? = null
    var dutyCompanyId: String? = null
    var dutyCompany: String? = null
    var engineeringStage: String? = null
    var groupId: String? = null
    var groupName: String? = null
    var isOnline: Boolean? = null
    var isTrouble: Boolean? = null
    var kindex: Double? = null
    var longitude: Double? = null
    var latitude: Double? = null
    var linkman: String? = null
    var phone: String? = null
    var province: String? = null
    var ringId: String? = null
    var ringName: String? = null
    var typeId: String? = null
    var typename: String? = null
    var buildArea: String? = null
    companion object {
        /**
         * é€šè¿‡é™å®‰åŒºç›‘测点位信息转换
         */
        fun fromJADustSiteInfo(list: List<DustSiteInfo?>): List<DeviceSiteVo> {
            val res = mutableListOf<DeviceSiteVo>()
            list.forEach {
                it ?: return@forEach
                res.add(DeviceSiteVo().apply {
                    id                  = it.id?.toIntOrNull()
                    mnCode              = it.mnCode
                    address             = it.address
                    name                = it.name
                    code                = it.code
                    beginDate           = it.beginDate
                    endDate             = it.endDate
                    dutyCompanyId       = it.dutyCompanyId
                    dutyCompany         = it.dutyCompany
                    engineeringStage    = it.engineeringStage
                    groupId             = it.groupId
                    groupName           = it.groupName
                    isOnline            = it.isOnline?.toBoolean()
                    isTrouble           = it.isTrouble?.toBoolean()
                    kindex              = it.kindex?.toDoubleOrNull()
                    longitude           = it.longitude?.toDoubleOrNull()
                    latitude            = it.latitude?.toDoubleOrNull()
                    linkman             = it.linkman
                    phone               = it.phone
                    province            = it.province
                    ringId              = it.ringId
//                    ringName            = it.ringName
                    typeId              = it.typeId
                    typename            = it.typename
                    buildArea           = it.buildArea
                })
            }
            return res
        }
        /**
         * é€šè¿‡é‡‘山区监测点位信息转换
         */
        fun fromJSDustSiteInfo(list: List<JSDustSiteInfo?>): List<DeviceSiteVo> {
            val res = mutableListOf<DeviceSiteVo>()
            list.forEach {
                it ?: return@forEach
                res.add(DeviceSiteVo().apply {
                    id                  = it.id
                    mnCode              = it.mnCode
                    address             = it.address
                    name                = it.name
                    code                = it.code
                    beginDate           = it.beginDate
                    endDate             = it.endDate
                    dutyCompanyId       = it.dutyCompanyId
                    dutyCompany         = it.dutyCompany
                    engineeringStage    = it.engineeringStage
                    groupId             = it.groupId
                    groupName           = it.groupName
                    isOnline            = it.isOnline?.toBoolean()
                    isTrouble           = it.isTrouble?.toBoolean()
                    kindex              = it.kindex?.toDoubleOrNull()
                    longitude           = it.longitude?.toDoubleOrNull()
                    latitude            = it.latitude?.toDoubleOrNull()
                    linkman             = it.linkman
                    phone               = it.phone
                    province            = it.province
                    ringId              = it.ringId
                    ringName            = it.ringName
                    typeId              = it.typeId
                    typename            = it.typename
                    buildArea           = it.buildArea
                })
            }
            return res
        }
    }
}
/**
 * æ ¹æ®è®¾å¤‡mn编码找到设备信息
 */
fun List<DeviceSiteVo>.findByMNCode(mnCode: String?): DeviceSiteVo? {
    this.forEach {
        if (it.mnCode == mnCode) {
            return it
        }
    }
    return null
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationVo.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
package cn.flightfeather.supervision.lightshare.vo
/**
 * è¯„分规则及得分
 */
class EvaluationVo {
    //规则id
    var id: String? = null
    //规则描述
    var title1: String? = null
    //分值
    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()
}
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()
}
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/InspectionInfoVo.kt
@@ -1,7 +1,10 @@
package cn.flightfeather.supervision.lightshare.vo
import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.annotation.JsonInclude
import org.apache.xpath.operations.Bool
import java.time.LocalDateTime
import java.util.*
@JsonInclude(JsonInclude.Include.NON_NULL)
class InspectionInfoVo {
@@ -21,7 +24,8 @@
    //是否已监管
    var inspected: Boolean? = null
    //监管时间
    var inspectionTime: String? = null
    @JsonFormat(pattern = "yyyy-MM-dd")
    var inspectionTime: Date? = null
    //监管次数
    var inspectionTimes: Int? = null
    //是否承诺
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDetail.kt
@@ -21,5 +21,5 @@
        var subScene: BaseScene? = null,
        //场景监测设备信息
        @ApiModelProperty("场景监测设备信息")
        var sceneDevice: SceneDevice? = null
        var sceneDevice: SceneDevice? = null,
)
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneDeviceVo.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,54 @@
package cn.flightfeather.supervision.lightshare.vo
import cn.flightfeather.supervision.domain.ds1.entity.Scense
/**
 * åœºæ™¯å’Œå¯¹åº”监测点位信息
 */
class SceneDeviceVo {
    var scene: Scense? = null
    var deviceList: MutableList<DeviceSiteVo?> = mutableListOf()
}
fun List<SceneDeviceVo>.tableHeadScene(): List<Array<Any>> {
    return listOf(arrayOf(
        "场景编号", "名称", "类型", "地址", "区县", "街镇", "联系人", "电话", "创建时间",
    ))
}
fun List<SceneDeviceVo>.tableHeadDevice(): List<Array<Any>> {
    return listOf(arrayOf(
        "监测点编号", "MN编码", "点位名称", "地址", "开工时间", "运维商", "区县",
    ))
}
fun List<SceneDeviceVo>.tableHead(): List<Array<Any>> {
    val a = this.tableHeadScene()[0].toMutableList()
    val b = this.tableHeadDevice()[0].toList()
    a.addAll(b)
    return listOf(a.toTypedArray())
}
fun List<SceneDeviceVo>.tableContent(): MutableList<Array<Any>> {
    val contents = mutableListOf<Array<Any>>()
    this.forEach { s ->
        val deviceList = s.deviceList
        val scene = s.scene
        deviceList.forEach each@ {
            it ?: return@each
            val content = mutableListOf<Any>()
            content.addAll(listOf(scene?.index ?: "", scene?.name ?: "", scene?.type ?: "", scene?.location ?: "",
                scene?.districtname ?: "", scene?.townname ?: "", scene?.contacts ?: "", scene?.contactst ?: "",
                scene?.createdate ?: ""))
            content.addAll(listOf(it.id ?: "", it.mnCode ?: "", it.name ?: "", it.address ?: "", it.beginDate ?: "", it
                .dutyCompany ?: "", it.groupName ?: ""))
            contents.add(content.toTypedArray())
        }
        if (contents.isEmpty()) {
            contents.add(arrayOf(scene?.index ?: "", scene?.name ?: "", scene?.type ?: "", scene?.location ?: "",
                scene?.districtname ?: "", scene?.townname ?: "", scene?.contacts ?: "", scene?.contactst ?: "",
                scene?.createdate ?: ""))
        }
    }
    return contents
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SceneProblemSummary.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package cn.flightfeather.supervision.lightshare.vo
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
/**
 * åœºæ™¯é—®é¢˜ç»Ÿè®¡
 */
class SceneProblemSummary {
    var sceneId: String? = null
    // åœºæ™¯ä¿¡æ¯
    var scene: Scense? = null
    var subtasks: List<Subtask>? = null
    // é—®é¢˜æ•°
    var proNum = 0
    // æ•´æ”¹æ•°
    var changeNum = 0
    var changePer: Double = 0.0
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ScenseVo.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.lightshare.vo
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import com.fasterxml.jackson.annotation.JsonInclude
import java.math.BigDecimal
import java.util.*
@@ -73,4 +74,16 @@
    var monitorNum: Int = 0
    var inspectedNum: Int = 0
}
/**
 * æ ¹æ®åœºæ™¯id找到场景
 */
fun List<Scense?>.findByGuid(guid: String?): Scense? {
    this.forEach {
        if (it?.guid == guid) {
            return it
        }
    }
    return null
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt
@@ -10,6 +10,7 @@
    var sceneName: String? = null
    var sceneType: String? = null
    var stPlanTime: Date? = null
    var stStatus:String? = null
    var proNum = 0
    var changeNum = 0
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/TaskProgressVo.kt
@@ -2,14 +2,26 @@
import com.fasterxml.jackson.annotation.JsonInclude
/**
 * ä»»åŠ¡å®Œæˆæƒ…å†µç»Ÿè®¡
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
class TaskProgressVo{
    // ä»»åŠ¡id
    var tguid: String? = null
    // ä»»åŠ¡åç§°
    var name: String? = null
    // ä»»åŠ¡ç­‰çº§(2:总任务;null:日任务或子任务)
    var levelnum: Int? = null
    var provinceCode: String? = null
    var provinceName: String? = null
    var cityCode: String? = null
    var cityName: String? = null
    var districtCode: String? = null
    var districtName: String? = null
    var townCode: String? = null
    var townName: String? = null
    var totaltask:Int? = null
@@ -19,5 +31,7 @@
    var mycompletetask:Int? = null
    var subtaskprogressVo = mutableListOf<TaskProgressVo>()
    var subtaskprogressVo: List<TaskProgressVo>? = null
    var subTaskSummary: List<SubTaskSummary>? = null
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt
@@ -1,6 +1,6 @@
package cn.flightfeather.supervision.lightshare.web
import cn.flightfeather.supervision.common.exception.ResponseErrorException
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.lightshare.vo.BaseResponse
import cn.flightfeather.supervision.lightshare.vo.DataHead
@@ -20,7 +20,7 @@
        } else {
            BaseResponse(true, data = res)
        }
    } catch (e: ResponseErrorException) {
    } catch (e: BizException) {
        BaseResponse(false, message = e.message ?: "")
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BgTaskController.kt
@@ -1,6 +1,7 @@
package cn.flightfeather.supervision.lightshare.web
import cn.flightfeather.supervision.common.executor.BgTaskConditionVo
import cn.flightfeather.supervision.common.executor.BgTaskStatus
import cn.flightfeather.supervision.lightshare.service.BgTaskService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
@@ -70,6 +70,8 @@
    @ApiOperation(value = "下载自动评估结果")
    @PostMapping("/auto/record/download")
    fun downloadAutoEvaluation(@RequestBody areaVo: AreaVo, @ApiIgnore response: HttpServletResponse) =
        resPack { evaluationService.downloadAutoEvaluation(areaVo, response) }
    fun downloadAutoEvaluation(
        @RequestBody areaVo: AreaVo, @RequestParam forceUpdate: Boolean,
        @ApiIgnore response: HttpServletResponse,
    ) = resPack { evaluationService.downloadAutoEvaluation(areaVo, forceUpdate, response) }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt
@@ -33,4 +33,10 @@
            @ApiParam("场景类型id") @RequestParam("sceneTypeId") sceneTypeId: String,
            @ApiParam(value = "评分表版本, æ ¼å¼ yyyy-MM, é»˜è®¤èŽ·å–æœ€æ–°ç‰ˆæœ¬") @RequestParam("version") version: String?
    ) = evaluationsubruleService.search(districtCode, sceneTypeId, version)
    @ApiOperation(value = "查找巡查任务自动评估的评分细节")
    @GetMapping("/score")
    fun getAutoScore(
        @ApiParam(value = "巡查任务id") @RequestParam subTaskId: String,
    ) = resPack { evaluationsubruleService.getAutoScore(subTaskId) }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/InspectionController.kt
@@ -1,7 +1,10 @@
package cn.flightfeather.supervision.lightshare.web
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.entity.Inspection
import cn.flightfeather.supervision.lightshare.service.InspectionService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.BaseResponse
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
@@ -10,7 +13,7 @@
@Api(tags = ["InspectionController"], description = "巡查信息API接口")
@RestController
@RequestMapping("/inspection")
class InspectionController (val inspectionService: InspectionService){
class InspectionController(val inspectionService: InspectionService) {
    @GetMapping
    fun getAll() = inspectionService.findAll()
@@ -21,31 +24,45 @@
    fun update(@RequestBody inspection: Inspection) = inspectionService.update(inspection)
    @GetMapping("/{id}")
    fun getById(@PathVariable id:String) = inspectionService.findByID(id)
    fun getById(@PathVariable id: String) = inspectionService.findByID(id)
    @GetMapping("/{id}/problemlist")
    fun findProblemListById(@PathVariable id:String) = inspectionService.findProblemListById(id)
    fun findProblemListById(@PathVariable id: String) = inspectionService.findProblemListById(id)
    @GetMapping("/{id}/gitlist")
    fun findGitListById(@PathVariable id:String) = inspectionService.findGitListById(id)
    fun findGitListById(@PathVariable id: String) = inspectionService.findGitListById(id)
    @GetMapping("/{id}/{date}/lastproblemlist")
    fun findLastProblemListById(@PathVariable id:String,@PathVariable date:String) = inspectionService.findLastProblemListBySenceId(id,date)
    fun findLastProblemListById(@PathVariable id: String, @PathVariable date: String) =
        inspectionService.findLastProblemListBySenceId(id, date)
    @GetMapping("/find/{id}")
    fun findBySubTaskID(@PathVariable id:String) = inspectionService.findBySubTaskID(id)
    fun findBySubTaskID(@PathVariable id: String) = inspectionService.findBySubTaskID(id)
    @DeleteMapping("/{id}")
    fun delete (@PathVariable id: String) = inspectionService.delete(id)
    fun delete(@PathVariable id: String) = inspectionService.delete(id)
    @GetMapping("/getInspectionInfoByScene")
    fun getInspectionInfoByScene(@RequestParam(value = "sceneId", required = true)sceneId:String, @RequestParam(value = "topTaskId", required = true)topTaskId:String)
            = inspectionService.getInspectionInfoByScene(sceneId, topTaskId)
    fun getInspectionInfoByScene(
        @RequestParam(value = "sceneId", required = true) sceneId: String,
        @RequestParam(value = "topTaskId", required = true) topTaskId: String,
    ) = inspectionService.getInspectionInfoByScene(sceneId, topTaskId)
    @ApiOperation(value = "获取某个总任务下某场景的统计信息", notes = "包括场景基本信息、评分、具体问题等")
    @GetMapping("/statistic")
    @PostMapping("/statistic")
    fun getStatistic(
            @ApiParam("总任务id") @RequestParam("topTaskId") topTaskId: String,
            @ApiParam("场景类型id") @RequestParam("sceneTypeId") sceneTypeId: String
    ) = inspectionService.getStatistic(topTaskId, sceneTypeId)
        @ApiParam("总任务id") @RequestParam(required = false) topTaskId: String?,
        @ApiParam("场景类型id") @RequestParam(required = false) sceneTypeId: String?,
        @ApiParam("区域条件") @RequestBody(required = false) areaVo: AreaVo?,
    ): BaseResponse<Any> {
        return resPack {
            if (topTaskId != null && sceneTypeId != null) {
                inspectionService.getStatistic(topTaskId, sceneTypeId)
            } else if (areaVo != null) {
                inspectionService.getStatistic(areaVo)
            } else {
                throw BizException("缺失总任务id和区域条件,请选择传输其中一种参数")
            }
        }
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt
@@ -40,53 +40,79 @@
    fun getByArea(@RequestBody areaVo: AreaVo): List<ProblemlistVo> = problemlistService.getByArea(areaVo)
    @GetMapping("/getbytoptask")
    fun getByTopTask(@RequestParam(value = "tguid", required = true) tguid: String): List<ProblemlistVo> = problemlistService.getByTopTask(tguid)
    fun getByTopTask(@RequestParam(value = "tguid", required = true) tguid: String): List<ProblemlistVo> =
        problemlistService.getByTopTask(tguid)
    @PostMapping("/getStatisticalResult")
    fun getStatisticalResult(@RequestBody areaVo: AreaVo): List<StatisticsVo> = problemlistService.getStatisticalResult(areaVo)
    fun getStatisticalResult(@RequestBody areaVo: AreaVo): List<StatisticsVo> =
        problemlistService.getStatisticalResult(areaVo)
    @PostMapping("/getStatisticalResultById")
    fun getStatisticalResult(@RequestParam(value = "id", required = true) topTaskId: String,
                             @RequestParam(value = "curSceneTypeId", required = true) sceneTypeId: String): List<StatisticsVo> = problemlistService.getStatisticalResultById(topTaskId, sceneTypeId)
    fun getStatisticalResult(
        @RequestParam(value = "id", required = true) topTaskId: String,
        @RequestParam(value = "curSceneTypeId", required = true) sceneTypeId: String,
    ): List<StatisticsVo> = problemlistService.getStatisticalResultById(topTaskId, sceneTypeId)
    @PostMapping("/getChargeResult")
    fun getChargeResult(@RequestBody areaVo: AreaVo): ChargeInfoVo = problemlistService.getChargeResult(areaVo)
    @GetMapping("/getProblemsByScene")
    fun getProblemsByScene(@RequestParam(value = "sceneId", required = true) sceneId: String, @RequestParam date: String): List<ProblemlistVo>
    = problemlistService.getProblemByScene(sceneId, date)
    fun getProblemsByScene(
        @RequestParam(value = "sceneId", required = true) sceneId: String,
        @RequestParam date: String,
    ): List<ProblemlistVo> = problemlistService.getProblemByScene(sceneId, date)
    @GetMapping("/month_anlysis")
    fun getMonthProblemsById(@RequestParam(value = "taskId", required = true) taskId: String,
                             @RequestParam(value = "sceneType", required = false) sceneType: Int?): List<MonthProblemVo> = problemlistService.findMonthProblemById(taskId, sceneType)
    fun getMonthProblemsById(
        @RequestParam(value = "taskId", required = true) taskId: String,
        @RequestParam(value = "sceneType", required = false) sceneType: Int?,
    ): List<MonthProblemVo> = problemlistService.findMonthProblemById(taskId, sceneType)
    @ApiOperation(value = "对问题进行审核操作", notes = "包括问题的提交审核和整改审核两种")
    @PostMapping("/check")
    fun checkProblem(
            @ApiParam(value = "问题id主键") @RequestParam("pId") pId: String,
            @ApiParam(value = "审核操作, 0: å®¡æ ¸é€šè¿‡ï¼›1: å®¡æ ¸ä¸é€šè¿‡ï¼›2: æ•´æ”¹é€šè¿‡ï¼›3: æ•´æ”¹ä¸é€šè¿‡", allowableValues = "0,1,2,3") @RequestParam("action") action: Byte,
            @ApiParam(value = "审核备注") @RequestParam("remark") remark: String,
            @ApiParam(value = "用户id") @RequestParam("userId") userId: String,
            @ApiParam(value = "用户名") @RequestParam("userName") userName: String
        @ApiParam(value = "问题id主键") @RequestParam("pId") pId: String,
        @ApiParam(value = "审核操作, 0: å®¡æ ¸é€šè¿‡ï¼›1: å®¡æ ¸ä¸é€šè¿‡ï¼›2: æ•´æ”¹é€šè¿‡ï¼›3: æ•´æ”¹ä¸é€šè¿‡",
            allowableValues = "0,1,2,3") @RequestParam("action") action: Byte,
        @ApiParam(value = "审核备注") @RequestParam("remark") remark: String,
        @ApiParam(value = "用户id") @RequestParam("userId") userId: String,
        @ApiParam(value = "用户名") @RequestParam("userName") userName: String,
    ) = problemlistService.check(pId, action, remark, userId, userName)
    @ApiOperation(value = "新增一个问题", notes = "简化上传所需问题信息,将大部分操作交由后台完成")
    @PostMapping("/newProblem")
    fun newProblem(
        @RequestParam("problemVo") problemVo: String,
        @RequestPart("images") files: Array<MultipartFile>
        @RequestPart("images") files: Array<MultipartFile>,
    ) = problemlistService.newProblem(problemVo, files)
    @ApiOperation(value = "整改一个问题", notes = "简化上传所需问题信息,将大部分操作交由后台完成")
    @PostMapping("/changeProblem")
    fun changeProblem(
        @RequestParam("problemId") problemId: String,
        @RequestPart("images") files: Array<MultipartFile>
        @RequestPart("images") files: Array<MultipartFile>,
    ) = problemlistService.changeProblem(problemId, files)
    @ApiOperation(value = "通过任务查找问题", notes = "简化上传所需问题信息,将大部分操作交由后台完成")
    @ApiOperation(value = "通过任务查找问题")
    @GetMapping("/subtask")
    fun getBySubTask(
        @RequestParam("stGuid") stGuid: String,
    ) = problemlistService.getBySubTask(stGuid)
        @ApiParam(value = "是否获取未审核及审核不通过的问题") @RequestParam(required = false) all:Boolean?
    ) = problemlistService.getBySubTask(stGuid, all)
    @ApiOperation(value = "查找发现了某种问题类型的所有巡查子任务")
    @PostMapping("/type/subtask")
    fun getSceneByProType(
        @RequestBody areaVo: AreaVo,
        @RequestParam pType: String,
    ) = resPack { problemlistService.getSceneByProType(areaVo, pType) }
    @ApiOperation(value = "查询某总任务下各场景的问题数量统计")
    @PostMapping("/summary/scene")
    fun getSceneProSummary(
        @RequestBody areaVo: AreaVo,
        @ApiParam(value = "排序字段", allowableValues = "pro, changePer") @RequestParam sortBy: String,
        @ApiParam(value = "页码") @RequestParam(value = "page") page: Int,
        @ApiParam(value = "单页数据量") @RequestParam(value = "per_page") perPage: Int,
    ) = resPack { problemlistService.getSceneProSummary(areaVo, sortBy, page, perPage) }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ScenseController.kt
@@ -10,6 +10,7 @@
import io.swagger.annotations.ApiImplicitParam
import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
@Api(tags = ["ScenseController"], description = "监管场景API接口")
@RestController
@@ -88,4 +89,16 @@
        @RequestParam("lat") lat: Double,
        @RequestParam("radius") radius: Double,
    ) = resPack { scenseService.searchByCoordinate(lng, lat, radius) }
    @ApiOperation(value = "通过文件导入场景信息")
    @PostMapping("/import")
    fun importSceneInfo(
        @RequestPart("file") file: MultipartFile,
    ) = resPack { scenseService.importSceneInfo(file) }
    @ApiOperation(value = "创建场景信息")
    @PutMapping("/create")
    fun createScene(
        @RequestBody scense: Scense
    ) = resPack { scenseService.createScene(scense) }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SubtaskController.kt
@@ -4,9 +4,12 @@
import cn.flightfeather.supervision.lightshare.service.SubtaskService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import cn.flightfeather.supervision.lightshare.vo.TaskVo
import com.fasterxml.jackson.annotation.JsonFormat
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.format.annotation.DateTimeFormat
import org.springframework.web.bind.annotation.*
import java.time.LocalDateTime
@Api(tags = ["SubtaskController"], description = "巡查子任务API接口")
@RestController
@@ -70,4 +73,18 @@
        @RequestParam("topTaskId") topTaskId: String,
        @RequestParam(value = "sceneTypeId", required = false) sceneTypeId: Int?
    ) = subtaskService.getSummary(topTaskId, sceneTypeId)
    @ApiOperation("获取某类场景的巡查任务统计信息")
    @PostMapping("/summary/area")
    fun getSummaryByArea(
        @RequestBody areaVo: AreaVo,
    ) = subtaskService.getSummaryByArea(areaVo)
    @ApiOperation("获取某个场景的巡查任务")
    @GetMapping("/byScene")
    fun getByScene(
        @RequestParam sceneId: String,
        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") startTime: LocalDateTime?,
        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") endTime: LocalDateTime?,
    ) = subtaskService.getByScene(sceneId, startTime, endTime)
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TaskController.kt
@@ -4,6 +4,7 @@
import cn.flightfeather.supervision.lightshare.service.TaskService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.web.bind.annotation.*
@Api(tags = ["TaskController"], description = "巡查总任务和日任务API接口")
@@ -65,4 +66,8 @@
    @PostMapping("/find")
    fun findTask(@RequestBody areaVo: AreaVo) = resPack { taskService.findTask(areaVo) }
    @ApiOperation(value = "获取总任务的完成情况")
    @PostMapping("/progress")
    fun findTaskProgress(@RequestBody areaVo: AreaVo) = resPack { taskService.findTaskProgress(areaVo) }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt
@@ -13,7 +13,11 @@
    @ApiOperation(value = "根据飞羽监管系统中的场景id,获取与飞羽环境系统中的关联用户")
    @GetMapping
    fun getTZId(@RequestParam("sceneId") sceneId: String) = userMapService.getTZIdBySceneId(sceneId)
    fun getTZId(@RequestParam sceneId: String) = userMapService.getTZIdBySceneId(sceneId)
    @ApiOperation(value = "根据飞羽环境系统中的用户id,获取与飞羽监管系统中的关联用户")
    @GetMapping("/scene")
    fun getSceneByTzId(@RequestParam tzUserId: String) = userMapService.getSceneByTZId(tzUserId)
    @ApiOperation(value = "获取区域用户的监测设备和飞羽监管系统、飞羽环境系统的匹配记录")
    @PostMapping("/device")
src/main/resources/mapper/ds1/InspectionMapper.xml
@@ -38,6 +38,18 @@
    <result column="I_Remark" property="iRemark" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    I_GUID, ST_GUID, S_GUID, I_ScenseName, I_ScenseAddress, I_IsTogether, I_EntourageT,
    I_EntourageWX, I_Entourage, I_ExecutionStartTime, I_ExecutionEndTime, I_ProblemCount,
    I_IsRechecked, I_RecheckCount, I_PromissedNum, I_ChangedNum, I_IsChanged, I_IsRvaluated,
    I_isPromissed, I_PromissedTime, I_PromissedUserGUID, I_PromissedUserName, I_PromissedUserRealName,
    I_PromissedWay, I_PromissedDeadline, I_PromissBookPath, I_SignPath, I_Extension1,
    I_Extension2, I_Extension3, I_Remark
  </sql>
    <resultMap id="InspectionStatisticVo" type="cn.flightfeather.supervision.lightshare.vo.InspectionStatisticVo" >
        <id column="MOV_DisplayID" property="index" jdbcType="INTEGER" />
        <result column="S_GUID" property="sceneId" jdbcType="VARCHAR" />
@@ -52,19 +64,25 @@
        <result column="problems" property="problem" jdbcType="VARCHAR" />
    </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    I_GUID, ST_GUID, S_GUID, I_ScenseName, I_ScenseAddress, I_IsTogether, I_EntourageT,
    I_EntourageWX, I_Entourage, I_ExecutionStartTime, I_ExecutionEndTime, I_ProblemCount,
    I_IsRechecked, I_RecheckCount, I_PromissedNum, I_ChangedNum, I_IsChanged, I_IsRvaluated,
    I_isPromissed, I_PromissedTime, I_PromissedUserGUID, I_PromissedUserName, I_PromissedUserRealName,
    I_PromissedWay, I_PromissedDeadline, I_PromissBookPath, I_SignPath, I_Extension1,
    I_Extension2, I_Extension3, I_Remark
  </sql>
    <resultMap id="InspectionInfoVo" type="cn.flightfeather.supervision.lightshare.vo.InspectionInfoVo" >
        <id column="inspectionId" property="inspectionId" />
        <result column="topTaskid" property="topTaskid"/>
        <result column="topTaskName" property="topTaskName"/>
        <result column="sceneId" property="sceneId"/>
        <result column="sceneName" property="sceneName"/>
        <result column="subtaskId" property="subtaskId"/>
        <result column="inspected" property="inspected"/>
        <result column="inspectionTime" property="inspectionTime"/>
        <result column="inspectionTimes" property="inspectionTimes"/>
        <result column="promised" property="promised"/>
        <result column="changed" property="changed"/>
        <result column="unChangedCount" property="unChangedCount"/>
        <result column="changedCount" property="changedCount"/>
        <result column="inspectionTimes" property="inspectionTimes"/>
        <result column="promisedTime" property="promisedTime"/>
    </resultMap>
  <select id="getInspectionInfoByScene" parameterType="String" resultType="map">
  <select id="getInspectionInfoByScene" resultMap="InspectionInfoVo">
    SELECT
        a.T_GUID AS topTaskId,
        a.T_Name AS topTaskName,
@@ -72,11 +90,11 @@
        b.ST_ScenseName AS sceneName,
        c.I_GUID AS inspectionId,
        b.ST_GUID AS subtaskId,
        (CASE WHEN COUNT(DISTINCT c.I_GUID) > 0 THEN TRUE ELSE FALSE END) AS isInspected,
        (CASE WHEN COUNT(DISTINCT c.I_GUID) > 0 THEN TRUE ELSE FALSE END) AS inspected,
        c.I_ExecutionStartTime AS inspectionTime,
        COUNT(DISTINCT c.I_GUID) AS inspectionTimes,
        (CASE WHEN (SUM(CASE WHEN d.PL_Extension1 IS NULL THEN 0 ELSE 1 END)) > 0 THEN TRUE ELSE FALSE END) AS isPromised,
        CASE WHEN SUM(d.PL_IsChanged) = COUNT(d.PL_IsChanged) THEN TRUE ELSE FALSE END AS isChanged,
        (CASE WHEN (SUM(CASE WHEN d.PL_Extension1 IS NULL THEN 0 ELSE 1 END)) > 0 THEN TRUE ELSE FALSE END) AS promised,
        CASE WHEN SUM(d.PL_IsChanged) = COUNT(d.PL_IsChanged) THEN TRUE ELSE FALSE END AS changed,
      COUNT(CASE WHEN d.PL_IsChanged = 0 AND d.PL_Extension3 = 'pass' THEN 1 ELSE NULL END) AS unChangedCount,
      COUNT(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE NULL END) AS changedCount,
      d.PL_Extension1 AS promisedTime
src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml
@@ -8,28 +8,39 @@
    <id column="MOV_ID" property="movId" jdbcType="VARCHAR" />
    <result column="T_ID" property="tId" jdbcType="VARCHAR" />
    <result column="S_GUID" property="sGuid" jdbcType="VARCHAR" />
    <result column="MOV_SenseName" property="movSensename" jdbcType="VARCHAR" />
    <result column="MOV_TaskTypeID" property="movTasktypeid" jdbcType="TINYINT" />
    <result column="MOV_TaskType" property="movTasktype" jdbcType="VARCHAR" />
    <result column="MOV_MonitorNum" property="movMonitornum" jdbcType="INTEGER" />
    <result column="MOV_Suitable" property="movSuitable" jdbcType="BIT" />
    <result column="MOV_DisplayID" property="movDisplayid" jdbcType="INTEGER" />
    <result column="MOV_Year" property="movYear" jdbcType="INTEGER" />
    <result column="MOV_Month" property="movMonth" jdbcType="INTEGER" />
    <result column="MOV_Day" property="movDay" jdbcType="INTEGER" />
    <result column="MOV_ISCP" property="movIscp" jdbcType="BIT" />
    <result column="MOV_CustomPeriod" property="movCustomperiod" jdbcType="VARCHAR" />
    <result column="MOV_Extension1" property="movExtension1" jdbcType="VARCHAR" />
    <result column="MOV_Extension2" property="movExtension2" jdbcType="VARCHAR" />
    <result column="MOV_Extension3" property="movExtension3" jdbcType="VARCHAR" />
    <result column="MOV_Remark" property="movRemark" jdbcType="VARCHAR" />
    <result column="MOV_SenseName" property="sensename" jdbcType="VARCHAR" />
    <result column="MOV_TaskTypeID" property="tasktypeid" jdbcType="TINYINT" />
    <result column="MOV_TaskType" property="tasktype" jdbcType="VARCHAR" />
    <result column="MOV_MonitorNum" property="monitornum" jdbcType="INTEGER" />
    <result column="MOV_Suitable" property="suitable" jdbcType="BIT" />
    <result column="MOV_DisplayID" property="displayid" jdbcType="INTEGER" />
    <result column="MOV_Year" property="year" jdbcType="INTEGER" />
    <result column="MOV_Month" property="month" jdbcType="INTEGER" />
    <result column="MOV_Day" property="day" jdbcType="INTEGER" />
    <result column="MOV_ISCP" property="iscp" jdbcType="BIT" />
    <result column="MOV_CustomPeriod" property="customperiod" jdbcType="VARCHAR" />
    <result column="MOV_Extension1" property="extension1" jdbcType="VARCHAR" />
    <result column="MOV_Extension2" property="extension2" jdbcType="VARCHAR" />
    <result column="MOV_Extension3" property="extension3" jdbcType="VARCHAR" />
    <result column="MOV_Remark" property="remark" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    MOV_ID, T_ID, S_GUID, MOV_SenseName, MOV_TaskTypeID, MOV_TaskType, MOV_MonitorNum,
    MOV_Suitable, MOV_DisplayID, MOV_Year, MOV_Month, MOV_Day, MOV_ISCP, MOV_CustomPeriod,
    MOV_ID, T_ID, S_GUID, MOV_SenseName, MOV_TaskTypeID, MOV_TaskType, MOV_MonitorNum,
    MOV_Suitable, MOV_DisplayID, MOV_Year, MOV_Month, MOV_Day, MOV_ISCP, MOV_CustomPeriod,
    MOV_Extension1, MOV_Extension2, MOV_Extension3, MOV_Remark
  </sql>
  <select id="findMonitorListByScene" resultMap="BaseResultMap">
    select
      a.*
    from sm_t_monitorobjectversion as a
    left join sm_t_scense as b on a.S_GUID = b.S_GUID
    where T_ID = #{taskId}
    <if test="sceneTypeId != null">
      and b.S_TypeID = #{sceneTypeId}
    </if>
  </select>
</mapper>
src/main/resources/mapper/ds1/ProblemlistMapper.xml
@@ -1,197 +1,258 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper" >
  <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Problemlist" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="PL_GUID" property="guid" jdbcType="VARCHAR" />
    <result column="I_GUID" property="iguid" jdbcType="VARCHAR" />
    <result column="ST_GUID" property="stguid" jdbcType="VARCHAR" />
    <result column="S_GUID" property="sguid" jdbcType="VARCHAR" />
    <result column="PL_SenseName" property="sensename" jdbcType="VARCHAR" />
    <result column="PL_SenseAddress" property="senseaddress" jdbcType="VARCHAR" />
    <result column="PT_GUID" property="ptguid" jdbcType="VARCHAR" />
    <result column="PL_ProblemName" property="problemname" jdbcType="VARCHAR" />
    <result column="PL_Longitude" property="longitude" jdbcType="DECIMAL" />
    <result column="PL_Latitude" property="latitude" jdbcType="DECIMAL" />
    <result column="PL_LocationID" property="locationid" jdbcType="TINYINT" />
    <result column="PL_Location" property="location" jdbcType="VARCHAR" />
    <result column="PL_Time" property="time" jdbcType="TIMESTAMP" />
    <result column="PL_IsRechecked" property="isrechecked" jdbcType="BIT" />
    <result column="PL_RecheckTime" property="rechecktime" jdbcType="TIMESTAMP" />
    <result column="PL_RecheckUserGUID" property="recheckuserguid" jdbcType="VARCHAR" />
    <result column="PL_RecheckUserName" property="recheckusername" jdbcType="VARCHAR" />
    <result column="PL_RecheckUserRealName" property="recheckuserrealname" jdbcType="VARCHAR" />
    <result column="PL_RecheckDescription" property="recheckdescription" jdbcType="VARCHAR" />
    <result column="PL_RecheckResultID" property="recheckresultid" jdbcType="BIT" />
    <result column="PL_RecheckResult" property="recheckresult" jdbcType="VARCHAR" />
    <result column="PL_IsChanged" property="ischanged" jdbcType="BIT" />
    <result column="PL_ChangeCatalog" property="changecatalog" jdbcType="VARCHAR" />
    <result column="PL_ChangedTime" property="changedtime" jdbcType="TIMESTAMP" />
    <result column="PL_ChangedResult" property="changedresult" jdbcType="VARCHAR" />
    <result column="PL_Advise" property="advise" jdbcType="VARCHAR" />
    <result column="PL_Extension1" property="extension1" jdbcType="VARCHAR" />
    <result column="PL_Extension2" property="extension2" jdbcType="VARCHAR" />
    <result column="PL_Extension3" property="extension3" jdbcType="VARCHAR" />
    <result column="PL_Remark" property="remark" jdbcType="VARCHAR" />
  </resultMap>
  <resultMap id="StatisticsVoMap" type="cn.flightfeather.supervision.lightshare.vo.StatisticsVo">
    <id property="name" column="T_Name"/>
    <result property="startTime" column="startTime"/>
    <result property="endTime" column="endTime"/>
    <result property="count" column="count1"/>
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    PL_GUID, I_GUID, ST_GUID, S_GUID, PL_SenseName, PL_SenseAddress, PT_GUID, PL_ProblemName,
    PL_Longitude, PL_Latitude, PL_LocationID, PL_Location, PL_Time, PL_IsRechecked, PL_RecheckTime,
    PL_RecheckUserGUID, PL_RecheckUserName, PL_RecheckUserRealName, PL_RecheckDescription,
    PL_RecheckResultID, PL_RecheckResult, PL_IsChanged, PL_ChangeCatalog, PL_ChangedTime,
    PL_ChangedResult, PL_Advise, PL_Extension1, PL_Extension2, PL_Extension3, PL_Remark
  </sql>
<mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper">
    <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Problemlist">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="PL_GUID" property="guid" jdbcType="VARCHAR"/>
        <result column="I_GUID" property="iguid" jdbcType="VARCHAR"/>
        <result column="ST_GUID" property="stguid" jdbcType="VARCHAR"/>
        <result column="S_GUID" property="sguid" jdbcType="VARCHAR"/>
        <result column="PL_SenseName" property="sensename" jdbcType="VARCHAR"/>
        <result column="PL_SenseAddress" property="senseaddress" jdbcType="VARCHAR"/>
        <result column="PT_GUID" property="ptguid" jdbcType="VARCHAR"/>
        <result column="PL_ProblemName" property="problemname" jdbcType="VARCHAR"/>
        <result column="PL_Longitude" property="longitude" jdbcType="DECIMAL"/>
        <result column="PL_Latitude" property="latitude" jdbcType="DECIMAL"/>
        <result column="PL_LocationID" property="locationid" jdbcType="TINYINT"/>
        <result column="PL_Location" property="location" jdbcType="VARCHAR"/>
        <result column="PL_Time" property="time" jdbcType="TIMESTAMP"/>
        <result column="PL_IsRechecked" property="isrechecked" jdbcType="BIT"/>
        <result column="PL_RecheckTime" property="rechecktime" jdbcType="TIMESTAMP"/>
        <result column="PL_RecheckUserGUID" property="recheckuserguid" jdbcType="VARCHAR"/>
        <result column="PL_RecheckUserName" property="recheckusername" jdbcType="VARCHAR"/>
        <result column="PL_RecheckUserRealName" property="recheckuserrealname" jdbcType="VARCHAR"/>
        <result column="PL_RecheckDescription" property="recheckdescription" jdbcType="VARCHAR"/>
        <result column="PL_RecheckResultID" property="recheckresultid" jdbcType="BIT"/>
        <result column="PL_RecheckResult" property="recheckresult" jdbcType="VARCHAR"/>
        <result column="PL_IsChanged" property="ischanged" jdbcType="BIT"/>
        <result column="PL_ChangeCatalog" property="changecatalog" jdbcType="VARCHAR"/>
        <result column="PL_ChangedTime" property="changedtime" jdbcType="TIMESTAMP"/>
        <result column="PL_ChangedResult" property="changedresult" jdbcType="VARCHAR"/>
        <result column="PL_Advise" property="advise" jdbcType="VARCHAR"/>
        <result column="PL_Extension1" property="extension1" jdbcType="VARCHAR"/>
        <result column="PL_Extension2" property="extension2" jdbcType="VARCHAR"/>
        <result column="PL_Extension3" property="extension3" jdbcType="VARCHAR"/>
        <result column="PL_Remark" property="remark" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        PL_GUID, I_GUID, ST_GUID, S_GUID, PL_SenseName, PL_SenseAddress, PT_GUID, PL_ProblemName,
        PL_Longitude, PL_Latitude, PL_LocationID, PL_Location, PL_Time, PL_IsRechecked, PL_RecheckTime,
        PL_RecheckUserGUID, PL_RecheckUserName, PL_RecheckUserRealName, PL_RecheckDescription,
        PL_RecheckResultID, PL_RecheckResult, PL_IsChanged, PL_ChangeCatalog, PL_ChangedTime,
        PL_ChangedResult, PL_Advise, PL_Extension1, PL_Extension2, PL_Extension3, PL_Remark
    </sql>
  <!--<select id="getStatisticalResult" parameterType="String" resultMap="StatisticsVoMap">-->
  <select id="getStatisticalResult" parameterType="String" resultType="map">
      SELECT
    <resultMap id="StatisticsVoMap" type="cn.flightfeather.supervision.lightshare.vo.StatisticsVo">
        <result property="name" column="name"/>
        <result property="startTime" column="startTime"/>
        <result property="endTime" column="endTime"/>
        <result property="count" column="count"/>
        <result property="changeCount" column="changeCount"/>
    </resultMap>
    <resultMap id="SceneProblemSummary" type="cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary">
        <id property="sceneId" column="sceneId"/>
        <result property="proNum" column="proNum"/>
        <result property="changeNum" column="changeNum"/>
        <result property="changePer" column="changePer"/>
        <association property="scene" resultMap="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.BaseResultMap" />
<!--        <collection property="subtasks" ofType="cn.flightfeather.supervision.domain.ds1.entity.Subtask"-->
<!--                     resultMap="cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper.BaseResultMap" />-->
    </resultMap>
    <select id="getStatisticalResult" parameterType="String" resultMap="StatisticsVoMap">
        SELECT
        b.PT_TypeName as name,
        COUNT(b.PT_TypeName) as count,
        COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount
      FROM
        FROM
        im_t_problemlist AS a
      LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID
      LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID
      WHERE
        a.ST_GUID IN (
          SELECT
            d.ST_GUID
          FROM
            tm_t_subtask AS d LEFT JOIN tm_t_task AS e ON d.T_GUID = e.T_GUID
          WHERE
            e.T_LevelNum = '2'
            AND e.T_StartTime &lt;= #{param2}
            AND e.T_EndTime >= #{param3}
            AND e.T_DistrictCode = #{param1}
          )
      AND f.S_TypeID = #{param4}
      GROUP BY
        LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID
        LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID
        LEFT JOIN tm_t_subtask AS c ON a.ST_GUID = c.ST_GUID
        <where>
<!--        a.ST_GUID IN (-->
<!--            SELECT-->
<!--            d.ST_GUID-->
<!--            FROM-->
<!--            tm_t_subtask AS d LEFT JOIN tm_t_task AS e ON d.T_GUID = e.T_GUID-->
<!--            WHERE-->
<!--            e.T_LevelNum = '2'-->
<!--            <if test="startTime != null">-->
<!--                AND e.T_StartTime &lt;= #{startTime}-->
<!--            </if>-->
<!--            <if test="endTime != null">-->
<!--                AND e.T_EndTime >= #{endTime}-->
<!--            </if>-->
<!--            <if test="districtCode != null">-->
<!--                AND e.T_DistrictCode = #{districtCode}-->
<!--            </if>-->
<!--        )-->
        <if test="startTime != null">
            AND c.ST_PlanStartTime >= #{startTime}
        </if>
        <if test="endTime != null">
            AND c.ST_PlanStartTime &lt;= #{endTime}
        </if>
        <if test="districtCode != null">
            AND f.S_DistrictCode = #{districtCode}
        </if>
        <if test="sceneType != null">
            AND f.S_TypeID = #{sceneType}
        </if>
        <if test="sceneId != null">
            AND a.S_GUID = #{sceneId}
        </if>
        </where>
        GROUP BY
        b.PT_TypeName
      ORDER BY
        ORDER BY
        COUNT(b.PT_TypeName) DESC
  </select>
  <!--select DISTINCT T_Name as name, count(*) as count from tm_t_task where T_LevelNum = 2-->
    </select>
    <!--根据顶层任务id和场景类型id获取问题分类情况,结果同getStatisticalResult-->
    <select id="getStatisticalResultById" parameterType="String" resultType="map">
        SELECT
            b.PT_TypeName AS name,
            COUNT(b.PT_TypeName) AS count,
            COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount
        b.PT_TypeName AS name,
        COUNT(b.PT_TypeName) AS count,
        COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount
        FROM
            im_t_problemlist AS a
        im_t_problemlist AS a
        LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID
        LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID
        LEFT JOIN tm_t_subtask AS c ON a.ST_GUID = c.ST_GUID
        WHERE
            c.T_GUID = #{param1}
        c.T_GUID = #{param1}
        AND f.S_TypeID = #{param2}
        GROUP BY
            b.PT_TypeName
        b.PT_TypeName
        ORDER BY
            COUNT(b.PT_TypeName) DESC
        COUNT(b.PT_TypeName) DESC
    </select>
    <select id="getChangeResult" parameterType="String" resultType="map">
    SELECT
      a.S_GUID as id,
      a.PL_SenseName as name,
      f.S_TypeID as type,
      COUNT(a.PL_GUID) as problemCount,
      COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount
    FROM
      im_t_problemlist AS a
    LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID
    LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID
    LEFT JOIN sm_t_monitorobjectversion as g ON a.S_GUID = g.S_GUID
    WHERE
      a.ST_GUID IN (
          SELECT
              ST_GUID
          FROM
              tm_t_subtask
          WHERE
              T_GUID = #{param1}
      )
    AND f.S_TypeID = #{param2}
    AND g.T_ID = #{param1}
    GROUP BY
      id
    ORDER BY
      problemCount DESC
        SELECT
        a.S_GUID as id,
        a.PL_SenseName as name,
        f.S_TypeID as type,
        COUNT(a.PL_GUID) as problemCount,
        COUNT(CASE WHEN a.PL_IsChanged = 1 THEN 1 ELSE NULL END) as changeCount
        FROM
        im_t_problemlist AS a
        LEFT JOIN sm_t_problemtype AS b ON a.PT_GUID = b.PT_GUID
        LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID
        LEFT JOIN sm_t_monitorobjectversion as g ON a.S_GUID = g.S_GUID
        WHERE
        a.ST_GUID IN (
        SELECT
        ST_GUID
        FROM
        tm_t_subtask
        WHERE
        T_GUID = #{param1}
        )
        AND f.S_TypeID = #{param2}
        AND g.T_ID = #{param1}
        GROUP BY
        id
        ORDER BY
        problemCount DESC
    </select>
    <select id="getScoreResult" resultType="map" parameterType="String">
        SELECT
          b.ST_name as name,
          E_ResultScoreBef as scoreBef,
          E_ResultScoreAft as scoreAft
        b.ST_name as name,
        E_ResultScoreBef as scoreBef,
        E_ResultScoreAft as scoreAft
        FROM
            ea_t_evaluation AS a
        ea_t_evaluation AS a
        RIGHT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID
        WHERE
            b.T_GUID = #{param1}
        b.T_GUID = #{param1}
        AND a.E_ScenseTypeID = #{param2}
    </select>
    <select id="selectSE" resultType="string" parameterType="String">
        ${_parameter}
    </select>
    <select id="getProblemByScene" resultMap="BaseResultMap" parameterType="String">
        SELECT
            a.*
        a.*
        FROM
            im_t_problemlist AS a
        im_t_problemlist AS a
        LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID
        WHERE
            a.S_GUID = #{param1}
        a.S_GUID = #{param1}
        AND b.T_GUID = #{param2}
  </select>
    <select id="findMonthProblemById" resultType="map" >
    </select>
    <select id="findMonthProblemById" resultType="map">
        SELECT
            b.S_TownCode as towncode,
            b.S_TownName as townname,
            b.S_TypeID as scenetype,
            b.S_Type as scenetypename,
            COUNT(DISTINCT a.S_GUID) as totalscenecount,
            COUNT(DISTINCT d.S_GUID) as problemscenes,
            COUNT(d.PL_GUID) as totalproblems,
            SUM(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE 0 END) as changedproblems
        b.S_TownCode as towncode,
        b.S_TownName as townname,
        b.S_TypeID as scenetype,
        b.S_Type as scenetypename,
        COUNT(DISTINCT a.S_GUID) as totalscenecount,
        COUNT(DISTINCT d.S_GUID) as problemscenes,
        COUNT(d.PL_GUID) as totalproblems,
        SUM(CASE WHEN d.PL_IsChanged = 1 THEN 1 ELSE 0 END) as changedproblems
        FROM
            sm_t_monitorobjectversion AS a
        sm_t_monitorobjectversion AS a
        LEFT JOIN sm_t_scense AS b ON a.S_GUID = b.S_GUID
        LEFT JOIN tm_t_subtask AS c ON a.T_ID = c.T_GUID AND b.S_GUID = c.ST_ScenseID
        LEFT JOIN im_t_problemlist AS d ON c.ST_GUID = d.ST_GUID
        WHERE
            a.T_ID = #{param1}
        a.T_ID = #{param1}
        <if test="param2 !=null and param2 !=''">
            AND S_TypeID = #{param2}
        </if>
        GROUP BY
            b.S_TownCode
        b.S_TownCode
    </select>
    <select id="findUnchangedCount" resultType="int" parameterType="String">
        SELECT
            SUM(CASE WHEN a.PL_IsChanged = 0 THEN 1 ELSE 0 END) as unChanged
        SUM(CASE WHEN a.PL_IsChanged = 0 THEN 1 ELSE 0 END) as unChanged
        FROM
            im_t_problemlist AS a
            LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID
        im_t_problemlist AS a
        LEFT JOIN tm_t_subtask AS b ON a.ST_GUID = b.ST_GUID
        WHERE
            b.TS_GUID = #{param1}
        b.TS_GUID = #{param1}
        GROUP BY
            b.ST_GUID
        b.ST_GUID
    </select>
    <select id="getSceneProSummary" resultMap="SceneProblemSummary">
        SELECT
        IF(proNum = 0, 1, changeNum/proNum) AS changePer,
        t_p.*
        FROM (
            SELECT
            b.S_GUID AS sceneId,
            SUM(d.PL_GUID is NOT null) AS proNum,
            SUM(d.PL_IsChanged = TRUE) AS changeNum,
            b.*
            FROM
            sm_t_scense AS b
            LEFT JOIN tm_t_subtask AS a ON a.ST_ScenseID = b.S_GUID
            LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID
            WHERE
            a.T_GUID = #{topTaskId}
            <if test="sceneTypeId != null">
                and b.S_TypeID = #{sceneTypeId}
            </if>
            GROUP BY
            b.S_GUID
        ) as t_p
        <if test="sortBy == 'pro'">
            <if test="sort == 'asc'">
                ORDER BY proNum asc, changeNum desc
            </if>
            <if test="sort == 'desc'">
                ORDER BY proNum desc, changeNum asc
            </if>
        </if>
        <if test="sortBy == 'changePer'">
            <if test="sort == 'asc'">
                ORDER BY changePer asc, proNum desc
            </if>
            <if test="sort == 'desc'">
                ORDER BY changePer desc, proNum asc
            </if>
        </if>
    </select>
</mapper>
src/main/resources/mapper/ds1/SubtaskMapper.xml
@@ -153,6 +153,7 @@
        <result column="ST_GUID" property="stGuid" jdbcType="VARCHAR" />
        <result column="ST_name" property="stName" jdbcType="VARCHAR" />
        <result column="ST_PlanStartTime" property="stPlanTime" jdbcType="TIMESTAMP" />
        <result column="ST_Status" property="stStatus" jdbcType="VARCHAR" />
        <result column="S_GUID" property="sceneId" jdbcType="VARCHAR" />
        <result column="S_Name" property="sceneName" jdbcType="VARCHAR" />
        <result column="S_Type" property="sceneType" jdbcType="VARCHAR" />
@@ -279,6 +280,7 @@
        a.ST_GUID,
        a.ST_name,
        a.ST_PlanStartTime,
        a.ST_Status,
        b.S_GUID,
        b.S_Name,
        b.S_Type,
@@ -303,4 +305,51 @@
        GROUP BY
        a.ST_GUID
    </select>
    <select id="getSummaryByScene" resultMap="SubTaskSummary">
        SELECT
        a.ST_GUID,
        a.ST_name,
        a.ST_PlanStartTime,
        a.ST_Status,
        b.S_GUID,
        b.S_Name,
        b.S_Type,
        c.I_GUID,
        SUM(d.PL_GUID is NOT null) AS proNum,
        SUM(d.PL_IsChanged = TRUE) AS changeNum,
        SUM(d.PL_Extension3 != 'unCheck') AS proCheckedNum,
        SUM(
        d.PL_Extension3 = 'change_pass' || d.PL_Extension3 = 'change_fail'
        ) AS changeCheckedNum
        FROM
        tm_t_subtask AS a
        LEFT JOIN sm_t_scense AS b ON a.ST_ScenseID = b.S_GUID
        LEFT JOIN im_t_inspection AS c ON a.ST_GUID = c.ST_GUID
        LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID
        WHERE
        a.ST_ScenseID = #{sceneId}
        <if test="startTime != null">
            and a.ST_PlanStartTime BETWEEN #{startTime} AND #{endTime}
        </if>
        GROUP BY
        a.ST_GUID
        ORDER BY a.ST_PlanStartTime DESC
    </select>
    <select id="findSubTasksByProType" resultMap="BaseResultMap">
        SELECT
        a.*
        FROM
        tm_t_subtask AS a
        LEFT JOIN im_t_problemlist AS b ON a.ST_GUID = b.ST_GUID
        LEFT JOIN sm_t_problemtype AS c ON b.PT_GUID = c.PT_GUID
        LEFT JOIN sm_t_scense AS d ON a.ST_ScenseID = d.S_GUID
        WHERE
        a.T_GUID = #{topTaskId}
        AND c.PT_TypeName = #{proType}
        AND d.S_TypeID = #{sceneTypeId}
        GROUP BY a.ST_GUID
    </select>
</mapper>
src/main/resources/mapper/ds2/BaseInfoMapper.xml
@@ -1,32 +1,45 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.flightfeather.supervision.domain.ds2.mapper.BaseInfoMapper" >
  <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds2.entity.BaseInfo" >
  <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds2.entity.BaseInfo">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="BI_GUID" property="biGuid" jdbcType="VARCHAR" />
    <result column="BI_Name" property="biName" jdbcType="VARCHAR" />
    <result column="CI_GUID" property="ciGuid" jdbcType="VARCHAR" />
    <result column="CI_Name" property="ciName" jdbcType="VARCHAR" />
    <result column="BI_Management_Company_Id" property="biManagementCompanyId" jdbcType="VARCHAR" />
    <result column="BI_Management_Company" property="biManagementCompany" jdbcType="VARCHAR" />
    <result column="BI_Contact" property="biContact" jdbcType="VARCHAR" />
    <result column="BI_Telephone" property="biTelephone" jdbcType="VARCHAR" />
    <result column="BI_Address" property="biAddress" jdbcType="VARCHAR" />
    <result column="BI_Create_Time" property="biCreateTime" jdbcType="TIMESTAMP" />
    <result column="BI_Update_Time" property="biUpdateTime" jdbcType="TIMESTAMP" />
    <result column="BI_Extension1" property="biExtension1" jdbcType="VARCHAR" />
    <result column="BI_Extension2" property="biExtension2" jdbcType="VARCHAR" />
    <result column="BI_Extension3" property="biExtension3" jdbcType="VARCHAR" />
    <result column="BI_Remark" property="biRemark" jdbcType="VARCHAR" />
    <id column="BI_GUID" jdbcType="VARCHAR" property="biGuid"/>
    <result column="BI_Name" jdbcType="VARCHAR" property="biName"/>
    <result column="BI_Nick_Name" jdbcType="VARCHAR" property="biNickName"/>
    <result column="CI_GUID" jdbcType="VARCHAR" property="ciGuid"/>
    <result column="CI_Name" jdbcType="VARCHAR" property="ciName"/>
    <result column="BI_Province_Code" jdbcType="VARCHAR" property="biProvinceCode"/>
    <result column="BI_Province_Name" jdbcType="VARCHAR" property="biProvinceName"/>
    <result column="BI_City_Code" jdbcType="VARCHAR" property="biCityCode"/>
    <result column="BI_City_Name" jdbcType="VARCHAR" property="biCityName"/>
    <result column="BI_District_Code" jdbcType="VARCHAR" property="biDistrictCode"/>
    <result column="BI_District_Name" jdbcType="VARCHAR" property="biDistrictName"/>
    <result column="BI_Town_Code" jdbcType="VARCHAR" property="biTownCode"/>
    <result column="BI_Town_Name" jdbcType="VARCHAR" property="biTownName"/>
    <result column="BI_Area_Code" jdbcType="VARCHAR" property="biAreaCode"/>
    <result column="BI_Area" jdbcType="VARCHAR" property="biArea"/>
    <result column="BI_Management_Company_Id" jdbcType="VARCHAR" property="biManagementCompanyId"/>
    <result column="BI_Management_Company" jdbcType="VARCHAR" property="biManagementCompany"/>
    <result column="BI_Contact" jdbcType="VARCHAR" property="biContact"/>
    <result column="BI_Telephone" jdbcType="VARCHAR" property="biTelephone"/>
    <result column="BI_Address" jdbcType="VARCHAR" property="biAddress"/>
    <result column="BI_Create_Time" jdbcType="TIMESTAMP" property="biCreateTime"/>
    <result column="BI_Update_Time" jdbcType="TIMESTAMP" property="biUpdateTime"/>
    <result column="BI_Extension1" jdbcType="VARCHAR" property="biExtension1"/>
    <result column="BI_Extension2" jdbcType="VARCHAR" property="biExtension2"/>
    <result column="BI_Extension3" jdbcType="VARCHAR" property="biExtension3"/>
    <result column="BI_Remark" jdbcType="VARCHAR" property="biRemark"/>
  </resultMap>
  <sql id="Base_Column_List" >
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    BI_GUID, BI_Name, CI_GUID, CI_Name, BI_Management_Company_Id, BI_Management_Company,
    BI_Contact, BI_Telephone, BI_Address, BI_Create_Time, BI_Update_Time, BI_Extension1,
    BI_Extension2, BI_Extension3, BI_Remark
    BI_GUID, BI_Name, BI_Nick_Name, CI_GUID, CI_Name, BI_Province_Code, BI_Province_Name,
    BI_City_Code, BI_City_Name, BI_District_Code, BI_District_Name, BI_Town_Code, BI_Town_Name,
    BI_Area_Code, BI_Area, BI_Management_Company_Id, BI_Management_Company, BI_Contact,
    BI_Telephone, BI_Address, BI_Create_Time, BI_Update_Time, BI_Extension1, BI_Extension2,
    BI_Extension3, BI_Remark
  </sql>
</mapper>
src/main/resources/mapper/ds3/JSDustSiteInfoMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.flightfeather.supervision.domain.ds3.mapper.JSDustSiteInfoMapper">
  <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds3.entity.JSDustSiteInfo">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="mn_code" jdbcType="VARCHAR" property="mnCode" />
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="begin_date" jdbcType="TIMESTAMP" property="beginDate" />
    <result column="duty_company" jdbcType="VARCHAR" property="dutyCompany" />
    <result column="duty_company_id" jdbcType="VARCHAR" property="dutyCompanyId" />
    <result column="end_date" jdbcType="TIMESTAMP" property="endDate" />
    <result column="engineering_stage" jdbcType="VARCHAR" property="engineeringStage" />
    <result column="group_id" jdbcType="VARCHAR" property="groupId" />
    <result column="group_name" jdbcType="VARCHAR" property="groupName" />
    <result column="is_online" jdbcType="VARCHAR" property="isOnline" />
    <result column="is_trouble" jdbcType="VARCHAR" property="isTrouble" />
    <result column="jhpt_update_time" jdbcType="VARCHAR" property="jhptUpdateTime" />
    <result column="kindex" jdbcType="VARCHAR" property="kindex" />
    <result column="latitude" jdbcType="VARCHAR" property="latitude" />
    <result column="linkman" jdbcType="VARCHAR" property="linkman" />
    <result column="longitude" jdbcType="VARCHAR" property="longitude" />
    <result column="phone" jdbcType="VARCHAR" property="phone" />
    <result column="province" jdbcType="VARCHAR" property="province" />
    <result column="ring_id" jdbcType="VARCHAR" property="ringId" />
    <result column="ring_name" jdbcType="VARCHAR" property="ringName" />
    <result column="type_id" jdbcType="VARCHAR" property="typeId" />
    <result column="typename" jdbcType="VARCHAR" property="typename" />
    <result column="stop_time" jdbcType="TIMESTAMP" property="stopTime" />
    <result column="active" jdbcType="VARCHAR" property="active" />
    <result column="trouble_num" jdbcType="INTEGER" property="troubleNum" />
    <result column="insert_time" jdbcType="TIMESTAMP" property="insertTime" />
    <result column="stage_begin_date" jdbcType="TIMESTAMP" property="stageBeginDate" />
    <result column="tsp" jdbcType="DOUBLE" property="tsp" />
    <result column="union_type_id" jdbcType="VARCHAR" property="unionTypeId" />
    <result column="wall_height" jdbcType="VARCHAR" property="wallHeight" />
    <result column="ywsj_date" jdbcType="TIMESTAMP" property="ywsjDate" />
    <result column="build_area" jdbcType="VARCHAR" property="buildArea" />
    <result column="construction_unit" jdbcType="VARCHAR" property="constructionUnit" />
    <result column="control_level" jdbcType="VARCHAR" property="controlLevel" />
    <result column="developers" jdbcType="VARCHAR" property="developers" />
    <result column="do_time" jdbcType="TIMESTAMP" property="doTime" />
    <result column="has_monitor" jdbcType="VARCHAR" property="hasMonitor" />
    <result column="data_time" jdbcType="TIMESTAMP" property="dataTime" />
    <result column="engineering_stage_code" jdbcType="VARCHAR" property="engineeringStageCode" />
    <result column="equipment_code" jdbcType="VARCHAR" property="equipmentCode" />
    <result column="floor_area" jdbcType="VARCHAR" property="floorArea" />
    <result column="jhpt_delete" jdbcType="VARCHAR" property="jhptDelete" />
    <result column="noise_region" jdbcType="VARCHAR" property="noiseRegion" />
    <result column="responsible" jdbcType="VARCHAR" property="responsible" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    id, mn_code, address, name, code, begin_date, duty_company, duty_company_id, end_date,
    engineering_stage, group_id, group_name, is_online, is_trouble, jhpt_update_time,
    kindex, latitude, linkman, longitude, phone, province, ring_id, ring_name, type_id,
    typename, stop_time, active, trouble_num, insert_time, stage_begin_date, tsp, union_type_id,
    wall_height, ywsj_date, build_area, construction_unit, control_level, developers,
    do_time, has_monitor, data_time, engineering_stage_code, equipment_code, floor_area,
    jhpt_delete, noise_region, responsible
  </sql>
</mapper>
src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt
@@ -2,6 +2,7 @@
import org.junit.Test
import java.util.*
import kotlin.properties.Delegates
class CommonTest {
@@ -12,4 +13,10 @@
        println(fName)
        println(dName)
    }
    @Test
    fun annotationTest() {
        "name" + "1"
        mapOf<String, String>("name" to "1")
    }
}
src/test/kotlin/cn/flightfeather/supervision/business/autooutput/dataanalysis/AopDataDeviceMapTest.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package cn.flightfeather.supervision.business.autooutput.dataanalysis
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import org.junit.Test
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit.jupiter.SpringExtension
import org.springframework.test.context.junit4.SpringRunner
import java.time.LocalDateTime
@RunWith(SpringRunner::class)
@ExtendWith(SpringExtension::class)
@SpringBootTest
class AopDataDeviceMapTest {
    @Autowired
    lateinit var aopDataDeviceMap: AopDataDeviceMap
    @Test
    fun outputMapSet() {
        // é‡‘山工地
        val areaVo = AreaVo().apply {
            provincecode = "31"
            provincename = "上海市"
            citycode = "3100"
            cityname = "上海市"
            districtcode = "310116"
            districtname = "金山区"
            starttime = LocalDateTime.of(2024, 1, 1, 0, 0, 0)
            scensetypeid = "1"
            sourceType = 2
        }
        aopDataDeviceMap.outputMapSet(areaVo)
        // é‡‘山码头
        areaVo.apply {
            scensetypeid = "2"
        }
        aopDataDeviceMap.outputMapSet(areaVo)
        // é‡‘山搅拌站
        areaVo.apply {
            scensetypeid = "3"
        }
        aopDataDeviceMap.outputMapSet(areaVo)
        // é™å®‰å·¥åœ°
        areaVo.apply {
            districtcode = "310106"
            districtname = "静安区"
            scensetypeid = "1"
        }
        aopDataDeviceMap.outputMapSet(areaVo)
    }
}
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ScenseServiceImplTest.kt
@@ -2,6 +2,8 @@
import cn.flightfeather.supervision.SupervisionApplication
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep
import cn.flightfeather.supervision.lightshare.service.ScenseService
import org.junit.Test
import org.junit.runner.RunWith
@@ -15,6 +17,12 @@
    @Autowired
    lateinit var scenseService: ScenseService
    @Autowired
    lateinit var sceneRep: SceneRep
    @Autowired
    lateinit var userInfoSVRep: UserInfoSVRep
    @Test
    fun getSceneType() {
@@ -33,4 +41,34 @@
        val r = scenseService.search(s)
        println(r)
    }
    @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",
        )
        sId.forEach {
            val scene = sceneRep.findScene(sceneId = it) ?: return@forEach
            val userInfo = userInfoSVRep.findUser(it) ?: return@forEach
            scenseService.createTZUserInfo(userInfo, scene)
        }
    }
}