Browse Source

**********************************wx*************************
需采集信息点设置,缺少批量同步到项目

weixinVSjinlai 4 years ago
parent
commit
c89042a0de

+ 2 - 2
datacenter/src/main/kotlin/com/persagy/server/services/relation_calc/ManualRelationCalcService.kt

@@ -4165,7 +4165,7 @@ open class ManualRelationCalcService {
                     listId2.add(rSp2SpTwo.id2!!)
                 }
                 val sCascadeQuery = sQueryRequest.cascade!!.get(0)
-                sCascadeQuery.filters = "id in ${listId2.toJson()}"
+                sCascadeQuery.filters = "projectId = '$projectId';id in ${listId2.toJson()}"
                 list.add(SFilter.inList("id",listId1.toList()))
                 val pageQuery = CommonServices.relShaftForBdService.pageQuery(sQueryRequest, list)
                 manualRelationCalcResponse.direction = "Left"
@@ -4203,7 +4203,7 @@ open class ManualRelationCalcService {
                 listSF.add(SFilter.or(SFilter.contain("localId2",manualRelationCalcRequest.vagueTo!!),SFilter.contain("localName2",manualRelationCalcRequest.vagueTo!!)))
             }
             listSF.add(SFilter.eq("projectId", projectId))
-            val rSp2SpTwoList = CommonServices.rFl2SpTwoService.select(list).exec()
+            val rSp2SpTwoList = CommonServices.rFl2SpTwoService.select(listSF).exec()
             if (rSp2SpTwoList.size>0) {
 
                 val listId1 = ArrayList<String>()

+ 2 - 0
datasyn/src/main/kotlin/com/persagy/server/syn/models/api/dict/DictTypeApi.kt

@@ -192,6 +192,8 @@ object DictTypeApi {
             /** 直接 http 请求还是通过注册中心 */
             if (!Configure.customProperties.eurekaorhttp) {
                 val url = "${Configure.opts.dataPlatform}/rwd/def/funcid"
+                logger.debug("url=${url}")
+                logger.debug("boby=${jsonObject}")
                 val postObject = SHttpUtil.postObject<DictPlatformInfoResponse>(url, jsonObject)
                 if (postObject.result == Configure.opts.SUCCESS_CODE) {
                     if (!postObject.data.isNullOrEmpty()){

+ 18 - 18
datasyn/src/main/kotlin/com/persagy/server/syn/services/dict/DClassDefService.kt

@@ -1327,7 +1327,7 @@ object DClassDefService : SObjectService<DefClass>(SMybatisDao(DefClass::class.j
                             defFuncId.firstTag = ParamTools.TwoLevelCode(dictPlatformInfo.firstTag!!)
                         }
                         defFuncId.formater = dictPlatformInfo.formater
-                        defFuncId.groupCode = if (dictPlatformInfo.groupCode.isNullOrEmpty()) "0" else dictPlatformInfo.groupCode
+                        defFuncId.groupCode = dictPlatformInfo.groupCode
                         defFuncId.idx = dictPlatformInfo.idx
                         defFuncId.inputMode = dictPlatformInfo.inputMode
                         defFuncId.isMultiple = dictPlatformInfo.isMultiple
@@ -1335,7 +1335,7 @@ object DClassDefService : SObjectService<DefClass>(SMybatisDao(DefClass::class.j
                         defFuncId.name = dictPlatformInfo.name
                         defFuncId.note = dictPlatformInfo.note
                         defFuncId.priority = dictPlatformInfo.priority
-                        defFuncId.projectId = if (dictPlatformInfo.projectId.isNullOrEmpty()) "0" else dictPlatformInfo.projectId
+                        defFuncId.projectId = dictPlatformInfo.projectId
                         defFuncId.readonly = dictPlatformInfo.readonly
                         defFuncId.secondName = dictPlatformInfo.secondTag
                         if (!dictPlatformInfo.secondTag.isNullOrEmpty()){
@@ -1375,22 +1375,22 @@ object DClassDefService : SObjectService<DefClass>(SMybatisDao(DefClass::class.j
                             }
                         }
 
-                        val dicConfigureEditable = ParamTools.dicConfigureEditable()
-                        val containsKey = dicConfigureEditable.containsKey(defFuncId.code!!)
-                        if (containsKey){
-                            defFuncId.editable = false
-                            defFuncId.unDisabled = false
-                            defFuncId.visible = false
-                        }
-                        val dicConfigure = ParamTools.dicConfigure()
-                        if (defFuncId.code!=null){
-                            val containsKey = dicConfigure.containsKey(defFuncId.code!!)
-                            if (containsKey){
-                                defFuncId.editable = true
-                                defFuncId.unDisabled = false
-                                defFuncId.visible = true
-                            }
-                        }
+//                        val dicConfigureEditable = ParamTools.dicConfigureEditable()
+//                        val containsKey = dicConfigureEditable.containsKey(defFuncId.code!!)
+//                        if (containsKey){
+//                            defFuncId.editable = false
+//                            defFuncId.unDisabled = false
+//                            defFuncId.visible = false
+//                        }
+//                        val dicConfigure = ParamTools.dicConfigure()
+//                        if (defFuncId.code!=null){
+//                            val containsKey = dicConfigure.containsKey(defFuncId.code!!)
+//                            if (containsKey){
+//                                defFuncId.editable = true
+//                                defFuncId.unDisabled = false
+//                                defFuncId.visible = true
+//                            }
+//                        }
                         defFuncIdGather.replace(defFuncId)
                     }
                 }

+ 2 - 2
datasyn/src/main/resources/application-dev.yml

@@ -5,9 +5,9 @@ spring:
 #    url:                                jdbc:postgresql://60.205.177.43:5432/datacenterlabsl
     #    username:                           postgres
     #    password:                           123qwe!@#
-    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
+#    url:                                jdbc:postgresql://192.168.64.14:5432/datacenterlabsl
 #    url:                                jdbc:postgresql://192.168.64.15:5432/datacenter
-#    url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
+    url:                                jdbc:postgresql://39.102.40.239:5432/datacenter
     username:                           postgres
     #    password:                           persagy_2020qwe!@#
     password:                           cGVyc2FneV8yMDIwcXdlIUAj

+ 8 - 0
equip-component/src/main/kotlin/com/persagy/server/controllers/dict/DictCustomController.kt

@@ -121,4 +121,12 @@ class DictCustomController {
         return DictDefClassService.settingDict(request)
     }
 
+    /**
+     * 需采集信息同步到所有项目
+     */
+    @Operation(summary = "需采集信息同步到所有项目", description = "")
+    @PostMapping(value = ["/syn-dic-project"])
+    fun synDict(): SCreateResponse<DefFuncIdGather> {
+        return DictDefClassService.synDictProject()
+    }
 }

+ 5 - 0
equip-component/src/main/kotlin/com/persagy/server/dao/mappers/CustomSql.kt

@@ -32,6 +32,7 @@ import com.persagy.server.models.SpaceBdFl
 import com.persagy.server.models.objects.FloorCompon
 import org.apache.ibatis.annotations.Mapper
 import org.apache.ibatis.annotations.Select
+import org.apache.ibatis.annotations.Update
 import org.springframework.stereotype.Repository
 
 /**
@@ -168,4 +169,8 @@ interface CustomSql {
     @Select("SELECT class_code as code ,(SELECT name FROM dict.def_class WHERE project_id = #{projectId} AND code = class_code ) FROM v_equipment WHERE project_id = #{projectId} GROUP BY class_code")
     fun  equipTypeName(projectId: String):ArrayList<DefClass>
 
+    @Update("UPDATE dict.def_funcid SET visible = #{visible}  class_code = #{classCode} AND code = #{code}")
+    fun updateVisible(visible: Boolean, classCode: String, code: String)
+
+
 } //

+ 21 - 4
equip-component/src/main/kotlin/com/persagy/server/service/dict/DictDefClassService.kt

@@ -31,6 +31,7 @@ import com.persagy.database.SPageQueryInfo
 import com.persagy.database.SQueryBuilder
 import com.persagy.mybatis.SMybatisDao
 import com.persagy.server.Opt
+import com.persagy.server.dao.mappers.CustomSql
 import com.persagy.server.datacenter.models.entities.dict.DictSQueryRequest
 import com.persagy.server.datacenter.models.entities.dict.EquipFamily
 import com.persagy.server.datacenter.models.entities.dict.Family
@@ -54,6 +55,11 @@ import com.persagy.service.utils.SSpringContextUtil
  */
 object DictDefClassService: SObjectService<DefFuncId>(SMybatisDao(DefFuncId::class.java)) {
 
+    /** 自定义sql */
+    val customSqlService by lazy {
+        SSpringContextUtil.getBean(CustomSql::class.java) as CustomSql
+    }
+
     /** 平台集团对象类型 */
     private val defClassService = SObjectService(SMybatisDao(DefClass::class.java))
     /**
@@ -486,10 +492,6 @@ object DictDefClassService: SObjectService<DefFuncId>(SMybatisDao(DefFuncId::cla
             if (!request.content.isNullOrEmpty()) {
                 /** 遍历字典信息列表 */
                 for (dictProject in request.content) {
-                    /** 项目id为空重新赋值 */
-                    if (dictProject.projectId.isNullOrEmpty()) {
-                        dictProject.projectId = "0"
-                    }
                     try {
                         /** 插入字典信息数据 */
                         defFuncIdGatherService.update(dictProject)
@@ -509,4 +511,19 @@ object DictDefClassService: SObjectService<DefFuncId>(SMybatisDao(DefFuncId::cla
             sCreateResponse
         }
     }
+
+    /**
+     * 同步到项目
+     */
+    fun synDictProject(): SCreateResponse<DefFuncIdGather>{
+        val defFuncIdGatherList = defFuncIdGatherService.selectAll().exec()
+        if (defFuncIdGatherList.size>0) {
+            for (defFuncIdGather in defFuncIdGatherList) {
+                customSqlService.updateVisible(defFuncIdGather.visible!!,defFuncIdGather.classCode!!,defFuncIdGather.code!!)
+            }
+        }
+        return SCreateResponse(SResponseType.success)
+    }
+
+
 }