package com.ydtech.modules.protocol.entity.po; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; import com.ydtech.modules.protocol.entity.dto.PtlAgreementAttributionDto; import lombok.*; import java.io.Serializable; /** * 协议归属信息 * * @TableName ptl_agreement_attribution */ @TableName(value = "ptl_agreement_attribution", autoResultMap = true) @Data @ToString @EqualsAndHashCode @AllArgsConstructor @NoArgsConstructor public class PtlAgreementAttribution implements Serializable { /** * 协议id */ @TableId(value = "id") private String id; /** * 保险公司ID */ @TableField(value = "ins_company_id") private String insCompanyId; /** * 保险公司名称 */ @TableField(value = "ins_company_name") private String insCompanyName; /** * 模板id */ @TableField(value = "template_id") private String templateId; /** * api类型(1、api对接,2、python对接) */ @TableField(value = "api_type") private Integer apiType; /** * 字段集 */ @TableField(value = "fields", typeHandler = FastjsonTypeHandler.class) private JSONArray fields; /** * 保险公司账号 */ @TableField(value = "username") private String username; /** * 保险公司密码 */ @TableField(value = "password") private String password; @TableField(exist = false) private static final long serialVersionUID = 1L; public PtlAgreementAttribution(String agreementId, String insCompanyId, String insCompanyName, PtlAgreementAttributionDto ptlAgreementAttributionDto) { this.id = agreementId; this.insCompanyId = insCompanyId; this.insCompanyName = insCompanyName; this.templateId = ptlAgreementAttributionDto.getTemplateId(); this.apiType = ptlAgreementAttributionDto.getApiType(); this.fields = JSON.parseArray(JSON.toJSONString(ptlAgreementAttributionDto.getFields())); this.username = ptlAgreementAttributionDto.getUsername(); this.password = ptlAgreementAttributionDto.getPassword(); } public PtlAgreementAttribution(PtlInsAttributionTemplate ptlInsAttributionTemplate) { this.id = ptlInsAttributionTemplate.getId(); this.insCompanyId = ptlInsAttributionTemplate.getInsCompanyId(); this.insCompanyName = ptlInsAttributionTemplate.getInsCompanyName(); this.templateId = ptlInsAttributionTemplate.getId(); this.apiType = ptlInsAttributionTemplate.getApiType(); this.fields = ptlInsAttributionTemplate.getFields(); } }