caiaf 4 éve
szülő
commit
9df268d433

+ 5 - 0
datacenter/build.gradle

@@ -175,3 +175,8 @@ task buildwanda {
     }
     finalizedBy(build)
 }
+
+bootWar{
+    baseName = 'datacenter'
+    version = ''
+}

+ 40 - 14
datacenter/src/main/kotlin/com/persagy/server/datacenter/mappers/IRelationExcelExportMapper.kt

@@ -101,7 +101,7 @@ interface IRelationExcelExportMapper {
     @Select("SELECT m.id, m.name, m.local_id, m.local_name,'建筑' AS object_type,m.name AS building_floor ," +
             "s.id AS _id, s.name AS _name, s.local_id AS _local_id, s.local_name AS _local_name, '设备' AS _object_type," +
             "s.f_name AS _building_floor FROM public.building as m JOIN (select e.id,e.name,e.local_id,e.local_name,e.building_id," +
-            "f.name as f_name from public.equipment as e join floor as f on e.floor_id=f.id) AS s ON s.building_id = m.id WHERE m.project_id =#{projectId}")
+            "f.local_name as f_name from public.equipment as e join floor as f on e.floor_id=f.id) AS s ON s.building_id = m.id WHERE m.project_id =#{projectId}")
     fun eq2bdIn(projectId: String): List<HashMap<String, Any?>>
 
     /**
@@ -147,28 +147,30 @@ interface IRelationExcelExportMapper {
      * 设备与空间关系
      *
      * @param   projectId       项目id
-     * @param   type            关系类型
+     * @param   type            类型
      * @param   zoneType        空间类型
+     * @param   graphCode       图类型
      * @return  关系记录
      */
     @Select("SELECT r.eq_id AS id, eq.name, eq.local_id, eq.local_name, '设备' AS object_type,\n" +
             "       r.sp_id AS _id, sp.name AS _name, sp.local_id AS _local_id, sp.local_name AS _local_name, '空间' AS _object_type\n" +
             "FROM relationship.r_eq2sp r JOIN equipment AS eq ON r.eq_id = eq.id JOIN zone_space_base AS sp ON r.sp_id = sp.id\n" +
-            "WHERE r.project_id = #{projectId} AND r.type = #{type} AND r.zone_type = #{zoneType}")
-    fun eq2sp(projectId: String, type: String, zoneType :String): List<HashMap<String, Any?>>
+            "WHERE r.project_id = #{projectId} AND r.type = #{type} AND r.zone_type = #{zoneType} AND r.graph_code = #{graphCode}")
+    fun eq2sp(projectId: String, type: String, zoneType :String,graphCode: String): List<HashMap<String, Any?>>
 
     /**
-     * 设备与系统关系
+     * 系统下的设备
      *
      * @param   projectId       项目id
-     * @param   type            关系类型
+     * @param   type            边类型
+     * @param   graphCode       图类型
      * @return  关系记录
      */
