瀏覽代碼

Merge remote-tracking branch 'origin/master'

zhangweixin 4 年之前
父節點
當前提交
845e0f8ec9

+ 1 - 1
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/graphtype/RelationTypeProjectService.kt

@@ -264,7 +264,7 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
      * @param   zoneType        业务空间类型
      * @return  应答体
      */
-    fun importExcel(file: MultipartFile, relType: String, zoneType: String? = null): SBaseResponse {
+    fun importExcel(file: MultipartFile, relType: String, zoneType: String? = null,type: String,graphCode: String): SBaseResponse {
         try {
             if (file.isEmpty) {
                 throw Exception("未选择文件")

+ 32 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/objects/SpaceService.kt

@@ -31,11 +31,14 @@ import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.datacenter.models.entities.logs.DataCenterLogs
 import com.persagy.server.datacenter.wanda.obj.ZoneIspace
 import com.persagy.server.datacenter.models.requests.DCSQueryRequest
+import com.persagy.server.datacenter.services.objects.ZoneSpaceBaseService
+import com.persagy.server.datacenter.wanda.obj.ZoneSpace
 import com.persagy.server.services.base.Service
 import com.persagy.server.utils.IdUtils
 import com.persagy.server.utils.ShaftNameUtil
 import com.persagy.service.SPageContext
 import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.requests.SCreateRequest
 import com.persagy.service.models.responses.SQueryResponse
 
 /**
@@ -70,6 +73,35 @@ object SpaceService : Service<ZoneIspace>(SMybatisDao(ZoneIspace::class.java)) {
         return true
     } // Function onCreateBefore()
 
+    /**
+     * @Description: 创建元空间后批量创建业务空间
+     */
+    override fun onCreateSuccess(entityList: ArrayList<ZoneIspace>) {
+        super.onCreateSuccess(entityList)
+        val zoneSpaces = ArrayList<ZoneSpace>()
+        for (zoneIspace in entityList) {
+            val zoneSpace = ZoneSpace()
+            zoneSpace.name = zoneIspace.name
+            zoneSpace.localId = zoneIspace.localId
+            zoneSpace.localName = zoneIspace.localName
+            zoneSpace.projectId = zoneIspace.projectId
+            zoneSpace.buildingId = zoneIspace.buildingId
+            zoneSpace.floorId = zoneIspace.floorId
+            zoneSpace.bimId = zoneIspace.bimId
+            zoneSpace.classCode = "GeneralZone"
+            zoneSpace.infos = zoneIspace.infos
+            if(zoneIspace.outline != null){
+                zoneSpace.outline = arrayListOf(zoneIspace.outline!!)
+            }
+            zoneSpace.state = 0
+            zoneSpaces.add(zoneSpace)
+        }
+        val request = SCreateRequest<ZoneSpace>()
+        request.content = zoneSpaces
+        ZoneSpaceBaseService.createList(request)
+
+    }
+
     override fun onDeleteBefore(entity: ZoneIspace): Boolean {
         try {
             val zoneIspace = this.select(SFilter.eq("id", entity.id!!)).entity()

+ 2 - 2
datacenter/src/main/kotlin/com/persagy/server/datacenter/wanda/controllers/relation/GraphicTypeController.kt

@@ -112,9 +112,9 @@ open class GraphicTypeController {
      */
     @Operation(summary = "导入excel", description = "")
     @PostMapping("/import",consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
-    fun importExcel(@RequestPart("file") file: MultipartFile, @RequestParam relType: String, @RequestParam zoneType: String? = null) : SBaseResponse {
+    fun importExcel(@RequestPart("file") file: MultipartFile, @RequestParam relType: String, @RequestParam zoneType: String? = null,@RequestParam type: String,@RequestParam graphCode: String) : SBaseResponse {
         try {
-            RelationTypeProjectService.importExcel(file, relType, zoneType)
+            RelationTypeProjectService.importExcel(file, relType, zoneType,type,graphCode)
         }catch (e : Exception){
             return SBaseResponse(SResponseType.failure,"error:" + e.message)
         }