Blame | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.user;import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.Table;import javax.persistence.UniqueConstraint;import java.time.LocalDateTime;/*** Do-not-call register (SOP §17). A retailer who asks not to be contacted goes here and is blocked* from every future dial, on any lead.** <p>Keyed on the <b>mobile number</b>, not the lead: the same retailer can appear as several leads* (re-created after a drop, entered by two different agents, Path A and Path B), and a block that* only covered one row would be no block at all. Numbers are stored as the last 10 digits so* {@code +91 98…}, {@code 098…} and {@code 98…} all collide on the same row.** <p>Written when an agent dispositions {@code DO_NOT_CALL}, and checked by the dialer pre-check* before any call is placed. Before this table existed {@code DO_NOT_CALL} only moved the lead's* stage — nothing stopped a re-dial.*/@Entity@Table(name = "user.lead_dnd",uniqueConstraints = {@UniqueConstraint(columnNames = "mobile")})public class LeadDnd {@Id@Column(name = "id", unique = true, updatable = false)@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;/** Last 10 digits, normalised. The block key. */@Column(name = "mobile")private String mobile;/** The lead that triggered the block — provenance only; the block is number-wide. */@Column(name = "lead_id")private Integer leadId;/** Who blocked it. */@Column(name = "auth_id")private Integer authId;/** DISPOSITION (agent marked DO_NOT_CALL) | AUDIT (audit team) | REGULATOR (NCPR/DLT import). */@Column(name = "source")private String source;@Column(name = "reason")private String reason;@Column(name = "created_timestamp")private LocalDateTime createdTimestamp;/** Reduce any input to the comparable last-10-digit form. Null/short input returns null. */public static String normalise(String mobile) {if (mobile == null) {return null;}String digits = mobile.replaceAll("\\D", "");if (digits.length() < 10) {return null;}return digits.substring(digits.length() - 10);}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getMobile() {return mobile;}public void setMobile(String mobile) {this.mobile = mobile;}public Integer getLeadId() {return leadId;}public void setLeadId(Integer leadId) {this.leadId = leadId;}public Integer getAuthId() {return authId;}public void setAuthId(Integer authId) {this.authId = authId;}public String getSource() {return source;}public void setSource(String source) {this.source = source;}public String getReason() {return reason;}public void setReason(String reason) {this.reason = reason;}public LocalDateTime getCreatedTimestamp() {return createdTimestamp;}public void setCreatedTimestamp(LocalDateTime createdTimestamp) {this.createdTimestamp = createdTimestamp;}@Overridepublic String toString() {return "LeadDnd [id=" + id + ", mobile=" + mobile + ", source=" + source + ", leadId=" + leadId + "]";}}