Rev 34133 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.dao.entity.fofo;import com.spice.profitmandi.dao.enumuration.transaction.UpSaleCallStatus;import com.spice.profitmandi.dao.model.UpsellingReportModel;import javax.persistence.*;import java.io.Serializable;import java.time.LocalDateTime;import java.util.Objects;/*** @author ranu*/@Entity@Table(name = "fofo.upSaleCall")@NamedQueries({@NamedQuery(name = "upSaleCall.checkNumberIsExist", query = "SELECT COUNT(u) FROM UpSaleCall u WHERE u.mobile = :mobile AND u.originalOrderId = :orderId"),@NamedQuery(name = "upSaleCall.checkOrderIsExist", query = "SELECT COUNT(u) FROM UpSaleCall u WHERE u.originalOrderId = :orderId"),})@NamedNativeQueries({@NamedNativeQuery(name = "Upsell.UpsellingReport",query = "SELECT uc.agentId, ucd.agent_id as agentEmail,u.name as partnerName,ua.phone as partnerMobile, ua.state, uc.originalOrderId as orderId, uc.mobile as customerNumber, " +"ucd.created_timestamp as callingDate, coalesce(ucd.disposition,'-') as disposition,coalesce(ucd.remark,'-') as remark," +" coalesce(rp.payment_status, 'Not Found') as paymentStatus, " +"(CASE WHEN ac.create_timestamp IS NOT NULL THEN 'Created' ELSE 'Not Created' END) AS insuranceStatus, " +"coalesce(ip.sale_amount,0) as soldAmount, coalesce(ip.invoice_number,'Not Found') as invoiceNumber, coalesce(ip.serial_number,'Not Found') as serialNumber" +" FROM fofo.upSaleCall uc" +" JOIN fofo.upsell_call_details ucd on uc.id = ucd.upsale_call_id" +" JOIN fofo.fofo_order fo on fo.id = uc.originalOrderId" +" JOIN user.user u on u.id = fo.fofo_id" +" JOIN user.address ua on ua.id = u.default_address_id" +" LEFT JOIN fofo.upsellRazorpayPaymentStatus rp on rp.order_id = uc.originalOrderId" +" LEFT JOIN fofo.upsaleAgentCollection ac on ac.order_id = uc.originalOrderId" +" LEFT JOIN dtr.insurance_policy ip on ip.device_invoice_number = fo.invoice_number" +" WHERE uc.create_timestamp >= :startDate and uc.create_timestamp < :endDate",resultSetMapping = "UpsellingReport"),})@SqlResultSetMappings({@SqlResultSetMapping(name = "UpsellingReport",classes = {@ConstructorResult(targetClass = UpsellingReportModel.class,columns = {@ColumnResult(name = "agentId", type = Integer.class),@ColumnResult(name = "agentEmail", type = String.class),@ColumnResult(name = "partnerName", type = String.class),@ColumnResult(name = "partnerMobile", type = String.class),@ColumnResult(name = "state", type = String.class),@ColumnResult(name = "orderId", type = Integer.class),@ColumnResult(name = "customerNumber ", type = String.class),@ColumnResult(name = "callingDate ", type = String.class),@ColumnResult(name = "disposition ", type = String.class),@ColumnResult(name = "remark ", type = String.class),@ColumnResult(name = "paymentStatus ", type = String.class),@ColumnResult(name = "insuranceStatus ", type = String.class),@ColumnResult(name = "soldAmount ", type = Float.class),@ColumnResult(name = "invoiceNumber ", type = String.class),@ColumnResult(name = "serialNumber ", type = String.class),})})})public class UpSaleCall implements Serializable {private static final long serialVersionUID = 1L;@Id@Column(name = "id")@GeneratedValue(strategy = GenerationType.IDENTITY)private int id;@Column(name = "agentId")private int agentId;@Column(name = "originalOrderId")private int originalOrderId;@Column(name = "mobile")private String mobile;@Column(name = "status")@Enumerated(EnumType.STRING)private UpSaleCallStatus status;@Column(name = "create_timestamp")private LocalDateTime createdTimestamp = LocalDateTime.now();@Column(name = "rescheduled_timestamp")private LocalDateTime rescheduledTimestamp;public int getId() {return id;}public void setId(int id) {this.id = id;}public int getAgentId() {return agentId;}public void setAgentId(int agentId) {this.agentId = agentId;}public String getMobile() {return mobile;}public void setMobile(String mobile) {this.mobile = mobile;}public UpSaleCallStatus getStatus() {return status;}public void setStatus(UpSaleCallStatus status) {this.status = status;}public LocalDateTime getCreatedTimestamp() {return createdTimestamp;}public void setCreatedTimestamp(LocalDateTime createdTimestamp) {this.createdTimestamp = createdTimestamp;}public int getOriginalOrderId() {return originalOrderId;}public void setOriginalOrderId(int originalOrderId) {this.originalOrderId = originalOrderId;}public LocalDateTime getRescheduledTimestamp() {return rescheduledTimestamp;}public void setRescheduledTimestamp(LocalDateTime rescheduledTimestamp) {this.rescheduledTimestamp = rescheduledTimestamp;}@Overridepublic String toString() {return "UpSaleCall{" +"id=" + id +", agentId=" + agentId +", originalOrderId=" + originalOrderId +", mobile='" + mobile + '\'' +", status=" + status +", createdTimestamp=" + createdTimestamp +", rescheduledTimestamp=" + rescheduledTimestamp +'}';}@Overridepublic boolean equals(Object o) {if (this == o) return true;if (o == null || getClass() != o.getClass()) return false;UpSaleCall that = (UpSaleCall) o;return id == that.id && agentId == that.agentId && originalOrderId == that.originalOrderId && Objects.equals(mobile, that.mobile) && status == that.status && Objects.equals(createdTimestamp, that.createdTimestamp) && Objects.equals(rescheduledTimestamp, that.rescheduledTimestamp);}@Overridepublic int hashCode() {return Objects.hash(id, agentId, originalOrderId, mobile, status, createdTimestamp, rescheduledTimestamp);}}