package com.ydtech.modules.order.entity; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; 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.fasterxml.jackson.annotation.JsonFormat; import com.ydtech.constants.enums.dict.InsOrderStatusEnum; import com.ydtech.modules.ins.model.vo.QuoteRespVo; import com.ydtech.modules.order.constants.UnderwritingStatus; import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution; import com.ydtech.utils.StringUtils; import com.ydtech.utils.idgen.IdGenerate; import io.swagger.annotations.ApiModel; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.Date; /** * 报价渠道 * * @TableName ins_area_company */ @TableName(value = "ins_area_company", autoResultMap = true) @Data @ApiModel(value = "报价渠道") @NoArgsConstructor @AllArgsConstructor public class InsAreaCompany implements Serializable { @TableField(exist = false) private static final long serialVersionUID = -6827009009645748787L; /** * 主键 */ @TableId(value = "id") private String id; /** * 订单号 */ @TableField(value = "orderno") private String orderno; /** * 协议id */ @TableField(value = "agreement_id") private String agreementId; /** * 请求类型 */ @TableField(value = "api_type") private Integer apiType; /** * 订单状态 * * @see com.ydtech.constants.enums.dict.InsOrderStatusEnum */ @TableField(value = "orderstatus") private String orderstatus; /** * 保险公司编号 */ @TableField(value = "company_id") private String companyId; /** * 保险名称 */ @TableField(value = "inscompany") private String inscompany; /** * 请求报文 */ @TableField(value = "reqtxt", typeHandler = FastjsonTypeHandler.class) private JSONObject reqtxt; /** * 响应报文 */ @TableField(value = "reptxt", typeHandler = FastjsonTypeHandler.class) private JSONObject reptxt; /** * 交强投保单号 */ @TableField(value = "jqapplyno") private String jqapplyno; /** * 交强保单号 */ @TableField(value = "jqpolicyno") private String jqpolicyno; /** * 商业投保单号 */ @TableField(value = "syapplyno") private String syapplyno; /** * 商业保单号 */ @TableField(value = "sypolicyno") private String sypolicyno; /** * 交叉销售保单信息 */ @TableField(value = "cross_insurance", typeHandler = FastjsonTypeHandler.class) private JSONArray crossInsurance; /** * 驾意险 */ @TableField(value = "accident_info", typeHandler = FastjsonTypeHandler.class) private JSONArray accidentInfo; /** * 交强险商业险 */ @TableField(value = "riskinfo", typeHandler = FastjsonTypeHandler.class) private JSONArray riskinfo; /** * 商业险信息 */ @TableField(value = "kindinfo", typeHandler = FastjsonTypeHandler.class) private JSONArray kindinfo; /** * 交强险费用 */ @TableField(value = "jqpremium") private BigDecimal jqpremium; /** * 商业险费用 */ @TableField(value = "sypremium") private BigDecimal sypremium; /** * 驾意险 */ @TableField(value = "jypremium") private BigDecimal jypremium; /** * 车船税费用 */ @TableField(value = "taxamount") private BigDecimal taxamount; /** * 总保费 */ @TableField(value = "sumpremium") private BigDecimal sumpremium; /** * 交强优惠比例 */ @TableField(value = "jqdiscountrate") private Double jqdiscountrate; /** * 商业优惠比例 */ @TableField(value = "sydiscountrate") private Double sydiscountrate; /** * 交强手续费比例 */ @TableField(value = "feerate") private Double feerate; /** * 商业手续费比例 */ @TableField(value = "disrate") private Double disrate; /** * 核保人 */ @TableField(value = "auditid") private String auditid; /** * 核保人姓名 */ @TableField(value = "auditname") private String auditname; /** * 核保时间 */ @TableField(value = "audittime") private LocalDateTime audittime; /** * 核保意见 */ @TableField(value = "auditopinion") private String auditopinion; /** * 交强特别约定 */ @TableField(value = "jqappoint") private String jqappoint; /** * 商业特别约定 */ @TableField(value = "syappoint") private String syappoint; /** * 创建时间 */ @TableField(value = "createtime") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime createtime; /** * 支付链接 */ @TableField(value = "payment_link") private String paymentLink; /** * 支付时间 */ @TableField(value = "pay_date") private LocalDateTime payDate; /** * 签单时间(支付二维生成时间) */ @TableField(value = "signing_time") private LocalDateTime signingTime; /** * 保险公司订单号 * lig 新增字段 2023-02-24 */ @TableField(value = "ins_order_no") private String insOrderNo; /** * */ @TableField(value = "attribution_id") private String attributionId; /** * 欠税 */ @TableField(value = "tax_arrears", typeHandler = FastjsonTypeHandler.class) private JSONArray taxArrears; /** * 交强险起期 * lig 新增字段 2023-09-14 */ @TableField(value = "jq_start_date") private String jqStartDate; /** * 交强险止期 * lig 新增字段 2023-09-14 */ @TableField(value = "jq_end_date") private String jqEndDate; /** * 商业险起期 * lig 新增字段 2023-09-14 */ @TableField(value = "sy_start_date") private String syStartDate; /** * 商业险止期 * lig 新增字段 2023-09-14 */ @TableField(value = "sy_end_date") private String syEndDate; /** * 出险 字符串 信息 * lig 新增字段 2023-10-10 */ @TableField(value = "accident_str_info") private String accidentStrInfo; /** * 评分 * lig 新增字段 2023-10-10 */ @TableField(value = "score") private String score; /** * 交强类型评分 */ @TableField(value = "jq_score") private String jqScore; /** * 商业类型评分 */ @TableField(value = "sy_score") private String syScore; /** * 总赔付率 */ @TableField(value = "loss_ration") private double lossRation; /** * 交强赔付率 */ @TableField(value = "jq_loss_ration") private double jqLossRation; /** * 商业赔付率 */ @TableField(value = "sy_loss_ration") private double syLossRation; /** * 总折扣率 */ @TableField(value = "total_adjust_rate") private double totalAdjustRate; /** * 交强险折扣 */ @TableField(value = "jq_adjust_rate") private double jqAdjustRate; /** * 商业险折扣 */ @TableField(value = "sy_adjust_rate") private double syAdjustRate; @TableField(value = "inside_order_status") private Integer insideOrderStatus; @TableField(value = "inside_pay_time") private String insidePayTime; /** * 紫金能源车(鼎然-车辆风险评分 add by hxl 2024-04-09 */ @TableField(value = "ubi_predicted_info_score") private String ubiPredictedInfoScore; /** * 太平洋绿黄红区间评分 */ @TableField(value = "tp_color_score") private String tpColorScore; /** * 紫金 渤海真假单交 */ @TableField(value = "is_djq") private String isDjq; /** * 添加操作人 */ @TableField(value = "operator_id") private String operatorId; /** * 操作时间 */ @TableField(value = "operator_time") private Date operatorTime; /** * 添加操作人 */ @TableField(value = "operator_name") private String operatorName; /** * 新操作人 */ @TableField(value = "new_operator_id") private String newOperatorId; /** * 新操作人 */ @TableField(value = "new_operator_name") private String newOperatorName; /** * 报价成功或者失败状态 */ //@TableField(value = "error_status") //private Integer errorStatus; // add by hxl 2024-05-10 子订单添加产品信息 更新 险种信息从子订单中获取 /** * 产品id */ @TableField(value = "productid") private String productid; /** * 产品名称 */ @TableField(value = "product") private String product; /** * 交强续保 * * @see com.ydtech.constants.enums.dict.insurance.Renewal */ @TableField(value = "jq_renewal") private String jqRenewal; /** * 商业续保 * * @see com.ydtech.constants.enums.dict.insurance.Renewal */ @TableField(value = "sy_renewal") private String syRenewal; /** * 交强出险次数 */ @TableField(value = "jq_claims") private String jqClaims; /** * 商业出险次数 */ @TableField("sy_claims") private String syClaims; /** * 疑问订单标注 */ @TableField("problem_order") private String problemOrder; @TableField(exist = false) private String licenseno; @TableField(exist = false) private String rejectinfo; /*** * 平安流程id */ @TableField("flowid") private String flowid; /*** * 平安通知单号 */ @TableField("notice_no") private String noticeNo; /** * 非车信息 */ @TableField(exist = false) private InsAreaCompanyAccidentalDriving accidentalDriving; /** * 业务员 */ @TableField(exist = false) private String userName; /** * 业务员ID */ @TableField(exist = false) private String userId; /*** * 外部状态 0 暂存 1 驳回 */ @TableField(exist = false) private String orderExternalStatus; /** * 录入状态 1 车险录入 2 待客录单 3 外部订单 */ @TableField(value = "entry_status") private Integer entryStatus; /** * @see com.ydtech.modules.order.constants.UnderwritingStatus * 核保状态 */ @TableField("underwriting_status") private Integer underwritingStatus; /** * @see com.ydtech.modules.order.constants.PcPhoneStatus * 报价状态 0 pc 1.app */ @TableField("order_source") private Integer orderSource; /** * 0 删除 1 正常 * 删除订单 */ @TableField(value = "del_flag") private String delFlag; public InsAreaCompany(QuoteRespVo quoteRespVo, PtlAgreementAttribution ptlAgreementAttribution) { this.id = IdGenerate.nextId(); this.orderno = quoteRespVo.getOrderno(); this.agreementId = ptlAgreementAttribution.getId(); this.apiType = ptlAgreementAttribution.getApiType(); this.companyId = ptlAgreementAttribution.getInsCompanyId(); this.inscompany = ptlAgreementAttribution.getInsCompanyName(); this.jqpremium = BigDecimal.valueOf(quoteRespVo.getJqPremium()); this.sypremium = BigDecimal.valueOf(quoteRespVo.getSyPremium()); this.jypremium = BigDecimal.valueOf(quoteRespVo.getJyPremium()); this.taxamount = BigDecimal.valueOf(quoteRespVo.getTaxAmount()); this.sumpremium = BigDecimal.valueOf(quoteRespVo.getSumPermium()); this.accidentInfo = JSON.parseArray(JSON.toJSONString(quoteRespVo.getAccidentInfo())); this.riskinfo = JSON.parseArray(JSON.toJSONString(quoteRespVo.getRiskList())); this.kindinfo = JSON.parseArray(JSON.toJSONString(quoteRespVo.getKindList())); this.orderstatus = InsOrderStatusEnum.QUOTE_ING.getCode(); this.jqStartDate = quoteRespVo.getStartDateJq(); this.jqEndDate = quoteRespVo.getEndDateJq(); this.syStartDate = quoteRespVo.getStartDateSy(); this.syEndDate = quoteRespVo.getEndDateSy(); this.accidentStrInfo = quoteRespVo.getAccidentInfoStr(); // 评分 this.score = quoteRespVo.getILogPreUdwMess(); this.jqScore = quoteRespVo.getJqScore(); this.syScore = quoteRespVo.getSyScore(); // 赔付率 this.lossRation = quoteRespVo.getLossRation(); this.jqLossRation = quoteRespVo.getJqLossRation(); this.syLossRation = quoteRespVo.getSyLossRation(); // 保单号 this.jqapplyno = quoteRespVo.getJqApplyNo(); this.syapplyno = quoteRespVo.getSyApplyNo(); // 折扣率 this.totalAdjustRate = quoteRespVo.getTotalAdjustRate(); this.jqAdjustRate = StringUtils.parseDouble(quoteRespVo.getJqAdjustRate()); this.syAdjustRate = StringUtils.parseDouble(quoteRespVo.getSyAdjustRate()); this.jqRenewal = StringUtils.isEmpty(quoteRespVo.getJqRenewal()) ? null : quoteRespVo.getJqRenewal(); this.syRenewal = StringUtils.isEmpty(quoteRespVo.getSyRenewal()) ? null : quoteRespVo.getSyRenewal(); if (StringUtils.isNotEmpty(quoteRespVo.getJqClaims())) { this.jqClaims = quoteRespVo.getJqClaims(); } if (StringUtils.isNotEmpty(quoteRespVo.getSyClaims())) { this.syClaims = quoteRespVo.getSyClaims(); } if (StringUtils.isNotEmpty(quoteRespVo.getIszdj())) { this.isDjq = quoteRespVo.getIszdj(); } } public void setPaymentLink(String paymentLink) { this.signingTime = LocalDateTime.now(); this.paymentLink = paymentLink; } }