SystemParamModel.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package jnpf.model;
  2. import jnpf.constant.DataInterfaceVarConst;
  3. import jnpf.util.StringUtil;
  4. import lombok.Data;
  5. import java.util.ArrayList;
  6. import java.util.List;
  7. import java.util.Set;
  8. import java.util.stream.Collectors;
  9. @Data
  10. public class SystemParamModel {
  11. public static final Set<String> MARKERS = Set.of(
  12. DataInterfaceVarConst.CURRENTTIME,
  13. DataInterfaceVarConst.ORGANDSUB,
  14. DataInterfaceVarConst.ORGANIZEANDPROGENY,
  15. DataInterfaceVarConst.USERANDSUB,
  16. DataInterfaceVarConst.USERANDPROGENY,
  17. DataInterfaceVarConst.POSITIONANDSUB,
  18. DataInterfaceVarConst.POSITIONANDPROGENY,
  19. DataInterfaceVarConst.USER,
  20. DataInterfaceVarConst.POSITIONID,
  21. DataInterfaceVarConst.ORG
  22. );
  23. private String str;
  24. private List<String> list;
  25. /**
  26. * 全量系统参数查询
  27. */
  28. public SystemParamModel() {
  29. this.list = new ArrayList<>(MARKERS);
  30. }
  31. /**
  32. * 字符串过滤查询
  33. * @param str 字符串
  34. */
  35. public SystemParamModel(String str) {
  36. this.list = StringUtil.isNotEmpty(str) ?
  37. MARKERS.stream().filter(str::contains).collect(Collectors.toList())
  38. : new ArrayList<>();
  39. }
  40. /**
  41. * 集合过滤查询
  42. * @param list 字符串集合
  43. */
  44. public SystemParamModel(List<String> list) {
  45. List<String> needList=new ArrayList<>();
  46. for (String string : list) {
  47. needList.addAll(MARKERS.stream().filter(string::contains).collect(Collectors.toList()));
  48. }
  49. this.list = needList.stream().distinct().collect(Collectors.toList());
  50. }
  51. }