Parcourir la source

********labsl VS meiku***********************************
蜡笔森林 添加注释
美库 添加注释

zhangweixin il y a 4 ans
Parent
commit
18d73a36ab

+ 2 - 2
gradle.properties

@@ -19,8 +19,8 @@
 #
 
 PERSAGY_URL = http://www.persagy.cn
-PERSAGY_KOTLIN_VERSION = 1.4.115
-PERSAGY_SERVICE_VERSION = 1.4.155
+PERSAGY_KOTLIN_VERSION = 1.4.120
+PERSAGY_SERVICE_VERSION = 1.4.160
 
 MAVEN_REPO_PUBLIC_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-public/
 MAVEN_REPO_RELEASE_URL = http://dev.dp.sagacloud.cn:8082/repository/maven-releases/

+ 15 - 1
labsl/src/main/kotlin/com/persagy/labsl/WebMvcConfg.kt

@@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory
 import org.springframework.context.annotation.Configuration
 import org.springframework.http.converter.HttpMessageConverter
 import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
+import org.springframework.web.servlet.config.annotation.CorsRegistry
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
@@ -37,13 +38,26 @@ open class WebMvcConfg: WebMvcConfigurer {
         // 日志
         private val logger = LoggerFactory.getLogger(WebMvcConfg::class.java)
     } // Companion object
