Prechádzať zdrojové kódy

关系导入导出修改

caiaf 4 rokov pred
rodič
commit
470809fa33

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

@@ -65,7 +65,7 @@ interface IRelationExcelImportMapper {
      * @return  excel需要的记录
      */
     @Update("UPDATE public.equipment SET building_id = #{id1} WHERE project_id = #{projectId} AND id = #{id2}")
-    fun Eq2BdIn(projectId: String, type: String, id1: String, id2: String)
+    fun Eq2BdIn(projectId: String, type: String, id1: String, id2: String,graphCode: String)
 
     /**
      * 设备与设备关系
@@ -89,7 +89,7 @@ interface IRelationExcelImportMapper {
      * @return  excel需要的记录
      */
     @Update("UPDATE public.equipment SET floor_id = #{id1} WHERE project_id = #{projectId} AND id = #{id2}")
-    fun Eq2FlIn(projectId: String, type: String, id1: String, id2: String)
+    fun Eq2FlIn(projectId: String, type: String, id1: String, id2: String,graphCode: String)
 
     /**
      * 建筑下空间
@@ -101,7 +101,7 @@ interface IRelationExcelImportMapper {
      * @return  excel需要的记录
      */
     @Update("UPDATE public.zone_space_base SET building_id = #{id1} WHERE project_id = #{projectId} AND id = #{id2}")
-    fun Bd2Sp(projectId: String, type: String, id1: String, id2: String)
+    fun Bd2Sp(projectId: String, type: String, id1: String, id2: String,graphCode: String)
 
     /**
      * 楼层下空间
@@ -113,7 +113,7 @@ interface IRelationExcelImportMapper {
      * @return  excel需要的记录
      */
     @Update("UPDATE public.equipment SET floor_id = #{id1} WHERE project_id = #{projectId} AND id = #{id2}")
-    fun Fl2Sp(projectId: String, type: String, id1: String, id2: String)
+    fun Fl2Sp(projectId: String, type: String, id1: String, id2: String,graphCode: String)
 
     /**
      * 楼层与设备关系
@@ -152,7 +152,7 @@ interface IRelationExcelImportMapper {
     fun Eq2Sp(projectId: String, type: String, id1: String, id2: String,zoneType: String, graphCode: String)
 
     /**
-     * 设备与空间关系
+     * 系统与设备关系
      *
      * @param   projectId       项目ID
      * @param   type            关系类型

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

@@ -149,21 +149,21 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
      * @param   relType         关系类型
      * @param   zoneType        业务空间类型
      */
-    fun reportDownloads(response: HttpServletResponse, relType: String, zoneType: String? = null) {
+    fun reportDownloads(response: HttpServletResponse, graphCode: String,relType: String, zoneType: String? = null) {
         val zone = if (zoneType != null) {
             "_${zoneType}"
         } else {
             ""
         }
         val projectId = SPageContext.getHeader("projectId")
-        val file = File("/tmp/relation-$projectId-${relType}${zone}.xlsx")
+        val file = File("/tmp/relation-$projectId-${graphCode}${relType}${zone}.xlsx")
         val workbook = if (file.exists()) {
             XSSFWorkbook(file)
         } else {
             XSSFWorkbook(RelationTypeProjectService::class.java.classLoader.getResourceAsStream("excel/relation-template.xlsx"))
         }
         response.contentType = "application/octet-stream"
-        response.setHeader("Content-disposition", "attachment;filename=report-${relType}${zone}.xlsx")
+        response.setHeader("Content-disposition", "attachment;filename=report-${graphCode}${relType}${zone}.xlsx")
         response.flushBuffer()
         workbook.write(response.outputStream)
     } // Function templateDownloads()
@@ -301,7 +301,7 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
 
             readExcelRelation(sheet, projectId, relType, zoneType,graphCode)
 
-            val outFile = File("/tmp/relation-$projectId-${relType}${zone}.xlsx")
+            val outFile = File("/tmp/relation-$projectId-${graphCode}${relType}${zone}.xlsx")
             workbook.write(outFile.outputStream())
             /** 发送消息 */
             rabbitMqService.sendRel(Opt.projectId!!, relType,"20","123","456")
@@ -404,9 +404,9 @@ object RelationTypeProjectService : RService<RelationTypeProject>(SMybatisDao(Re
             val type = relType
 
             val importMethod = if (relType == RelationType.Eq2Bd || relType == RelationType.Eq2Fl) {
-                excelImport.javaClass.getDeclaredMethod("${relType}In", String::class.java, String::class.java, String::class.java, String::class.java)
+                excelImport.javaClass.getDeclaredMethod("${relType}In", String::class.java, String::class.java, String::class.java, String::class.java, String::class.java)
             }else if(relType == RelationType.Bd2Sp || relType == RelationType.Fl2Sp){
-                excelImport.javaClass.getDeclaredMethod(relType, String::class.java, String::class.java, String::class.java, String::class.java)
+                excelImport.javaClass.getDeclaredMethod(relType, String::class.java, String::class.java, String::class.java, String::class.java, String::class.java)
             }
             else {
                 if(zoneType.isNullOrEmpty()) {

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

@@ -126,8 +126,8 @@ open class GraphicTypeController {
      */
     @Operation(summary="下载报告", description ="")
     @GetMapping(value = ["/report/downloads"])
-    fun reportDownloads(@RequestBody response: HttpServletResponse, @RequestParam relType: String, @RequestParam zoneType: String? = null) {
-        RelationTypeProjectService.reportDownloads(response, relType, zoneType)
+    fun reportDownloads(response: HttpServletResponse,@RequestParam graphCode: String, @RequestParam relType: String, @RequestParam zoneType: String? = null) {
+        RelationTypeProjectService.reportDownloads(response, graphCode, relType, zoneType)
     } // Fun reportDownloads()
 
     /**