package com.ydtech.modules.protocol.entity.po; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ydtech.modules.protocol.entity.constants.PtlCrawlerApiType; import com.ydtech.modules.protocol.entity.vo.PtlCrawlerApiSaveVo; import lombok.Data; import java.io.Serializable; import java.util.List; import java.util.stream.Collectors; /** * python对接接口 * * @TableName ptl_crawler_api */ @TableName(value = "ptl_crawler_api") @Data public class PtlCrawlerApi implements Serializable { /** * */ @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 模板id */ @TableField(value = "template_id") private Long templateId; /** * 1、归属配置;2、报价;3、影像上传;4、核保;5、缴费查询;6、保单下载;7、非车险查询 */ @TableField(value = "api_type") private Integer apiType; /** * api名称 */ @TableField(value = "api_name") private String apiName; /** * 请求路劲 */ @TableField(value = "url") private String url; @TableField(exist = false) private static final long serialVersionUID = 1L; public static List toPtlCrawlerApiList(Long templateId, List ptlCrawlerApiSaveVoList){ return ptlCrawlerApiSaveVoList.stream().map(a-> new PtlCrawlerApi(templateId, a)).collect(Collectors.toList()); } public PtlCrawlerApi(Long templateId, PtlCrawlerApiSaveVo ptlCrawlerApiSaveVo) { this.templateId = templateId; this.apiType = ptlCrawlerApiSaveVo.getApiType(); this.apiName = Enum.valueOf(PtlCrawlerApiType.class, "API_" + ptlCrawlerApiSaveVo.getApiType()).getDesc(); this.url = ptlCrawlerApiSaveVo.getUrl(); } }