|
@@ -31,6 +31,9 @@ import com.persagy.mybatis.SMybatisDao
|
|
|
import com.persagy.server.Opt
|
|
|
import com.persagy.server.datacenter.models.entities.dictnew.DefClass
|
|
|
import com.persagy.server.datacenter.models.entities.dictnew.DefFuncId
|
|
|
+import com.persagy.server.datacenter.wanda.dict.DictInfosWanDa
|
|
|
+import com.persagy.server.datacenter.wanda.dict.DictStage
|
|
|
+import com.persagy.server.datacenter.wanda.response.DictInfoResponse
|
|
|
import com.persagy.service.SObjectService
|
|
|
import com.persagy.service.models.enums.SResponseType
|
|
|
import com.persagy.service.models.responses.SQueryResponse
|
|
@@ -41,137 +44,118 @@ import com.persagy.service.models.responses.SQueryResponse
|
|
|
* @author wx <zhangweixin@sagacloud.com>
|
|
|
* @date 2020/11/17 17:28
|
|
|
*/
|
|
|
-object DictDefClassService: SObjectService<DefFuncId>(SMybatisDao(DefFuncId::class.java)) {
|
|
|
+object DefFuncIdService: SObjectService<DefFuncId>(SMybatisDao(DefFuncId::class.java)) {
|
|
|
|
|
|
/** 平台集团对象类型 */
|
|
|
private val defClassService = SObjectService(SMybatisDao(DefClass::class.java))
|
|
|
+ /** 对照表 */
|
|
|
+ private val dictInfosWanDaService = SObjectService(SMybatisDao(DictInfosWanDa::class.java))
|
|
|
+ /** 阶段 */
|
|
|
+ private val dictStageService = SObjectService(SMybatisDao(DictStage::class.java))
|
|
|
+
|
|
|
/**
|
|
|
- * 查询 M 和 L 类型的信息点
|
|
|
+ * 查询设备类型
|
|
|
*/
|
|
|
- fun queryMOrL(dictTypeList: ArrayList<String>): SQueryResponse<DefFuncId> {
|
|
|
- /** 返回对象 */
|
|
|
- val sQueryResponse = SQueryResponse<DefFuncId>(SResponseType.success)
|
|
|
- /** 对象列表 */
|
|
|
- var list = ArrayList<DefFuncId>()
|
|
|
- /** 入参不为空 */
|
|
|
- if (!dictTypeList.isNullOrEmpty()){
|
|
|
- /** 遍历入参列表 */
|
|
|
- for (dictType in dictTypeList){
|
|
|
- /** 类型筛选 */
|
|
|
- when(dictType){
|
|
|
- "project" -> {
|
|
|
- /** 项目 */
|
|
|
- list.add(typeStatisticsOne("project","项目"))
|
|
|
- }
|
|
|
- "building" -> {
|
|
|
- /** 建筑 */
|
|
|
- list.add(typeStatisticsOne("building","建筑"))
|
|
|
- }
|
|
|
- "floor" -> {
|
|
|
- /** 楼层 */
|
|
|
- list.add(typeStatisticsOne("floor","楼层"))
|
|
|
- }
|
|
|
- "equipment" -> {
|
|
|
- /** 设备 */
|
|
|
- list.add(typeStatisticsTwo("equipment","设备"))
|
|
|
- }
|
|
|
- "component" -> {
|
|
|
- /** 部件 */
|
|
|
- list.add(typeStatisticsTwo("component","部件"))
|
|
|
- }
|
|
|
- "system" -> {
|
|
|
- /** 系统 */
|
|
|
- list.add(typeStatisticsTwo("system","系统"))
|
|
|
- }
|
|
|
- "space" -> {
|
|
|
- /** 空间 */
|
|
|
- list.add(typeStatisticsTwo("space","空间"))
|
|
|
- }
|
|
|
+ fun dictTypeEquipQuery(): SQueryResponse<DefClass>{
|
|
|
+ return try {
|
|
|
+ val sQueryResponse = SQueryResponse<DefClass>(SResponseType.success)
|
|
|
+ val dictInfosWanDaGroupList = dictInfosWanDaService.select(SFilter.eq("groupCode", Opt.groupCode!!), SFilter.eq("projectId", "0")).exec()
|
|
|
+ val dictInfosWanDaProjectList = dictInfosWanDaService.select(SFilter.eq("groupCode", Opt.groupCode!!), SFilter.eq("projectId", Opt.projectId!!)).exec()
|
|
|
+ val setCode = HashSet<String>()
|
|
|
+ for (dictInfosWanDaGroup in dictInfosWanDaGroupList){
|
|
|
+ setCode.add(dictInfosWanDaGroup.classCode!!)
|
|
|
+ }
|
|
|
+ if (dictInfosWanDaProjectList.size>0){
|
|
|
+ for (dictInfosWanDaProject in dictInfosWanDaProjectList){
|
|
|
+ setCode.add(dictInfosWanDaProject.classCode!!)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /** 列表赋值 */
|
|
|
- sQueryResponse.content = list
|
|
|
- }else {
|
|
|
- /** 返回状态 */
|
|
|
- sQueryResponse.result = SResponseType.failure
|
|
|
+ var defClassList = defClassService.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.inList("code", setCode.toList())).order("code").exec()
|
|
|
+ if (defClassList.size == 0){
|
|
|
+ defClassList = defClassService.select(SFilter.eq("type","group"), SFilter.inList("code", setCode.toList())).order("code").exec()
|
|
|
+ if (defClassList.size == 0){
|
|
|
+ defClassList = defClassService.select(SFilter.eq("type", "common"), SFilter.inList("code", setCode.toList())).order("code").exec()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sQueryResponse.content = defClassList
|
|
|
+ sQueryResponse.total = defClassList.size.toLong()
|
|
|
+ sQueryResponse
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
+ SQueryResponse(SResponseType.failure)
|
|
|
}
|
|
|
|
|
|
- /** 返回对象 */
|
|
|
- return sQueryResponse
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 项目、建筑、楼层 M 或 L 信息点统计
|
|
|
+ * 类型下信息点查询
|
|
|
*
|
|
|
- * @param code 编码
|
|
|
- * @param name 名称
|
|
|
- * @return 信息点对象
|
|
|
+ * @param category 分类
|
|
|
*/
|
|
|
- private fun typeStatisticsOne(code: String,name:String): DefFuncId {
|
|
|
- /** 实例化对象 */
|
|
|
- val defFuncId = DefFuncId()
|
|
|
- /** 查询 M 或 L 信息点 */
|
|
|
- val infosList = select(
|
|
|
- SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("classCode", code),
|
|
|
- SFilter.not(SFilter.eq("category","STATIC"))
|
|
|
- ).exec()
|
|
|
- /** 编码赋值 */
|
|
|
- defFuncId.code = code
|
|
|
- /** 名称赋值 */
|
|
|
- defFuncId.name = name
|
|
|
- /** 列表赋值 */
|
|
|
- defFuncId.content = infosList
|
|
|
- /** 返回对象 */
|
|
|
- return defFuncId
|
|
|
- }
|
|
|
+ fun dictEquipInfoQuery(category: String): DictInfoResponse {
|
|
|
+ val dictInfoResponse = DictInfoResponse()
|
|
|
+ val dictInfosWanDaGroupList = dictInfosWanDaService.select(SFilter.eq("groupCode", Opt.groupCode!!), SFilter.eq("projectId", "0")
|
|
|
+ ,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 = "设备类型名称"
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * 设备、部件、系统、空间 M 或 L 信息点统计
|
|
|
- *
|
|
|
- * @param code 编码
|
|
|
- * @param name 名称
|
|
|
- * @return 信息点对象
|
|
|
- */
|
|
|
- private fun typeStatisticsTwo(code: String,name:String): DefFuncId {
|
|
|
- /** 返回对象 */
|
|
|
- val defFuncId = DefFuncId()
|
|
|
- /** 名称 */
|
|
|
- defFuncId.name = name
|
|
|
- /** 编码 */
|
|
|
- defFuncId.code = code
|
|
|
- /** 对象列表 */
|
|
|
- var equipList = ArrayList<DefFuncId>()
|
|
|
- /** 查询 */
|
|
|
- val typeList = defClassService.select(
|
|
|
- SFilter.eq("parentCode", code),
|
|
|
- SFilter.eq("projectId", Opt.projectId!!)
|
|
|
- ).exec()
|
|
|
- /** 遍历列表 */
|
|
|
- for (type in typeList){
|
|
|
- /** 实例化对象 */
|
|
|
- val defFuncId = DefFuncId()
|
|
|
- /** 名称 */
|
|
|
- defFuncId.name = type.name
|
|
|
- /** 编码 */
|
|
|
- defFuncId.code = type.code
|
|
|
- /** 查询 */
|
|
|
- val equipInfosList = select(
|
|
|
- SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("classCode", type.code!!),
|
|
|
- SFilter.not(SFilter.eq("category","STATIC"))
|
|
|
- ).exec()
|
|
|
- /** 列表赋值 */
|
|
|
- defFuncId.content = equipInfosList
|
|
|
- /** 添加到列表 */
|
|
|
- equipList.add(defFuncId)
|
|
|
+ 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.inList("code", setCode.toList())).order("code").exec()
|
|
|
+ if (funcIdList.size == 0 ) {
|
|
|
+ funcIdList = DefFuncIdService.select(SFilter.eq("type","group"),
|
|
|
+ SFilter.inList("code", setCode.toList())).order("code").exec()
|
|
|
+ if (funcIdList.size == 0) {
|
|
|
+ funcIdList = DefFuncIdService.select(SFilter.eq("type","common"),
|
|
|
+ SFilter.inList("code", setCode.toList())).order("code").exec()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dictStage.infos = funcIdList
|
|
|
}
|
|
|
|
|
|
- /** 列表赋值 */
|
|
|
- defFuncId.content = equipList
|
|
|
- /** 返回对象 */
|
|
|
- return defFuncId
|
|
|
+ dictInfoResponse.basicInfos = defFuncIdList
|
|
|
+ dictInfoResponse.dictStages = dictStageList
|
|
|
+ return dictInfoResponse
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|