From 517296b16b1faf07bc389809387b1937f9415746 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期三, 23 七月 2025 17:35:06 +0800 Subject: [PATCH] 2025.7.23 --- src/main/kotlin/cn/flightfeather/supervision/business/datafetch/FetchNightConstruction.kt | 2 + src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt | 2 src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt | 13 ++++-- src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DomainitemService.kt | 7 +++ src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt | 11 +++++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt | 40 ++++++++++++++++++++ src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt | 6 ++- src/main/resources/application-dev.yml | 5 ++ src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt | 5 ++ src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt | 7 ++- src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DomainitemController.kt | 6 +++ src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt | 4 +- src/main/resources/application.yml | 4 +- 13 files changed, 98 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/datafetch/FetchNightConstruction.kt b/src/main/kotlin/cn/flightfeather/supervision/business/datafetch/FetchNightConstruction.kt index 4f0ed9f..c00d493 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/datafetch/FetchNightConstruction.kt +++ b/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 diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt b/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt index ee3070c..0e4d059 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt +++ b/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") { diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt index 42de868..bece96e 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt +++ b/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" } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt b/src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt index 50a22c2..0b07853 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/config/CorsConfig.kt +++ b/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()) diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt index c3d8226..98619a1 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/MediaFileRep.kt +++ b/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) diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DomainitemService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DomainitemService.kt index dde9c25..2ad1c44 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DomainitemService.kt +++ b/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 浠绘剰鎷嶇被鍨嬬粨鏋渕ap缁撴瀯锛�<绫诲瀷鍊硷紝绫诲瀷鍚嶇О> + */ + fun getMediaFileType(sceneType: Int?): MutableMap<String?, String?> } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt index b950837..9baf7f1 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DomainitemServiceImpl.kt +++ b/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 + } } \ No newline at end of file diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt index 4081cf9..927627b 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/MediafileServiceImpl.kt +++ b/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鍜屽贰鏌ヤ换鍔d鑷冲皯濉啓鍏朵腑涓�涓�") } 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) } diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DomainitemController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DomainitemController.kt index 1500eea..380364c 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DomainitemController.kt +++ b/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) } \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index d18704d..889bda0 100644 --- a/src/main/resources/application-dev.yml +++ b/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 diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 350ca41..13d7197 100644 --- a/src/main/resources/application.yml +++ b/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 閰嶇疆 diff --git a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt index f0e9fa0..070a972 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt +++ b/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) + } } \ No newline at end of file diff --git a/src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt b/src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt index f374e7f..36b9bc5 100644 --- a/src/test/kotlin/cn/flightfeather/supervision/SupervisionApplicationTests.kt +++ b/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 { -- Gitblit v1.9.3