|
@@ -43,19 +43,6 @@ import java.util.stream.Collectors;
|
|
|
@EqualsAndHashCode(callSuper=true)
|
|
|
public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> implements IAdmDictService<T> {
|
|
|
|
|
|
- @Autowired
|
|
|
- private IAdmEquipmentService equipmentService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IAdmSpaceService spaceService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IAdmSystemService systemService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private IAdmShaftService shaftService;
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 字典类型查询:所有设备类型、部件类型、系统类型、专业类型
|
|
|
* 查询类型:输入设备类型:equipment,输入部件类型:component,输入系统类型:system,输入专业类型:major,业务空间类型 space ,资产 property,
|
|
@@ -711,101 +698,25 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public AdmResponse queryDictDeliveredInfos(InstanceUrlParam context, AdmDictDeliverieInfosRequest request, Class<T> clazz) {
|
|
|
+ public Map<String, AdmObjectInfo> queryDictDeliveredInfos(InstanceUrlParam context, AdmDictDeliverieInfosRequest request, Class<T> clazz) {
|
|
|
String classCode = request.getClassCode();
|
|
|
String objType = request.getObjType();
|
|
|
//根据类型查询信息点
|
|
|
List<AdmObjectInfo> admObjectInfos = queryObjectInfoByType(context, objType, classCode, clazz);
|
|
|
if(CollUtil.isEmpty(admObjectInfos)){
|
|
|
log.info("此类型下无信息点:{}{}"+objType +","+classCode);
|
|
|
- return AdmResponse.success(new ArrayList<>());
|
|
|
- }
|
|
|
- Map<String, AdmObjectInfo> admObjectInfoMap = admObjectInfos.stream().collect(Collectors.toMap(AdmObjectInfo::getCode, Function.identity(),(v1,v2) -> v2));
|
|
|
-
|
|
|
- //初始化待交付的信息点,id,name,localId,localName 无论是否有值默认展示,兼容历史逻辑
|
|
|
- List<AdmObjectInfo> deliveredInfos = new ArrayList<>();
|
|
|
- List<String> deliveredCodes = new ArrayList<>();
|
|
|
- initDeliveredInfos( admObjectInfoMap, deliveredInfos, deliveredCodes);
|
|
|
-
|
|
|
- if("equipment".equals(objType)){
|
|
|
- //查询已交付的设备信息点
|
|
|
- return getAdmEquipDeliveredInfo(context,request, admObjectInfoMap,deliveredInfos,deliveredCodes);
|
|
|
- }
|
|
|
- if("space".equals(objType)){
|
|
|
- //查询已交付的空间信息点
|
|
|
- return getAdmSpaceDeliveredInfo(context,request, admObjectInfoMap,deliveredInfos,deliveredCodes);
|
|
|
- }
|
|
|
- if("system".equals(objType)){
|
|
|
- //查询已交付的系统信息点
|
|
|
- return getAdmSystemDeliveredInfo(context,request, admObjectInfoMap,deliveredInfos,deliveredCodes);
|
|
|
- }
|
|
|
- if("shaft".equals(objType)){
|
|
|
- //查询已交付的竖井信息点
|
|
|
- return getAdmShaftDeliveredInfo(context,request, admObjectInfoMap,deliveredInfos,deliveredCodes);
|
|
|
- }
|
|
|
- return AdmResponse.success(deliveredInfos);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询项目下已有的系统设备类型树
|
|
|
- * @param context
|
|
|
- * @param request
|
|
|
- * @param clazz
|
|
|
- * @return
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- @Override
|
|
|
- public AdmResponse querySystemEquipTree(InstanceUrlParam context, AdmDictQueryCriteria request, Class<T> clazz) throws Exception {
|
|
|
- //查询项目下已有的设备类型
|
|
|
- request.setName("equipment");
|
|
|
- AdmResponse dictResponse = equipmentService.queryEquipClassCode(context, request, AdmEquipment.class);
|
|
|
- List<String> classCodes = (List<String>)dictResponse.getContent();
|
|
|
- if(CollUtil.isEmpty(classCodes)){
|
|
|
- return AdmResponse.success(new ArrayList<>());
|
|
|
- }
|
|
|
- Map<String, List<String>> classCodeMap = classCodes.stream().collect(Collectors.groupingBy(item->item.substring(0,4),Collectors.toList()));
|
|
|
- //查询系统设备类树
|
|
|
- AdmDict admDict = new AdmDict();
|
|
|
- admDict.setType(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue());
|
|
|
- AdmResponse categoryResponse = queryCategory(context, admDict, clazz);
|
|
|
- List<AdmObjectType> objectTypes = (List<AdmObjectType>) categoryResponse.getContent();
|
|
|
- if(CollUtil.isEmpty(objectTypes)){
|
|
|
- return AdmResponse.success(new ArrayList<>());
|
|
|
- }
|
|
|
- //过滤设备实体中不存在的类型
|
|
|
- Iterator<AdmObjectType> it = objectTypes.iterator();
|
|
|
- while(it.hasNext()){
|
|
|
- //过滤系统
|
|
|
- AdmObjectType objectType = it.next();
|
|
|
- List<String> objTypes = classCodeMap.get(objectType.getCode());
|
|
|
- if(CollUtil.isEmpty(objTypes)){
|
|
|
- it.remove();
|
|
|
- continue;
|
|
|
- }
|
|
|
- //过滤子级:设备类型
|
|
|
- List<AdmObjectType> children = objectType.getChildren();
|
|
|
- if(CollUtil.isEmpty(children)){
|
|
|
- it.remove();
|
|
|
- continue;
|
|
|
- }
|
|
|
- Iterator<AdmObjectType> chidIterator = children.iterator();
|
|
|
- while (chidIterator.hasNext()){
|
|
|
- AdmObjectType next = chidIterator.next();
|
|
|
- if(!objTypes.contains(next.getCode())){
|
|
|
- chidIterator.remove();
|
|
|
- }
|
|
|
- }
|
|
|
+ return new HashMap<>();
|
|
|
}
|
|
|
- return AdmResponse.success(objectTypes);
|
|
|
+ return admObjectInfos.stream().collect(Collectors.toMap(AdmObjectInfo::getCode, Function.identity(),(v1,v2) -> v2));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 组装通用对象查询条件
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
|
- private AdmQueryCriteria commbineObjectQueryCriteria(AdmDictDeliverieInfosRequest request){
|
|
|
+ @Override
|
|
|
+ public AdmQueryCriteria commbineObjectQueryCriteria(AdmDictDeliverieInfosRequest request){
|
|
|
//增加过滤条件
|
|
|
StringBuilder filters = new StringBuilder();
|
|
|
if(StringUtils.isNotEmpty(request.getBuildingId())){
|
|
@@ -833,156 +744,14 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
|
|
|
return equipQueryCriteria;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询已交付的设备信息点
|
|
|
- * @param context
|
|
|
- * @param request
|
|
|
- */
|
|
|
- private AdmResponse getAdmEquipDeliveredInfo(InstanceUrlParam context,AdmDictDeliverieInfosRequest request, Map<String, AdmObjectInfo> admObjectInfoMap,List<AdmObjectInfo> deliveredInfos,List<String> deliveredCodes){
|
|
|
- AdmQueryCriteria admQueryCriteria = commbineObjectQueryCriteria(request);
|
|
|
- AdmResponse response = equipmentService.query(admQueryCriteria);
|
|
|
- List<AdmEquipment> content = (List<AdmEquipment>)response.getContent();
|
|
|
- if(CollUtil.isEmpty(content)){
|
|
|
- return AdmResponse.success(new ArrayList<>());
|
|
|
- }
|
|
|
- //统计有值的信息点
|
|
|
- for (AdmEquipment admEquipment : content) {
|
|
|
- Map<String, Object> infos = admEquipment.getInfos();
|
|
|
- if(CollUtil.isEmpty(infos)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (Map.Entry<String, Object> info : infos.entrySet()) {
|
|
|
- Object value = info.getValue();
|
|
|
- if(deliveredCodes.contains(info.getKey()) || value == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- AdmObjectInfo admObjectInfo = admObjectInfoMap.get(info.getKey());
|
|
|
- if(admObjectInfo == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- deliveredCodes.add(info.getKey());
|
|
|
- deliveredInfos.add(admObjectInfo);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- return AdmResponse.success(deliveredInfos);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询已交付的空间信息点
|
|
|
- * @param context
|
|
|
- * @param request
|
|
|
- */
|
|
|
- private AdmResponse getAdmSpaceDeliveredInfo(InstanceUrlParam context,AdmDictDeliverieInfosRequest request, Map<String, AdmObjectInfo> admObjectInfoMap,List<AdmObjectInfo> deliveredInfos,List<String> deliveredCodes){
|
|
|
- AdmQueryCriteria admQueryCriteria = commbineObjectQueryCriteria(request);
|
|
|
- AdmResponse response = spaceService.query(admQueryCriteria);
|
|
|
- List<AdmSpace> content = (List<AdmSpace>)response.getContent();
|
|
|
- if(CollUtil.isEmpty(content)){
|
|
|
- return AdmResponse.success(new ArrayList<>());
|
|
|
- }
|
|
|
- //统计有值的信息点
|
|
|
- for (AdmSpace admSpace : content) {
|
|
|
- Map<String, Object> infos = admSpace.getInfos();
|
|
|
- if(CollUtil.isEmpty(infos)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (Map.Entry<String, Object> info : infos.entrySet()) {
|
|
|
- Object value = info.getValue();
|
|
|
- if(deliveredCodes.contains(info.getKey()) || value == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- AdmObjectInfo admObjectInfo = admObjectInfoMap.get(info.getKey());
|
|
|
- if(admObjectInfo == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- deliveredCodes.add(info.getKey());
|
|
|
- deliveredInfos.add(admObjectInfo);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- return AdmResponse.success(deliveredInfos);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询已交付的竖井信息点
|
|
|
- * @param context
|
|
|
- * @param request
|
|
|
- */
|
|
|
- private AdmResponse getAdmShaftDeliveredInfo(InstanceUrlParam context,AdmDictDeliverieInfosRequest request, Map<String, AdmObjectInfo> admObjectInfoMap,List<AdmObjectInfo> deliveredInfos,List<String> deliveredCodes){
|
|
|
- AdmQueryCriteria admQueryCriteria = commbineObjectQueryCriteria(request);
|
|
|
- AdmResponse response = shaftService.doQuery(context,admQueryCriteria, AdmShaft.class);
|
|
|
- List<AdmShaft> content = (List<AdmShaft>)response.getContent();
|
|
|
- if(CollUtil.isEmpty(content)){
|
|
|
- return AdmResponse.success(new ArrayList<>());
|
|
|
- }
|
|
|
- //统计有值的信息点
|
|
|
- for (AdmShaft admShaft : content) {
|
|
|
- Map<String, Object> infos = admShaft.getInfos();
|
|
|
- if(CollUtil.isEmpty(infos)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (Map.Entry<String, Object> info : infos.entrySet()) {
|
|
|
- Object value = info.getValue();
|
|
|
- if(deliveredCodes.contains(info.getKey()) || value == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- AdmObjectInfo admObjectInfo = admObjectInfoMap.get(info.getKey());
|
|
|
- if(admObjectInfo == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- deliveredCodes.add(info.getKey());
|
|
|
- deliveredInfos.add(admObjectInfo);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- return AdmResponse.success(deliveredInfos);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询已交付的系统信息点
|
|
|
- * @param context
|
|
|
- * @param request
|
|
|
- */
|
|
|
- private AdmResponse getAdmSystemDeliveredInfo(InstanceUrlParam context,AdmDictDeliverieInfosRequest request, Map<String, AdmObjectInfo> admObjectInfoMap,List<AdmObjectInfo> deliveredInfos,List<String> deliveredCodes){
|
|
|
- AdmQueryCriteria admQueryCriteria = commbineObjectQueryCriteria(request);
|
|
|
- AdmResponse response = systemService.query(admQueryCriteria);
|
|
|
- List<AdmSystem> content = (List<AdmSystem>)response.getContent();
|
|
|
- if(CollUtil.isEmpty(content)){
|
|
|
- return AdmResponse.success(new ArrayList<>());
|
|
|
- }
|
|
|
- //统计有值的信息点
|
|
|
- for (AdmSystem admSystem : content) {
|
|
|
- Map<String, Object> infos = admSystem.getInfos();
|
|
|
- if(CollUtil.isEmpty(infos)){
|
|
|
- continue;
|
|
|
- }
|
|
|
- for (Map.Entry<String, Object> info : infos.entrySet()) {
|
|
|
- Object value = info.getValue();
|
|
|
- if(deliveredCodes.contains(info.getKey()) || value == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- AdmObjectInfo admObjectInfo = admObjectInfoMap.get(info.getKey());
|
|
|
- if(admObjectInfo == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- deliveredCodes.add(info.getKey());
|
|
|
- deliveredInfos.add(admObjectInfo);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- return AdmResponse.success(deliveredInfos);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 初始化待交付的信息点
|
|
|
* @param admObjectInfoMap
|
|
|
* @param deliveredInfos
|
|
|
* @param deliveredCodes
|
|
|
*/
|
|
|
- private void initDeliveredInfos(Map<String, AdmObjectInfo> admObjectInfoMap,List<AdmObjectInfo> deliveredInfos,List<String> deliveredCodes){
|
|
|
+ @Override
|
|
|
+ public void initDeliveredInfos(Map<String, AdmObjectInfo> admObjectInfoMap,List<AdmObjectInfo> deliveredInfos,List<String> deliveredCodes){
|
|
|
deliveredCodes.add("id");
|
|
|
deliveredCodes.add("name");
|
|
|
deliveredCodes.add("localId");
|