| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import java.io.IOException;
|
3 |
import java.io.IOException;
|
| 4 |
import java.time.LocalDate;
|
4 |
import java.time.LocalDate;
|
| 5 |
import java.time.LocalDateTime;
|
5 |
import java.time.LocalDateTime;
|
| 6 |
import java.time.format.DateTimeFormatter;
|
6 |
import java.time.format.DateTimeFormatter;
|
| 7 |
import java.util.ArrayList;
|
- |
|
| 8 |
import java.util.Arrays;
|
- |
|
| 9 |
import java.util.Comparator;
|
- |
|
| 10 |
import java.util.HashMap;
|
- |
|
| 11 |
import java.util.List;
|
- |
|
| 12 |
import java.util.Map;
|
7 |
import java.util.*;
|
| 13 |
import java.util.Map.Entry;
|
8 |
import java.util.Map.Entry;
|
| 14 |
import java.util.Set;
|
- |
|
| 15 |
import java.util.stream.Collectors;
|
9 |
import java.util.stream.Collectors;
|
| 16 |
|
10 |
|
| 17 |
import javax.servlet.http.HttpServletRequest;
|
11 |
import javax.servlet.http.HttpServletRequest;
|
| 18 |
|
12 |
|
| 19 |
import com.spice.profitmandi.common.enumuration.ActivationType;
|
13 |
import com.spice.profitmandi.common.enumuration.ActivationType;
|
| - |
|
14 |
import com.spice.profitmandi.common.util.Utils;
|
| 20 |
import com.spice.profitmandi.common.web.client.RestClient;
|
15 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| - |
|
16 |
import com.spice.profitmandi.dao.entity.cs.*;
|
| 21 |
import com.spice.profitmandi.dao.entity.fofo.RetailerContact;
|
17 |
import com.spice.profitmandi.dao.entity.dtr.Document;
|
| 22 |
import com.spice.profitmandi.service.FofoUser;
|
18 |
import com.spice.profitmandi.dao.entity.fofo.*;
|
| - |
|
19 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| - |
|
20 |
import com.spice.profitmandi.dao.model.*;
|
| - |
|
21 |
import com.spice.profitmandi.dao.repository.cs.*;
|
| - |
|
22 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| - |
|
23 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 23 |
import com.spice.profitmandi.service.smartping.SmartPingAgentModel;
|
24 |
import com.spice.profitmandi.service.smartping.SmartPingAgentModel;
|
| 24 |
import com.spice.profitmandi.service.smartping.SmartPingService;
|
25 |
import com.spice.profitmandi.service.smartping.SmartPingService;
|
| 25 |
import org.apache.commons.csv.CSVRecord;
|
26 |
import org.apache.commons.csv.CSVRecord;
|
| - |
|
27 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 26 |
import org.apache.logging.log4j.LogManager;
|
28 |
import org.apache.logging.log4j.LogManager;
|
| 27 |
import org.apache.logging.log4j.Logger;
|
29 |
import org.apache.logging.log4j.Logger;
|
| 28 |
import org.springframework.beans.factory.annotation.Autowired;
|
30 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 29 |
import org.springframework.format.annotation.DateTimeFormat;
|
31 |
import org.springframework.format.annotation.DateTimeFormat;
|
| 30 |
import org.springframework.http.HttpHeaders;
|
32 |
import org.springframework.http.HttpHeaders;
|
| 31 |
import org.springframework.http.HttpStatus;
|
33 |
import org.springframework.http.HttpStatus;
|
| 32 |
import org.springframework.http.MediaType;
|
34 |
import org.springframework.http.MediaType;
|
| 33 |
import org.springframework.http.ResponseEntity;
|
35 |
import org.springframework.http.ResponseEntity;
|
| - |
|
36 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 34 |
import org.springframework.stereotype.Controller;
|
37 |
import org.springframework.stereotype.Controller;
|
| 35 |
import org.springframework.transaction.annotation.Transactional;
|
38 |
import org.springframework.transaction.annotation.Transactional;
|
| 36 |
import org.springframework.ui.Model;
|
39 |
import org.springframework.ui.Model;
|
| 37 |
import org.springframework.web.bind.annotation.*;
|
40 |
import org.springframework.web.bind.annotation.*;
|
| 38 |
import org.springframework.web.multipart.MultipartFile;
|
41 |
import org.springframework.web.multipart.MultipartFile;
|
| Line 42... |
Line 45... |
| 42 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
45 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 43 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
46 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 44 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
47 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 45 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
48 |
import com.spice.profitmandi.common.model.SendNotificationModel;
|
| 46 |
import com.spice.profitmandi.common.util.FileUtil;
|
49 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 47 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
- |
|
| 48 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
50 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 49 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
51 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| 50 |
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionPlan;
|
52 |
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionPlan;
|
| 51 |
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionRemark;
|
53 |
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionRemark;
|
| 52 |
import com.spice.profitmandi.dao.entity.auth.PartnerSecondaryPlan;
|
54 |
import com.spice.profitmandi.dao.entity.auth.PartnerSecondaryPlan;
|
| 53 |
import com.spice.profitmandi.dao.entity.cs.Ticket;
|
- |
|
| 54 |
import com.spice.profitmandi.dao.entity.cs.TicketCategory;
|
- |
|
| 55 |
import com.spice.profitmandi.dao.entity.cs.TicketSubCategory;
|
- |
|
| 56 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
55 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 57 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
56 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
| 58 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
- |
|
| 59 |
import com.spice.profitmandi.dao.entity.fofo.PartnerDailyInvestment;
|
- |
|
| 60 |
import com.spice.profitmandi.dao.entity.fofo.PartnerOnBoardingPanel;
|
- |
|
| 61 |
import com.spice.profitmandi.dao.entity.user.FranchiseeActivity;
|
57 |
import com.spice.profitmandi.dao.entity.user.FranchiseeActivity;
|
| 62 |
import com.spice.profitmandi.dao.entity.user.FranchiseeVisit;
|
58 |
import com.spice.profitmandi.dao.entity.user.FranchiseeVisit;
|
| 63 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
59 |
import com.spice.profitmandi.dao.entity.user.Lead;
|
| 64 |
import com.spice.profitmandi.dao.entity.user.LeadActivity;
|
60 |
import com.spice.profitmandi.dao.entity.user.LeadActivity;
|
| 65 |
import com.spice.profitmandi.dao.entity.user.VisitRequest;
|
61 |
import com.spice.profitmandi.dao.entity.user.VisitRequest;
|
| Line 68... |
Line 64... |
| 68 |
import com.spice.profitmandi.dao.enumuration.dtr.FranchiseeActivityStatus;
|
64 |
import com.spice.profitmandi.dao.enumuration.dtr.FranchiseeActivityStatus;
|
| 69 |
import com.spice.profitmandi.dao.enumuration.dtr.FranchiseeVisitStatus;
|
65 |
import com.spice.profitmandi.dao.enumuration.dtr.FranchiseeVisitStatus;
|
| 70 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
66 |
import com.spice.profitmandi.dao.enumuration.dtr.LeadStatus;
|
| 71 |
import com.spice.profitmandi.dao.enumuration.dtr.StoreTimeline;
|
67 |
import com.spice.profitmandi.dao.enumuration.dtr.StoreTimeline;
|
| 72 |
import com.spice.profitmandi.dao.enumuration.dtr.VisitStatus;
|
68 |
import com.spice.profitmandi.dao.enumuration.dtr.VisitStatus;
|
| 73 |
import com.spice.profitmandi.dao.model.CreateRefferalRequest;
|
- |
|
| 74 |
import com.spice.profitmandi.dao.model.OnBoardingTimelineModel;
|
- |
|
| 75 |
import com.spice.profitmandi.dao.model.PartnerCollectionPlanModel;
|
- |
|
| 76 |
import com.spice.profitmandi.dao.model.PartnerCollectionRemarkModel;
|
- |
|
| 77 |
import com.spice.profitmandi.dao.model.PartnerSecondaryPlanModel;
|
- |
|
| 78 |
import com.spice.profitmandi.dao.model.PartnerTargetAchievementModel;
|
- |
|
| 79 |
import com.spice.profitmandi.dao.model.TargetModel;
|
- |
|
| 80 |
import com.spice.profitmandi.dao.model.TicketViewModel;
|
- |
|
| 81 |
import com.spice.profitmandi.dao.model.UserCart;
|
- |
|
| 82 |
import com.spice.profitmandi.dao.model.UserVisitModel;
|
- |
|
| 83 |
import com.spice.profitmandi.dao.model.VisitDescriptionModel;
|
- |
|
| 84 |
import com.spice.profitmandi.dao.model.VisitSummaryModel;
|
- |
|
| 85 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
69 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.auth.AuthUserPartnerMappingRepository;
|
70 |
import com.spice.profitmandi.dao.repository.auth.AuthUserPartnerMappingRepository;
|
| 87 |
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionPlanRepository;
|
71 |
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionPlanRepository;
|
| 88 |
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionRemarkRepository;
|
72 |
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionRemarkRepository;
|
| 89 |
import com.spice.profitmandi.dao.repository.auth.PartnerSecondaryPlanRepository;
|
73 |
import com.spice.profitmandi.dao.repository.auth.PartnerSecondaryPlanRepository;
|
| 90 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
- |
|
| 91 |
import com.spice.profitmandi.dao.repository.cs.TicketCategoryRepository;
|
- |
|
| 92 |
import com.spice.profitmandi.dao.repository.cs.TicketRepository;
|
- |
|
| 93 |
import com.spice.profitmandi.dao.repository.cs.TicketSubCategoryRepository;
|
- |
|
| 94 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
- |
|
| 95 |
import com.spice.profitmandi.dao.repository.dtr.FranchiseeActivityRepository;
|
- |
|
| 96 |
import com.spice.profitmandi.dao.repository.dtr.FranchiseeVisitRepository;
|
- |
|
| 97 |
import com.spice.profitmandi.dao.repository.dtr.LeadActivityRepository;
|
- |
|
| 98 |
import com.spice.profitmandi.dao.repository.dtr.LeadRepository;
|
- |
|
| 99 |
import com.spice.profitmandi.dao.repository.dtr.Mongo;
|
- |
|
| 100 |
import com.spice.profitmandi.dao.repository.dtr.PartnerOnBoardingPanelRepository;
|
- |
|
| 101 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
- |
|
| 102 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
- |
|
| 103 |
import com.spice.profitmandi.dao.repository.dtr.VisitRequestRepository;
|
- |
|
| 104 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
74 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 105 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
75 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 106 |
import com.spice.profitmandi.service.AuthService;
|
76 |
import com.spice.profitmandi.service.AuthService;
|
| 107 |
import com.spice.profitmandi.service.NotificationService;
|
77 |
import com.spice.profitmandi.service.NotificationService;
|
| 108 |
import com.spice.profitmandi.service.PartnerCollectionService;
|
78 |
import com.spice.profitmandi.service.PartnerCollectionService;
|
| Line 126... |
Line 96... |
| 126 |
|
96 |
|
| 127 |
@Autowired
|
97 |
@Autowired
|
| 128 |
private LeadRepository leadRepository;
|
98 |
private LeadRepository leadRepository;
|
| 129 |
|
99 |
|
| 130 |
@Autowired
|
100 |
@Autowired
|
| - |
|
101 |
private ActivityRepository activityRepository;
|
| - |
|
102 |
|
| - |
|
103 |
@Autowired
|
| - |
|
104 |
private TicketActivityMediaRepository activityMeidaRepository;
|
| - |
|
105 |
|
| - |
|
106 |
@Autowired
|
| - |
|
107 |
DocumentRepository documentRepository;
|
| - |
|
108 |
|
| - |
|
109 |
@Autowired
|
| - |
|
110 |
PositionRepository positionRepository;
|
| - |
|
111 |
|
| - |
|
112 |
@Autowired
|
| - |
|
113 |
private ActivityAttachmentRepository activityAttachmentRepository;
|
| - |
|
114 |
|
| - |
|
115 |
@Autowired
|
| 131 |
private CsService csService;
|
116 |
private CsService csService;
|
| 132 |
|
117 |
|
| 133 |
@Autowired
|
118 |
@Autowired
|
| 134 |
private UserRepository userRepository;
|
119 |
private UserRepository userRepository;
|
| 135 |
|
120 |
|
| 136 |
@Autowired
|
121 |
@Autowired
|
| - |
|
122 |
private AddressRepository addressRepository;
|
| - |
|
123 |
|
| - |
|
124 |
@Autowired
|
| - |
|
125 |
|
| - |
|
126 |
private UserRoleRepository userRoleRepository;
|
| - |
|
127 |
|
| - |
|
128 |
@Autowired
|
| 137 |
private UserAccountRepository userAccountRepository;
|
129 |
private UserAccountRepository userAccountRepository;
|
| 138 |
|
130 |
|
| 139 |
@Autowired
|
131 |
@Autowired
|
| 140 |
private com.spice.profitmandi.dao.repository.user.UserRepository userUserRepository;
|
132 |
private com.spice.profitmandi.dao.repository.user.UserRepository userUserRepository;
|
| 141 |
|
133 |
|
| Line 200... |
Line 192... |
| 200 |
private AuthService authService;
|
192 |
private AuthService authService;
|
| 201 |
|
193 |
|
| 202 |
@Autowired
|
194 |
@Autowired
|
| 203 |
private NotificationService notificationService;
|
195 |
private NotificationService notificationService;
|
| 204 |
|
196 |
|
| - |
|
197 |
@Autowired
|
| - |
|
198 |
JavaMailSender mailSender;
|
| - |
|
199 |
|
| - |
|
200 |
@Autowired
|
| - |
|
201 |
private TicketAssignedRepository ticketAssignedRepository;
|
| - |
|
202 |
|
| 205 |
@RequestMapping(value = "/lead", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
203 |
@RequestMapping(value = "/lead", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 206 |
@ApiImplicitParams({
|
204 |
@ApiImplicitParams({
|
| 207 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
205 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
| 208 |
public ResponseEntity<?> LeadUser(HttpServletRequest request,
|
206 |
public ResponseEntity<?> LeadUser(HttpServletRequest request,
|
| 209 |
@RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
|
207 |
@RequestBody CreateRefferalRequest createRefferalRequest) throws Exception {
|
| Line 1000... |
Line 998... |
| 1000 |
}
|
998 |
}
|
| 1001 |
|
999 |
|
| 1002 |
ptams.add(ptam);
|
1000 |
ptams.add(ptam);
|
| 1003 |
|
1001 |
|
| 1004 |
}
|
1002 |
}
|
| - |
|
1003 |
List<Position> positions = positionRepository.selectPositionByAuthId(authUser.getId()).stream().collect(Collectors.toList());
|
| - |
|
1004 |
|
| - |
|
1005 |
LOGGER.info("positions {}", positions);
|
| - |
|
1006 |
|
| - |
|
1007 |
boolean isRBMAndL1 = positions.stream()
|
| - |
|
1008 |
.anyMatch(position ->
|
| - |
|
1009 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId()
|
| - |
|
1010 |
&& EscalationType.L1.equals(position.getEscalationType()));
|
| - |
|
1011 |
boolean isRBMAndNotL1 = positions.stream()
|
| - |
|
1012 |
.anyMatch(position ->
|
| - |
|
1013 |
ProfitMandiConstants.TICKET_CATEGORY_RBM == position.getCategoryId()
|
| - |
|
1014 |
&& !EscalationType.L1.equals(position.getEscalationType()));
|
| - |
|
1015 |
|
| - |
|
1016 |
LOGGER.info("isRBMAndL1{}",isRBMAndL1);
|
| - |
|
1017 |
|
| - |
|
1018 |
boolean isSales = positions.stream()
|
| - |
|
1019 |
.anyMatch(position ->
|
| - |
|
1020 |
ProfitMandiConstants.TICKET_CATEGORY_SALES == position.getCategoryId());
|
| 1005 |
|
1021 |
|
| 1006 |
tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
|
1022 |
tm.setTotalPartnerTargetCollection(totalPartnerTargetCollection);
|
| 1007 |
tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
|
1023 |
tm.setTotalPartnerTargetSecondary(totalPartnerTargetSecondary);
|
| 1008 |
tm.setTotalPartnerSecondary(totalPartnerAchievementSecondary);
|
1024 |
tm.setTotalPartnerSecondary(totalPartnerAchievementSecondary);
|
| 1009 |
tm.setTotalPartnerCollection(totalPartnerAchievementCollection);
|
1025 |
tm.setTotalPartnerCollection(totalPartnerAchievementCollection);
|
| 1010 |
tm.setTodayCollectionCount((int) todayCollectionCount);
|
1026 |
tm.setTodayCollectionCount((int) todayCollectionCount);
|
| - |
|
1027 |
List<PartnerTargetAchievementModel> filteredPtams;
|
| 1011 |
|
1028 |
|
| - |
|
1029 |
if (isRBMAndL1) {
|
| - |
|
1030 |
filteredPtams = ptams.stream()
|
| - |
|
1031 |
.filter(ptam -> !(CollectionRemark.RBM_ESCALATION.equals(ptam.getRemark()) || CollectionRemark.SALES_ESCALATION.equals(ptam.getRemark())))
|
| - |
|
1032 |
.collect(Collectors.toList());
|
| - |
|
1033 |
} else if (isRBMAndNotL1) {
|
| - |
|
1034 |
filteredPtams = ptams.stream()
|
| - |
|
1035 |
.filter(ptam -> !(CollectionRemark.SALES_ESCALATION.equals(ptam.getRemark())))
|
| - |
|
1036 |
.collect(Collectors.toList());
|
| - |
|
1037 |
} else {
|
| - |
|
1038 |
filteredPtams = ptams;
|
| - |
|
1039 |
}
|
| - |
|
1040 |
|
| 1012 |
tm.setTargetAchievement(ptams.stream().sorted(Comparator.comparing(PartnerTargetAchievementModel::getRank))
|
1041 |
tm.setTargetAchievement(filteredPtams.stream().sorted(Comparator.comparing(PartnerTargetAchievementModel::getRank))
|
| 1013 |
.collect(Collectors.toList()));
|
1042 |
.collect(Collectors.toList()));
|
| 1014 |
|
1043 |
|
| 1015 |
}
|
1044 |
}
|
| 1016 |
|
1045 |
|
| 1017 |
}
|
1046 |
}
|
| - |
|
1047 |
|
| 1018 |
return responseSender.ok(tm);
|
1048 |
return responseSender.ok(tm);
|
| 1019 |
|
1049 |
|
| 1020 |
}
|
1050 |
}
|
| 1021 |
|
1051 |
|
| 1022 |
//TODO:Amit
|
1052 |
//TODO:Amit
|
| Line 1198... |
Line 1228... |
| 1198 |
|
1228 |
|
| 1199 |
return responseSender.ok(true);
|
1229 |
return responseSender.ok(true);
|
| 1200 |
|
1230 |
|
| 1201 |
}
|
1231 |
}
|
| 1202 |
|
1232 |
|
| 1203 |
@RequestMapping(value = "/viewTickets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1204 |
@ApiImplicitParams({
|
- |
|
| 1205 |
|
- |
|
| 1206 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
- |
|
| 1207 |
public ResponseEntity<?> viewTickets(HttpServletRequest request, @RequestParam int fofoId)
|
- |
|
| 1208 |
throws ProfitMandiBusinessException {
|
- |
|
| 1209 |
List<Ticket> tickets = ticketRepository.selectAllOpenTicketByRetailer(fofoId);
|
- |
|
| 1210 |
|
- |
|
| 1211 |
List<TicketViewModel> viewList = new ArrayList<>();
|
- |
|
| 1212 |
for (Ticket ticket : tickets) {
|
- |
|
| 1213 |
|
- |
|
| 1214 |
TicketViewModel ticketViewModel = new TicketViewModel();
|
- |
|
| 1215 |
ticketViewModel.setId(ticket.getId());
|
- |
|
| 1216 |
TicketSubCategory ticketSubCategory = ticketSubCategoryRepository.selectById(ticket.getSubCategoryId());
|
- |
|
| 1217 |
TicketCategory ticketCategory = ticketCategoryRepository.selectById(ticketSubCategory.getCategoryId());
|
- |
|
| 1218 |
|
- |
|
| 1219 |
ticketViewModel.setCategoryName(ticketCategory.getName());
|
- |
|
| 1220 |
ticketViewModel.setSubCategoryName(ticketSubCategory.getName());
|
- |
|
| 1221 |
ticketViewModel.setCreatedTimestamp(ticket.getCreateTimestamp());
|
- |
|
| 1222 |
|
- |
|
| 1223 |
viewList.add(ticketViewModel);
|
- |
|
| 1224 |
}
|
- |
|
| 1225 |
return responseSender.ok(viewList);
|
- |
|
| 1226 |
|
- |
|
| 1227 |
}
|
- |
|
| 1228 |
|
- |
|
| 1229 |
@RequestMapping(value = "/viewRecentTickets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1230 |
@ApiImplicitParams({
|
- |
|
| 1231 |
|
- |
|
| 1232 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
- |
|
| 1233 |
public ResponseEntity<?> viewRecentTickets(HttpServletRequest request, @RequestParam int fofoId)
|
- |
|
| 1234 |
throws ProfitMandiBusinessException {
|
- |
|
| 1235 |
List<TicketViewModel> viewList = ticketRepository.selectRecentClosedTicket(fofoId,
|
- |
|
| 1236 |
LocalDateTime.now().minusDays(20));
|
- |
|
| 1237 |
|
- |
|
| 1238 |
return responseSender.ok(viewList);
|
- |
|
| 1239 |
|
- |
|
| 1240 |
}
|
- |
|
| 1241 |
|
- |
|
| 1242 |
@RequestMapping(value = "/createTicket", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1243 |
@ApiImplicitParams({
|
- |
|
| 1244 |
|
- |
|
| 1245 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
- |
|
| 1246 |
public ResponseEntity<?> createTicket(HttpServletRequest request) throws ProfitMandiBusinessException {
|
- |
|
| 1247 |
List<TicketCategory> ticketCategories = csService.getAllTicketCategotyFromSubCategory();
|
- |
|
| 1248 |
|
- |
|
| 1249 |
return responseSender.ok(ticketCategories);
|
- |
|
| 1250 |
}
|
- |
|
| 1251 |
|
- |
|
| 1252 |
@RequestMapping(value = "/getSubCategoriesByCategoryId", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1253 |
@ApiImplicitParams({
|
- |
|
| 1254 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
- |
|
| 1255 |
|
- |
|
| 1256 |
public ResponseEntity<?> getSubCategoriesByCategoryId(HttpServletRequest request,
|
- |
|
| 1257 |
@RequestParam(name = "categoryId", defaultValue = "0") int categoryId, Model model) {
|
- |
|
| 1258 |
List<TicketSubCategory> ticketSubCategories = ticketSubCategoryRepository.selectAll(categoryId);
|
- |
|
| 1259 |
LOGGER.info(ticketSubCategories);
|
- |
|
| 1260 |
return responseSender.ok(ticketSubCategories);
|
- |
|
| 1261 |
}
|
- |
|
| 1262 |
|
- |
|
| 1263 |
@RequestMapping(value = "/createTicket", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1264 |
@ApiImplicitParams({
|
- |
|
| 1265 |
|
- |
|
| 1266 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
- |
|
| 1267 |
public ResponseEntity<?> createTicket(HttpServletRequest request, @RequestParam(name = "categoryId") int categoryId,
|
- |
|
| 1268 |
@RequestParam(name = "subCategoryId") int subCategoryId, @RequestParam(name = "message") String message,
|
- |
|
| 1269 |
@RequestParam(name = "fofoId") int fofoId) throws Exception {
|
- |
|
| 1270 |
|
- |
|
| 1271 |
int id = (int) request.getAttribute("userId");
|
- |
|
| 1272 |
|
- |
|
| 1273 |
LOGGER.info("id" + id);
|
- |
|
| 1274 |
|
- |
|
| 1275 |
User user = userRepository.selectById(id);
|
- |
|
| 1276 |
|
- |
|
| 1277 |
AuthUser authUser = authRepository.selectByEmailOrMobile(user.getEmailId());
|
- |
|
| 1278 |
|
- |
|
| 1279 |
List<Ticket> tickets = ticketRepository.selectAllResolvedMarkedTicketByCreator(fofoId);
|
- |
|
| 1280 |
if (tickets.size() > 3 || tickets.size() == 3) {
|
- |
|
| 1281 |
return responseSender.ok(false);
|
- |
|
| 1282 |
} else {
|
- |
|
| 1283 |
csService.createTicket(fofoId, categoryId, subCategoryId, message);
|
- |
|
| 1284 |
|
- |
|
| 1285 |
PartnerCollectionRemark pcr = new PartnerCollectionRemark();
|
- |
|
| 1286 |
pcr.setFofoId(fofoId);
|
- |
|
| 1287 |
pcr.setAuthId(authUser.getId());
|
- |
|
| 1288 |
pcr.setMessage("Ticket Created");
|
- |
|
| 1289 |
pcr.setRemark(CollectionRemark.TICKET_CREATED);
|
- |
|
| 1290 |
pcr.setCreateTimestamp(LocalDateTime.now());
|
- |
|
| 1291 |
partnerCollectionRemarkRepository.persist(pcr);
|
- |
|
| 1292 |
|
- |
|
| 1293 |
}
|
- |
|
| 1294 |
return responseSender.ok(true);
|
- |
|
| 1295 |
}
|
- |
|
| 1296 |
|
- |
|
| 1297 |
@RequestMapping(value = "/getCollectionRemark", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1298 |
@ApiImplicitParams({
|
- |
|
| 1299 |
|
- |
|
| 1300 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
- |
|
| 1301 |
public ResponseEntity<?> getCollectionRemark(HttpServletRequest request) throws ProfitMandiBusinessException {
|
- |
|
| 1302 |
List<CollectionRemark> remarks = Arrays.asList(CollectionRemark.values()).stream()
|
- |
|
| 1303 |
.filter(x -> !x.equals(CollectionRemark.COLLECTION_PLAN)).collect(Collectors.toList());
|
- |
|
| 1304 |
return responseSender.ok(remarks);
|
- |
|
| 1305 |
}
|
- |
|
| 1306 |
|
- |
|
| 1307 |
@Autowired
|
- |
|
| 1308 |
RestClient restClient;
|
- |
|
| 1309 |
|
- |
|
| 1310 |
@Autowired
|
- |
|
| 1311 |
SmartPingService smartPingService;
|
- |
|
| 1312 |
|
- |
|
| 1313 |
@RequestMapping(value = "/retailer/contacts/{fofoId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1314 |
public ResponseEntity<?> getContacts(HttpServletRequest request, @PathVariable int fofoId) throws Exception {
|
- |
|
| 1315 |
return responseSender.ok(retailerService.getContactsByFofoId(fofoId, true));
|
- |
|
| 1316 |
}
|
- |
|
| 1317 |
|
- |
|
| 1318 |
@RequestMapping(value = "/click2call/{toMobile}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1319 |
public ResponseEntity<?> makeCallOnAgentBehalf(HttpServletRequest request, @PathVariable String toMobile) throws Exception {
|
- |
|
| 1320 |
int id = (int) request.getAttribute("userId");
|
- |
|
| 1321 |
User user = userRepository.selectById(id);
|
- |
|
| 1322 |
AuthUser authUser = authRepository.selectByEmailOrMobile(user.getEmailId());
|
- |
|
| 1323 |
String fromMobile = authUser.getMobileNumber();
|
- |
|
| 1324 |
|
- |
|
| 1325 |
SmartPingAgentModel smartPingAgentModel = smartPingService.getAllAgents().get(fromMobile);
|
- |
|
| 1326 |
|
- |
|
| 1327 |
String urlTemplate = "https://ccs1.smartpingcc.io/v2/clickToCall/para?&user_id=71287091&token=InCfClzwFUtLUW610faI&from=%d&fromType=Agent&fromCLI=&to=%s&toCLI=%s";
|
- |
|
| 1328 |
LOGGER.info("smartPingAgentModel - {}", smartPingAgentModel);
|
- |
|
| 1329 |
String url = String.format(urlTemplate, smartPingAgentModel.getAgentId(), smartPingAgentModel.getAllowDid().get(0), toMobile, smartPingAgentModel.getAllowDid().get(0));
|
- |
|
| 1330 |
|
- |
|
| 1331 |
restClient.get(url, null, null);
|
- |
|
| 1332 |
|
- |
|
| 1333 |
return responseSender.ok(true);
|
- |
|
| 1334 |
}
|
- |
|
| 1335 |
|
- |
|
| 1336 |
@RequestMapping(value = "/createPartnerColectionRemark", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
- |
|
| 1337 |
@ApiImplicitParams({
|
- |
|
| 1338 |
|
- |
|
| 1339 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header")})
|
- |
|
| 1340 |
public ResponseEntity<?> createPartnerCollectionRemark(HttpServletRequest request,
|
- |
|
| 1341 |
@RequestBody PartnerCollectionRemarkModel partnerCollectionRemarkModel)
|
- |
|
| 1342 |
throws ProfitMandiBusinessException {
|
- |
|
| 1343 |
AuthUser authUser = authRepository.selectByGmailId(partnerCollectionRemarkModel.getGmailId());
|
- |
|
| 1344 |
|
- |
|
| 1345 |
PartnerCollectionRemark pcr = new PartnerCollectionRemark();
|
- |
|
| 1346 |
pcr.setFofoId(partnerCollectionRemarkModel.getFofoId());
|
- |
|
| 1347 |
pcr.setAuthId(authUser.getId());
|
- |
|
| 1348 |
pcr.setMessage(partnerCollectionRemarkModel.getMessage());
|
- |
|
| 1349 |
pcr.setRemark(partnerCollectionRemarkModel.getRemark());
|
- |
|
| 1350 |
pcr.setCreateTimestamp(LocalDateTime.now());
|
- |
|
| 1351 |
partnerCollectionRemarkRepository.persist(pcr);
|
- |
|
| 1352 |
return responseSender.ok(true);
|
- |
|
| 1353 |
|
- |
|
| 1354 |
}
|
- |
|
| 1355 |
|
- |
|
| 1356 |
@RequestMapping(value = "/uploadFranchiseeVisit", method = RequestMethod.POST)
|
1233 |
@RequestMapping(value = "/uploadFranchiseeVisit", method = RequestMethod.POST)
|
| 1357 |
public ResponseEntity<?> readCsvFileAndSetLead(HttpServletRequest request, @RequestPart MultipartFile multipartFile)
|
1234 |
public ResponseEntity<?> readCsvFileAndSetLead(HttpServletRequest request, @RequestPart MultipartFile multipartFile)
|
| 1358 |
throws Throwable {
|
1235 |
throws Throwable {
|
| 1359 |
|
1236 |
|
| 1360 |
int id = (int) request.getAttribute("userId");
|
1237 |
int id = (int) request.getAttribute("userId");
|
| Line 1409... |
Line 1286... |
| 1409 |
|
1286 |
|
| 1410 |
// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
1287 |
// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
| 1411 |
|
1288 |
|
| 1412 |
List<List<?>> rows = new ArrayList<>();
|
1289 |
List<List<?>> rows = new ArrayList<>();
|
| 1413 |
|
1290 |
|
| 1414 |
org.apache.commons.io.output.ByteArrayOutputStream byteArrayOutputStream = FileUtil
|
1291 |
ByteArrayOutputStream byteArrayOutputStream = FileUtil
|
| 1415 |
.getCSVByteStream(Arrays.asList("Partner Id", "Agenda", "Schedule Timestamp"), rows);
|
1292 |
.getCSVByteStream(Arrays.asList("Partner Id", "Agenda", "Schedule Timestamp"), rows);
|
| 1416 |
|
1293 |
|
| 1417 |
try {
|
1294 |
try {
|
| 1418 |
byteArrayOutputStream.close();
|
1295 |
byteArrayOutputStream.close();
|
| 1419 |
} catch (IOException e) {
|
1296 |
} catch (IOException e) {
|