Subversion Repositories SmartDukaan

Rev

Rev 37145 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
 
33244 ranu 71
    Map<String, Set<Integer>> getAuthUserPartnerIdMapping() throws ProfitMandiBusinessException;
25721 tejbeer 72
 
33244 ranu 73
    Map<Integer, List<Integer>> getAuthUserIdPartnerIdMapping() throws ProfitMandiBusinessException;
28377 tejbeer 74
 
36802 ranu 75
    Map<Integer, List<Integer>> getAuthUserIdAllPartnerIdMapping() throws ProfitMandiBusinessException;
76
 
33244 ranu 77
    List<String> getAuthUserByPartnerId(int fofoId) throws ProfitMandiBusinessException;
26978 tejbeer 78
 
34082 ranu 79
    Map<Integer, List<Integer>> authUserpartnerIdMap(int authId, int categoryId);
80
 
33244 ranu 81
    List<AuthUser> getAuthUserIdByPartnerId(int fofoId) throws ProfitMandiBusinessException;
26298 tejbeer 82
 
33244 ranu 83
    List<AuthUser> getAuthUserIdByPartnerId(int fofoId, EscalationType... escalationTypes) throws ProfitMandiBusinessException;
33041 ranu 84
 
37357 amit 85
    /**
86
     * Active auth users holding a single position category against a partner, optionally narrowed to
87
     * given escalation levels (all levels when none is passed). Covers both the partner's own
88
     * cs.partner_position rows and the region-wide (partner_id = 0 / ALL_PARTNERS_REGION) ones.
89
     * Returns an empty list when the partner has no such position mapped.
90
     */
91
    List<AuthUser> getAuthUsersByPartnerIdAndCategory(int fofoId, int categoryId, EscalationType... escalationTypes) throws ProfitMandiBusinessException;
92
 
33244 ranu 93
    Map<EscalationType, String> getAuthUserAndEsclationTypeByPartnerId(int fofoId) throws ProfitMandiBusinessException;
27078 amit.gupta 94
 
33244 ranu 95
    Map<Integer, List<Integer>> getL2L1Mapping() throws ProfitMandiBusinessException;
28908 tejbeer 96
 
33244 ranu 97
    int getAuthUserId(int categoryId, EscalationType escalationType, int fofoId) throws ProfitMandiBusinessException;
28908 tejbeer 98
 
36212 ranu 99
    /**
100
     * Gets auth user ID with fallback to next escalation level if not found.
101
     * Returns both the user ID and the actual escalation level that was used.
102
     */
103
    EscalationAssignmentResult getAuthUserWithFallback(int categoryId, EscalationType targetEscalation, int fofoId) throws ProfitMandiBusinessException;
104
 
31762 tejbeer 105
    List<AuthUser> getAuthUserIds(int categoryId, List<EscalationType> escalationType);
27124 amit.gupta 106
 
31762 tejbeer 107
    List<AuthUser> getAuthUserByCategoryId(int categoryId);
27205 amit.gupta 108
 
35683 ranu 109
    void assignTicket(Ticket ticket,int currentUserId) throws ProfitMandiBusinessException;
110
 
31762 tejbeer 111
    void assignTicket(Ticket ticket) throws ProfitMandiBusinessException;
27545 tejbeer 112
 
37145 ranu 113
    /**
114
     * True if authId has ever been an assignee on the given ticket (any escalation level, including
115
     * the initial L1 assignment). Reads from ticket_assigned history.
116
     */
117
    boolean isInEscalationChain(int ticketId, int authId);
118
 
119
    /**
120
     * Batch variant of {@link #isInEscalationChain}. Returns the subset of ticketIds where authId
121
     * has been an assignee at some point. Use this for dashboards / list views to avoid N+1.
122
     */
123
    Set<Integer> ticketsInEscalationChain(int authId, List<Integer> ticketIds);
124
 
31762 tejbeer 125
    Map<Integer, List<AuthUser>> getAssignedAuthList(List<Ticket> tickets);
27205 amit.gupta 126
 
33244 ranu 127
    Map<EscalationType, AuthUser> getAuthUserAndEsclationByPartnerId(int fofoId) throws ProfitMandiBusinessException;
29296 manish 128
 
35394 amit 129
    // Batch method to fetch auth user escalations for all fofoIds at once
130
    Map<Integer, Map<EscalationType, AuthUser>> getAuthUserAndEsclationByPartnerIds(Set<Integer> fofoIds) throws ProfitMandiBusinessException;
131
 
31762 tejbeer 132
    Activity createActivity(ActivityType activityType, String message, int createdBy);
30003 tejbeer 133
 
31762 tejbeer 134
    List<AuthUser> getAuthUserByCategoryId(int categoryId, EscalationType escalationType);
31152 tejbeer 135
 
33244 ranu 136
    Map<Integer, FofoReportingModel> getPartnerIdSalesHeaders() throws ProfitMandiBusinessException;
31152 tejbeer 137
 
34905 ranu 138
    Map<Integer, FofoAbmReportingModel> getPartnerIdABMHeaders() throws ProfitMandiBusinessException;
139
 
33244 ranu 140
    Map<Integer, FofoRBMReportingModel> getPartnerIdRBMHeaders() throws ProfitMandiBusinessException;
33161 ranu 141
 
35920 ranu 142
    @Cacheable(value = "authUserEmailInactivePartnerIdMapping", cacheManager = "thirtyMinsTimeOutCacheManager")
143
    Map<String, Set<Integer>> getAuthUserInactivePartnerIdMapping() throws ProfitMandiBusinessException;
144
 
33244 ranu 145
    Map<String, Set<Integer>> getAuthUserPartnerIdMappingByCategoryIds(List<Integer> categoryIds, boolean activeOnly) throws ProfitMandiBusinessException;
31762 tejbeer 146
 
35394 amit 147
    /**
148
     * Batch method to get BM/ASM/RBM auth user IDs for all fofoIds at once.
149
     * Returns Map<fofoId, Map<role, authUserId>> where role is "BM", "ASM", or "RBM".
150
     */
151
    Map<Integer, Map<String, Integer>> getBmAsmRbmAuthUserIdsByFofoIds(Set<Integer> fofoIds) throws ProfitMandiBusinessException;
31762 tejbeer 152
 
36972 ranu 153
    /**
154
     * Batch equivalent of {@link #getAuthUserIdWithoutTicketAssignee}. Returns Map&lt;fofoId, authUserId&gt; for a
155
     * single (categoryId, escalationType). Missing fofoIds map to 0.
156
     */
157
    Map<Integer, Integer> getAuthUserIdsWithoutTicketAssigneeByFofoIds(int categoryId, EscalationType escalationType, Set<Integer> fofoIds) throws ProfitMandiBusinessException;
158
 
35635 ranu 159
    Map<Integer, Boolean> getUnreadStatusForTickets(List<Ticket> tickets, int userId, TicketReadStatus.UserType userType);
35626 amit 160
 
35635 ranu 161
    void markTicketAsRead(int ticketId, int userId, TicketReadStatus.UserType userType);
35626 amit 162
 
163
    Map<Integer, Activity> getLastActivitiesForTickets(List<Integer> ticketIds);
164
 
35639 amit 165
    Map<Integer, Activity> getLastMessageActivitiesForTickets(List<Integer> ticketIds);
166
 
35626 amit 167
    void notifyPartnerOfExternalCommunication(Ticket ticket, Activity activity);
168
 
24500 govind 169
}