| Line 6... |
Line 6... |
| 6 |
import com.spice.profitmandi.common.util.Utils;
|
6 |
import com.spice.profitmandi.common.util.Utils;
|
| 7 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
7 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 8 |
import com.spice.profitmandi.dao.entity.cs.*;
|
8 |
import com.spice.profitmandi.dao.entity.cs.*;
|
| 9 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
9 |
import com.spice.profitmandi.dao.entity.fofo.ActivityType;
|
| 10 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
10 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| - |
|
11 |
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
|
| 11 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
12 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| - |
|
13 |
import com.spice.profitmandi.dao.model.ActivityMediaModel;
|
| 12 |
import com.spice.profitmandi.dao.model.FofoReportingModel;
|
14 |
import com.spice.profitmandi.dao.model.FofoReportingModel;
|
| 13 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
15 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 14 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
16 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 15 |
import com.spice.profitmandi.service.user.RetailerService;
|
17 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 16 |
import org.apache.commons.collections4.map.HashedMap;
|
18 |
import org.apache.commons.collections4.map.HashedMap;
|
| Line 53... |
Line 55... |
| 53 |
|
55 |
|
| 54 |
@Autowired
|
56 |
@Autowired
|
| 55 |
ActivityRepository activityRepository;
|
57 |
ActivityRepository activityRepository;
|
| 56 |
|
58 |
|
| 57 |
@Autowired
|
59 |
@Autowired
|
| - |
|
60 |
TicketActivityMediaRepository activityMediaRepository;
|
| - |
|
61 |
|
| - |
|
62 |
@Autowired
|
| 58 |
PartnerRegionRepository partnerRegionRepository;
|
63 |
PartnerRegionRepository partnerRegionRepository;
|
| 59 |
|
64 |
|
| 60 |
@Autowired
|
65 |
@Autowired
|
| 61 |
private PositionRepository positionRepository;
|
66 |
private PositionRepository positionRepository;
|
| 62 |
|
67 |
|
| Line 78... |
Line 83... |
| 78 |
@Autowired
|
83 |
@Autowired
|
| 79 |
private FofoStoreRepository fofoStoreRepository;
|
84 |
private FofoStoreRepository fofoStoreRepository;
|
| 80 |
|
85 |
|
| 81 |
@Override
|
86 |
@Override
|
| 82 |
public void createTicket(int fofoId, int categoryId, int subcategoryId, String message) throws ProfitMandiBusinessException {
|
87 |
public void createTicket(int fofoId, int categoryId, int subcategoryId, String message) throws ProfitMandiBusinessException {
|
| - |
|
88 |
this.createTicket(fofoId, categoryId, subcategoryId, message, 0);
|
| - |
|
89 |
}
|
| - |
|
90 |
|
| - |
|
91 |
|
| - |
|
92 |
@Override
|
| - |
|
93 |
public void createTicket(int fofoId, int categoryId, int subcategoryId, String message, int createdByAuthId) throws ProfitMandiBusinessException {
|
| 83 |
|
94 |
|
| 84 |
ActivityType type = ActivityType.OPENED;
|
95 |
ActivityType type = ActivityType.OPENED;
|
| 85 |
Ticket ticket = new Ticket();
|
96 |
Ticket ticket = new Ticket();
|
| 86 |
ticket.setSubCategoryId(subcategoryId);
|
97 |
ticket.setSubCategoryId(subcategoryId);
|
| 87 |
ticket.setFofoId(fofoId);
|
98 |
ticket.setFofoId(fofoId);
|
| 88 |
ticket.setCreateTimestamp(LocalDateTime.now());
|
99 |
ticket.setCreateTimestamp(LocalDateTime.now());
|
| 89 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
100 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
| 90 |
ticket.setHappyCode(getRandomString());
|
101 |
ticket.setHappyCode(getRandomString());
|
| 91 |
ticketRepository.persist(ticket);
|
102 |
ticketRepository.persist(ticket);
|
| 92 |
this.addActivity(ticket, this.createActivity(type, message, 0));
|
103 |
this.addActivity(ticket, this.createActivity(type, message, createdByAuthId));
|
| - |
|
104 |
ticket.setFirstActivityId(ticket.getLastActivityId());
|
| - |
|
105 |
if(createdByAuthId != 0){
|
| - |
|
106 |
int l2AuthUser = this.getAuthUserId(categoryId,EscalationType.L2,fofoId);
|
| - |
|
107 |
this.updateTicket(categoryId, subcategoryId, ticket, l2AuthUser, EscalationType.L2);
|
| - |
|
108 |
}else{
|
| 93 |
this.assignTicket(ticket);
|
109 |
this.assignTicket(ticket);
|
| - |
|
110 |
}
|
| - |
|
111 |
|
| - |
|
112 |
}
|
| 94 |
|
113 |
|
| - |
|
114 |
@Override
|
| - |
|
115 |
public void createTicketWithMedia(int fofoId, int categoryId, int subcategoryId, String message, int createdByAuthId, ActivityMediaModel selectedRecording) throws ProfitMandiBusinessException {
|
| - |
|
116 |
ActivityType type = ActivityType.OPENED;
|
| - |
|
117 |
Ticket ticket = new Ticket();
|
| - |
|
118 |
ticket.setSubCategoryId(subcategoryId);
|
| - |
|
119 |
ticket.setFofoId(fofoId);
|
| - |
|
120 |
ticket.setCreateTimestamp(LocalDateTime.now());
|
| - |
|
121 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
| - |
|
122 |
ticket.setHappyCode(getRandomString());
|
| - |
|
123 |
ticketRepository.persist(ticket);
|
| - |
|
124 |
this.addActivity(ticket, this.createActivity(type, message, createdByAuthId));
|
| - |
|
125 |
this.addMediaActivity(ticket, this.createMediaActivity(selectedRecording));
|
| - |
|
126 |
ticket.setFirstActivityId(ticket.getLastActivityId());
|
| - |
|
127 |
if(createdByAuthId != 0){
|
| - |
|
128 |
int l2AuthUser = this.getAuthUserId(categoryId,EscalationType.L2,fofoId);
|
| - |
|
129 |
this.updateTicket(categoryId, subcategoryId, ticket, l2AuthUser, EscalationType.L2);
|
| - |
|
130 |
}else{
|
| - |
|
131 |
this.assignTicket(ticket);
|
| - |
|
132 |
}
|
| 95 |
}
|
133 |
}
|
| 96 |
|
134 |
|
| - |
|
135 |
public TicketActivityMedia createMediaActivity(ActivityMediaModel selectedRecording) {
|
| - |
|
136 |
TicketActivityMedia activity = new TicketActivityMedia();
|
| - |
|
137 |
activity.setMobile(selectedRecording.getMobile());
|
| - |
|
138 |
activity.setMediaUrl(selectedRecording.getMediaUrl());
|
| - |
|
139 |
activity.setDurationInSec(selectedRecording.getDurationInSec());
|
| - |
|
140 |
activity.setCallTime(selectedRecording.getCallConnectTime());
|
| - |
|
141 |
activity.setCreatedBy(0);
|
| - |
|
142 |
activity.setCreateTimestamp(LocalDateTime.now());
|
| - |
|
143 |
activityMediaRepository.persist(activity);
|
| - |
|
144 |
return activity;
|
| - |
|
145 |
}
|
| - |
|
146 |
|
| - |
|
147 |
public void addMediaActivity(Ticket ticket, TicketActivityMedia activity) {
|
| - |
|
148 |
activity.setTicketId(ticket.getId());
|
| - |
|
149 |
}
|
| - |
|
150 |
|
| - |
|
151 |
@Override
|
| - |
|
152 |
public void createTicketRemarkEscalation(int fofoId, int authId, int categoryId, int subcategoryId, String message, CollectionRemark remark) throws ProfitMandiBusinessException {
|
| - |
|
153 |
|
| - |
|
154 |
ActivityType type = ActivityType.OPENED;
|
| - |
|
155 |
Ticket ticket = new Ticket();
|
| - |
|
156 |
ticket.setSubCategoryId(subcategoryId);
|
| - |
|
157 |
ticket.setFofoId(fofoId);
|
| - |
|
158 |
ticket.setCreateTimestamp(LocalDateTime.now());
|
| - |
|
159 |
ticket.setUpdateTimestamp(LocalDateTime.now());
|
| - |
|
160 |
ticket.setHappyCode(getRandomString());
|
| - |
|
161 |
ticketRepository.persist(ticket);
|
| - |
|
162 |
this.addActivity(ticket, this.createActivity(type, String.valueOf(remark), authId));
|
| - |
|
163 |
ticket.setFirstActivityId(ticket.getLastActivityId());
|
| - |
|
164 |
this.assignTicketByAuthId(ticket, authId,EscalationType.L2);
|
| - |
|
165 |
|
| - |
|
166 |
}
|
| - |
|
167 |
|
| - |
|
168 |
|
| 97 |
@Override
|
169 |
@Override
|
| 98 |
public void assignTicket(Ticket ticket) throws ProfitMandiBusinessException {
|
170 |
public void assignTicket(Ticket ticket) throws ProfitMandiBusinessException {
|
| 99 |
TicketAssigned ticketAssigned = null;
|
171 |
TicketAssigned ticketAssigned = null;
|
| 100 |
EscalationType newEscalationType = EscalationType.L1;
|
172 |
EscalationType newEscalationType = EscalationType.L1;
|
| 101 |
if (ticket.getAssignmentId() > 0) {
|
173 |
if (ticket.getAssignmentId() > 0) {
|