feiyu02
2025-07-23 517296b16b1faf07bc389809387b1937f9415746
2025.7.23
已修改13个文件
112 ■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/business/datafetch/FetchNightConstruction.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DomainitemService.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DomainitemController.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/datafetch/FetchNightConstruction.kt
@@ -86,6 +86,8 @@
                            ncFileName = vo["filename"].asString
                            ncCreateTime = DateUtil.StringToDate(vo["createtime"].asString)
                            ncUrl = vo["url"].asString
                            val url = ncUrl.split("://")[1].split("/")[0]
                            ncUrl = ncUrl.replace(url, "${NCHttpService.IP}:${NCHttpService.PORT}")
                            ncProvinceCode = PROVINCE_CODE
                            ncProvinceName = PROVINCE_NAME
src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt
@@ -11,16 +11,21 @@
object NCHttpService {
    data class Params(
            val time: String
        val time: String,
    )
    private val httpMethod = HttpMethod("114.94.28.171", 9006)
    const val IP = "114.94.28.171"
    const val PORT = 9006
    private val httpMethod = HttpMethod(IP, PORT)
    fun getFile(time: String): JsonArray? {
        val params = Params(time)
        val data = Gson().toJson(params)
        val response = httpMethod.post("/streetapp/nightwork/getInfo", data,
                listOf(Pair("Authorization", "c2hpZXRpb246MjAyMDBhMjc5NjAx")))
        val response = httpMethod.post(
            "/streetapp/nightwork/getInfo", data,
            listOf(Pair("Authorization", "c2hpZXRpb246MjAyMDBhMjc5NjAx"))
        )
        return if (response.success) {
            val json = JsonParser.parseString(response.m.responseBodyAsString)
            if (json.isJsonObject && json.asJsonObject["result"].asString == "1") {
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
@@ -263,5 +263,10 @@
        const val DOMAIN_GUID_TASK_DEADLINE_TYPE = "cS9MAkmXN1S37Tbv"
        // 任务层次
        const val DOMAIN_GUID_TASK_LEVEL = "TzbIi3ckPWMzlsH6"
        // 工地任意拍图片类型
        const val MEDIA_FILE_TYPE_INDUSTRY = "vToOfXftwyMuhvN1"
        // 餐饮任意拍图片类型
        const val MEDIA_FILE_TYPE_RESTAURANT = "cgbe0HoYEVcbzQt0"
    }
}
src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt
@@ -6,7 +6,7 @@
import org.springframework.web.cors.UrlBasedCorsConfigurationSource
import org.springframework.web.filter.CorsFilter
@Configuration
//@Configuration
class CorsConfig {
    private fun buildConfig(): CorsConfiguration {
@@ -18,7 +18,7 @@
        }
    }
    @Bean
//    @Bean
    fun corsFilter(): CorsFilter {
        val source = UrlBasedCorsConfigurationSource().apply {
            registerCorsConfiguration("/**", buildConfig())
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt
@@ -33,7 +33,7 @@
    /**
     * 根据巡查记录和文件业务类型查询
     */
    fun findList(iGuid: String?, typeList: List<Int>): List<Mediafile?> {
    fun findList(iGuid: String?, typeList: List<Int?>): List<Mediafile?> {
        return mediaFileMapper.selectByExample(Example(Mediafile::class.java).apply {
            createCriteria().andEqualTo("iguid", iGuid)
                .andIn("businesstypeid", typeList)
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DomainitemService.kt
@@ -28,4 +28,11 @@
    fun getDeadlineType(): List<Domainitem>
    fun getLevelType(): List<Domainitem>
    /**
     * 获取场景的任意拍类型
     * @param sceneType 场景类型
     * @return 任意拍类型结果map结构,<类型值,类型名称>
     */
    fun getMediaFileType(sceneType: Int?): MutableMap<String?, String?>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt
@@ -117,4 +117,44 @@
            orderBy("index")
        })
    }
    override fun getMediaFileType(sceneType: Int?): MutableMap<String?, String?> {
        val res = mutableMapOf<String?, String?>()
        val type = Constant.SceneType.getByValue(sceneType.toString())
        when (type) {
            // 工地
            Constant.SceneType.TYPE1 -> {
                val domainItems = domainitemMapper.selectByExample(Example(Domainitem::class.java).apply {
                    createCriteria().andEqualTo("dcguid", Constant.MEDIA_FILE_TYPE_INDUSTRY)
                    orderBy("index")
                })
                domainItems.forEach { res[it.value] = it.text }
                // 工地中的任意拍包含“常规记录”类型
                res[Constant.MediaFileType.RoutineRecord.value.toString()] = Constant.MediaFileType.RoutineRecord.des
                return res
            }
            // 餐饮
            Constant.SceneType.TYPE5 -> {
                val domainItems = domainitemMapper.selectByExample(Example(Domainitem::class.java).apply {
                    createCriteria().andEqualTo("dcguid", Constant.MEDIA_FILE_TYPE_RESTAURANT)
                    orderBy("index")
                })
                domainItems.forEach { res[it.value] = it.text }
                // 餐饮中的任意拍包含“常规记录”类型
                res[Constant.MediaFileType.RoutineRecord.value.toString()] = Constant.MediaFileType.RoutineRecord.des
                return res
            }
            // 其余类型场景,使用默认的分类
            else -> {
                listOf(
                    Constant.MediaFileType.Nameplate,
                    Constant.MediaFileType.MonitorDevice,
                    Constant.MediaFileType.RoutineRecord,
                ).forEach {
                    res[it.value.toString()] = it.des
                }
            }
        }
        return res
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt
@@ -10,6 +10,7 @@
import cn.flightfeather.supervision.domain.ds1.repository.MediaFileRep
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
import cn.flightfeather.supervision.lightshare.service.DomainitemService
import cn.flightfeather.supervision.lightshare.service.MediafileService
import cn.flightfeather.supervision.lightshare.vo.MediaFileVo
import com.fasterxml.jackson.core.type.TypeReference
@@ -30,6 +31,7 @@
    private val inspectionRep: InspectionRep,
    private val subTaskRep: SubTaskRep,
    private val sceneRep: SceneRep,
    private val domainItemService: DomainitemService,
    @Value("\${filePath}") var filePath: String,
    @Value("\${imgPath}") var imgPath: String,
) : MediafileService {
@@ -63,8 +65,8 @@
            throw BizException("巡查记录id和巡查任务id至少填写其中一个")
        }
        sceneId ?: throw BizException("记录对应的场景不存在")
        val sceneInfo = sceneRep.findScene(sceneId = sceneId)
        val mediaFileTypeList = Constant.MediaFileType.getList(sceneInfo?.typeid).map { it.value }
        val sceneInfo = sceneRep.findScene(sceneId = sceneId) ?: throw BizException("场景不存在,获取场景图片失败")
        val mediaFileTypeList = domainItemService.getMediaFileType(sceneInfo.typeid?.toInt()).entries.map { it.key?.toInt() }
        return mediaFileRep.findList(inspectionGuid, mediaFileTypeList)
    }
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DomainitemController.kt
@@ -44,4 +44,10 @@
    @ApiOperation("获取巡查任务层次类型选项")
    @GetMapping("/level")
    fun getLevelType() = domainitemService.getLevelType()
    @ApiOperation("根据场景类型获取任意拍的类型")
    @GetMapping("/mediaFileType")
    fun getMediaFileType(
        @ApiParam("场景类型id") @RequestParam("sceneType") sceneType:Int
    ) = domainitemService.getMediaFileType(sceneType)
}
src/main/resources/application-dev.yml
@@ -17,6 +17,11 @@
      v2:
        enabled: true
# mybatis 配置
mybatis:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
imgPath: C:\02product\supervision\images
filePath: C:\02product\supervision\files
mode: dev
src/main/resources/application.yml
@@ -74,8 +74,8 @@
  type-aliases-package: cn.flightfeather.supervision.domain.ds1.entity, cn.flightfeather.supervision.domain.ds2.entity, cn.flightfeather.supervision.domain.ds3.entity
  mapper-locations: classpath*:mapper/**/*.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  #    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
  #    map-underscore-to-camel-case: true
## 通用 Mapper 配置
src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt
@@ -19,4 +19,15 @@
        "name" + "1"
        mapOf<String, String>("name" to "1")
    }
    @Test
    fun findStr() {
        val str = "http://114.233.144.555:9006/asdasd/asdasd"
        val url = str.split("://")[1].split("/")[0]
        val newStr = str.replace(url, "224.55.2.12:8085")
//        val i1 = str.indexOf("://")
//        val i2 = str.indexOf("/")
        println(str)
        println(newStr)
    }
}
src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt
@@ -3,14 +3,15 @@
import cn.flightfeather.supervision.business.datafetch.FetchController
import cn.flightfeather.supervision.infrastructure.service.ServerManager
import cn.flightfeather.supervision.common.utils.UUIDGenerator
//import org.junit.Test
import org.junit.jupiter.api.Test
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
@RunWith(SpringRunner::class)
@ExtendWith(SpringExtension::class)
@SpringBootTest
class SupervisionApplicationTests {