feiyu02
2025-08-14 f373bbf83d9d2a7e5f96118d7dcd658c9fea8bc8
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
@@ -29,8 +29,10 @@
     * 设置数据源
     */
    fun setResource(topTaskGuid: String?, sceneType: Int, districtName: String?, townCode: String?) {
        val config = AopDataConfig(topTaskGuid = topTaskGuid, sceneType = sceneType, districtName = districtName,
            townCode = townCode)
        val config = AopDataConfig(
            topTaskGuid = topTaskGuid, sceneType = sceneType, districtName = districtName,
            townCode = townCode
        )
        evaluationScene.config = config
        val check = aopSceneTypeCheck.checkSceneType(sceneType)
        if (check.first) {
@@ -60,8 +62,10 @@
    fun setResource(subtask: Subtask) {
        val scene = aopDbMapper.scenseMapper.selectByPrimaryKey(subtask.scenseid)
        val sceneType = scene.typeid?.toInt()
        val config = AopDataConfig(topTaskGuid = subtask.tguid, sceneType = sceneType,
            districtName = subtask.districtname, townCode = subtask.towncode)
        val config = AopDataConfig(
            topTaskGuid = subtask.tguid, sceneType = sceneType,
            districtName = subtask.districtname, townCode = subtask.towncode
        )
        evaluationScene.config = config
//        val check = aopSceneTypeCheck.checkSceneType(sceneType)
        this.mode = 0
@@ -84,6 +88,7 @@
                    } while (evaluationScene.gotoNextSubTask())
                }
            }
            1 -> {
                userSourceList.forEachIndexed { i, user ->
                    evaluationScene.clear()
@@ -109,6 +114,7 @@
                    callback(i, evaluationScene)
                }
            }
            1 -> {
                userSourceList.forEachIndexed { i, user ->
                    evaluationScene.clear()
@@ -188,6 +194,7 @@
                dGuid = scene.value?.guid
            })
        }
        //巡查任务信息
        var subTaskIndex = 0
        val subTask = InfoProxy<Subtask> {_,_ ->
@@ -220,12 +227,15 @@
                Constant.SceneType.TYPE1.value -> {
                    aopDbMapper.sceneConstructionSiteMapper.selectByPrimaryKey(scene.value?.guid)
                }
                Constant.SceneType.TYPE2.value -> {
                    aopDbMapper.sceneWharfMapper.selectByPrimaryKey(scene.value?.guid)
                }
                Constant.SceneType.TYPE3.value -> {
                    aopDbMapper.sceneMixingPlantMapper.selectByPrimaryKey(scene.value?.guid)
                }
                Constant.SceneType.TYPE14.value -> {
                    aopDbMapper.sceneStorageYardMapper.selectByPrimaryKey(scene.value?.guid)
                }
@@ -233,9 +243,11 @@
                Constant.SceneType.TYPE5.value -> {
                    aopDbMapper.restaurantBaseInfoMapper.selectByPrimaryKey(userInfoTZ.value?.guid)
                }
                Constant.SceneType.TYPE6.value -> {
                    aopDbMapper.vehicleBaseInfoMapper.selectByPrimaryKey(userInfoTZ.value?.guid)
                }
                else -> null
            }
        }
@@ -289,6 +301,14 @@
                createCriteria()
                    .andEqualTo("tasktypeid", 99)
                    .andEqualTo("scensetypeid", scene.value?.typeid)
                and(createCriteria().orEqualTo("provincecode", scene.value?.provincecode).orIsNull("provincecode"))
                and(createCriteria().orEqualTo("citycode", scene.value?.citycode).orIsNull("citycode"))
                and(createCriteria().orEqualTo("districtcode", scene.value?.districtcode).orIsNull("districtcode"))
                and(createCriteria().orEqualTo("towncode", scene.value?.towncode).orIsNull("towncode"))
                orderBy("towncode").desc()
                    .orderBy("districtcode").desc()
                    .orderBy("citycode").desc()
                    .orderBy("provincecode").desc()
            })
            if (rule.isNotEmpty()) {
                this@EvaluationScene.baseRule.value = rule[0]
@@ -378,9 +398,12 @@
                orderBy("planstarttime").desc()
            })
            if (r.isNotEmpty()) {
                val thisMonth = LocalDateTime.ofInstant(subTask.value?.planstarttime?.toInstant(), ZoneId.systemDefault())
                val thisMonth =
                    LocalDateTime.ofInstant(subTask.value?.planstarttime?.toInstant(), ZoneId.systemDefault())
                    .withDayOfMonth(1).toLocalDate()
                val lastMonth = LocalDateTime.ofInstant(r[0]?.planstarttime?.toInstant(), ZoneId.systemDefault()).withDayOfMonth(1).toLocalDate()
                val lastMonth =
                    LocalDateTime.ofInstant(r[0]?.planstarttime?.toInstant(), ZoneId.systemDefault()).withDayOfMonth(1)
                        .toLocalDate()
                if (lastMonth.plusMonths(1).isEqual(thisMonth)) {
                    last.subTask.value = r[0]
                }
@@ -458,7 +481,8 @@
                if (defaultValue != null) {
                    return defaultValue
                } else if (!fetched && _value == null) {
                    _value = if (cacheMap.containsKey(key) && LocalDateTime.now().minusDays(1).isBefore(cacheTimeStamp)) {
                    _value =
                        if (cacheMap.containsKey(key) && LocalDateTime.now().minusDays(1).isBefore(cacheTimeStamp)) {
                        cacheMap[key]
                    } else {
                        cacheTimeStamp = LocalDateTime.now()