|
@@ -36,6 +36,7 @@ import com.persagy.proxy.object.model.*;
|
|
|
import com.persagy.proxy.object.service.IAdmComponentService;
|
|
|
import com.persagy.proxy.object.service.IAdmEquipmentService;
|
|
|
import com.persagy.proxy.object.service.IAdmSystemService;
|
|
|
+import com.persagy.proxy.report.model.AdmGatherInfoPoint;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -744,12 +745,61 @@ public class AdmReportEquipController {
|
|
|
*/
|
|
|
@PostMapping("/info-point")
|
|
|
public AdmResponse infoPoint() {
|
|
|
- //return customSqlService.infoPoints()
|
|
|
- JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, false, false);
|
|
|
- JSONObject infoPoint = new JSONObject();
|
|
|
- infoPoint.put("dynamicInfoPoint",gatherInfoPoint.getString("gatherDynamicInfoPointCounts"));
|
|
|
- infoPoint.put("staticInfoPoint",gatherInfoPoint.getString("gatherStaticInfoPointCounts"));
|
|
|
- return AdmResponse.success(CollUtil.newArrayList(infoPoint));
|
|
|
+ if(StrUtil.isEmpty(AdmContextUtil.toDmpContext().getProjectId())){
|
|
|
+ return AdmResponse.failure(ResponseCode.A0400.getCode());
|
|
|
+ }
|
|
|
+ Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
|
|
|
+ AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
|
|
|
+ gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
|
|
|
+ // 根据objType获取定义 获取采集的设备的classcode
|
|
|
+ Set<String> objTypes = new HashSet<>(1);
|
|
|
+ objTypes.add(AdmEquipment.OBJ_TYPE);
|
|
|
+ List<Map<String, Object>> codes = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null, RequestData.builder().objTypes(objTypes).build());
|
|
|
+ if(CollUtil.isNotEmpty(codes)) {
|
|
|
+ Set<String> classCodeSet = new HashSet<String>(codes.size());
|
|
|
+ codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
|
|
|
+
|
|
|
+ //项目下所有已采集的动态信息点编码
|
|
|
+ List<ObjectInfoDefine> dynamicInfoPointCodes = gatherDynamicInfoCode(false, classCodeSet);
|
|
|
+ //项目下所有已采集静态信息点编码
|
|
|
+ List<ObjectInfoDefine> staticInfoPointCodes = gatherStaticInfoCode(false, classCodeSet);
|
|
|
+ //项目下所有的设备 分页查询
|
|
|
+ AdmQueryCriteria admQueryCriteriaObj = new AdmQueryCriteria();
|
|
|
+ admQueryCriteriaObj.setPageNumber(1);
|
|
|
+ admQueryCriteriaObj.setPageSize(500);
|
|
|
+ admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
|
|
|
+
|
|
|
+ admQueryCriteriaObj.setProjection(Arrays.asList("id", "name", "localId", "localName", "cadId", "bimId", "bimLocation", "infos", "classCode", "equipSerial", "bimFamilyName", "bimFamilySymbol"));
|
|
|
+ AdmResponse admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
|
|
|
+
|
|
|
+ Map<String, Integer> hashMap = new HashMap<>();
|
|
|
+ List<AdmEquipment> admEquipmentList = (List<AdmEquipment>) admResponse.getContent();
|
|
|
+ List<ObjectNode> projectEquipment = JsonNodeUtils.toListNode(admEquipmentList, null, null);
|
|
|
+ calculate(dynamicInfoPointCodes, staticInfoPointCodes, projectEquipment, 0, hashMap);
|
|
|
+
|
|
|
+ long page = admResponse.getTotal() / admResponse.getPageSize() + 1;
|
|
|
+ if (page >= 2) {
|
|
|
+ for (long i = 2; i <= page; i++) {
|
|
|
+ admQueryCriteriaObj.setPageNumber(Integer.parseInt(String.valueOf(i)));
|
|
|
+ admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
|
|
|
+ admEquipmentList = (List<AdmEquipment>) admResponse.getContent();
|
|
|
+ projectEquipment = JsonNodeUtils.toListNode(admEquipmentList, null, null);
|
|
|
+ calculate(dynamicInfoPointCodes, staticInfoPointCodes, projectEquipment, 0, hashMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gatherInfoPoint.setDynamicInfoPointCounts(dynamicInfoPointCodes.size());
|
|
|
+ gatherInfoPoint.setStaticInfoPointCounts(staticInfoPointCodes.size());
|
|
|
+ gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
|
|
|
+ gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
|
|
|
+ gatherInfoPoint.setGatherStaticInfoPointCounts(hashMap.get("staticInfoPoint"));
|
|
|
+ }else{
|
|
|
+ gatherInfoPoint.setDynamicInfoPointCounts(0);
|
|
|
+ gatherInfoPoint.setStaticInfoPointCounts(0);
|
|
|
+ gatherInfoPoint.setGatherCustomInfoPointCounts(0);
|
|
|
+ gatherInfoPoint.setGatherDynamicInfoPointCounts(0);
|
|
|
+ gatherInfoPoint.setGatherStaticInfoPointCounts(0);
|
|
|
+ }
|
|
|
+ return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -758,12 +808,58 @@ public class AdmReportEquipController {
|
|
|
*/
|
|
|
@PostMapping("/gather-info-point")
|
|
|
public AdmResponse gatherInfoPoint() {
|
|
|
- //return customSqlService.gatherInfoPoints()
|
|
|
if(StrUtil.isEmpty(AdmContextUtil.toDmpContext().getProjectId())){
|
|
|
return AdmResponse.failure(ResponseCode.A0400.getCode());
|
|
|
}
|
|
|
-
|
|
|
- JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, true, true);
|
|
|
+ AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
|
|
|
+
|
|
|
+ Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
|
|
|
+ // 根据objType获取定义 获取采集的设备的classcode
|
|
|
+ Set<String> objTypes = new HashSet<>(1);
|
|
|
+ objTypes.add(AdmEquipment.OBJ_TYPE);
|
|
|
+ List<Map<String, Object>> codes = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null, RequestData.builder().objTypes(objTypes).build());
|
|
|
+ if(CollUtil.isNotEmpty(codes)){
|
|
|
+ Set<String> classCodeSet = new HashSet<String>(codes.size());
|
|
|
+ codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
|
|
|
+
|
|
|
+ //项目下所有已采集的动态信息点编码
|
|
|
+ List<ObjectInfoDefine> gatherDynamicInfoCode = gatherDynamicInfoCode(true, classCodeSet);
|
|
|
+ //项目下所有已采集静态信息点编码
|
|
|
+ List<ObjectInfoDefine> gatherStaticInfoCode = gatherStaticInfoCode(true, classCodeSet);
|
|
|
+
|
|
|
+ //项目下所有的设备 分页查询
|
|
|
+ AdmQueryCriteria admQueryCriteriaObj = new AdmQueryCriteria();
|
|
|
+ admQueryCriteriaObj.setPageNumber(1);
|
|
|
+ admQueryCriteriaObj.setPageSize(500);
|
|
|
+ admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
|
|
|
+
|
|
|
+ admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","bimLocation","infos","classCode","equipSerial","bimFamilyName","bimFamilySymbol"));
|
|
|
+ AdmResponse admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
|
|
|
+
|
|
|
+ Map<String,Integer> hashMap = new HashMap<>();
|
|
|
+ List<AdmEquipment> admEquipmentList = (List<AdmEquipment>) admResponse.getContent();
|
|
|
+ List<ObjectNode> projectEquipment = JsonNodeUtils.toListNode(admEquipmentList,null,null);
|
|
|
+ calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,0, hashMap);
|
|
|
+
|
|
|
+ long page = admResponse.getTotal() / admResponse.getPageSize() + 1;
|
|
|
+ if(page >= 2){
|
|
|
+ for(long i = 2; i <= page; i++){
|
|
|
+ admQueryCriteriaObj.setPageNumber(Integer.parseInt(String.valueOf(i)));
|
|
|
+ admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
|
|
|
+ admEquipmentList = (List<AdmEquipment>) admResponse.getContent();
|
|
|
+ projectEquipment = JsonNodeUtils.toListNode(admEquipmentList,null,null);
|
|
|
+ calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,0, hashMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
|
|
|
+ gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
|
|
|
+ gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
|
|
|
+ }else{
|
|
|
+ gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
|
|
|
+ gatherInfoPoint.setGatherCustomInfoPointCounts(0);
|
|
|
+ gatherInfoPoint.setGatherDynamicInfoPointCounts(0);
|
|
|
+ gatherInfoPoint.setGatherStaticInfoPointCounts(0);
|
|
|
+ }
|
|
|
return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
|
|
|
}
|
|
|
|
|
@@ -773,11 +869,55 @@ public class AdmReportEquipController {
|
|
|
*/
|
|
|
@PostMapping("/system-info-point")
|
|
|
public AdmResponse systemInfoPoin() {
|
|
|
- if(StrUtil.isEmpty(AdmContextUtil.toDmpContext().getProjectId())){
|
|
|
- return AdmResponse.failure(ResponseCode.A0400.getCode());
|
|
|
+ AdmGatherInfoPoint gatherInfoPoint = new AdmGatherInfoPoint();
|
|
|
+ Integer controlInfoCounts = controlInfoCounts(AdmEquipment.OBJ_TYPE);
|
|
|
+ // 根据objType获取定义 获取采集的设备的classcode
|
|
|
+ Set<String> objTypes = new HashSet<>(1);
|
|
|
+ objTypes.add(AdmSystem.OBJ_TYPE);
|
|
|
+ List<Map<String, Object>> codes = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null, RequestData.builder().objTypes(objTypes).build());
|
|
|
+ if(CollUtil.isNotEmpty(codes)){
|
|
|
+ Set<String> classCodeSet = new HashSet<String>(codes.size());
|
|
|
+ codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
|
|
|
+
|
|
|
+ //项目下所有已采集的动态信息点编码
|
|
|
+ List<ObjectInfoDefine> gatherDynamicInfoCode = gatherDynamicInfoCode(true, classCodeSet);
|
|
|
+ //项目下所有已采集静态信息点编码
|
|
|
+ List<ObjectInfoDefine> gatherStaticInfoCode = gatherStaticInfoCode(true, classCodeSet);
|
|
|
+
|
|
|
+ //项目下所有的设备 分页查询
|
|
|
+ AdmQueryCriteria admQueryCriteriaObj = new AdmQueryCriteria();
|
|
|
+ admQueryCriteriaObj.setPageNumber(1);
|
|
|
+ admQueryCriteriaObj.setPageSize(500);
|
|
|
+ admQueryCriteriaObj.setName(AdmEquipment.OBJ_TYPE);
|
|
|
+
|
|
|
+ admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","infos","classCode"));
|
|
|
+ AdmResponse admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
|
|
|
+
|
|
|
+ Map<String,Integer> hashMap = new HashMap<>();
|
|
|
+ List<AdmSystem> admSystemList = (List<AdmSystem>) admResponse.getContent();
|
|
|
+ List<ObjectNode> projectEquipment = JsonNodeUtils.toListNode(admSystemList,null,null);
|
|
|
+ calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,1, hashMap);
|
|
|
+
|
|
|
+ long page = admResponse.getTotal() / admResponse.getPageSize() + 1;
|
|
|
+ if(page >= 2){
|
|
|
+ for(long i = 2; i <= page; i++){
|
|
|
+ admQueryCriteriaObj.setPageNumber(Integer.parseInt(String.valueOf(i)));
|
|
|
+ admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
|
|
|
+ admSystemList = (List<AdmSystem>) admResponse.getContent();
|
|
|
+ projectEquipment = JsonNodeUtils.toListNode(admSystemList,null,null);
|
|
|
+ calculate(gatherDynamicInfoCode, gatherStaticInfoCode, projectEquipment,1, hashMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
|
|
|
+ gatherInfoPoint.setGatherCustomInfoPointCounts(hashMap.get("customInfoPoint"));
|
|
|
+ gatherInfoPoint.setGatherDynamicInfoPointCounts(hashMap.get("dynamicInfoPoint"));
|
|
|
+ gatherInfoPoint.setGatherStaticInfoPointCounts(hashMap.get("staticInfoPoint"));
|
|
|
+ }else{
|
|
|
+ gatherInfoPoint.setGatherInfoPointCounts(controlInfoCounts);
|
|
|
+ gatherInfoPoint.setGatherCustomInfoPointCounts(0);
|
|
|
+ gatherInfoPoint.setGatherDynamicInfoPointCounts(0);
|
|
|
+ gatherInfoPoint.setGatherStaticInfoPointCounts(0);
|
|
|
}
|
|
|
-
|
|
|
- JSONObject gatherInfoPoint = calInfoPointByObjType(AdmSystem.OBJ_TYPE,true, true);
|
|
|
return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
|
|
|
}
|
|
|
|
|
@@ -836,84 +976,90 @@ public class AdmReportEquipController {
|
|
|
/**
|
|
|
* 计算动态、静态信息点
|
|
|
*/
|
|
|
- private Map<String, Integer> calculate(List<ObjectInfoDefine> dynamicInfoPointCodes, List<ObjectInfoDefine> staticInfoPointCodes, List objList, Integer num,Map<String, Integer> hashMap) {
|
|
|
- int dynamicInfoPoint = hashMap.get("dynamicInfoPoint");
|
|
|
- int staticInfoPoint = hashMap.get("staticInfoPoint");
|
|
|
- int customInfoPoint = hashMap.get("customInfoPoint");
|
|
|
-
|
|
|
- Iterator<ObjectInfoDefine> iterator1 = staticInfoPointCodes.iterator();
|
|
|
- for (int i=0;i<objList.size();i++) {
|
|
|
- JsonNode objectNode = JsonNodeUtils.toObjectNode(objList.get(i),null,null);
|
|
|
- while (iterator1.hasNext()) {
|
|
|
- ObjectInfoDefine infoDefine = iterator1.next();
|
|
|
- if (objectNode.get("id") != null && "id" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
- if (objectNode.get("name") != null && "name" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
-
|
|
|
- if (objectNode.get("localId") != null && "localId" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
-
|
|
|
- if (objectNode.get("localName") != null && "localName" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
-
|
|
|
- if (objectNode.get("qrCode") != null && "qRCode" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
- if (objectNode.get("cADID") != null && "cADID" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode() && num==0) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
-
|
|
|
- if (objectNode.get("bimId") != null && "bimId" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode() && num==0) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
+ private void calculate(List<ObjectInfoDefine> dynamicInfoPointCodes, List<ObjectInfoDefine> staticInfoPointCodes, List<ObjectNode> objList, Integer num, Map<String, Integer> hashMap) {
|
|
|
+ int dynamicInfoPoint = hashMap.get("dynamicInfoPoint") == null ? 0 : hashMap.get("dynamicInfoPoint");
|
|
|
+ int staticInfoPoint = hashMap.get("staticInfoPoint") == null ? 0 : hashMap.get("staticInfoPoint");
|
|
|
+ int customInfoPoint = hashMap.get("customInfoPoint") == null ? 0 : hashMap.get("customInfoPoint");
|
|
|
+
|
|
|
+ if(CollUtil.isNotEmpty(objList)) {
|
|
|
+ for (int i = 0; i < objList.size(); i++) {
|
|
|
+ JsonNode objectNode = JsonNodeUtils.toObjectNode(objList.get(i), "infos", null);
|
|
|
+ Iterator<ObjectInfoDefine> iterator1 = staticInfoPointCodes.iterator();
|
|
|
+ while (iterator1.hasNext()) {
|
|
|
+ ObjectInfoDefine infoDefine = iterator1.next();
|
|
|
+ if(!objectNode.get("classCode").textValue().equals(infoDefine.getClassCode())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("id") != null && "id".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("name") != null && "name".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("localId") != null && "localId".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("localName") != null && "localName".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("qrCode") != null && "qRCode".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("cADID") != null && "cADID".equals(infoDefine.getCode()) && num == 0) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ }
|
|
|
+ if (objectNode.get("bimId") != null && "bimId".equals(infoDefine.getCode()) && num == 0) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("bimLocation") != null && "bimLocation".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("equipSerial") != null && "equipSerial".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("bimFamilyName") != null && "bimFamilyName".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (objectNode.get("bimFamilySymbol") != null && "bimFamilySymbol".equals(infoDefine.getCode())) {
|
|
|
+ staticInfoPoint++;
|
|
|
+ iterator1.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (objectNode.get("bimLocation") != null && "bimLocation" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
- if (objectNode.get("equipSerial") != null && "equipSerial" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
- if (objectNode.get("bimFamilyName") != null && "bimFamilyName" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
- }
|
|
|
- if (objectNode.get("bimFamilySymbol") != null && "bimFamilySymbol" == infoDefine.getCode() && objectNode.get("classCode").textValue() == infoDefine.getClassCode()) {
|
|
|
- staticInfoPoint++;
|
|
|
- iterator1.remove();
|
|
|
+ JsonNode objectNode1 = JsonNodeUtils.toObjectNode(objList.get(i), null, null);
|
|
|
+ if (!JSONUtil.isNull(objectNode1.get("infos")) && StrUtil.isNotEmpty(objectNode1.get("infos").textValue())) {
|
|
|
+ Map<String, Object> dynamic = calculateInfoPoints(objectNode1.get("infos").toString(), objectNode1.get("classCode").textValue(), dynamicInfoPointCodes);
|
|
|
+ Map<String, Object> staticMap = calculateInfoPoints(objectNode1.get("infos").toString(), objectNode1.get("classCode").textValue(), staticInfoPointCodes);
|
|
|
+ dynamicInfoPoint += Integer.parseInt(dynamic.get("counts").toString());
|
|
|
+ staticInfoPoint += Integer.parseInt(staticMap.get("counts").toString());
|
|
|
+ dynamicInfoPointCodes.remove(dynamic.get("next"));
|
|
|
+ staticInfoPointCodes.remove(staticMap.get("next"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- for (int i=0;i<objList.size();i++) {
|
|
|
- JsonNode objectNode = JsonNodeUtils.toObjectNode(objList.get(i),null,null);
|
|
|
- if (StrUtil.isNotEmpty(objectNode.get("infos").textValue())) {
|
|
|
- Map<String,Object> dynamic = calculateInfoPoints(objectNode.get("infos").toString(), objectNode.get("classCode").textValue(), dynamicInfoPointCodes);
|
|
|
- Map<String,Object> staticMap = calculateInfoPoints(objectNode.get("infos").toString(), objectNode.get("classCode").textValue(), staticInfoPointCodes);
|
|
|
- dynamicInfoPoint += Integer.parseInt(dynamic.get("counts").toString());
|
|
|
- staticInfoPoint += Integer.parseInt(staticMap.get("counts").toString());
|
|
|
- dynamicInfoPointCodes.remove(dynamic.get("next"));
|
|
|
- staticInfoPointCodes.remove(staticMap.get("next"));
|
|
|
- }
|
|
|
- }
|
|
|
hashMap.put("dynamicInfoPoint", dynamicInfoPoint);
|
|
|
hashMap.put("staticInfoPoint", staticInfoPoint);
|
|
|
hashMap.put("customInfoPoint", customInfoPoint);
|
|
|
-
|
|
|
- return hashMap;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -930,7 +1076,7 @@ public class AdmReportEquipController {
|
|
|
Iterator<ObjectInfoDefine> iterator = infoPointCodes.iterator();
|
|
|
while (iterator.hasNext()){
|
|
|
ObjectInfoDefine nextInfo = iterator.next();
|
|
|
- if(str.contains(nextInfo.getCode()) && type==nextInfo.getClassCode()){
|
|
|
+ if(str.contains(nextInfo.getCode()) && type.equals(nextInfo.getClassCode())){
|
|
|
counts ++;
|
|
|
hashMap.put("next", nextInfo);
|
|
|
iterator.remove();
|
|
@@ -940,102 +1086,63 @@ public class AdmReportEquipController {
|
|
|
return hashMap;
|
|
|
}
|
|
|
|
|
|
- private JSONObject calInfoPointByObjType(String objType, Boolean visible, Boolean getInfoCounts){
|
|
|
- JSONObject gatherInfoPoint = new JSONObject();
|
|
|
- gatherInfoPoint.put("gatherInfoPointCounts", 0);
|
|
|
- gatherInfoPoint.put("gatherCustomInfoPointCounts",0);
|
|
|
- gatherInfoPoint.put("gatherDynamicInfoPointCounts",0);
|
|
|
- gatherInfoPoint.put("gatherStaticInfoPointCounts",0);
|
|
|
-
|
|
|
- Map<String, Integer> hashMap = new HashMap<>(16);
|
|
|
- hashMap.put("dynamicInfoPoint", 0);
|
|
|
- hashMap.put("staticInfoPoint", 0);
|
|
|
- hashMap.put("customInfoPoint", 0);
|
|
|
- //查询当前实例所有信息点总数
|
|
|
- long controlInfoCounts = 0L;
|
|
|
- Set<String> classCodeSet = new HashSet<>();
|
|
|
- //2 获取动态 静态 信息点
|
|
|
- // 2.1 根据objType获取定义 获取采集的设备的classcode
|
|
|
- Set<String> objTypes = new HashSet<>(1);
|
|
|
- objTypes.add(objType);
|
|
|
- List<Map<String, Object>> codes = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null, RequestData.builder().objTypes(objTypes).build());
|
|
|
- if(CollUtil.isEmpty(codes)){
|
|
|
- return gatherInfoPoint;
|
|
|
- }else{
|
|
|
- codes.stream().forEach(stringObjectMap -> classCodeSet.add(stringObjectMap.get("code").toString()));
|
|
|
- //1 查询项目下所有现有的系统
|
|
|
- AdmQueryCriteria admQueryCriteriaObj = new AdmQueryCriteria();
|
|
|
- admQueryCriteriaObj.setPageNumber(1);
|
|
|
- admQueryCriteriaObj.setPageSize(500);
|
|
|
- admQueryCriteriaObj.setName(objType);
|
|
|
- AdmResponse admResponse = new AdmResponse();
|
|
|
- if(objType.equals(AdmEquipment.OBJ_TYPE)){
|
|
|
- admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","bimLocation","infos","classCode","equipSerial","bimFamilyName","bimFamilySymbol"));
|
|
|
- admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmEquipment.class);
|
|
|
- }else{
|
|
|
- admQueryCriteriaObj.setProjection(Arrays.asList("id","name","localId","localName","cadId","bimId","infos","classCode"));
|
|
|
- admResponse = systemService.doQuery(AdmContextUtil.toDmpContext(), admQueryCriteriaObj, AdmSystem.class);
|
|
|
- }
|
|
|
-
|
|
|
- //获取信息点
|
|
|
- QueryCriteria queryCriteria = new QueryCriteria();
|
|
|
- ObjectNode criteria = JsonNodeFactory.instance.objectNode();
|
|
|
- criteria = JsonNodeFactory.instance.objectNode();
|
|
|
- ArrayNode arrayNode = criteria.putObject("classCode").putArray("$in");
|
|
|
- classCodeSet.stream().forEach(classCode -> arrayNode.add(classCode));
|
|
|
-
|
|
|
- //查询当前实例所有信息点总数
|
|
|
- if(getInfoCounts){
|
|
|
- queryCriteria.setCriteria(criteria);
|
|
|
- queryCriteria.setOnlyCount(true);
|
|
|
- List<ObjectInfoDefine> totalInfo = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
- controlInfoCounts = totalInfo.size();
|
|
|
- }
|
|
|
-
|
|
|
- //静态信息点
|
|
|
- criteria.put("groupCode","0");
|
|
|
- criteria.put("projectId","0");
|
|
|
- criteria.put("category","STATIC");
|
|
|
- if(visible){
|
|
|
- criteria.put("valid", "1");
|
|
|
- }else{
|
|
|
- criteria.remove("valid");
|
|
|
- }
|
|
|
-
|
|
|
- queryCriteria.setOnlyCount(false);
|
|
|
- queryCriteria.setCriteria(criteria);
|
|
|
- List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
+ /**
|
|
|
+ * 根据对象分类查询信息的总数
|
|
|
+ * @param objtype
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Integer controlInfoCounts(String objtype){
|
|
|
+ AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
|
|
|
+ admQueryCriteria.setOnlyCount(true);
|
|
|
+ AdmResponse response = dictService.doQueryObjectInfo(AdmContextUtil.toDmpContext(), admQueryCriteria, objtype, AdmObjectInfo.class);
|
|
|
+ return response.getTotal().intValue();
|
|
|
+ }
|
|
|
|
|
|
- criteria.remove("category");
|
|
|
+ /** 项目下所有已采集的动态信息点编码
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private List<ObjectInfoDefine> gatherDynamicInfoCode(Boolean visible, Set<String> classCodeSet){
|
|
|
+ //获取信息点
|
|
|
+ AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
|
|
|
|
|
|
- //动态信息点9
|
|
|
- JSONObject category = new JSONObject();
|
|
|
- category.put("$ne","STATIC");
|
|
|
- criteria.putPOJO("category", category);
|
|
|
- queryCriteria.setCriteria(criteria);
|
|
|
- List<ObjectInfoDefine> dynamicInfoCode = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
-
|
|
|
- // 2.2 根据定义获取信息点
|
|
|
- //4 计算已采集的和需要采集的信息点占比
|
|
|
- //return customSqlService.systemInfoPoins()
|
|
|
- List admObjList = admResponse.getContent();
|
|
|
- hashMap = calculate(dynamicInfoCode, staticInfoCode, admObjList, 1, hashMap);
|
|
|
- long totalPage = admResponse.getTotal() / admResponse.getPageSize();
|
|
|
- if(totalPage > 0l){
|
|
|
- for (long page = admResponse.getPageSize() +1; page <= totalPage; page++){
|
|
|
- hashMap = calculate(dynamicInfoCode, staticInfoCode, admObjList, 1, hashMap);
|
|
|
- }
|
|
|
- }
|
|
|
- if(CollUtil.isNotEmpty(hashMap)){
|
|
|
- gatherInfoPoint.put("gatherCustomInfoPointCounts",hashMap.get("customInfoPoint"));
|
|
|
- gatherInfoPoint.put("gatherDynamicInfoPointCounts",hashMap.get("dynamicInfoPoint"));
|
|
|
- gatherInfoPoint.put("gatherStaticInfoPointCounts",hashMap.get("staticInfoPoint"));
|
|
|
- }
|
|
|
+ ObjectNode criteria = JsonNodeFactory.instance.objectNode();
|
|
|
+ ArrayNode arrayNode = criteria.putObject("classCode").putArray("$in");
|
|
|
+ classCodeSet.stream().forEach(classCode -> arrayNode.add(classCode));
|
|
|
+ //静态信息点
|
|
|
+ String filters = "groupCode='0' and projectId='0' and category != 'STATIC'";
|
|
|
+ if(visible){
|
|
|
+ filters = filters + " and valid = '1' ";
|
|
|
}
|
|
|
- gatherInfoPoint.put("gatherInfoPointCounts", controlInfoCounts);
|
|
|
- return gatherInfoPoint;
|
|
|
+ filters = filters +" and classCode in ['"+StrUtil.join("','",classCodeSet)+"']";
|
|
|
+ admQueryCriteria.setFilters(filters);
|
|
|
+ System.out.println(filters);
|
|
|
+ AdmResponse dynamicInfoCode = dictService.doQueryObjectInfo(AdmContextUtil.toDmpContext(), admQueryCriteria,null, AdmObjectInfo.class);
|
|
|
+ return (List<ObjectInfoDefine>) dynamicInfoCode.getContent();
|
|
|
}
|
|
|
|
|
|
+ /** 项目下所有已采集静态信息点编码
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private List<ObjectInfoDefine> gatherStaticInfoCode(Boolean visible, Set<String> classCodeSet){
|
|
|
+ //获取信息点
|
|
|
+ QueryCriteria queryCriteria = new QueryCriteria();
|
|
|
+ ObjectNode criteria = JsonNodeFactory.instance.objectNode();
|
|
|
+ ArrayNode arrayNode = criteria.putObject("classCode").putArray("$in");
|
|
|
+ classCodeSet.stream().forEach(classCode -> arrayNode.add(classCode));
|
|
|
+ //静态信息点
|
|
|
+ criteria.put("groupCode","0");
|
|
|
+ criteria.put("projectId","0");
|
|
|
+ criteria.put("category","STATIC");
|
|
|
+ if(visible){
|
|
|
+ criteria.put("valid", "1");
|
|
|
+ }else{
|
|
|
+ criteria.remove("valid");
|
|
|
+ }
|
|
|
+ queryCriteria.setOnlyCount(false);
|
|
|
+ queryCriteria.setCriteria(criteria);
|
|
|
+ List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
+ return staticInfoCode;
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|