|
@@ -14,10 +14,10 @@ import com.google.common.collect.Sets;
|
|
|
import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
import com.persagy.dmp.common.context.AppContext;
|
|
|
import com.persagy.dmp.common.helper.SpringHelper;
|
|
|
+import com.persagy.dmp.common.model.entity.BaseEntity;
|
|
|
import com.persagy.dmp.common.model.response.CommonResult;
|
|
|
import com.persagy.dmp.define.entity.ObjectTypeDefine;
|
|
|
import com.persagy.dmp.digital.client.DigitalObjectFacade;
|
|
|
-import com.persagy.dmp.digital.entity.ObjectDigital;
|
|
|
import com.persagy.dmp.digital.entity.ObjectRelation;
|
|
|
import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
|
|
|
import com.persagy.proxy.adm.constant.AdmCommonConstant;
|
|
@@ -29,6 +29,7 @@ import com.persagy.proxy.adm.request.AdmResponse;
|
|
|
import com.persagy.proxy.adm.service.IAdmRelationService;
|
|
|
import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
|
|
|
import com.persagy.proxy.adm.utils.AdmContextUtil;
|
|
|
+import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
|
|
|
import com.persagy.proxy.common.client.DmpRwdClient;
|
|
|
import com.persagy.proxy.common.entity.DmpResult;
|
|
|
import com.persagy.proxy.common.entity.InstanceUrlParam;
|
|
@@ -121,20 +122,15 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
|
|
|
request.setName(AdmSpace.OBJ_TYPE);
|
|
|
String classCodeFilter = "";
|
|
|
if(StrUtil.isNotEmpty(request.getZoneType())){
|
|
|
- classCodeFilter = "classCode = '"+request.getZoneType()+"'";
|
|
|
+ classCodeFilter = " classCode = '"+request.getZoneType()+"'";
|
|
|
}else{
|
|
|
- StringBuffer zoneTypefilters = new StringBuffer(" classCode ");
|
|
|
- zoneTypefilters.append("in ['");
|
|
|
- request.getZoneTypeList().stream().forEach(code ->{
|
|
|
- zoneTypefilters.append(code).append("',");
|
|
|
- });
|
|
|
- classCodeFilter = StrUtil.sub(zoneTypefilters.toString(),0,-1)+"']";
|
|
|
+ classCodeFilter = " classCode in ['"+ String.join("', '",request.getZoneTypeList()) + "']";
|
|
|
}
|
|
|
String filters = request.getFilters();
|
|
|
if(StrUtil.isBlank(filters)){
|
|
|
request.setFilters(classCodeFilter);
|
|
|
}else{
|
|
|
- request.setFilters(filters+";"+classCodeFilter);
|
|
|
+ request.setFilters(filters+"; "+classCodeFilter);
|
|
|
}
|
|
|
if(StrUtil.isNotEmpty(request.getBuildingId()) && StrUtil.isNotEmpty(request.getFloorId()) && !request.getFloorId().equals("isnull")){
|
|
|
//明确建筑,明确楼层
|
|
@@ -157,13 +153,22 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
|
|
|
if(CollUtil.isNotEmpty(relations)){
|
|
|
Map<String, ObjectRelation> objectRelationMap = CollUtil.fieldValueMap(relations, "objTo");
|
|
|
//查询 建筑 不在楼层下 的空间
|
|
|
+ //1 查询楼层下的空间 spaceIdList
|
|
|
ObjectNode relationTo = JsonNodeFactory.instance.objectNode();
|
|
|
relationTo.put("relCode", "Fl2Sp");
|
|
|
relationTo.put("graphCode", "ArchSubset");
|
|
|
ArrayNode arrayNode = relationTo.putObject("objFrom").putArray("$in");
|
|
|
objectRelationMap.keySet().stream().forEach(floorId -> arrayNode.add(floorId));
|
|
|
- relationTo.put("$bindFlag", false);
|
|
|
request.setRelationTo(relationTo);
|
|
|
+ AdmResponse spaceFl = doQuery(AdmContextUtil.toDmpContext(), request, AdmSpace.class);
|
|
|
+ request.setRelationTo(null);
|
|
|
+ //2 查询建筑下的空间 and space not in spaceIdList
|
|
|
+ if(CollUtil.isNotEmpty(spaceFl.getContent())){
|
|
|
+ List<AdmSpace> admSpaceList = (List<AdmSpace>) spaceFl.getContent();
|
|
|
+ Map<String, AdmSpace> admSpaceMap = CollUtil.fieldValueMap(admSpaceList, BaseEntity.PROP_ID);
|
|
|
+ String ids = request.getFilters() +"; not id in ['"+ String.join("', '", admSpaceMap.keySet())+"']";
|
|
|
+ request.setFilters(ids);
|
|
|
+ }
|
|
|
request.setFilters(request.getFilters() + "; buildingId = '"+request.getBuildingId()+"'");
|
|
|
}else{
|
|
|
//查询建筑下的空间
|
|
@@ -339,7 +344,9 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
|
|
|
@Override
|
|
|
public AdmResponse query(AdmQueryCriteria request) {
|
|
|
InstanceUrlParam context = AdmContextUtil.toDmpContext();
|
|
|
- AdmResponse response = super.doQuery(AdmContextUtil.toDmpContext(), request, AdmSpace.class);
|
|
|
+ QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
|
|
|
+ processDmpCriteria(queryCriteria);
|
|
|
+ AdmResponse response = super.doQuery(context, queryCriteria, AdmSpace.class);
|
|
|
// 系统需要补充分类名称属性
|
|
|
ensureSpecialValues(context, (List<AdmSpace>) response.getContent());
|
|
|
return response;
|
|
@@ -368,6 +375,8 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
|
|
|
relationTo.set("objFrom",criteria.get("floorId"));
|
|
|
criteria.set("relationTo",relationTo);
|
|
|
criteria.remove("floorId");
|
|
|
+ if (criteria.has("buildingId"))
|
|
|
+ criteria.remove("buildingId");
|
|
|
return;
|
|
|
}
|
|
|
if (criteria.has("buildingId")){
|