|
@@ -6,18 +6,21 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
import com.google.common.collect.Sets;
|
|
|
import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
import com.persagy.dmp.basic.utils.JsonNodeUtils;
|
|
|
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.define.client.DigitalDefineFacade;
|
|
|
import com.persagy.dmp.define.entity.ObjectInfoDefine;
|
|
|
import com.persagy.dmp.define.entity.ObjectTypeDefine;
|
|
|
import com.persagy.dmp.digital.client.DigitalObjectFacade;
|
|
|
import com.persagy.dmp.digital.entity.ObjectDigital;
|
|
|
import com.persagy.proxy.adm.constant.AdmCommonConstant;
|
|
|
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
|
|
|
import com.persagy.proxy.adm.request.AdmCreateRequest;
|
|
|
import com.persagy.proxy.adm.request.AdmQueryCriteria;
|
|
|
import com.persagy.proxy.adm.request.AdmResponse;
|
|
@@ -123,6 +126,40 @@ public class AdmEquipmentController {
|
|
|
//vos = service.doUpdateEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
|
|
|
//针对设备更新时,所有更新的字段都放到信息点中的情况特殊处理
|
|
|
if(CollUtil.isNotEmpty(vos)){
|
|
|
+ Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
|
|
|
+ AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2BD;
|
|
|
+ String graphCode = typeEnum.getGraphCode();
|
|
|
+ QueryCriteria criteria = new QueryCriteria();
|
|
|
+ ObjectNode node = JsonNodeFactory.instance.objectNode();
|
|
|
+ node.put("graphCode", graphCode);
|
|
|
+ admEquipmentMap.keySet().stream().forEach(equipId -> {
|
|
|
+ node.put("relCode", "Eq2Bd");
|
|
|
+ node.put("objFrom", equipId);
|
|
|
+ criteria.setCriteria(node);
|
|
|
+ relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
|
|
|
+
|
|
|
+ node.put("relCode", "Eq2Fl");
|
|
|
+ node.put("objFrom", equipId);
|
|
|
+ criteria.setCriteria(node);
|
|
|
+ relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
|
|
|
+ });
|
|
|
+
|
|
|
+ List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
|
|
|
+ admEquipmentMap.keySet().stream().forEach(equipId -> {
|
|
|
+ if(StrUtil.isNotEmpty(admEquipmentMap.get(equipId).getBuildingId())){
|
|
|
+ RelationDTO relationbd = new RelationDTO(null, graphCode, "Eq2Bd", null, equipId, admEquipmentMap.get(equipId).getBuildingId());
|
|
|
+ relationDTOList.add(relationbd);
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(admEquipmentMap.get(equipId).getFloorId())) {
|
|
|
+ RelationDTO relationfl = new RelationDTO(null, graphCode, "Eq2Fl", null, equipId, admEquipmentMap.get(equipId).getFloorId());
|
|
|
+ relationDTOList.add(relationfl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if(CollUtil.isNotEmpty(relationDTOList)){
|
|
|
+ relationService.doSave(AdmContextUtil.toDmpContext(), relationDTOList);
|
|
|
+ }
|
|
|
+
|
|
|
List<AdmEquipment> equipmentList = new ArrayList<>(vos.size());
|
|
|
vos.stream().forEach(equipment -> {
|
|
|
if(CollUtil.isNotEmpty(equipment.getInfos())){
|
|
@@ -235,10 +272,7 @@ public class AdmEquipmentController {
|
|
|
|
|
|
/**
|
|
|
* 设备上传excel识别静态信息点
|
|
|
- *
|
|
|
- * @param relType
|
|
|
- * @param code
|
|
|
- * @param zoneType
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @param response
|
|
|
*/
|