+
+    override fun addCorsMappings(registry: CorsRegistry) {
+//        super.addCorsMappings(registry)
+        registry.addMapping("/**")
+            .allowedOrigins("*")
+            .allowedMethods("GET","POST","PUT","OPTIONS","DELETE","PATCH")
+            .allowedHeaders("*")
+            .allowCredentials(true)
+            .maxAge(3600);
+        super.addCorsMappings(registry)
+    }
+
     /**
      * 配置拦截器
      *
      * @param   registry        拦截器注册器
      */
     override fun addInterceptors(registry : InterceptorRegistry) {
-        //registry.addInterceptor(AccessControlAllowOriginInterceptor()).addPathPatterns("/**")
+//        registry.addInterceptor(AccessControlAllowOriginInterceptor()).addPathPatterns("/**")
+
         registry.addInterceptor(SPageInterceptor()).addPathPatterns("/**")
         super.addInterceptors(registry)
 

+ 0 - 3
labsl/src/main/kotlin/com/persagy/labsl/models/entities/pbs/PlanarGraph.kt

@@ -35,7 +35,6 @@ open class PlanarGraph : SBaseEntity(), Serializable {
     /** 图名称 */
     @Schema(description = "图名称", required = true)
     @Column(name = "name")
-    @NotNull(message = "图名称不可以为空")
     var name: String? = null
 
     /** 文件夹 id */
@@ -55,13 +54,11 @@ open class PlanarGraph : SBaseEntity(), Serializable {
     /** 建筑 id */
     @Schema(description = "建筑 id")
     @Column(name = "building_id")
-    @NotNull(message = "建筑不可以为空")
     var buildingId: String? = null
 
     /** 楼层 id */
     @Schema(description = "楼层 id")
     @Column(name = "floor_id")
-    @NotNull(message = "楼层不可以为空")
     var floorId: String? = null
 
     /** 说明 */

+ 0 - 3
labsl/src/main/kotlin/com/persagy/labsl/models/entities/pbs/PlanarGraphPub.kt

@@ -34,7 +34,6 @@ open class PlanarGraphPub : SBaseEntity(), Serializable {
     /** 图名称 */
     @Schema(description = "图名称", required = true)
     @Column(name = "name")
-    @NotNull(message = "图名称不可以为空")
     var name: String? = null
 
     /** 文件夹 id */
@@ -54,13 +53,11 @@ open class PlanarGraphPub : SBaseEntity(), Serializable {
     /** 建筑 id */
     @Schema(description = "建筑 id")
     @Column(name = "building_id")
-    @NotNull(message = "建筑不可以为空")
     var buildingId: String? = null
 
     /** 楼层 id */
     @Schema(description = "楼层 id")
     @Column(name = "floor_id")
-    @NotNull(message = "楼层不可以为空")
     var floorId: String? = null
 
     /** 说明 */

+ 6 - 4
labsl/src/main/kotlin/com/persagy/labsl/models/entities/pbs/PlanarQbsRule.kt

@@ -18,18 +18,20 @@ open class PlanarQbsRule : SBaseEntity() {
 
 
     /** 图对象id */
-    @Schema(description = "图对象id" ,required = true)
+    @Schema(description = "图对象id" )
     @Id
     @Column(name = "id")
-    var id: String? = null
+    var id: Long? = null
 
     /** 图编码 */
     @Schema(description = "图编码" ,required = true)
+    @Id
     @Column(name = "graph_coding")
     var graphCoding: String? = null
 
     /** 图 id */
     @Schema(description = "图 id" ,required = true)
+    @Id
     @Column(name = "graph_id")
     var graphId: String? = null
 
@@ -46,10 +48,10 @@ open class PlanarQbsRule : SBaseEntity() {
     /** 查询参数 */
     @Schema(description = "查询参数" ,required = true)
     @Column(name = "params")
-    var params: String? = null
+    var params: HashMap<String,Any?>? = null
 
     /** 说明 */
-    @Schema(description = "说明" ,required = true)
+    @Schema(description = "说明" )
     @Column(name = "note")
     var note: String? = null
 

+ 14 - 2
labsl/src/main/kotlin/com/persagy/labsl/services/GraphService.kt

@@ -131,6 +131,7 @@ object GraphService : SObjectService<Graph>(SMybatisDao(
                     nodes.graphId = graph.graphId
                     /** 图形 id */
                     nodes.id = graph.id
+                    nodes.state = 1
                     /** 子节点 id */
                     if (nodes.nodeId.isNullOrEmpty()) {
                         /** id 赋值 */
@@ -160,6 +161,7 @@ object GraphService : SObjectService<Graph>(SMybatisDao(
                             anchor.id = graph.id
                             /** 节点 id 赋值 */
                             anchor.nodeId = nodes.nodeId
+                            anchor.state = 1
                             if (anchor.anchorId.isNullOrEmpty()) {
                                 /** id赋值 */
                                 anchor.anchorId = UUID.randomUUID().toString().replace("-", "")
@@ -320,6 +322,7 @@ object GraphService : SObjectService<Graph>(SMybatisDao(
                 val nodePubList = nodebuilder.table("labsl.node").exec()
                 /** 列表长度大于 0 */
                 if (nodePubList.size>0){
+                    logger.debug("对象长度 = ${nodePubList.size}   ******************************************************")
                     /** 遍历列表 */
                     for (nodePub in nodePubList){
                         /** 图编码 */
@@ -438,7 +441,6 @@ object GraphService : SObjectService<Graph>(SMybatisDao(
                     }
                 }
 
-
                 /** 清除草稿箱图 */
                 delOldData(graph1)
                 /** 提交事务 */
@@ -866,9 +868,19 @@ object GraphService : SObjectService<Graph>(SMybatisDao(
     fun readPub(graphPub: GraphPub): SCommonResponse<GraphPub>{
         /** 返回对象 */
         val sQueryResponse = SCommonResponse<GraphPub>()
+        var projectId: String
+        if (!Opts.projectId.isNullOrEmpty()){
+            projectId = Opts.projectId!!
+        }else if (!graphPub.projectId.isNullOrEmpty()) {
+            projectId = graphPub.projectId!!
+        }else {
+            sQueryResponse.message = "项目id不可以为空"
+            sQueryResponse.result = SResponseType.failure
+            return  sQueryResponse
+        }
         /** 查询 */
         val graph = GraphPubService.select(
-            SFilter.eq("projectId", Opts.projectId!!),
+            SFilter.eq("projectId", projectId),
             SFilter.eq("id", graphPub.id!!),
             SFilter.eq("graphId", graphPub.graphId!!)
         ).entity()

+ 41 - 24
labsl/src/main/kotlin/com/persagy/labsl/services/planar/PlanarGraphService.kt

@@ -86,6 +86,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
         if (entity.projectId.isNullOrEmpty()){
             entity.projectId = Opts.projectId
         }
+        entity.state = "Draft"
         if (!entity.folderName.isNullOrEmpty()) {
 
             val execList = QbsFolderService.select(SFilter.eq("projectId", Opts.projectId!!),SFilter.eq("name", entity.folderName!!)).exec()
@@ -281,9 +282,9 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                 for (rule in graph.ruleList!!) {
                     rule.graphCoding = graph.id
                     rule.graphId = graph.graphId
-                    if (rule.id.isNullOrEmpty()) {
-                        rule.id =  UUID.randomUUID().toString().replace("-", "")
-                    }
+//                    if (rule.id.isNullOrEmpty()) {
+//                        rule.id =  UUID.randomUUID().toString().replace("-", "")
+//                    }
                     val insert = planarQbsRuleService.insert(rule)
                     if (!insert) {
                         /** 事务回滚 */
@@ -334,7 +335,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                 SFilter.eq("projectId", Opts.projectId!!),
                 SFilter.eq("id", graphPub.id!!),
                 SFilter.eq("graphId", graphPub.graphId!!),
-                SFilter.eq("state", 1)
+                SFilter.eq("state", "Draft")
             )
             /** 设置表明,查询 */
             val graph = squeryBuilder.table("qibaishi_gallery.qbs_graph").entity()
@@ -391,6 +392,11 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                             return  sCreateResponse
                         }
                     }
+                    if (graph.elements == null) {
+                        graph.elements = PlanarElementsPub()
+                    } else {
+                        graph.elements!!.objExtInfo = nodePubList
+                    }
                 }
 
                 /** 查询 */
@@ -420,6 +426,11 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                             return  sCreateResponse
                         }
                     }
+                    if (graph.elements == null) {
+                        graph.elements = PlanarElementsPub()
+                    } else {
+                        graph.elements!!.markers = markersPubList
+                    }
                 }
 
                 /** 查询 */
@@ -451,12 +462,18 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                             return  sCreateResponse
                         }
                     }
+                    if (graph.elements == null) {
+                        graph.elements = PlanarElementsPub()
+                    } else {
+                        graph.elements!!.relations = relationList
+                    }
+
                 }
 
                 /** 规则 */
                 val planarQbsRuleBuilder = planarQbsRulePubService.select(
                     SFilter.eq("graphId", graph.graphId!!),
-                    SFilter.eq("id", graphPub.id!!)
+                    SFilter.eq("graphCoding", graphPub.id!!)
                 )
                 /** 设置表明,查询 */
                 val planarQbsRuleList = planarQbsRuleBuilder.table("qibaishi_gallery.qbs_rule").exec()
@@ -465,7 +482,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                     /** 遍历列表 */
                     for (relation in planarQbsRuleList){
                         /** 图编码  */
-                        relation.id = graph.id
+                        relation.graphCoding = graph.id
                         /** 图 id */
                         relation.graphId = graph.graphId
                         /** 插入数据 */
@@ -480,6 +497,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                             return  sCreateResponse
                         }
                     }
+                    graph.ruleList = planarQbsRuleList
                 }
 
                 /** 清除草稿箱图 */
@@ -527,18 +545,17 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
             )
             if (delete){
                 /** 清除图下子集 */
-//                NodeService.delete(
-//                    SFilter.eq("id", graph.id!!),
-//                    SFilter.eq("graphId", graph.graphId!!))
-//                MarkersService.delete(
-//                    SFilter.eq("id", graph.id!!),
-//                    SFilter.eq("graphId", graph.graphId!!))
-//                RelationService.delete(
-//                    SFilter.eq("id", graph.id!!),
-//                    SFilter.eq("graphId", graph.graphId!!))
-//                AnchorService.delete(
-//                    SFilter.eq("id", graph.id!!),
-//                    SFilter.eq("graphId", graph.graphId!!))
+                objExtInfoService.delete(
+                    SFilter.eq("id", graph.id!!),
+                    SFilter.eq("graphId", graph.graphId!!))
+                planarMarkersService.delete(
+                    SFilter.eq("id", graph.id!!),
+                    SFilter.eq("graphId", graph.graphId!!))
+                planarRelationService.delete(
+                    SFilter.eq("id", graph.id!!),
+                    SFilter.eq("graphId", graph.graphId!!))
+                planarQbsRuleService.delete(SFilter.eq("graphCoding", graph.id!!),
+                    SFilter.eq("graphId", graph.graphId!!))
             }
         }
     }
@@ -577,7 +594,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                 planarRelationService.delete(
                     SFilter.eq("id", graph.id!!),
                     SFilter.eq("graphId", graph.graphId!!))
-                planarQbsRuleService.delete(SFilter.eq("id", graph.id!!),
+                planarQbsRuleService.delete(SFilter.eq("graphCoding", graph.id!!),
                     SFilter.eq("graphId", graph.graphId!!))
             }
         }
@@ -618,7 +635,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                     SFilter.eq("id", graph.id!!),
                     SFilter.eq("graphId", graph.graphId!!))
                 planarQbsRulePubService.delete(
-                    SFilter.eq("id", graph.id!!),
+                    SFilter.eq("graphCoding", graph.id!!),
                     SFilter.eq("graphId", graph.graphId!!))
             }
         }
@@ -780,7 +797,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
 
                     /** 规则 */
                     val planarQbsRuleBuilder = planarQbsRuleService.select(
-                        SFilter.eq("id", graph.id!!),
+                        SFilter.eq("graphCoding", graph.id!!),
                         SFilter.eq("graphId", graph.graphId!!)
                     )
                     /** 设置表明,查询 */
@@ -789,7 +806,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
                         /** 遍历列表 */
                         for (relation in planarQbsRuleList ){
                             /** 图编码 */
-                            relation.id = graphPub.id
+                            relation.graphCoding = graphPub.id
                             /** 插入数据 */
                             planarQbsRuleService.insert(relation)
                         }
@@ -854,7 +871,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
 
             /** 规则 */
             val planarQbsRuleList = planarQbsRuleService.select(
-                SFilter.eq("id", graph.id!!),
+                SFilter.eq("graphCoding", graph.id!!),
                 SFilter.eq("graphId", graph.graphId!!)
             ).exec()
             if (planarQbsRuleList.size>0) {
@@ -925,7 +942,7 @@ object PlanarGraphService : SObjectService<PlanarGraph>(SMybatisDao(PlanarGraph:
 
             try {
                 val planarQbsRuleList = planarQbsRulePubService.select(
-                    SFilter.eq("id", graph.id!!),
+                    SFilter.eq("graphCoding", graph.id!!),
                     SFilter.eq("graphId", graph.graphId!!)
                 ).exec()
 

+ 3 - 3
labsl/src/main/kotlin/com/persagy/labsl/services/planar/PlanarQbsRuleService.kt

@@ -15,9 +15,9 @@ object PlanarQbsRuleService : SObjectService<PlanarQbsRule>(SMybatisDao(PlanarQb
 
 
     override fun onCreateBefore(entity: PlanarQbsRule): Boolean {
-        if (entity.id.isNullOrEmpty()) {
-            entity.id = IdUtils.uuidCreate()
-        }
+//        if (entity.id.isNullOrEmpty()) {
+//            entity.id = IdUtils.uuidCreate()
+//        }
 
         return super.onCreateBefore(entity)
     }

+ 3 - 3
labsl/src/main/resources/application-prod.yml

@@ -3,14 +3,14 @@ server:
 
 spring:
   datasource:
-    url:                                jdbc:postgresql://172.17.11.228:5432/datacenterlabsl
-##    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
+#    url:                                jdbc:postgresql://172.17.11.228:5432/datacenterlabsl
+    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
 #    username:                           postgres
 ##    password:                           123qwe!@#
 #    password:                           cGVyc2FneV8yMDIwcXdlIUAj
 
 #  datasource:
-#    url:                                jdbc:postgresql://172.17.100.16:5432/datacenterlabsl
+#    url:                                jdbc:postgresql://172.17.100.16:5432/datacenter
     username:                           postgres
 #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj

+ 2 - 1
meiku/src/main/kotlin/com/persagy/meiku/WebMvcConfg.kt

@@ -22,6 +22,7 @@ package com.persagy.meiku
 
 //import com.persagy.service.interceptors.SPageInterceptor
 import com.alibaba.fastjson.PropertyNamingStrategy
+import com.persagy.service.interceptors.SPageInterceptor
 import com.persagy.service.json.SJsonHttpMessageConverter
 import org.slf4j.LoggerFactory
 import org.springframework.context.annotation.Configuration
@@ -45,7 +46,7 @@ open class WebMvcConfg: WebMvcConfigurer {
      */
     override fun addInterceptors(registry : InterceptorRegistry) {
         //registry.addInterceptor(AccessControlAllowOriginInterceptor()).addPathPatterns("/**")
-//        registry.addInterceptor(SPageInterceptor()).addPathPatterns("/**")
+        registry.addInterceptor(SPageInterceptor()).addPathPatterns("/**")
         super.addInterceptors(registry)
 
     } // Function addInterceptors()