| 37499 |
ranu |
1 |
package com.spice.profitmandi.dao.entity.inventory;
|
|
|
2 |
|
|
|
3 |
import javax.persistence.Column;
|
|
|
4 |
import javax.persistence.Entity;
|
|
|
5 |
import javax.persistence.GeneratedValue;
|
|
|
6 |
import javax.persistence.GenerationType;
|
|
|
7 |
import javax.persistence.Id;
|
|
|
8 |
import javax.persistence.Table;
|
|
|
9 |
import java.time.LocalDateTime;
|
|
|
10 |
import java.util.Objects;
|
|
|
11 |
|
|
|
12 |
/**
|
|
|
13 |
* Daily target snapshot for one Sales-hierarchy person (ASM / CM / DM / BM /
|
|
|
14 |
* RSM / NSM) at one warehouse, split by movement class — mirrors
|
|
|
15 |
* {@link RbmTargets} but rolled up to a manager. Written each day by the
|
|
|
16 |
* cron chain: {@code pushRbmTargets} → {@code pushSalesTargets}. The Sales
|
|
|
17 |
* daily target is the sum of persisted RBM daily targets for the RBMs in
|
|
|
18 |
* that manager's downline for the same warehouse.
|
|
|
19 |
*
|
|
|
20 |
* <p>Table DDL (run once against the target DB):
|
|
|
21 |
* <pre>
|
|
|
22 |
* CREATE TABLE inventory.sales_targets (
|
|
|
23 |
* id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
|
24 |
* sales_auth_id INT NOT NULL,
|
|
|
25 |
* sales_name VARCHAR(128),
|
|
|
26 |
* role VARCHAR(8),
|
|
|
27 |
* warehouse_id INT NOT NULL,
|
|
|
28 |
* hid_target FLOAT DEFAULT 0,
|
|
|
29 |
* fastmoving_target FLOAT DEFAULT 0,
|
|
|
30 |
* running_target FLOAT DEFAULT 0,
|
|
|
31 |
* slowmoving_target FLOAT DEFAULT 0,
|
|
|
32 |
* other_target FLOAT DEFAULT 0,
|
|
|
33 |
* create_timestamp DATETIME NOT NULL,
|
|
|
34 |
* KEY idx_sales_created (sales_auth_id, create_timestamp),
|
|
|
35 |
* KEY idx_created (create_timestamp)
|
|
|
36 |
* );
|
|
|
37 |
* </pre>
|
|
|
38 |
*/
|
|
|
39 |
@Entity
|
|
|
40 |
@Table(name = "inventory.sales_targets")
|
|
|
41 |
public class SalesTargets {
|
|
|
42 |
|
|
|
43 |
@Id
|
|
|
44 |
@Column(name = "id", unique = true, updatable = false)
|
|
|
45 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
|
46 |
private int id;
|
|
|
47 |
|
|
|
48 |
@Column(name = "sales_auth_id")
|
|
|
49 |
private int salesAuthId;
|
|
|
50 |
|
|
|
51 |
@Column(name = "sales_name")
|
|
|
52 |
private String salesName;
|
|
|
53 |
|
|
|
54 |
@Column(name = "role")
|
|
|
55 |
private String role;
|
|
|
56 |
|
|
|
57 |
@Column(name = "warehouse_id")
|
|
|
58 |
private int warehouseId;
|
|
|
59 |
|
|
|
60 |
@Column(name = "hid_target")
|
|
|
61 |
private float hidTarget;
|
|
|
62 |
|
|
|
63 |
@Column(name = "fastmoving_target")
|
|
|
64 |
private float fastMovingTarget;
|
|
|
65 |
|
|
|
66 |
@Column(name = "running_target")
|
|
|
67 |
private float runningTarget;
|
|
|
68 |
|
|
|
69 |
@Column(name = "slowmoving_target")
|
|
|
70 |
private float slowMovingTarget;
|
|
|
71 |
|
|
|
72 |
@Column(name = "other_target")
|
|
|
73 |
private float otherTarget;
|
|
|
74 |
|
|
|
75 |
@Column(name = "create_timestamp")
|
|
|
76 |
private LocalDateTime createTimestamp;
|
|
|
77 |
|
|
|
78 |
public int getId() { return id; }
|
|
|
79 |
public void setId(int id) { this.id = id; }
|
|
|
80 |
|
|
|
81 |
public int getSalesAuthId() { return salesAuthId; }
|
|
|
82 |
public void setSalesAuthId(int salesAuthId) { this.salesAuthId = salesAuthId; }
|
|
|
83 |
|
|
|
84 |
public String getSalesName() { return salesName; }
|
|
|
85 |
public void setSalesName(String salesName) { this.salesName = salesName; }
|
|
|
86 |
|
|
|
87 |
public String getRole() { return role; }
|
|
|
88 |
public void setRole(String role) { this.role = role; }
|
|
|
89 |
|
|
|
90 |
public int getWarehouseId() { return warehouseId; }
|
|
|
91 |
public void setWarehouseId(int warehouseId) { this.warehouseId = warehouseId; }
|
|
|
92 |
|
|
|
93 |
public float getHidTarget() { return hidTarget; }
|
|
|
94 |
public void setHidTarget(float hidTarget) { this.hidTarget = hidTarget; }
|
|
|
95 |
|
|
|
96 |
public float getFastMovingTarget() { return fastMovingTarget; }
|
|
|
97 |
public void setFastMovingTarget(float fastMovingTarget) { this.fastMovingTarget = fastMovingTarget; }
|
|
|
98 |
|
|
|
99 |
public float getRunningTarget() { return runningTarget; }
|
|
|
100 |
public void setRunningTarget(float runningTarget) { this.runningTarget = runningTarget; }
|
|
|
101 |
|
|
|
102 |
public float getSlowMovingTarget() { return slowMovingTarget; }
|
|
|
103 |
public void setSlowMovingTarget(float slowMovingTarget) { this.slowMovingTarget = slowMovingTarget; }
|
|
|
104 |
|
|
|
105 |
public float getOtherTarget() { return otherTarget; }
|
|
|
106 |
public void setOtherTarget(float otherTarget) { this.otherTarget = otherTarget; }
|
|
|
107 |
|
|
|
108 |
public LocalDateTime getCreateTimestamp() { return createTimestamp; }
|
|
|
109 |
public void setCreateTimestamp(LocalDateTime createTimestamp) { this.createTimestamp = createTimestamp; }
|
|
|
110 |
|
|
|
111 |
@Override
|
|
|
112 |
public boolean equals(Object o) {
|
|
|
113 |
if (this == o) return true;
|
|
|
114 |
if (o == null || getClass() != o.getClass()) return false;
|
|
|
115 |
SalesTargets that = (SalesTargets) o;
|
|
|
116 |
return id == that.id && salesAuthId == that.salesAuthId && warehouseId == that.warehouseId
|
|
|
117 |
&& Float.compare(hidTarget, that.hidTarget) == 0
|
|
|
118 |
&& Float.compare(fastMovingTarget, that.fastMovingTarget) == 0
|
|
|
119 |
&& Float.compare(runningTarget, that.runningTarget) == 0
|
|
|
120 |
&& Float.compare(slowMovingTarget, that.slowMovingTarget) == 0
|
|
|
121 |
&& Float.compare(otherTarget, that.otherTarget) == 0
|
|
|
122 |
&& Objects.equals(salesName, that.salesName) && Objects.equals(role, that.role)
|
|
|
123 |
&& Objects.equals(createTimestamp, that.createTimestamp);
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
@Override
|
|
|
127 |
public int hashCode() {
|
|
|
128 |
return Objects.hash(id, salesAuthId, salesName, role, warehouseId, hidTarget, fastMovingTarget,
|
|
|
129 |
runningTarget, slowMovingTarget, otherTarget, createTimestamp);
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
@Override
|
|
|
133 |
public String toString() {
|
|
|
134 |
return "SalesTargets{id=" + id + ", salesAuthId=" + salesAuthId + ", role='" + role
|
|
|
135 |
+ "', warehouseId=" + warehouseId + ", hid=" + hidTarget + ", fast=" + fastMovingTarget
|
|
|
136 |
+ ", run=" + runningTarget + ", slow=" + slowMovingTarget + ", other=" + otherTarget
|
|
|
137 |
+ ", ts=" + createTimestamp + "}";
|
|
|
138 |
}
|
|
|
139 |
}
|