123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package com.persagy.proxy.adm.strategy.relationdata;
- import java.util.List;
- import org.springframework.stereotype.Component;
- import com.fasterxml.jackson.databind.node.ObjectNode;
- import com.persagy.dmp.basic.model.QueryCriteria;
- import com.persagy.dmp.common.model.response.CommonResult;
- import com.persagy.dmp.digital.client.DigitalRelationFacade;
- import com.persagy.dmp.digital.entity.ObjectDigital;
- import com.persagy.dmp.digital.entity.ObjectRelation;
- import com.persagy.proxy.adm.constant.AdmCommonConstant;
- import com.persagy.proxy.adm.constant.AdmObjectInfoConstant;
- import com.persagy.proxy.adm.constant.AdmRelationType;
- import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
- import com.persagy.proxy.adm.model.AdmRelationObject;
- import com.persagy.proxy.adm.service.IRelationReportService;
- /**
- *
- * @version 1.0.0
- * @company persagy
- * @author zhangqiankun
- * @date 2021年9月3日 上午9:42:46
- */
- @Component(value = AdmRelationType.EQ2EQ_EQUIPPOWER_2)
- public class Eq2EqEqBackupRelationObject extends AbstractReportRelationObject {
-
- public Eq2EqEqBackupRelationObject(IRelationReportService relationReportService) {
- super(relationReportService);
- }
- @Override
- public long countRelationObjects(String groupCode, String projectId) {
- QueryCriteria queryCriteria = new QueryCriteria();
- ObjectNode objectNode = OBJECT_MAPPER.createObjectNode();
- objectNode.put("graphCode", AdmRelationTypeEnum.EQ2EQ_EQUIPPOWER_2.getGraphCode());
- objectNode.put("relCode", AdmRelationTypeEnum.EQ2EQ_EQUIPPOWER_2.getRelCode());
- queryCriteria.setCriteria(objectNode);
- queryCriteria.setOnlyCount(true);
-
- CommonResult<List<ObjectRelation>> result = DigitalRelationFacade.queryPrototype(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
- return result == null ? 0 : (result.getCount() == null ? 0 : result.getCount());
- }
-
- @Override
- protected AdmRelationObject handleObjectDigital(ObjectDigital master, ObjectDigital slave, String groupCode, String projectId) {
- throw new UnsupportedOperationException("未实现的策略类");
- }
- @Override
- public Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code) {
- return this.beforeSaveRelationObject(relationObject, AdmRelationTypeEnum.EQ2EQ_EQUIPPOWER_2, groupCode, projectId, code);
- }
- @Override
- protected String checkRelationObject(ObjectNode master, String masterClassCode, ObjectNode slave,
- String slaveClassCode) {
- if (!AdmObjectInfoConstant.CHECK_CLASS_CODES.contains(masterClassCode)) {
- return "主对象不属于低/高压开关柜,请参考规则";
- }
- return null;
- }
-
- }
|