PtlCrawlerApi.java 1.9 KB

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