feiyu02
2024-04-25 0392c333ed3d987cb2ab3dac4e1a972cff405f21
src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
@@ -1,5 +1,6 @@
package cn.flightfeather.supervision.business.autooutput.datasource
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
@@ -47,6 +48,18 @@
        }
    }
    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)
        evaluationScene.config = config
//        val check = aopSceneTypeCheck.checkSceneType(sceneType)
        this.mode = 0
        sceneSourceList.clear()
        sceneSourceList.add(scene)
    }
    /**
     * 轮询数据源
     */
@@ -73,23 +86,13 @@
    // 从监管系统获取场景
    private fun initSceneSource(config: AopDataConfig) {
        config.topTaskGuid ?: throw IllegalStateException("顶层任务id不能为null")
        config.topTaskGuid ?: throw BizException("顶层任务id不能为null")
        this.config = config
        this.mode = 0
        sceneSourceList.clear()
        val taskSceneIdList =
            aopDbMapper.monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode)
        aopDbMapper.scenseMapper.selectByExample(Example(Scense::class.java).apply {
            createCriteria()
                .andIn("guid", taskSceneIdList)
//                .andEqualTo("provincecode", config.provinceCode)
//                .andEqualTo("citycode", config.cityCode)
//                .andEqualTo("districtcode", config.districtCode)
//                .andEqualTo("towncode", config.townCode)
//                .andEqualTo("typeid", config.sceneType)
//                .andNotEqualTo("extension1", '0')
        })?.let { sceneSourceList.addAll(it) }
            aopDbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config.sceneType, config.townCode)
        sceneSourceList.addAll(taskSceneIdList)
    }
    // 从台账系统获取场景
@@ -166,23 +169,23 @@
        val baseScene = InfoProxy<BaseScene> {_,_ ->
            return@InfoProxy when (config?.sceneType.toString()) {
                // 监管系统
                Constant.ScenseType.TYPE1.value -> {
                Constant.SceneType.TYPE1.value -> {
                    aopDbMapper.sceneConstructionSiteMapper.selectByPrimaryKey(scene.value?.guid)
                }
                Constant.ScenseType.TYPE2.value -> {
                Constant.SceneType.TYPE2.value -> {
                    aopDbMapper.sceneWharfMapper.selectByPrimaryKey(scene.value?.guid)
                }
                Constant.ScenseType.TYPE3.value -> {
                Constant.SceneType.TYPE3.value -> {
                    aopDbMapper.sceneMixingPlantMapper.selectByPrimaryKey(scene.value?.guid)
                }
                Constant.ScenseType.TYPE14.value -> {
                Constant.SceneType.TYPE14.value -> {
                    aopDbMapper.sceneStorageYardMapper.selectByPrimaryKey(scene.value?.guid)
                }
                // 台账系统
                Constant.ScenseType.TYPE5.value -> {
                Constant.SceneType.TYPE5.value -> {
                    aopDbMapper.restaurantBaseInfoMapper.selectByPrimaryKey(userInfoTZ.value?.guid)
                }
                Constant.ScenseType.TYPE6.value -> {
                Constant.SceneType.TYPE6.value -> {
                    aopDbMapper.vehicleBaseInfoMapper.selectByPrimaryKey(userInfoTZ.value?.guid)
                }
                else -> null
@@ -295,7 +298,7 @@
        //必填台账数量
        val ledgerCount = InfoProxy<Int>(config?.sceneType.toString()) {_, cacheMap ->
            val tzSceneType = Constant.ScenseType.typeMap(scene.value?.typeid)
            val tzSceneType = Constant.SceneType.typeMap(scene.value?.typeid)
            val list = aopDbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply {
                createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true)
            })