AdmObjectRelationCalServiceImpl.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package com.persagy.proxy.adm.service.impl;
  2. import com.fasterxml.jackson.databind.node.ArrayNode;
  3. import com.fasterxml.jackson.databind.node.JsonNodeFactory;
  4. import com.fasterxml.jackson.databind.node.ObjectNode;
  5. import com.persagy.dmp.basic.model.QueryCriteria;
  6. import com.persagy.dmp.digital.entity.ObjectRelationProjectCal;
  7. import com.persagy.proxy.adm.model.AdmModelRel;
  8. import com.persagy.proxy.adm.request.AdmResponse;
  9. import com.persagy.proxy.adm.service.IAdmObjectRelationCalService;
  10. import com.persagy.proxy.common.entity.InstanceUrlParam;
  11. import lombok.extern.slf4j.Slf4j;
  12. import org.springframework.stereotype.Service;
  13. import java.util.List;
  14. import java.util.Set;
  15. /**
  16. * 标记关系计算
  17. *
  18. * @author:linhuili
  19. * @date:2021/10/15
  20. */
  21. @Service
  22. @Slf4j
  23. public class AdmObjectRelationCalServiceImpl extends AbstractAdmBaseServiceImpl<ObjectRelationProjectCal> implements IAdmObjectRelationCalService {
  24. /**
  25. * 根据关系类型查询标记计算关系
  26. * @param context
  27. * @param relationType
  28. * @return
  29. */
  30. @Override
  31. public List<ObjectRelationProjectCal> queryCalRelByRelationType(InstanceUrlParam context, Set<String> relationType){
  32. //设置查询条件
  33. QueryCriteria queryCriteria = new QueryCriteria();
  34. ObjectNode criteria = JsonNodeFactory.instance.objectNode();
  35. ArrayNode arrayNode = criteria.putObject("relCode").putArray("$in");
  36. relationType.stream().forEach(relCode -> arrayNode.add(relCode));
  37. queryCriteria.setCriteria(criteria);
  38. //查询标记计算关系
  39. AdmResponse admResponse = doQueryRelationProjectCal(context, queryCriteria, ObjectRelationProjectCal.class);
  40. return (List<ObjectRelationProjectCal>)admResponse.getContent();
  41. }
  42. /**
  43. * 更新标记计算关系
  44. * @param objectRelationProjectCals
  45. */
  46. @Override
  47. public void updateObjectCalRel(InstanceUrlParam context, List<ObjectRelationProjectCal> objectRelationProjectCals) {
  48. doUpdateRelationProjectCal(context, ObjectRelationProjectCal.class, objectRelationProjectCals);
  49. }
  50. }