|
@@ -19,7 +19,6 @@
|
|
|
*/
|
|
|
package cn.sagacloud.server.algorithm.controllers.modelFile
|
|
|
|
|
|
-import cn.sagacloud.server.algorithm.backstage.state.ExportPassedState_3
|
|
|
import cn.sagacloud.server.algorithm.backstage.sync.SyncUtil
|
|
|
import cn.sagacloud.server.algorithm.dao.mapper.FloorMapper
|
|
|
import cn.sagacloud.server.algorithm.models.config.MyProperties
|
|
@@ -32,7 +31,7 @@ import cn.sagacloud.server.algorithm.services.comparator.FloorComparator
|
|
|
import cn.sagacloud.server.algorithm.services.datacenter.DataCenterService
|
|
|
import cn.sagacloud.server.algorithm.services.endpoint.FloorModelService
|
|
|
import cn.sagacloud.server.algorithm.services.endpoint.FloorService
|
|
|
-import com.alibaba.fastjson.JSONObject
|
|
|
+import cn.sagacloud.server.algorithm.services.endpoint.ModelFileService
|
|
|
import com.sybotan.database.SFilter
|
|
|
import com.sybotan.service.SPageContext
|
|
|
import com.sybotan.service.models.enums.SResponseType
|
|
@@ -46,13 +45,15 @@ import com.sybotan.service.models.responses.SCreateResponse
|
|
|
import com.sybotan.service.models.responses.SQueryResponse
|
|
|
import io.swagger.annotations.Api
|
|
|
import io.swagger.annotations.ApiOperation
|
|
|
+import org.apache.commons.lang3.StringUtils
|
|
|
import org.slf4j.LoggerFactory
|
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
|
import org.springframework.web.bind.annotation.PostMapping
|
|
|
import org.springframework.web.bind.annotation.RequestBody
|
|
|
import org.springframework.web.bind.annotation.RequestMapping
|
|
|
import org.springframework.web.bind.annotation.RestController
|
|
|
-import java.lang.StringBuilder
|
|
|
+import java.util.stream.Collector
|
|
|
+import java.util.stream.Collectors.toSet
|
|
|
|
|
|
/**
|
|
|
*
|
|
@@ -80,6 +81,9 @@ class FloorModelController {
|
|
|
lateinit var floorService : FloorService
|
|
|
|
|
|
@Autowired
|
|
|
+ lateinit var modelFileService : ModelFileService
|
|
|
+
|
|
|
+ @Autowired
|
|
|
lateinit var floorMapper : FloorMapper
|
|
|
|
|
|
@Autowired
|
|
@@ -105,8 +109,18 @@ class FloorModelController {
|
|
|
response = FloorModelService.pageQuery(request)
|
|
|
}
|
|
|
val list = response.content
|
|
|
- if(list != null && list.isNotEmpty())
|
|
|
+ if(list != null && list.isNotEmpty()) {
|
|
|
+ // 2021年12月23日11:24:57 新增一个预获取url
|
|
|
+ try{
|
|
|
+ val fileIds: Set<String> = list.stream().filter { model -> StringUtils.isNotBlank(model.url) }
|
|
|
+ .map { model -> model.url!!.subSequence(model.url!!.lastIndexOf("key=")+4, model.url!!.length) }
|
|
|
+ .collect(toSet<String>() as Collector<in CharSequence, out Any, Set<String>>)
|
|
|
+ val urlMap:Map<String,String> = modelFileService.queryFetchUrlsByFileIds(fileIds, myProperties)
|
|
|
+ list.forEach { model -> model.fetchUrl=urlMap
|
|
|
+ .getOrDefault(model.url!!.subSequence(model.url!!.lastIndexOf("key=")+4, model.url!!.length),null) }
|
|
|
+ }catch (e:Exception){}
|
|
|
response.content = list.sortedWith(floorComparator)
|
|
|
+ }
|
|
|
return response
|
|
|
} // Function queryList()
|
|
|
|