AbstractRelationObject.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package com.persagy.proxy.adm.strategy.relationdata;
  2. import java.util.List;
  3. import com.fasterxml.jackson.databind.node.ObjectNode;
  4. import com.persagy.dmp.basic.dto.RequestData;
  5. import com.persagy.dmp.digital.client.DigitalObjectFacade;
  6. import com.persagy.dmp.digital.client.DigitalRelationFacade;
  7. import com.persagy.dmp.digital.entity.ObjectDigital;
  8. import com.persagy.dmp.digital.entity.ObjectRelation;
  9. import com.persagy.proxy.adm.constant.AdmCommonConstant;
  10. import com.persagy.proxy.adm.model.AdmRelationObject;
  11. import com.persagy.proxy.adm.service.IRelationReportService;
  12. import cn.hutool.core.collection.CollectionUtil;
  13. /**
  14. * 普通操作抽象类
  15. *
  16. * @version 1.0.0
  17. * @company persagy
  18. * @author zhangqiankun
  19. * @date 2021年9月2日 下午11:00:26
  20. */
  21. public abstract class AbstractRelationObject implements RelationObjectStrategy {
  22. protected IRelationReportService relationReportService;
  23. public AbstractRelationObject(IRelationReportService reportDownloadService) {
  24. this.relationReportService = reportDownloadService;
  25. }
  26. @Override
  27. public void queryPageObjectInfo(List<ObjectDigital> masterObjs, RequestData requestData, String groupCode, String projectId, Long page) {
  28. requestData.setPage(page);
  29. List<ObjectDigital> objectDigitals = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCode(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
  30. if (CollectionUtil.isEmpty(objectDigitals)) {
  31. return;
  32. }
  33. masterObjs.addAll(objectDigitals);
  34. this.queryPageObjectInfo(masterObjs, requestData, groupCode, projectId, ++page);
  35. }
  36. @Override
  37. public boolean saveRelationObject(ObjectNode relationObject, String groupCode, String projectId) {
  38. ObjectRelation objectRelation = DigitalRelationFacade.createOne(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, relationObject);
  39. return objectRelation != null;
  40. }
  41. @Override
  42. public boolean saveRelationObjects(List<ObjectNode> relationObjects, String groupCode, String projectId) {
  43. List<ObjectRelation> create = DigitalRelationFacade.create(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, relationObjects);
  44. return CollectionUtil.isNotEmpty(create);
  45. }
  46. /**************************************************** 默认不实现的类 *******************************************************/
  47. @Override
  48. public List<AdmRelationObject> findRelationObject(String groupCode, String projectId) {
  49. throw new UnsupportedOperationException("未实现的策略类");
  50. }
  51. @Override
  52. public Object beforeSaveRelationObject(AdmRelationObject relationObject, String groupCode, String projectId, String code) {
  53. throw new UnsupportedOperationException("未实现的策略类");
  54. }
  55. }