|
@@ -29,9 +29,9 @@ import com.persagy.proxy.adm.service.IAdmComponentService;
|
|
|
import com.persagy.proxy.adm.service.IAdmDictService;
|
|
|
import com.persagy.proxy.adm.service.IAdmEquipmentService;
|
|
|
import com.persagy.proxy.adm.service.IAdmSystemService;
|
|
|
+import com.persagy.proxy.adm.utils.AdmContextUtil;
|
|
|
import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
|
|
|
import com.persagy.proxy.common.entity.DmpResult;
|
|
|
-import com.persagy.proxy.common.entity.InstanceUrlParam;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -65,16 +65,13 @@ public class AdmReportEquipController {
|
|
|
* 查询设备信息 关联的部件 资产信息
|
|
|
* 查询设备关联资产部件数量
|
|
|
*
|
|
|
- * @param projectId
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
@PostMapping("/equip-components")
|
|
|
- public AdmResponse getEquipAssetComponents(@QueryParam("projectId") String projectId,
|
|
|
- @RequestBody AdmQueryCriteria request) throws Exception {
|
|
|
- // 组装上下文条件
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
+ public AdmResponse getEquipAssetComponents(@RequestBody AdmQueryCriteria request) throws Exception {
|
|
|
//查询设备
|
|
|
request.setName(AdmEquipment.OBJ_TYPE);
|
|
|
List<AdmQueryCriteria> cascade = new ArrayList<>();
|
|
@@ -88,7 +85,7 @@ public class AdmReportEquipController {
|
|
|
cascade.add(cascadeSys);
|
|
|
request.setCascade(cascade);
|
|
|
QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
|
|
|
- List<ObjectNode> equips = DigitalObjectFacade.query(context.getGroupCode(), context.getProjectId(), context.getAppId(), null, queryCriteria);
|
|
|
+ List<ObjectNode> equips = DigitalObjectFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(), null, queryCriteria);
|
|
|
if (CollUtil.isEmpty(equips)) {
|
|
|
return AdmResponse.success();
|
|
|
}
|
|
@@ -107,7 +104,7 @@ public class AdmReportEquipController {
|
|
|
ObjectNode criteria = JsonNodeFactory.instance.objectNode();
|
|
|
criteria.put("code", admEquipment.getClassCode());
|
|
|
defineCriteria.setCriteria(criteria);
|
|
|
- AdmResponse defRes = dictService.doQueryObjectType(context, queryCriteria, AdmObjectType.class);
|
|
|
+ AdmResponse defRes = dictService.doQueryObjectType(AdmContextUtil.toDmpContext(), defineCriteria, AdmObjectType.class);
|
|
|
if (CollUtil.isNotEmpty(defRes.getContent())) {
|
|
|
List<AdmObjectType> componentCategory = (List<AdmObjectType>) defRes.getContent();
|
|
|
admEquipment.setComponentCategory(componentCategory);
|
|
@@ -123,10 +120,7 @@ public class AdmReportEquipController {
|
|
|
* @return 查询结果
|
|
|
*/
|
|
|
@PostMapping("/components-count")
|
|
|
- public AdmResponse getEquipComponentsCount(@QueryParam("projectId") String projectId,
|
|
|
- @RequestBody AdmQueryCriteria request){
|
|
|
- // 组装上下文条件
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
+ public AdmResponse getEquipComponentsCount(@RequestBody AdmQueryCriteria request){
|
|
|
QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
|
|
|
ObjectNode criteria = queryCriteria.getCriteria();
|
|
|
if(JSONUtil.isNull(criteria)){
|
|
@@ -135,7 +129,7 @@ public class AdmReportEquipController {
|
|
|
JsonNode euipId = criteria.get("id");
|
|
|
RequestData requestData = new RequestData();
|
|
|
requestData.setEquipmentId(String.valueOf(euipId));
|
|
|
- List result = DigitalObjectSimpleFacade.queryComponentsCountByEquipId(context.getGroupCode(), context.getProjectId(), context.getAppId(),null,requestData);
|
|
|
+ List result = DigitalObjectSimpleFacade.queryComponentsCountByEquipId(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null,requestData);
|
|
|
if(CollUtil.isNotEmpty(result)){
|
|
|
return AdmResponse.success(result);
|
|
|
}else{
|
|
@@ -152,12 +146,9 @@ public class AdmReportEquipController {
|
|
|
* @return 查询结果
|
|
|
*/
|
|
|
@PostMapping("/components-property")
|
|
|
- public AdmResponse getComponentProperty(@QueryParam("projectId") String projectId,
|
|
|
- @RequestBody AdmQueryCriteria request){
|
|
|
- // 组装上下文条件
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
+ public AdmResponse getComponentProperty(@RequestBody AdmQueryCriteria request){
|
|
|
request.setName(AdmComponent.OBJ_TYPE);
|
|
|
- return componentService.doQuery(context, request, AdmComponent.class);
|
|
|
+ return componentService.doQuery(AdmContextUtil.toDmpContext(), request, AdmComponent.class);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -167,10 +158,8 @@ public class AdmReportEquipController {
|
|
|
* @param category 分类
|
|
|
*/
|
|
|
@GetMapping("/equip-compon")
|
|
|
- public AdmResponse getEquipCompon(@QueryParam("projectId") String projectId, @QueryParam("id") String id, @QueryParam("category") String category){
|
|
|
- //return rEquipComponService.getEquipCompon(id,category)
|
|
|
- // 组装上下文条件
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
+ public AdmResponse getEquipCompon(@QueryParam("id") String id, @QueryParam("category") String category){
|
|
|
+ //return rEquipComponService.getEquipCompon(id,category)
|
|
|
RequestData requestData = new RequestData();
|
|
|
if(StrUtil.isNotEmpty(id)){
|
|
|
requestData.setEquipmentId(id);
|
|
@@ -178,7 +167,7 @@ public class AdmReportEquipController {
|
|
|
if(StrUtil.isNotEmpty(category)){
|
|
|
requestData.setClassCode(category);
|
|
|
}
|
|
|
- List result = DigitalObjectSimpleFacade.queryEquipComponentsByProjectId(context.getGroupCode(), context.getProjectId(), context.getAppId(),null, requestData);
|
|
|
+ List result = DigitalObjectSimpleFacade.queryEquipComponentsByProjectId(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmContextUtil.toDmpContext().getAppId(),null, requestData);
|
|
|
if(CollUtil.isNotEmpty(result)){
|
|
|
return AdmResponse.success(result);
|
|
|
}else{
|
|
@@ -204,7 +193,7 @@ public class AdmReportEquipController {
|
|
|
* "根据设备类型和建筑楼层查询(\"Filters\": \"category ='FASE';buildingId = '建筑id';floorId = '楼层id'\")"
|
|
|
*/
|
|
|
@PostMapping("/count")
|
|
|
- public AdmResponse count(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request) {
|
|
|
+ public AdmResponse count(@RequestBody AdmQueryCriteria request) {
|
|
|
QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
|
|
|
ObjectNode criteria = JsonNodeFactory.instance.objectNode();
|
|
|
if(StrUtil.isNotEmpty(request.getFilters()) && request.getFilters().contains("category")){
|
|
@@ -213,7 +202,7 @@ public class AdmReportEquipController {
|
|
|
}
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
queryCriteria.setOnlyCount(true);
|
|
|
- List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
|
|
|
+ List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteria);
|
|
|
if(CollUtil.isNotEmpty(euipCom)){
|
|
|
return AdmResponse.success(euipCom);
|
|
|
}else{
|
|
@@ -229,7 +218,7 @@ public class AdmReportEquipController {
|
|
|
* "根据设备类型和建筑楼层查询(\"Filters\": \"category ='FASE';buildingId = '建筑id';floorId = '楼层id'\")"
|
|
|
*/
|
|
|
@PostMapping("/pagequery")
|
|
|
- public AdmResponse pageQuery(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request) {
|
|
|
+ public AdmResponse pageQuery(@RequestBody AdmQueryCriteria request) {
|
|
|
QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
|
|
|
ObjectNode criteria = JsonNodeFactory.instance.objectNode();
|
|
|
queryCriteria.setCriteria(criteria);
|
|
@@ -237,7 +226,7 @@ public class AdmReportEquipController {
|
|
|
criteria.put("classCode", criteria.get("category").textValue());
|
|
|
criteria.remove("category");
|
|
|
}
|
|
|
- List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
|
|
|
+ List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteria);
|
|
|
if(CollUtil.isNotEmpty(euipCom)){
|
|
|
return AdmResponse.success(euipCom);
|
|
|
}else{
|
|
@@ -257,10 +246,10 @@ public class AdmReportEquipController {
|
|
|
* "如果是查询不属于任何业务空间的对象, 设置notInZone = true"
|
|
|
*/
|
|
|
@PostMapping("/zone-query")
|
|
|
- public AdmResponse zoneQuery(@QueryParam("projectId") String projectId, @RequestBody AdmZoneEquipQueryRequest request) {
|
|
|
+ public AdmResponse zoneQuery(@RequestBody AdmZoneEquipQueryRequest request) {
|
|
|
request.setName(AdmEquipment.OBJ_TYPE);
|
|
|
if(StrUtil.isAllEmpty(request.getZoneType(),request.getZoneId())){
|
|
|
- return pageQuery(projectId, request);
|
|
|
+ return pageQuery(request);
|
|
|
}else{
|
|
|
|
|
|
}
|
|
@@ -278,10 +267,10 @@ public class AdmReportEquipController {
|
|
|
* "如果是查询不属于任何业务空间的对象, 设置notInZone = true"
|
|
|
*/
|
|
|
@PostMapping("/zone-component-query")
|
|
|
- public AdmResponse zoneComponentQuery(@QueryParam("projectId") String projectId,@RequestBody AdmZoneEquipQueryRequest request) {
|
|
|
+ public AdmResponse zoneComponentQuery(@RequestBody AdmZoneEquipQueryRequest request) {
|
|
|
if(StrUtil.isAllEmpty(request.getZoneType(),request.getZoneId())){
|
|
|
request.setName(AdmComponent.OBJ_TYPE);
|
|
|
- return pageQuery(projectId, request);
|
|
|
+ return pageQuery(request);
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
@@ -291,12 +280,10 @@ public class AdmReportEquipController {
|
|
|
*
|
|
|
*/
|
|
|
@PostMapping("/creat-equip-pro")
|
|
|
- public AdmResponse create(@QueryParam("projectId") String projectId,@RequestBody AdmCreateRequest<AdmEquipment> createRequest){
|
|
|
+ public AdmResponse create(@RequestBody AdmCreateRequest<AdmEquipment> createRequest){
|
|
|
//return EquipmentProSyService.createList(request)
|
|
|
- // 组装上下文条件
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
|
|
|
- vos = equipmentService.doInsertEuip(context, AdmEquipment.class, vos);
|
|
|
+ vos = equipmentService.doInsertEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
|
|
|
return AdmResponse.success(vos);
|
|
|
}
|
|
|
|
|
@@ -304,7 +291,7 @@ public class AdmReportEquipController {
|
|
|
* 查询不在当前系统下的设备
|
|
|
*/
|
|
|
@PostMapping("/equip-sys")
|
|
|
- public AdmResponse pageQueryEquipSys(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request,@QueryParam("sysId") String sysId){
|
|
|
+ public AdmResponse pageQueryEquipSys(@RequestBody AdmQueryCriteria request,@QueryParam("sysId") String sysId){
|
|
|
//return EquipmentService.queryBeforeEquipSy(sysId,request)
|
|
|
QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
|
|
|
ObjectNode criteriaEquip = JsonNodeFactory.instance.objectNode();
|
|
@@ -317,7 +304,7 @@ public class AdmReportEquipController {
|
|
|
relationTo.put("objFrom", objFrom);
|
|
|
criteriaEquip.putPOJO("relationTo",relationTo);
|
|
|
queryCriteria.setCriteria(criteriaEquip);
|
|
|
- List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
+ List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
if (CollUtil.isEmpty(equips))
|
|
|
return AdmResponse.success();
|
|
|
else
|
|
@@ -330,12 +317,12 @@ public class AdmReportEquipController {
|
|
|
* datacenter 查询目标是SysEquip 没先查询系统,根据系统id查询系统和设备的关系,根据关系查询设备,拼接数据
|
|
|
*/
|
|
|
@PostMapping("/sys-equip")
|
|
|
- public AdmResponse pageQuerySysEquip(@QueryParam("projectId") String projectId, @RequestBody AdmQueryCriteria request){
|
|
|
- //return SysEquipService.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageContext.getHeader("projectId").toString())))
|
|
|
+ public AdmResponse pageQuerySysEquip(@RequestBody AdmQueryCriteria request){
|
|
|
+ //return SysEquipService.pageQuery(request, arrayListOf(SFilter.eq("projectId", SPageAdmContextUtil.toDmpContext().getHeader("projectId").toString())))
|
|
|
request.setName(AdmSystem.OBJ_TYPE);
|
|
|
QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
|
|
|
queryCriteria.setSize(500l);
|
|
|
- List<ObjectNode> objectNodeList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
+ List<ObjectNode> objectNodeList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
if(CollUtil.isEmpty(objectNodeList)){
|
|
|
return AdmResponse.success();
|
|
|
}
|
|
@@ -352,7 +339,7 @@ public class AdmReportEquipController {
|
|
|
admSystemMap.keySet().stream().forEach(id -> arrayNode.add(id));
|
|
|
queryCriteriaRelation.setCriteria(criteria);
|
|
|
|
|
|
- List<ObjectRelation> relations = DigitalRelationFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteriaRelation);
|
|
|
+ List<ObjectRelation> relations = DigitalRelationFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteriaRelation);
|
|
|
if(CollUtil.isEmpty(relations)){
|
|
|
AdmResponse.success();
|
|
|
}
|
|
@@ -365,7 +352,7 @@ public class AdmReportEquipController {
|
|
|
ArrayNode array = criteriaEquip.putObject("id").putArray("$in");
|
|
|
relationMap.keySet().stream().forEach(id -> array.add(id));
|
|
|
queryCriteriaEqu.setCriteria(criteriaEquip);
|
|
|
- List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteriaEqu);
|
|
|
+ List<ObjectNode> equips = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteriaEqu);
|
|
|
List<AdmEquipment> equipsList = JSONUtil.toList(equips.toString(), AdmEquipment.class);
|
|
|
Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(equipsList, BaseEntity.PROP_ID);
|
|
|
|
|
@@ -392,14 +379,12 @@ public class AdmReportEquipController {
|
|
|
@GetMapping("/equip-compon-category")
|
|
|
public AdmResponse equipORComponCategory(@QueryParam("projectId") String projectId){
|
|
|
//return EquipORComponCategoryService.getEquipORComponCategory()
|
|
|
- // 组装上下文条件
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
RequestData requestData = new RequestData();
|
|
|
if(StrUtil.isNotEmpty(projectId)){
|
|
|
requestData.setProjectId(projectId);
|
|
|
}
|
|
|
requestData.setObjTypes(CollUtil.newHashSet(AdmEquipment.OBJ_TYPE, AdmComponent.OBJ_TYPE));
|
|
|
- List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(context.getGroupCode(),projectId,context.getAppId(),null,requestData);
|
|
|
+ List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(),AdmContextUtil.toDmpContext().getAppId(),null,requestData);
|
|
|
if(CollUtil.isNotEmpty(result)){
|
|
|
return AdmResponse.success(result);
|
|
|
}else{
|
|
@@ -436,12 +421,12 @@ public class AdmReportEquipController {
|
|
|
* }
|
|
|
*/
|
|
|
@PostMapping("/update")
|
|
|
- public AdmResponse equipUpDateEnclosure(@QueryParam("projectId") String projectId,@RequestBody ObjectNode equipUpDateEnclosureRequest) {
|
|
|
+ public AdmResponse equipUpDateEnclosure(@RequestBody ObjectNode equipUpDateEnclosureRequest) {
|
|
|
//return EquipmentService.equipUpDateEnclosurs(equipUpDateEnclosureRequest)
|
|
|
if(JSONUtil.isNull(equipUpDateEnclosureRequest)){
|
|
|
return AdmResponse.failure(ResponseCode.A0400.getDesc()+",不能为空");
|
|
|
}
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
+
|
|
|
List<EquipUpDateEnclosure> equipUpDateEnclosure = JSONUtil.toList(equipUpDateEnclosureRequest.get("content").toString(), EquipUpDateEnclosure.class);
|
|
|
if(CollUtil.isNotEmpty(equipUpDateEnclosure)){
|
|
|
Map<String, EquipUpDateEnclosure> equipUpDateEnclosureMap = CollUtil.fieldValueMap(equipUpDateEnclosure, BaseEntity.PROP_ID);
|
|
@@ -455,7 +440,7 @@ public class AdmReportEquipController {
|
|
|
ArrayNode arrayNode = criteria.putObject("id").putArray("$in");
|
|
|
equipUpDateEnclosureMap.keySet().stream().forEach(equipId -> arrayNode.add(equipId));
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
- AdmResponse equips = equipmentService.doQuery(context, queryCriteria, AdmEquipment.class);
|
|
|
+ AdmResponse equips = equipmentService.doQuery(AdmContextUtil.toDmpContext(), queryCriteria, AdmEquipment.class);
|
|
|
if(CollUtil.isEmpty(equips.getContent())){
|
|
|
return AdmResponse.failure(ResponseCode.A0400.getDesc());
|
|
|
}
|
|
@@ -473,7 +458,7 @@ public class AdmReportEquipController {
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- List<AdmEquipment> vos = equipmentService.doUpdate(context, AdmEquipment.class, equipmentList);
|
|
|
+ List<AdmEquipment> vos = equipmentService.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, equipmentList);
|
|
|
return AdmResponse.success(vos);
|
|
|
}else{
|
|
|
return AdmResponse.failure(ResponseCode.A0400.getDesc());
|
|
@@ -488,7 +473,7 @@ public class AdmReportEquipController {
|
|
|
* }]
|
|
|
*/
|
|
|
@PostMapping("/equip-del-com")
|
|
|
- public AdmResponse equipComDel(@QueryParam("projectId") String projectId,@RequestBody List<ObjectNode> equipComDelList){
|
|
|
+ public AdmResponse equipComDel(@RequestBody List<ObjectNode> equipComDelList){
|
|
|
//return EquipmentService.equipComDels(equipComDelList)
|
|
|
if(CollUtil.isEmpty(equipComDelList)){
|
|
|
return AdmResponse.failure(ResponseCode.A0400.getCode());
|
|
@@ -504,7 +489,7 @@ public class AdmReportEquipController {
|
|
|
}
|
|
|
});
|
|
|
queryCriteriaEuip.setCriteria(criteriaEquip);
|
|
|
- List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
|
|
|
+ List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
|
|
|
if(CollUtil.isEmpty(equipList)){
|
|
|
return AdmResponse.success(equipComDelList);
|
|
|
}
|
|
@@ -532,9 +517,9 @@ public class AdmReportEquipController {
|
|
|
* }]
|
|
|
*/
|
|
|
@PostMapping("/equip-supply")
|
|
|
- public AdmResponse equipPropertySupply(@QueryParam("projectId") String projectId,@RequestBody List<ObjectNode> equipComDelList){
|
|
|
+ public AdmResponse equipPropertySupply(@RequestBody List<ObjectNode> equipComDelList){
|
|
|
//return EquipmentService.equipPropertySupplys(equipComDelList)
|
|
|
- //InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
+ //
|
|
|
if(CollUtil.isEmpty(equipComDelList)){
|
|
|
return AdmResponse.failure(ResponseCode.A0400.getCode());
|
|
|
}
|
|
@@ -547,7 +532,7 @@ public class AdmReportEquipController {
|
|
|
arrayNode.add(node.get("modelId").textValue());
|
|
|
});
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
- List<ObjectNode> floorList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
+ List<ObjectNode> floorList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
if(CollUtil.isEmpty(floorList)){
|
|
|
return AdmResponse.success();
|
|
|
}
|
|
@@ -573,7 +558,7 @@ public class AdmReportEquipController {
|
|
|
criteriaEquip.putPOJO("modelId", modelId);
|
|
|
|
|
|
queryCriteriaEuip.setCriteria(criteriaEquip);
|
|
|
- List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
|
|
|
+ List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteriaEuip);
|
|
|
if(CollUtil.isEmpty(equipList)){
|
|
|
return AdmResponse.success(equipComDelList);
|
|
|
}
|
|
@@ -606,8 +591,7 @@ public class AdmReportEquipController {
|
|
|
* 级联-任务(scanTaskBase)、资产(property)、设备类型(equipCategory),级联任务的时候需要设置条件(TaskState = 0 添加时间降序 取第一个值 )
|
|
|
*/
|
|
|
@PostMapping("/equip-comm-del")
|
|
|
- public AdmResponse equipCommDel(@QueryParam("projectId") String projectId,@RequestBody AdmQueryCriteria request){
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
+ public AdmResponse equipCommDel(@RequestBody AdmQueryCriteria request){
|
|
|
//return EquipDelService.pageQuery(sQueryRequest,withFilterList)
|
|
|
//e.task_state = '-1'::integer
|
|
|
//AND NOT e.model_id IS NULL
|
|
@@ -621,7 +605,7 @@ public class AdmReportEquipController {
|
|
|
criteria.put("taskState","-1");
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
|
|
|
- AdmResponse equipRes = equipmentService.doQuery(context, queryCriteria, AdmEquipment.class);
|
|
|
+ AdmResponse equipRes = equipmentService.doQuery(AdmContextUtil.toDmpContext(), queryCriteria, AdmEquipment.class);
|
|
|
return equipRes;
|
|
|
}
|
|
|
|
|
@@ -630,8 +614,8 @@ public class AdmReportEquipController {
|
|
|
* 级联-设备类型(equipFamily)
|
|
|
*/
|
|
|
@PostMapping("/property-equip-supp")
|
|
|
- public AdmResponse propertyEquip(@QueryParam("projectId") String projectId,@RequestBody AdmQueryCriteria request){
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
+ public AdmResponse propertyEquip(@RequestBody AdmQueryCriteria request){
|
|
|
+
|
|
|
//return EquipmentService.equipPropertySupp(sQueryRequest)
|
|
|
//equipment.bim_id IS NULL
|
|
|
// AND equipment.model_id IS NULL
|
|
@@ -652,7 +636,7 @@ public class AdmReportEquipController {
|
|
|
criteria.putPOJO("bimLocation", bimLocation);
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
|
|
|
- AdmResponse equipRes = equipmentService.doQuery(context, queryCriteria, AdmEquipment.class);
|
|
|
+ AdmResponse equipRes = equipmentService.doQuery(AdmContextUtil.toDmpContext(), queryCriteria, AdmEquipment.class);
|
|
|
if(CollUtil.isNotEmpty(equipRes.getContent())){
|
|
|
List<AdmEquipment> admEquipments = JSONUtil.toList(equipRes.getContent().toString(), AdmEquipment.class);
|
|
|
Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(admEquipments, BaseEntity.PROP_ID);
|
|
@@ -676,7 +660,7 @@ public class AdmReportEquipController {
|
|
|
filter = filter + ";id in "+arrayNode.toString();
|
|
|
request.setFilters(filter);
|
|
|
|
|
|
- AdmResponse admResponse = equipmentService.doQuery(context, request, AdmEquipment.class);
|
|
|
+ AdmResponse admResponse = equipmentService.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
|
|
|
if(CollUtil.isNotEmpty(admResponse.getContent())){
|
|
|
//处理数据
|
|
|
List<ObjectNode> objectNodeList = (List<ObjectNode>) admResponse.getContent();
|
|
@@ -753,8 +737,8 @@ public class AdmReportEquipController {
|
|
|
@PostMapping("/info-point")
|
|
|
public AdmResponse infoPoint(@QueryParam("projectId") String projectId) {
|
|
|
//return customSqlService.infoPoints()
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
- JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, context, false, false);
|
|
|
+
|
|
|
+ JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, false, false);
|
|
|
JSONObject infoPoint = new JSONObject();
|
|
|
infoPoint.put("dynamicInfoPoint",gatherInfoPoint.getString("gatherDynamicInfoPointCounts"));
|
|
|
infoPoint.put("staticInfoPoint",gatherInfoPoint.getString("gatherStaticInfoPointCounts"));
|
|
@@ -771,8 +755,8 @@ public class AdmReportEquipController {
|
|
|
if(StrUtil.isEmpty(projectId)){
|
|
|
return AdmResponse.failure(ResponseCode.A0400.getCode());
|
|
|
}
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
- JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, context, true, true);
|
|
|
+
|
|
|
+ JSONObject gatherInfoPoint = calInfoPointByObjType(AdmEquipment.OBJ_TYPE, true, true);
|
|
|
return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
|
|
|
}
|
|
|
|
|
@@ -785,8 +769,8 @@ public class AdmReportEquipController {
|
|
|
if(StrUtil.isEmpty(projectId)){
|
|
|
return AdmResponse.failure(ResponseCode.A0400.getCode());
|
|
|
}
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
- JSONObject gatherInfoPoint = calInfoPointByObjType(AdmSystem.OBJ_TYPE, context, true, true);
|
|
|
+
|
|
|
+ JSONObject gatherInfoPoint = calInfoPointByObjType(AdmSystem.OBJ_TYPE,true, true);
|
|
|
return AdmResponse.success(CollUtil.newArrayList(gatherInfoPoint));
|
|
|
}
|
|
|
|
|
@@ -802,7 +786,7 @@ public class AdmReportEquipController {
|
|
|
criteria.put("objType","['equipment','component']");
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
queryCriteria.setOnlyCount(true);
|
|
|
- List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,projectId,AdmCommonConstant.APP_ID,null, queryCriteria);
|
|
|
+ List<ObjectNode> euipCom = DigitalObjectFacade.query(groupCode,AdmContextUtil.toDmpContext().getProjectId(),AdmCommonConstant.APP_ID,null, queryCriteria);
|
|
|
if(CollUtil.isNotEmpty(euipCom)){
|
|
|
return AdmResponse.success(euipCom);
|
|
|
}else{
|
|
@@ -817,14 +801,12 @@ public class AdmReportEquipController {
|
|
|
*/
|
|
|
@PostMapping("/type")
|
|
|
public AdmResponse equipType(@QueryParam("projectId") String projectId){
|
|
|
- // 组装上下文条件
|
|
|
- InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
|
|
|
RequestData requestData = new RequestData();
|
|
|
if(StrUtil.isNotEmpty(projectId)){
|
|
|
requestData.setProjectId(projectId);
|
|
|
}
|
|
|
requestData.setObjType(AdmEquipment.OBJ_TYPE);
|
|
|
- List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(context.getGroupCode(),projectId,context.getAppId(),null,requestData);
|
|
|
+ List<Map<String, Object>> result = DigitalObjectSimpleFacade.queryDefineInfoByObjType(AdmContextUtil.toDmpContext().getGroupCode(),AdmContextUtil.toDmpContext().getProjectId(),AdmContextUtil.toDmpContext().getAppId(),null,requestData);
|
|
|
if(CollUtil.isNotEmpty(result)){
|
|
|
return AdmResponse.success(result);
|
|
|
}else{
|
|
@@ -936,7 +918,7 @@ public class AdmReportEquipController {
|
|
|
return hashMap;
|
|
|
}
|
|
|
|
|
|
- private JSONObject calInfoPointByObjType(String objType, InstanceUrlParam context, Boolean visible, Boolean getInfoCounts){
|
|
|
+ private JSONObject calInfoPointByObjType(String objType, Boolean visible, Boolean getInfoCounts){
|
|
|
//1 查询项目下所有现有的系统
|
|
|
AdmQueryCriteria admQueryCriteriaObj = new AdmQueryCriteria();
|
|
|
if(objType.equals(AdmEquipment.OBJ_TYPE)){
|
|
@@ -946,7 +928,7 @@ public class AdmReportEquipController {
|
|
|
}
|
|
|
admQueryCriteriaObj.setName(objType);
|
|
|
QueryCriteria queryCriteriaSys = AdmQueryCriteriaHelper.toDmpCriteria(admQueryCriteriaObj);
|
|
|
- List<ObjectNode> admObjList = DigitalObjectFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteriaSys);
|
|
|
+ List<ObjectNode> admObjList = DigitalObjectFacade.query(groupCode, AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteriaSys);
|
|
|
|
|
|
//2 获取动态 静态 信息点
|
|
|
// 2.1 根据objType获取定义
|
|
@@ -956,7 +938,7 @@ public class AdmReportEquipController {
|
|
|
ObjectNode criteria = JsonNodeFactory.instance.objectNode();
|
|
|
criteria.put("objType", objType);
|
|
|
queryCriteriaType.setCriteria(criteria);
|
|
|
- AdmResponse admResponseType = dictService.doQueryObjectType(context, queryCriteriaType, AdmObjectType.class);
|
|
|
+ AdmResponse admResponseType = dictService.doQueryObjectType(AdmContextUtil.toDmpContext(), queryCriteriaType, AdmObjectType.class);
|
|
|
if(CollUtil.isEmpty(admResponseType.getContent())){
|
|
|
return null;
|
|
|
}
|
|
@@ -989,7 +971,7 @@ public class AdmReportEquipController {
|
|
|
criteria.put("valid","['0','1']");
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
queryCriteria.setOnlyCount(true);
|
|
|
- List<ObjectInfoDefine> totalInfo = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
+ List<ObjectInfoDefine> totalInfo = DigitalObjectInfoFacade.query(groupCode, AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
controlInfoCounts = totalInfo.size();
|
|
|
criteria.remove("valid");
|
|
|
}
|
|
@@ -1001,7 +983,7 @@ public class AdmReportEquipController {
|
|
|
criteria.put("valid","['0','1']");
|
|
|
}
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
- List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
+ List<ObjectInfoDefine> staticInfoCode = DigitalObjectInfoFacade.query(groupCode, AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
criteria.remove("category");
|
|
|
|
|
|
//动态信息点
|
|
@@ -1009,7 +991,7 @@ public class AdmReportEquipController {
|
|
|
category.put("$ne","STATIC");
|
|
|
criteria.putPOJO("category", category);
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
- List<ObjectInfoDefine> dynamicInfoCode = DigitalObjectInfoFacade.query(groupCode, context.getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
+ List<ObjectInfoDefine> dynamicInfoCode = DigitalObjectInfoFacade.query(groupCode, AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
|
|
|
//4 计算已采集的和需要采集的信息点占比
|
|
|
//return customSqlService.systemInfoPoins()
|
|
|
Map<String, Integer> hashMap = calculate(dynamicInfoCode, staticInfoCode, admObjList, 1);
|