CollectProperties.java 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.shkpr.service.aimodelpower.commproperties;
  2. import lombok.Getter;
  3. import lombok.Setter;
  4. import lombok.ToString;
  5. import org.springframework.boot.context.properties.ConfigurationProperties;
  6. import org.springframework.context.annotation.Configuration;
  7. import java.util.List;
  8. import java.util.Map;
  9. import java.util.stream.Collectors;
  10. /**
  11. * 采集属性
  12. *
  13. * @author 欧阳劲驰
  14. * @since 1.0.4
  15. */
  16. @ConfigurationProperties("collect")
  17. @Configuration
  18. @Getter
  19. @Setter
  20. @ToString
  21. public class CollectProperties {
  22. /**
  23. * 最大水量
  24. */
  25. private Double maxWater = 20000d;
  26. /**
  27. * 最小水量
  28. */
  29. private Double minWater = -20000d;
  30. /**
  31. * 关闭标签
  32. */
  33. private List<String> closeTags;
  34. /**
  35. * 自供标签
  36. */
  37. private List<CollectTagAttr> supplySelfTags;
  38. /**
  39. * 供入标签
  40. */
  41. private List<CollectTagAttr> supplyInTags;
  42. /**
  43. * 供出标签
  44. */
  45. private List<CollectTagAttr> supplyOutTags;
  46. public Map<String, List<String>> getSupplySelfTagsMap() {
  47. return supplySelfTags.stream().collect(Collectors.toMap(CollectProperties.CollectTagAttr::getName, CollectProperties.CollectTagAttr::getValues));
  48. }
  49. public Map<String, List<String>> getSupplyInTagsMap() {
  50. return supplyInTags.stream().collect(Collectors.toMap(CollectProperties.CollectTagAttr::getName, CollectProperties.CollectTagAttr::getValues));
  51. }
  52. public Map<String, List<String>> getSupplyOutTagsMap() {
  53. return supplyOutTags.stream().collect(Collectors.toMap(CollectProperties.CollectTagAttr::getName, CollectProperties.CollectTagAttr::getValues));
  54. }
  55. /**
  56. * 采集标签
  57. */
  58. @Getter
  59. @Setter
  60. public static class CollectTagAttr {
  61. /**
  62. * 名称
  63. */
  64. private String name;
  65. /**
  66. * 值
  67. */
  68. private List<String> values;
  69. }
  70. }