Browse Source

****************************************提交分类************************************

weixinVSjinlai 4 years ago
parent
commit
97bae69cb3

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

@@ -101,61 +101,62 @@ object DefFuncIdService: SObjectService<DefFuncId>(SMybatisDao(DefFuncId::class.
 //                ,SFilter.eq("classCode", category)).exec()
 //        val dictInfosWanDaProjectList = dictInfosWanDaService.select(SFilter.eq("groupCode", Opt.groupCode!!), SFilter.eq("projectId", Opt.projectId!!)
 //                ,SFilter.eq("classCode", category)).exec()
-//            var defFuncIdList = DefFuncIdService.select(SFilter.eq("projectId", Opt.projectId!!),
-//                    SFilter.inList("code", arrayListOf("bimTypeId","name","localName","localId"))).exec()
-//            if (defFuncIdList.size == 0 ) {
-//                defFuncIdList = DefFuncIdService.select(SFilter.eq("type","group"),
-//                        SFilter.inList("code", arrayListOf("bimTypeId","name","localName","localId"))).exec()
-//                if (defFuncIdList.size == 0) {
-//                    defFuncIdList = DefFuncIdService.select(SFilter.eq("type","common"),
-//                            SFilter.inList("code", arrayListOf("bimTypeId","name","localName","localId"))).exec()
-//                }
-//            }
-//            for (defFuncId in defFuncIdList) {
-//                if (defFuncId.code == "name"){
-//                    defFuncId.code = "systemCategory"
-//                    defFuncId.name = "系统分类"
-//                    defFuncId.aliasCode = "systemCategory"
-//                    defFuncId.aliasName = "系统分类"
-//                } else if (defFuncId.code == "localName"){
-//                    defFuncId.code = "codeName"
-//                    defFuncId.name = "设备类型名称"
-//                    defFuncId.aliasCode = "codeName"
-//                    defFuncId.aliasName = "设备类型名称"
-//                }
-//            }
-//
-//            val dictStageList = dictStageService.selectAll().exec()
-//            for (dictStage in dictStageList) {
-//                val dictInfosWanDaGroupList = dictInfosWanDaService.select(SFilter.eq("groupCode", Opt.groupCode!!), SFilter.eq("projectId", "0")
-//                        ,SFilter.eq("classCode", category),SFilter.eq("stage", dictStage.code!!)).exec()
-//                val dictInfosWanDaProjectList = dictInfosWanDaService.select(SFilter.eq("groupCode", Opt.groupCode!!), SFilter.eq("projectId", Opt.projectId!!)
-//                        ,SFilter.eq("classCode", category),SFilter.eq("stage", dictStage.code!!)).exec()
-//                if (dictInfosWanDaProjectList.size>0){
-//                    dictInfosWanDaGroupList.addAll(dictInfosWanDaProjectList)
-//                }
-//                var setCode = HashSet<String>()
-//                for (dictInfosWanDaGroup in dictInfosWanDaGroupList){
-//                    setCode.add(dictInfosWanDaGroup.code!!)
-//                }
-//                var funcIdList = DefFuncIdService.select(SFilter.eq("projectId", Opt.projectId!!),SFilter.eq("classCode", category),
-//                        SFilter.inList("code", setCode.toList())).order("code").exec()
-//                if (funcIdList.size == 0 ) {
-//                    funcIdList = DefFuncIdService.select(SFilter.eq("type","group"),
-//                             SFilter.eq("groupCode",Opt.groupCode!!),SFilter.eq("classCode", category),
-//                            SFilter.inList("code", setCode.toList())).order("code").exec()
-//                    if (funcIdList.size == 0) {
-//                        funcIdList = DefFuncIdService.select(SFilter.eq("type","common"),SFilter.eq("classCode", category),
-//                                SFilter.inList("code",  setCode.toList())).order("code").exec()
-//                    }
-//                }
-//                dictStage.infos = funcIdList
-//                logger.debug("阶段=${dictStage.code}*************************************************")
-//            }
-//            logger.debug("结束*************************************************")
-//            dictInfoResponse.basicInfos = defFuncIdList
-//            dictInfoResponse.dictStages = dictStageList
-//            dictInfoResponse.result = SResponseType.success
+            var defFuncIdList = DefFuncIdService.select(SFilter.eq("projectId", Opt.projectId!!),
+                    SFilter.inList("code", arrayListOf("bimTypeId","name","localName","localId"))).exec()
+            if (defFuncIdList.size == 0 ) {
+                defFuncIdList = DefFuncIdService.select(SFilter.eq("type","group"),
+                        SFilter.inList("code", arrayListOf("bimTypeId","name","localName","localId"))).exec()
+                if (defFuncIdList.size == 0) {
+                    defFuncIdList = DefFuncIdService.select(SFilter.eq("type","common"),
+                            SFilter.inList("code", arrayListOf("bimTypeId","name","localName","localId"))).exec()
+                }
+            }
+            for (defFuncId in defFuncIdList) {
+                if (defFuncId.code == "name"){
+                    defFuncId.code = "systemCategory"
+                    defFuncId.name = "系统分类"
+                    defFuncId.aliasCode = "systemCategory"
+                    defFuncId.aliasName = "系统分类"
+                } else if (defFuncId.code == "localName"){
+                    defFuncId.code = "codeName"
+                    defFuncId.name = "设备类型名称"
+                    defFuncId.aliasCode = "codeName"
+                    defFuncId.aliasName = "设备类型名称"
+                }
+            }
+
+            val dictStageList = dictStageService.selectAll().exec()
+            for (dictStage in dictStageList) {
+                val dictInfosWanDaGroupList = dictInfosWanDaService.select(SFilter.eq("groupCode", Opt.groupCode!!), SFilter.eq("projectId", "0")
+                        ,SFilter.eq("classCode", category),SFilter.eq("stage", dictStage.code!!)).exec()
+                val dictInfosWanDaProjectList = dictInfosWanDaService.select(SFilter.eq("groupCode", Opt.groupCode!!), SFilter.eq("projectId", Opt.projectId!!)
+                        ,SFilter.eq("classCode", category),SFilter.eq("stage", dictStage.code!!)).exec()
+                if (dictInfosWanDaProjectList.size>0){
+                    dictInfosWanDaGroupList.addAll(dictInfosWanDaProjectList)
+                }
+                var setCode = HashSet<String>()
+                for (dictInfosWanDaGroup in dictInfosWanDaGroupList){
+                    setCode.add(dictInfosWanDaGroup.code!!)
+                }
+                var funcIdList = DefFuncIdService.select(SFilter.eq("projectId", Opt.projectId!!),SFilter.eq("classCode", category),
+                        SFilter.inList("code", setCode.toList())).order("code").exec()
+                if (funcIdList.size == 0 ) {
+                    funcIdList = DefFuncIdService.select(SFilter.eq("type","group"),
+                             SFilter.eq("groupCode",Opt.groupCode!!),SFilter.eq("classCode", category),
+                            SFilter.inList("code", setCode.toList())).order("code").exec()
+                    if (funcIdList.size == 0) {
+                        funcIdList = DefFuncIdService.select(SFilter.eq("type","common"),SFilter.eq("classCode", category),
+                                SFilter.inList("code",  setCode.toList())).order("code").exec()
+                    }
+                }
+                dictStage.infos = funcIdList
+                logger.debug("阶段=${dictStage.code}*************************************************")
+            }
+            logger.debug("结束*************************************************")
+            dictInfoResponse.basicInfos = defFuncIdList
+            dictInfoResponse.dictStages = dictStageList
+            dictInfoResponse.result = SResponseType.success
+            return dictInfoResponse
         } catch (e: Exception) {
             e.printStackTrace()
             dictInfoResponse.result = SResponseType.failure