| 24383 |
amit.gupta |
1 |
package com.spice.profitmandi.dao.repository.cs;
|
|
|
2 |
|
| 24439 |
govind |
3 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 24417 |
govind |
4 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
|
|
5 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 29927 |
amit.gupta |
6 |
import com.spice.profitmandi.dao.entity.cs.*;
|
| 27393 |
amit.gupta |
7 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
| 32923 |
ranu |
8 |
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
|
| 26978 |
tejbeer |
9 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 36212 |
ranu |
10 |
import com.spice.profitmandi.dao.model.*;
|
| 35920 |
ranu |
11 |
import org.springframework.cache.annotation.Cacheable;
|
| 29927 |
amit.gupta |
12 |
import org.springframework.stereotype.Service;
|
| 24383 |
amit.gupta |
13 |
|
| 29927 |
amit.gupta |
14 |
import java.util.List;
|
|
|
15 |
import java.util.Map;
|
|
|
16 |
import java.util.Set;
|
|
|
17 |
|
| 24383 |
amit.gupta |
18 |
@Service
|
|
|
19 |
public interface CsService {
|
| 34921 |
ranu |
20 |
int getAuthUserIdWithoutTicketAssignee(int categoryId, EscalationType escalationType, int fofoId) throws ProfitMandiBusinessException;
|
|
|
21 |
|
| 31762 |
tejbeer |
22 |
// Sends happy code to customer
|
|
|
23 |
void addActivity(Ticket ticket, Activity activity);
|
| 24500 |
govind |
24 |
|
| 31762 |
tejbeer |
25 |
void createTicket(int fofoId, int categoryId, int subcategoryId, String message) throws ProfitMandiBusinessException;
|
| 24500 |
govind |
26 |
|
| 32923 |
ranu |
27 |
void createTicket(int fofoId, int categoryId, int subcategoryId, String message, int createdByAuthId) throws ProfitMandiBusinessException;
|
|
|
28 |
|
| 36210 |
ranu |
29 |
void createTicket(int fofoId, int categoryId, int subcategoryId, String message, int createdByAuthId, EscalationType targetEscalation) throws ProfitMandiBusinessException;
|
|
|
30 |
|
| 32923 |
ranu |
31 |
void createTicketWithMedia(int fofoId, int categoryId, int subcategoryId, String message, int createdByAuthId, ActivityMediaModel selectedRecording) throws ProfitMandiBusinessException;
|
|
|
32 |
|
| 36210 |
ranu |
33 |
void createTicketWithMedia(int fofoId, int categoryId, int subcategoryId, String message, int createdByAuthId, ActivityMediaModel selectedRecording, EscalationType targetEscalation) throws ProfitMandiBusinessException;
|
|
|
34 |
|
| 33204 |
ranu |
35 |
TicketActivityMedia createMediaActivity(ActivityMediaModel selectedRecording);
|
|
|
36 |
|
|
|
37 |
void addMediaActivity(Ticket ticket, TicketActivityMedia activity);
|
|
|
38 |
|
| 32923 |
ranu |
39 |
void createTicketRemarkEscalation(int fofoId, int authId, int categoryId, int subcategoryId, String message, CollectionRemark remark) throws ProfitMandiBusinessException;
|
|
|
40 |
|
| 31762 |
tejbeer |
41 |
void addPartnerToRegion(int regionId, List<Integer> fofoIds);
|
| 24500 |
govind |
42 |
|
| 31762 |
tejbeer |
43 |
Map<Integer, TicketSubCategory> getSubCategoryIdAndSubCategoryMap(List<Integer> subCategoryIds);
|
| 24500 |
govind |
44 |
|
| 31762 |
tejbeer |
45 |
Map<Integer, TicketCategory> getSubCategoryIdAndCategoryMap(List<Integer> subCategoryIds);
|
| 24500 |
govind |
46 |
|
|
|
47 |
|
| 31762 |
tejbeer |
48 |
Map<Integer, AuthUser> getAuthUserIdAndAuthUserMap(List<TicketAssigned> ticketAssigneds);
|
| 24500 |
govind |
49 |
|
| 33244 |
ranu |
50 |
Map<Integer, CustomRetailer> getPartnerByFofoIds(List<Ticket> tickets) throws ProfitMandiBusinessException;
|
| 24500 |
govind |
51 |
|
| 31762 |
tejbeer |
52 |
List<TicketCategory> getAllTicketCategotyFromSubCategory();
|
| 24500 |
govind |
53 |
|
| 31762 |
tejbeer |
54 |
Map<Integer, AuthUser> getAuthUserIdAndAuthUserMapUsingPositions(List<Position> positions);
|
| 25721 |
tejbeer |
55 |
|
| 31762 |
tejbeer |
56 |
Map<Integer, TicketCategory> getCategoryIdAndCategoryUsingPositions(List<Position> positions);
|
| 25721 |
tejbeer |
57 |
|
| 31762 |
tejbeer |
58 |
Map<Integer, Region> getRegionIdAndRegionMap(List<Position> positions);
|
| 24500 |
govind |
59 |
|
| 33244 |
ranu |
60 |
Map<Integer, List<CustomRetailer>> getRegionPartners(List<Position> position) throws ProfitMandiBusinessException;
|
| 25721 |
tejbeer |
61 |
|
| 33244 |
ranu |
62 |
Map<Integer, List<CustomRetailer>> getPositionCustomRetailerMap(List<Position> position) throws ProfitMandiBusinessException;
|
| 25721 |
tejbeer |
63 |
|
| 31762 |
tejbeer |
64 |
Map<Integer, AuthUser> getTicketIdAndAuthUserMapUsingTickets(List<Ticket> tickets);
|
| 25721 |
tejbeer |
65 |
|
| 35683 |
ranu |
66 |
void updateTicket(int categoryId, int subCategoryId, Ticket ticket, int authUserId, EscalationType escalationType, ActivityMediaModel recording,int currentUserId) throws ProfitMandiBusinessException;
|
| 31762 |
tejbeer |
67 |
void updateTicket(int categoryId, int subCategoryId, Ticket ticket, int authUserId, EscalationType escalationType) throws ProfitMandiBusinessException;
|
| 25721 |
tejbeer |
68 |
|
| 33244 |
ranu |
69 |
Map<String, Set<String>> getAuthUserPartnerEmailMapping() throws ProfitMandiBusinessException;
|
| 26298 |
tejbeer |
70 |
|
| 37866 |
ranu |
71 |
/**
|
|
|
72 |
* Parameterised variant of {@link #getAuthUserPartnerEmailMapping}. The baseline
|
|
|
73 |
* method hard-codes Sales + RBM + ABM positions, which left non-sales HO roles
|
|
|
74 |
* (Category, Training, BI) with an empty partner list on the React admin page.
|
|
|
75 |
* This overload lets the caller pass the exact category set it wants mapped so
|
|
|
76 |
* each surface can own its own scope. Not cached because the category list is
|
|
|
77 |
* caller-supplied — a shared cache keyed only by method name would cross-pollinate.
|
|
|
78 |
*/
|
|
|
79 |
Map<String, Set<String>> getAuthUserPartnerEmailMappingByCategoryIds(List<Integer> categoryIds) throws ProfitMandiBusinessException;
|
|
|
80 |
|
| 33244 |
ranu |
81 |
Map<String, Set<Integer>> getAuthUserPartnerIdMapping() throws ProfitMandiBusinessException;
|
| 25721 |
tejbeer |
82 |
|
| 33244 |
ranu |
83 |
Map<Integer, List<Integer>> getAuthUserIdPartnerIdMapping() throws ProfitMandiBusinessException;
|
| 28377 |
tejbeer |
84 |
|
| 36802 |
ranu |
85 |
Map<Integer, List<Integer>> getAuthUserIdAllPartnerIdMapping() throws ProfitMandiBusinessException;
|
|
|
86 |
|
| 33244 |
ranu |
87 |
List<String> getAuthUserByPartnerId(int fofoId) throws ProfitMandiBusinessException;
|
| 26978 |
tejbeer |
88 |
|
| 34082 |
ranu |
89 |
Map<Integer, List<Integer>> authUserpartnerIdMap(int authId, int categoryId);
|
|
|
90 |
|
| 33244 |
ranu |
91 |
List<AuthUser> getAuthUserIdByPartnerId(int fofoId) throws ProfitMandiBusinessException;
|
| 26298 |
tejbeer |
92 |
|
| 33244 |
ranu |
93 |
List<AuthUser> getAuthUserIdByPartnerId(int fofoId, EscalationType... escalationTypes) throws ProfitMandiBusinessException;
|
| 33041 |
ranu |
94 |
|
| 37357 |
amit |
95 |
/**
|
|
|
96 |
* Active auth users holding a single position category against a partner, optionally narrowed to
|
|
|
97 |
* given escalation levels (all levels when none is passed). Covers both the partner's own
|
|
|
98 |
* cs.partner_position rows and the region-wide (partner_id = 0 / ALL_PARTNERS_REGION) ones.
|
|
|
99 |
* Returns an empty list when the partner has no such position mapped.
|
|
|
100 |
*/
|
|
|
101 |
List<AuthUser> getAuthUsersByPartnerIdAndCategory(int fofoId, int categoryId, EscalationType... escalationTypes) throws ProfitMandiBusinessException;
|
|
|
102 |
|
| 33244 |
ranu |
103 |
Map<EscalationType, String> getAuthUserAndEsclationTypeByPartnerId(int fofoId) throws ProfitMandiBusinessException;
|
| 27078 |
amit.gupta |
104 |
|
| 33244 |
ranu |
105 |
Map<Integer, List<Integer>> getL2L1Mapping() throws ProfitMandiBusinessException;
|
| 28908 |
tejbeer |
106 |
|
| 33244 |
ranu |
107 |
int getAuthUserId(int categoryId, EscalationType escalationType, int fofoId) throws ProfitMandiBusinessException;
|
| 28908 |
tejbeer |
108 |
|
| 36212 |
ranu |
109 |
/**
|
|
|
110 |
* Gets auth user ID with fallback to next escalation level if not found.
|
|
|
111 |
* Returns both the user ID and the actual escalation level that was used.
|
|
|
112 |
*/
|
|
|
113 |
EscalationAssignmentResult getAuthUserWithFallback(int categoryId, EscalationType targetEscalation, int fofoId) throws ProfitMandiBusinessException;
|
|
|
114 |
|
| 31762 |
tejbeer |
115 |
List<AuthUser> getAuthUserIds(int categoryId, List<EscalationType> escalationType);
|
| 27124 |
amit.gupta |
116 |
|
| 31762 |
tejbeer |
117 |
List<AuthUser> getAuthUserByCategoryId(int categoryId);
|
| 27205 |
amit.gupta |
118 |
|
| 35683 |
ranu |
119 |
void assignTicket(Ticket ticket,int currentUserId) throws ProfitMandiBusinessException;
|
|
|
120 |
|
| 31762 |
tejbeer |
121 |
void assignTicket(Ticket ticket) throws ProfitMandiBusinessException;
|
| 27545 |
tejbeer |
122 |
|
| 37145 |
ranu |
123 |
/**
|
|
|
124 |
* True if authId has ever been an assignee on the given ticket (any escalation level, including
|
|
|
125 |
* the initial L1 assignment). Reads from ticket_assigned history.
|
|
|
126 |
*/
|
|
|
127 |
boolean isInEscalationChain(int ticketId, int authId);
|
|
|
128 |
|
|
|
129 |
/**
|
|
|
130 |
* Batch variant of {@link #isInEscalationChain}. Returns the subset of ticketIds where authId
|
|
|
131 |
* has been an assignee at some point. Use this for dashboards / list views to avoid N+1.
|
|
|
132 |
*/
|
|
|
133 |
Set<Integer> ticketsInEscalationChain(int authId, List<Integer> ticketIds);
|
|
|
134 |
|
| 31762 |
tejbeer |
135 |
Map<Integer, List<AuthUser>> getAssignedAuthList(List<Ticket> tickets);
|
| 27205 |
amit.gupta |
136 |
|
| 33244 |
ranu |
137 |
Map<EscalationType, AuthUser> getAuthUserAndEsclationByPartnerId(int fofoId) throws ProfitMandiBusinessException;
|
| 29296 |
manish |
138 |
|
| 35394 |
amit |
139 |
// Batch method to fetch auth user escalations for all fofoIds at once
|
|
|
140 |
Map<Integer, Map<EscalationType, AuthUser>> getAuthUserAndEsclationByPartnerIds(Set<Integer> fofoIds) throws ProfitMandiBusinessException;
|
|
|
141 |
|
| 31762 |
tejbeer |
142 |
Activity createActivity(ActivityType activityType, String message, int createdBy);
|
| 30003 |
tejbeer |
143 |
|
| 31762 |
tejbeer |
144 |
List<AuthUser> getAuthUserByCategoryId(int categoryId, EscalationType escalationType);
|
| 31152 |
tejbeer |
145 |
|
| 33244 |
ranu |
146 |
Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException;
|
| 31152 |
tejbeer |
147 |
|
| 34905 |
ranu |
148 |
Map<Integer, FofoAbmReportingModel> getPartnerIdABMHeaders() throws ProfitMandiBusinessException;
|
|
|
149 |
|
| 33244 |
ranu |
150 |
Map<Integer, FofoRBMReportingModel> getPartnerIdRBMHeaders() throws ProfitMandiBusinessException;
|
| 33161 |
ranu |
151 |
|
| 35920 |
ranu |
152 |
@Cacheable(value = "authUserEmailInactivePartnerIdMapping", cacheManager = "thirtyMinsTimeOutCacheManager")
|
|
|
153 |
Map<String, Set<Integer>> getAuthUserInactivePartnerIdMapping() throws ProfitMandiBusinessException;
|
|
|
154 |
|
| 33244 |
ranu |
155 |
Map<String, Set<Integer>> getAuthUserPartnerIdMappingByCategoryIds(List<Integer> categoryIds, boolean activeOnly) throws ProfitMandiBusinessException;
|
| 31762 |
tejbeer |
156 |
|
| 35394 |
amit |
157 |
/**
|
|
|
158 |
* Batch method to get BM/ASM/RBM auth user IDs for all fofoIds at once.
|
|
|
159 |
* Returns Map<fofoId, Map<role, authUserId>> where role is "BM", "ASM", or "RBM".
|
|
|
160 |
*/
|
|
|
161 |
Map<Integer, Map<String, Integer>> getBmAsmRbmAuthUserIdsByFofoIds(Set<Integer> fofoIds) throws ProfitMandiBusinessException;
|
| 31762 |
tejbeer |
162 |
|
| 36972 |
ranu |
163 |
/**
|
|
|
164 |
* Batch equivalent of {@link #getAuthUserIdWithoutTicketAssignee}. Returns Map<fofoId, authUserId> for a
|
|
|
165 |
* single (categoryId, escalationType). Missing fofoIds map to 0.
|
|
|
166 |
*/
|
|
|
167 |
Map<Integer, Integer> getAuthUserIdsWithoutTicketAssigneeByFofoIds(int categoryId, EscalationType escalationType, Set<Integer> fofoIds) throws ProfitMandiBusinessException;
|
|
|
168 |
|
| 35635 |
ranu |
169 |
Map<Integer, Boolean> getUnreadStatusForTickets(List<Ticket> tickets, int userId, TicketReadStatus.UserType userType);
|
| 35626 |
amit |
170 |
|
| 35635 |
ranu |
171 |
void markTicketAsRead(int ticketId, int userId, TicketReadStatus.UserType userType);
|
| 35626 |
amit |
172 |
|
|
|
173 |
Map<Integer, Activity> getLastActivitiesForTickets(List<Integer> ticketIds);
|
|
|
174 |
|
| 35639 |
amit |
175 |
Map<Integer, Activity> getLastMessageActivitiesForTickets(List<Integer> ticketIds);
|
|
|
176 |
|
| 35626 |
amit |
177 |
void notifyPartnerOfExternalCommunication(Ticket ticket, Activity activity);
|
|
|
178 |
|
| 24500 |
govind |
179 |
}
|