package com.persagy.proxy.adm.service.impl; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.persagy.dmp.basic.model.QueryCriteria; import com.persagy.dmp.digital.entity.ObjectRelationProjectCal; import com.persagy.proxy.adm.model.AdmModelRel; import com.persagy.proxy.adm.request.AdmResponse; import com.persagy.proxy.adm.service.IAdmObjectRelationCalService; import com.persagy.proxy.common.entity.InstanceUrlParam; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.util.List; import java.util.Set; /** * 标记关系计算 * * @author:linhuili * @date:2021/10/15 */ @Service @Slf4j public class AdmObjectRelationCalServiceImpl extends AbstractAdmBaseServiceImpl implements IAdmObjectRelationCalService { /** * 根据关系类型查询标记计算关系 * @param context * @param relationType * @return */ @Override public List queryCalRelByRelationType(InstanceUrlParam context, Set relationType){ //设置查询条件 QueryCriteria queryCriteria = new QueryCriteria(); ObjectNode criteria = JsonNodeFactory.instance.objectNode(); ArrayNode arrayNode = criteria.putObject("relCode").putArray("$in"); relationType.stream().forEach(relCode -> arrayNode.add(relCode)); queryCriteria.setCriteria(criteria); //查询标记计算关系 AdmResponse admResponse = doQueryRelationProjectCal(context, queryCriteria, ObjectRelationProjectCal.class); return (List)admResponse.getContent(); } /** * 更新标记计算关系 * @param objectRelationProjectCals */ @Override public void updateObjectCalRel(InstanceUrlParam context, List objectRelationProjectCals) { doUpdateRelationProjectCal(context, ObjectRelationProjectCal.class, objectRelationProjectCals); } }