PtlCrawlerApi.java 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package com.ydtech.modules.protocol.entity.po;
  2. import com.baomidou.mybatisplus.annotation.IdType;
  3. import com.baomidou.mybatisplus.annotation.TableField;
  4. import com.baomidou.mybatisplus.annotation.TableId;
  5. import com.baomidou.mybatisplus.annotation.TableName;
  6. import com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType;
  7. import com.ydtech.modules.protocol.entity.vo.PtlCrawlerApiSaveVo;
  8. import lombok.AllArgsConstructor;
  9. import lombok.Data;
  10. import lombok.NoArgsConstructor;
  11. import java.io.Serializable;
  12. import java.util.List;
  13. import java.util.stream.Collectors;
  14. /**
  15. * python对接接口
  16. *
  17. * @TableName ptl_crawler_api
  18. */
  19. @TableName(value = "ptl_crawler_api")
  20. @Data
  21. @AllArgsConstructor
  22. @NoArgsConstructor
  23. public class PtlCrawlerApi implements Serializable {
  24. /**
  25. *
  26. */
  27. @TableId(value = "id", type = IdType.AUTO)
  28. private String id;
  29. /**
  30. * 模板id
  31. */
  32. @TableField(value = "template_id")
  33. private String templateId;
  34. /**
  35. * 1、归属配置;2、报价;3、影像上传;4、核保;5、缴费查询;6、保单下载;7、非车险查询
  36. */
  37. @TableField(value = "api_type")
  38. private Integer apiType;
  39. /**
  40. * api名称
  41. */
  42. @TableField(value = "api_name")
  43. private String apiName;
  44. /**
  45. * 请求路劲
  46. */
  47. @TableField(value = "url")
  48. private String url;
  49. @TableField(exist = false)
  50. private static final long serialVersionUID = 1L;
  51. public static List<PtlCrawlerApi> toPtlCrawlerApiList(String templateId, List<PtlCrawlerApiSaveVo> ptlCrawlerApiSaveVoList) {
  52. return ptlCrawlerApiSaveVoList.stream().map(a -> new PtlCrawlerApi(templateId, a)).collect(Collectors.toList());
  53. }
  54. public PtlCrawlerApi(String templateId, PtlCrawlerApiSaveVo ptlCrawlerApiSaveVo) {
  55. this.templateId = templateId;
  56. this.apiType = ptlCrawlerApiSaveVo.getApiType();
  57. this.apiName = Enum.valueOf(PtlCrawlerApiType.class, "API_" + ptlCrawlerApiSaveVo.getApiType()).getDesc();
  58. this.url = ptlCrawlerApiSaveVo.getUrl();
  59. }
  60. }