-    @Select("SELECT r.eq_id AS id, eq.name, eq.local_id, eq.local_name, '设备' AS object_type,\n" +
-            "       r.sy_id AS _id, sy.name AS _name, sy.local_id AS _local_id, sy.local_name AS _local_name, '系统' AS _object_type\n" +
-            "FROM relationship.r_eq2sy r JOIN equipment AS eq ON r.eq_id = eq.id JOIN general_system AS sy ON r.sy_id = sy.id\n" +
-            "WHERE r.project_id = #{projectId} AND r.type = #{type}")
-    fun eq2sy(projectId: String, type: String): List<HashMap<String, Any?>>
+    @Select("SELECT r.sy_id AS id, sy.name AS name, sy.local_id AS local_id, sy.local_name AS local_name, '系统' AS object_type,\n" +
+            "     r.eq_id AS _id, eq.name AS _name, eq.local_id AS _local_id, eq.local_name AS _local_name, '设备' AS _object_type\n" +
+            "FROM relationship.r_sy2eq r JOIN equipment AS eq ON r.eq_id = eq.id JOIN general_system AS sy ON r.sy_id = sy.id\n" +
+            "WHERE r.project_id = #{projectId} AND r.type = #{type} AND r.graph_code = #{graphCode}")
+    fun sy2eq(projectId: String, type: String,graphCode: String): List<HashMap<String, Any?>>
 
     /**
      * 楼层与楼层关系
@@ -301,6 +303,18 @@ interface IRelationExcelExportMapper {
     fun sp2bd(projectId: String, type: String): List<HashMap<String, Any?>>
 
     /**
+     * 建筑与空间关系
+     *
+     * @param   projectId       项目ID
+     * @return  excel需要的记录
+     */
+    @Select("SELECT  r.building_id AS id, bd.name AS name, bd.local_id AS local_id, bd.local_name AS local_name, '建筑' AS object_type,\n" +
+            "       r.id AS _id, r.name AS _name, r.local_id AS _local_id, r.local_name AS _local_name, '空间' AS _object_type\n" +
+            "FROM public.zone_space_base r JOIN building AS bd ON r.building_id = bd.id\n" +
+            "WHERE r.project_id = #{projectId}")
+    fun bd2sp(projectId: String): List<HashMap<String, Any?>>
+
+    /**
      * 楼层与空间关系
      *
      * @param   projectId       项目ID
@@ -311,7 +325,19 @@ interface IRelationExcelExportMapper {
             "       r.fl_id AS _id, fl.name AS _name, fl.local_id AS _local_id, fl.local_name AS _local_name, '楼层' AS _object_type\n" +
             "FROM relationship.r_sp2fl r JOIN floor AS fl ON r.fl_id = fl.id JOIN zone_space_base AS sp ON r.sp_id = sp.id\n" +
             "WHERE r.project_id = #{projectId} AND r.type = #{type}")
-    fun sp2fl(projectId: String, type: String): List<HashMap<String, Any?>>
+    fun sp2fl(projectId: String): List<HashMap<String, Any?>>
+
+    /**
+     * 楼层与空间关系
+     *
+     * @param   projectId       项目ID
+     * @return  excel需要的记录
+     */
+    @Select("SELECT fl.id AS id, fl.name, fl.local_id, fl.local_name, '楼层' AS object_type,\n" +
+            "       r.floor_id AS _id, r.name AS _name, r.local_id AS _local_id, r.local_name AS _local_name, '空间' AS _object_type\n" +
+            "FROM public.zone_space_base r JOIN floor AS fl ON r.floor_id = fl.id \n" +
+            "WHERE r.project_id = #{projectId}")
+    fun fl2sp(projectId: String): List<HashMap<String, Any?>>
 
     /**
      * 空间与空间关系
@@ -323,8 +349,8 @@ interface IRelationExcelExportMapper {
     @Select("SELECT r.id1 AS id, sp1.name, sp1.local_id, sp1.local_name, '空间' AS object_type,\n" +
             "       r.id2 AS _id, sp2.name AS _name, sp2.local_id AS _local_id, sp2.local_name AS _local_name, '空间' AS _object_type\n" +
             "FROM relationship.r_sp2sp r JOIN zone_space_base AS sp1 ON r.id1 = sp1.id JOIN zone_space_base AS sp2 ON r.id2 = sp2.id\n" +
-            "WHERE r.project_id = #{projectId} AND r.type = #{type}")
-    fun sp2sp(projectId: String, type: String): List<HashMap<String, Any?>>
+            "WHERE r.project_id = #{projectId} AND r.type = #{type} AND r.graph_code = #{graphCode}")
+    fun sp2sp(projectId: String, type: String,graphCode: String): List<HashMap<String, Any?>>
 
     /**
      * 建筑与系统关系

+ 1 - 1
datacenter/src/main/kotlin/com/persagy/server/datacenter/mappers/IRelationExcelImportMapper.kt

@@ -149,7 +149,7 @@ interface IRelationExcelImportMapper {
      * @return  excel需要的记录
      */
     @Insert("INSERT INTO relationship.r_eq2sp(project_id, eq_id, sp_id, type, sign, graph_code,zone_type) VALUES(#{projectId}, #{id1}, #{id2}, #{type}, 1, #{graphCode},#{zoneType})")
-    fun Eq2Sp(projectId: String, type: String, id1: String, id2: String, graphCode: String,zoneType: String)
+    fun Eq2Sp(projectId: String, type: String, id1: String, id2: String,zoneType: String, graphCode: String)
 
     /**
      * 设备与空间关系

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

@@ -176,7 +176,7 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
      * @param   code            识别码类型
      * @param   zoneType        业务空间类型
      */
-    fun exportExcel(response: HttpServletResponse, projectId: String,relType: String, code: String = "对象ID", zoneType: String? = null) {
+    fun exportExcel(response: HttpServletResponse, projectId: String,relType: String, code: String = "对象ID", zoneType: String? = null,graphCode: String) {
         val workbook = XSSFWorkbook(RelationTypeProjectService::class.java.classLoader.getResourceAsStream("excel/relation-template.xlsx"))
         response.contentType = "application/octet-stream"
         response.setHeader("Content-disposition", "attachment;filename=relation-$relType.xlsx")
@@ -187,7 +187,7 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
 //        val projectId = SPageContext.getHeader("projectId")
 
         try {
-            writeExcelRelation(sheet, projectId, relType, code, zoneType)
+            writeExcelRelation(sheet, projectId, relType, code, zoneType,graphCode)
         }catch (e: Exception) {
             // DO NOTHING
         }
@@ -205,33 +205,35 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
      * @param   zoneType        业务空间类型
      */
     @Suppress("UNCHECKED_CAST")
-    private fun writeExcelRelation(sheet: XSSFSheet, projectId: String, relType: String, code: String, zoneType: String? = null) {
-        val len = relType.indexOf("_")
-        val cmd = if (len > 0) {
-            relType.substring(0, len)
-        } else {
-            relType
-        }
-        val type = relType
+    private fun writeExcelRelation(sheet: XSSFSheet, projectId: String, relType: String, code: String, zoneType: String? = null,graphCode: String) {
+//        val len = relType.indexOf("_")
+//        val cmd = if (len > 0) {
+//            relType.substring(0, len)
+//        } else {
+//            relType
+//        }
+        val type = relType.toLowerCase()
 //        val type = if (len > 0) {
 //            relType.substring(len + 1)
 //        } else {
 //            ""
 //        }
 
-        val list = if (relType == "eq2bd" || relType == "pe2bd") {
-            val exportMethod = excelExport.javaClass.getDeclaredMethod("${relType}In", String::class.java)
+        val list = if (relType == RelationType.Eq2Bd || relType == RelationType.Eq2Fl) {
+            val exportMethod = excelExport.javaClass.getDeclaredMethod("${type}In", String::class.java)
             exportMethod!!.invoke(excelExport, projectId) as List<HashMap<String, Any?>>
-        } else if (relType == "eq2fl" || relType == "pe2fl") {
-            val exportMethod = excelExport.javaClass.getDeclaredMethod("${relType}In", String::class.java)
+        }
+        else if (relType == RelationType.Bd2Sp || relType == RelationType.Fl2Sp) {
+            val exportMethod = excelExport.javaClass.getDeclaredMethod(type, String::class.java)
             exportMethod!!.invoke(excelExport, projectId) as List<HashMap<String, Any?>>
-        } else {
+        }
+        else {
             if(zoneType.isNullOrEmpty()) {
-                val exportMethod = excelExport.javaClass.getDeclaredMethod(cmd, String::class.java, String::class.java)
-                exportMethod!!.invoke(excelExport, projectId, type) as List<HashMap<String, Any?>>
+                val exportMethod = excelExport.javaClass.getDeclaredMethod(type, String::class.java, String::class.java,String::class.java)
+                exportMethod!!.invoke(excelExport, projectId, relType, graphCode) as List<HashMap<String, Any?>>
             } else {
-                val exportMethod = excelExport.javaClass.getDeclaredMethod(cmd, String::class.java, String::class.java, String::class.java)
-                exportMethod!!.invoke(excelExport, projectId, type, zoneType) as List<HashMap<String, Any?>>
+                val exportMethod = excelExport.javaClass.getDeclaredMethod(type, String::class.java, String::class.java, String::class.java,String::class.java)
+                exportMethod!!.invoke(excelExport, projectId, relType, zoneType, graphCode) as List<HashMap<String, Any?>>
             }
         }
 
@@ -408,9 +410,9 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
             }
             else {
                 if(zoneType.isNullOrEmpty()) {
-                    excelImport.javaClass.getDeclaredMethod(relType, String::class.java, String::class.java, String::class.java, String::class.java)
-                } else {
                     excelImport.javaClass.getDeclaredMethod(relType, String::class.java, String::class.java, String::class.java, String::class.java, String::class.java)
+                } else {
+                    excelImport.javaClass.getDeclaredMethod(relType, String::class.java, String::class.java, String::class.java, String::class.java, String::class.java, String::class.java)
                 }
             }
 
@@ -429,9 +431,9 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
                     return
                 }
                     if(zoneType.isNullOrEmpty()) {
-                        importMethod.invoke(excelImport, projectId, type, id1, id2)
+                        importMethod.invoke(excelImport, projectId, type, id1, id2, graphCode)
                     } else {
-                        importMethod.invoke(excelImport, projectId, type, id1, id2, zoneType)
+                        importMethod.invoke(excelImport, projectId, type, id1, id2, zoneType, graphCode)
                     }
                     row.createCell(stateCol).setCellValue("关联成功")
                 } catch (e: Exception) {

+ 230 - 3
datacenter/src/main/kotlin/com/persagy/server/datacenter/services/objects/EquipmentService.kt

@@ -27,11 +27,10 @@
 package com.persagy.server.datacenter.services.objects
 
 import com.persagy.database.SFilter
-import com.persagy.database.SQueryBuilder
-import com.persagy.database.enums.SOps
 import com.persagy.database.extensions.keyValue
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
+import com.persagy.server.datacenter.models.entities.dictnew.DefFuncIdProject
 import com.persagy.server.datacenter.models.entities.graphtype.RelationTypeProject
 import com.persagy.server.datacenter.wanda.obj.Equipment
 import com.persagy.server.datacenter.wanda.rel.REq2Sy
@@ -41,8 +40,22 @@ import com.persagy.server.utils.IdUtils
 import com.persagy.server.utils.ShaftNameUtil
 import com.persagy.service.SBaseService
 import com.persagy.service.SObjectService
-
+import com.persagy.service.models.enums.SResponseType
+import com.persagy.service.models.requests.SUpdateRequest
+import com.persagy.service.models.responses.SBaseResponse
+import org.apache.poi.ss.usermodel.CellType
+import org.apache.poi.xssf.usermodel.XSSFCell
+import org.apache.poi.xssf.usermodel.XSSFRow
+import org.apache.poi.xssf.usermodel.XSSFSheet
+import org.apache.poi.xssf.usermodel.XSSFWorkbook
 import org.slf4j.LoggerFactory
+import org.springframework.web.multipart.MultipartFile
+import java.io.IOException
+import java.io.InputStream
+import java.io.OutputStream
+import java.util.*
+import javax.servlet.http.HttpServletResponse
+
 
 /**
  * 设备信息服务
@@ -59,6 +72,9 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
     /** 设备和系统关系 */
     private val rEq2SyService = SObjectService(SMybatisDao(REq2Sy::class.java))
 
+    /** 设备与信息点关系 */
+    private val defFuncIdProjectService = SObjectService(SMybatisDao(DefFuncIdProject::class.java))
+
     /**
      * 创建前赋值操作
      *
@@ -214,4 +230,215 @@ object EquipmentService : Service<Equipment>(SMybatisDao(Equipment::class.java))
             e.printStackTrace()
         }
     }
+
+    fun exportExcel(response: HttpServletResponse, projectId: String, classCode: String) {
+        response.contentType = "application/octet-stream"
+        response.setHeader("Content-disposition", "attachment;filename=equip-$classCode.xlsx")
+        response.flushBuffer()
+        val defFuncIds = defFuncIdProjectService.select(SFilter.eq("projectId",projectId), SFilter.eq("classCode",classCode)).exec()
+
+        val equipments = select(SFilter.eq("projectId",projectId), SFilter.eq("classCode",classCode)).exec()
+        val list = ArrayList<List<Any>>()
+        val firstList = ArrayList<String>()
+        val codeList = ArrayList<String>()
+        codeList.add("id")
+        codeList.add("bimTypeId")
+        codeList.add("systemCategory")
+        codeList.add("codeName")
+        codeList.add("localId")
+        firstList.add("设备ID-id")
+        firstList.add("BIM构件编码-bimTypeId")
+        firstList.add("系统分类-systemCategory")
+        firstList.add("设备类型名称-codeName")
+        firstList.add("本地编码-localId")
+        for (defFuncId in defFuncIds) {
+            codeList.add(defFuncId.code!!)
+            firstList.add("${defFuncId.name}-${defFuncId.code}")
+        }
+
+
+        list.add(firstList)
+        for (equipment in equipments) {
+            val itemList = ArrayList<Any>()
+            val infos = equipment.infos
+            for (s in codeList) {
+                if(s == "id"){
+                    itemList.add(equipment.id?:"")
+                } else if(s == "bimTypeId"){
+                    itemList.add(equipment.bimTypeId?:"")
+                }else if(s == "systemCategory"){
+                    itemList.add(equipment.systemCategory?:"")
+                }else if(s == "codeName"){
+                    itemList.add(equipment.codeName?:"")
+                }else if(s == "localId"){
+                    itemList.add(equipment.localId?:"")
+                }else{
+                    if(infos != null && infos[s] != null){
+                        itemList.add(infos[s]!!)
+                    }else{
+                        itemList.add("")
+                    }
+                }
+
+                
+            }
+            list.add(itemList)
+
+        }
+        writeExcel(list,response.outputStream)
+
+
+    } // Fun exportExcel
+
+
+    /**
+     * 把内容写入Excel
+     * @param list 传入要写的内容,此处以一个List内容为例,先把要写的内容放到一个list中
+     * @param outputStream 把输出流怼到要写入的Excel上,准备往里面写数据
+     */
+    fun writeExcel(list: List<List<*>>, outputStream: OutputStream){
+        //创建工作簿
+        var xssfWorkbook = XSSFWorkbook()
+
+        //创建工作表
+        val xssfSheet: XSSFSheet
+        xssfSheet = xssfWorkbook.createSheet("设备绑点")
+
+        //创建行
+        var xssfRow: XSSFRow
+
+        //创建列,即单元格Cell
+        var xssfCell: XSSFCell
+
+        //把List里面的数据写到excel中
+        for (i in list.indices) {
+            //从第一行开始写入
+            xssfRow = xssfSheet.createRow(i)
+            //创建每个单元格Cell,即列的数据
+            val sub_list = list[i]
+            for (j in sub_list.indices) {
+                xssfCell = xssfRow.createCell(j) //创建单元格
+                xssfCell.setCellValue(sub_list[j] as String?) //设置单元格内容
+            }
+        }
+
+        //用输出流写到excel
+        try {
+            xssfWorkbook.write(outputStream)
+            outputStream.flush()
+            outputStream.close()
+        } catch (e: IOException) {
+            e.printStackTrace()
+        }
+    }
+
+    fun importExcel(file: MultipartFile,projectId: String, classCode: String) : SBaseResponse {
+        try {
+            val equipments = select(SFilter.eq("projectId",projectId), SFilter.eq("classCode",classCode)).exec()
+            val equipMap = HashMap<String,Equipment>()
+            for (equipment in equipments) {
+                equipMap[equipment.id!!] = equipment
+            }
+            val content = ArrayList<Equipment>()
+            val list = readExcel(file.inputStream,"")
+            for (map in list) {
+                val infos = HashMap<String,Any?>()
+                var equipId : String? = null
+                for (key in map.keys) {
+                    val code = key.substring(key.lastIndexOf("-"),key.length)
+                    if(code == "id"){
+                        equipId = map[key]!!
+                    } else if(code == "bimTypeId"){
+
+                    }else if(code == "systemCategory"){
+
+                    }else if(code == "codeName"){
+
+                    }else if(code == "localId"){
+
+                    }else{
+                        if(!map[key].isNullOrEmpty()){
+                            infos[key] = map[key]
+                        }
+                    }
+                }
+
+                val equipment = equipMap[equipId]
+                if(equipment != null){
+                    content.add(equipment)
+                }
+            }
+            val request = SUpdateRequest<Equipment>()
+            request.content = content
+            updateList(request)
+
+
+        }catch (e : Exception){
+            return SBaseResponse(SResponseType.failure,"error:" + e.message)
+        }
+        return SBaseResponse(SResponseType.success, "")
+    }
+
+    /**
+     * 读取Excel文件的内容
+     * @param inputStream excel文件,以InputStream的形式传入
+     * @param sheetName sheet名字
+     * @return 以List返回excel中内容
+     */
+    fun readExcel(inputStream: InputStream?, sheetName: String): List<Map<String, String>> {
+
+        //定义工作簿
+        var xssfWorkbook: XSSFWorkbook? = null
+        try {
+            xssfWorkbook = XSSFWorkbook(inputStream)
+        } catch (e: Exception) {
+            println("Excel data file cannot be found!")
+        }
+
+        //定义工作表
+        val xssfSheet: XSSFSheet
+        xssfSheet = if (sheetName == "") {
+            // 默认取第一个子表
+            xssfWorkbook!!.getSheetAt(0)
+        } else {
+            xssfWorkbook!!.getSheet(sheetName)
+        }
+        val list = ArrayList<LinkedHashMap<String, String>>()
+
+        //定义行
+        //默认第一行为标题行,index = 0
+        val titleRow = xssfSheet.getRow(0)
+
+        //循环取每行的数据
+        for (rowIndex in 1 until xssfSheet.physicalNumberOfRows) {
+            val xssfRow = xssfSheet.getRow(rowIndex) ?: continue
+            val map = LinkedHashMap<String, String>()
+            //循环取每个单元格(cell)的数据
+            for (cellIndex in 0 until xssfRow.physicalNumberOfCells) {
+                val titleCell = titleRow.getCell(cellIndex)
+                val xssfCell = xssfRow.getCell(cellIndex)
+                map[getString(titleCell)] = getString(xssfCell)
+            }
+            list.add(map)
+        }
+        return list
+    }
+
+    /**
+     * 把单元格的内容转为字符串
+     * @param xssfCell 单元格
+     * @return 字符串
+     */
+    fun getString(xssfCell: XSSFCell?): String {
+        if (xssfCell == null) {
+            return ""
+        }
+        return if (xssfCell.cellType == CellType.NUMERIC) {
+            xssfCell.numericCellValue.toString()
+        } else if (xssfCell.cellType == CellType.BOOLEAN) {
+            xssfCell.booleanCellValue.toString()
+        } else {
+            xssfCell.stringCellValue
+        }
+    }
 }

+ 24 - 0
datacenter/src/main/kotlin/com/persagy/server/datacenter/wanda/controllers/obj/EquipController.kt

@@ -31,6 +31,7 @@ import com.persagy.server.Opt
 import com.persagy.server.datacenter.services.graphtype.RelationTypeProjectService
 import com.persagy.server.datacenter.services.objects.EquipmentService
 import com.persagy.server.datacenter.wanda.obj.Equipment
+import com.persagy.service.models.enums.SResponseType
 import com.persagy.service.models.requests.SCountRequest
 import com.persagy.service.models.requests.SCreateRequest
 import com.persagy.service.models.requests.SQueryRequest
@@ -41,7 +42,9 @@ import com.persagy.service.models.responses.SCreateResponse
 import com.persagy.service.models.responses.SQueryResponse
 import io.swagger.v3.oas.annotations.Operation
 import io.swagger.v3.oas.annotations.tags.Tag
+import org.springframework.http.MediaType
 import org.springframework.web.bind.annotation.*
+import org.springframework.web.multipart.MultipartFile
 import javax.servlet.http.HttpServletResponse
 
 /**
@@ -121,4 +124,25 @@ open class EquipController {
         RelationTypeProjectService.downloadsService.downloadsEquip(response)
     }
 
+    /**
+     * 导出设备
+     */
+    @Operation(summary="导出设备*", description="")
+    @GetMapping(value = ["/export"])
+    fun exportExcel( response: HttpServletResponse, @RequestParam projectId: String,@RequestParam classCode: String) {
+        EquipmentService.exportExcel(response, projectId,classCode)
+    } // Fun exportExcel
+
+    /**
+     * 导入excel
+     *
+     * @param   file            导入的excel文件
+     * @return  导入状态
+     */
+    @Operation(summary = "导入excel", description = "")
+    @PostMapping("/import",consumes = [MediaType.MULTIPART_FORM_DATA_VALUE])
+    fun importExcel(@RequestPart("file") file: MultipartFile, @RequestParam projectId: String, @RequestParam classCode: String) : SBaseResponse {
+       return EquipmentService.importExcel(file,projectId,classCode)
+    } // Fun importExcel()
+
 }

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

@@ -100,8 +100,8 @@ open class GraphicTypeController {
      */
     @Operation(summary="导出关系*", description="")
     @GetMapping(value = ["/export"])
-    fun exportExcel( response: HttpServletResponse, @RequestParam projectId: String,@RequestParam relType: String,@RequestParam code: String = "对象ID", @RequestParam zoneType: String? = null) {
-        RelationTypeProjectService.exportExcel(response, projectId,relType, code, zoneType)
+    fun exportExcel( response: HttpServletResponse, @RequestParam projectId: String,@RequestParam relType: String,@RequestParam(required = false) code: String = "对象ID", @RequestParam zoneType: String? = null,@RequestParam graphCode: String) {
+        RelationTypeProjectService.exportExcel(response, projectId,relType, code, zoneType,graphCode)
     } // Fun exportExcel
 
     /**