| Line 33... |
Line 33... |
| 33 |
import com.spice.profitmandi.service.order.OrderService;
|
33 |
import com.spice.profitmandi.service.order.OrderService;
|
| 34 |
import com.spice.profitmandi.service.user.RetailerService;
|
34 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 35 |
import com.spice.profitmandi.web.model.LoginDetails;
|
35 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 36 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
36 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 37 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
37 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| - |
|
38 |
import org.apache.commons.csv.CSVFormat;
|
| - |
|
39 |
import org.apache.commons.csv.CSVParser;
|
| 38 |
import org.apache.commons.csv.CSVRecord;
|
40 |
import org.apache.commons.csv.CSVRecord;
|
| 39 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
41 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 40 |
import org.apache.logging.log4j.LogManager;
|
42 |
import org.apache.logging.log4j.LogManager;
|
| 41 |
import org.apache.logging.log4j.Logger;
|
43 |
import org.apache.logging.log4j.Logger;
|
| 42 |
import org.springframework.beans.factory.annotation.Autowired;
|
44 |
import org.springframework.beans.factory.annotation.Autowired;
|
| Line 54... |
Line 56... |
| 54 |
|
56 |
|
| 55 |
import javax.servlet.http.HttpServletRequest;
|
57 |
import javax.servlet.http.HttpServletRequest;
|
| 56 |
import javax.servlet.http.HttpServletResponse;
|
58 |
import javax.servlet.http.HttpServletResponse;
|
| 57 |
import java.io.ByteArrayInputStream;
|
59 |
import java.io.ByteArrayInputStream;
|
| 58 |
import java.io.InputStream;
|
60 |
import java.io.InputStream;
|
| - |
|
61 |
import java.io.InputStreamReader;
|
| - |
|
62 |
import java.io.Reader;
|
| 59 |
import java.text.DecimalFormat;
|
63 |
import java.text.DecimalFormat;
|
| 60 |
import java.time.LocalDate;
|
64 |
import java.time.LocalDate;
|
| 61 |
import java.time.LocalDateTime;
|
65 |
import java.time.LocalDateTime;
|
| 62 |
import java.time.format.DateTimeFormatter;
|
66 |
import java.time.format.DateTimeFormatter;
|
| 63 |
import java.util.*;
|
67 |
import java.util.*;
|
| Line 383... |
Line 387... |
| 383 |
model.addAttribute("leadFirsts", leadFirsts);
|
387 |
model.addAttribute("leadFirsts", leadFirsts);
|
| 384 |
model.addAttribute("lwDays", lwDays);
|
388 |
model.addAttribute("lwDays", lwDays);
|
| 385 |
|
389 |
|
| 386 |
model.addAttribute("selectedLeadStatus", leadStatus.get(0));
|
390 |
model.addAttribute("selectedLeadStatus", leadStatus.get(0));
|
| 387 |
|
391 |
|
| - |
|
392 |
boolean showBulkUploader =
|
| - |
|
393 |
"sm@smartdukaan.com".equalsIgnoreCase(emailId);
|
| - |
|
394 |
|
| - |
|
395 |
model.addAttribute("showBulkUploader", showBulkUploader);
|
| 388 |
|
396 |
|
| 389 |
List<BrandCatalog> brandsDisplays = brandsService.getBrandsToDisplay(3);
|
397 |
List<BrandCatalog> brandsDisplays = brandsService.getBrandsToDisplay(3);
|
| 390 |
brandsDisplays.addAll(brandsService.getBrandsToDisplay(6));
|
398 |
brandsDisplays.addAll(brandsService.getBrandsToDisplay(6));
|
| 391 |
model.addAttribute("brandsDisplays", brandsDisplays.stream().distinct().collect(Collectors.toList()));
|
399 |
model.addAttribute("brandsDisplays", brandsDisplays.stream().distinct().collect(Collectors.toList()));
|
| 392 |
|
400 |
|
| Line 920... |
Line 928... |
| 920 |
leadActivity.setCreatedTimestamp(LocalDateTime.now());
|
928 |
leadActivity.setCreatedTimestamp(LocalDateTime.now());
|
| 921 |
leadActivity.setAuthId(authUser.getId());
|
929 |
leadActivity.setAuthId(authUser.getId());
|
| 922 |
leadActivityRepository.persist(leadActivity);
|
930 |
leadActivityRepository.persist(leadActivity);
|
| 923 |
lead.setAssignTo(createLeadActivityRequest.getAssignTo());
|
931 |
lead.setAssignTo(createLeadActivityRequest.getAssignTo());
|
| 924 |
lead.setStatus(createLeadActivityRequest.getStatus());
|
932 |
lead.setStatus(createLeadActivityRequest.getStatus());
|
| - |
|
933 |
lead.setState(createLeadActivityRequest.getState());
|
| - |
|
934 |
lead.setCity(createLeadActivityRequest.getCity());
|
| 925 |
if (createLeadActivityRequest.getColorCheck() == true) {
|
935 |
if (createLeadActivityRequest.getColorCheck() == true) {
|
| 926 |
lead.setColor("Green");
|
936 |
lead.setColor("Green");
|
| 927 |
} else {
|
937 |
} else {
|
| 928 |
lead.setColor("Yellow");
|
938 |
lead.setColor("Yellow");
|
| 929 |
}
|
939 |
}
|
| Line 1128... |
Line 1138... |
| 1128 |
return "lead-detail";
|
1138 |
return "lead-detail";
|
| 1129 |
|
1139 |
|
| 1130 |
}
|
1140 |
}
|
| 1131 |
|
1141 |
|
| 1132 |
@RequestMapping(value = "/getLeadDetailByLeadId", method = RequestMethod.GET)
|
1142 |
@RequestMapping(value = "/getLeadDetailByLeadId", method = RequestMethod.GET)
|
| 1133 |
public ResponseEntity<?> getLeadDetailByLeadId(HttpServletRequest request, @RequestParam int leadId, Model model) throws Exception {
|
1143 |
public ResponseEntity<?> getLeadDetailByLeadId(@RequestParam int leadId) {
|
| 1134 |
|
1144 |
|
| - |
|
1145 |
Lead lead = leadRepository.selectById(leadId);
|
| 1135 |
LeadDetail leadDetail = leadDetailRepository.selectByLeadId(leadId);
|
1146 |
LeadDetail leadDetail = leadDetailRepository.selectByLeadId(leadId);
|
| - |
|
1147 |
Map<String, Object> response = new HashMap<>();
|
| - |
|
1148 |
response.put("city", lead.getCity());
|
| - |
|
1149 |
response.put("state", lead.getState());
|
| - |
|
1150 |
if (leadDetail != null) {
|
| - |
|
1151 |
response.put("outletName", leadDetail.getOutletName());
|
| - |
|
1152 |
response.put("counterSize", leadDetail.getCounterSize());
|
| - |
|
1153 |
}
|
| 1136 |
return responseSender.ok(leadDetail);
|
1154 |
return responseSender.ok(response);
|
| - |
|
1155 |
}
|
| - |
|
1156 |
|
| - |
|
1157 |
@PostMapping("/upload-assign-id")
|
| - |
|
1158 |
public ResponseEntity<?> uploadAssignIdCsv(
|
| - |
|
1159 |
@RequestParam("file") MultipartFile file)
|
| - |
|
1160 |
throws Exception {
|
| - |
|
1161 |
|
| - |
|
1162 |
try (Reader reader = new InputStreamReader(file.getInputStream());
|
| - |
|
1163 |
CSVParser parser = new CSVParser(reader, CSVFormat.DEFAULT)) {
|
| - |
|
1164 |
|
| - |
|
1165 |
List<CSVRecord> records = parser.getRecords();
|
| - |
|
1166 |
|
| - |
|
1167 |
if (records.size() < 2) {
|
| - |
|
1168 |
throw new ProfitMandiBusinessException(
|
| - |
|
1169 |
"Uploaded File", "", "No records Found");
|
| - |
|
1170 |
}
|
| - |
|
1171 |
|
| - |
|
1172 |
records.remove(0);
|
| 1137 |
|
1173 |
|
| - |
|
1174 |
for (CSVRecord record : records) {
|
| - |
|
1175 |
|
| - |
|
1176 |
int leadId = Integer.parseInt(record.get(0));
|
| - |
|
1177 |
int assignId = Integer.parseInt(record.get(1));
|
| - |
|
1178 |
|
| - |
|
1179 |
Lead lead = leadRepository.selectById(leadId);
|
| - |
|
1180 |
|
| - |
|
1181 |
if (lead == null) {
|
| - |
|
1182 |
LOGGER.warn("Lead not found for id {}", leadId);
|
| - |
|
1183 |
continue;
|
| - |
|
1184 |
}
|
| - |
|
1185 |
|
| - |
|
1186 |
lead.setAssignTo(assignId);
|
| - |
|
1187 |
}
|
| - |
|
1188 |
}
|
| - |
|
1189 |
|
| - |
|
1190 |
return responseSender.ok("CSV processed successfully");
|
| 1138 |
}
|
1191 |
}
|
| 1139 |
|
1192 |
|
| - |
|
1193 |
|
| - |
|
1194 |
|
| 1140 |
@RequestMapping(value = "/getTeamCommitment", method = RequestMethod.GET)
|
1195 |
@RequestMapping(value = "/getTeamCommitment", method = RequestMethod.GET)
|
| 1141 |
public String getTeamCommitments(HttpServletRequest request, @RequestParam LocalDateTime date, Model model) throws Exception {
|
1196 |
public String getTeamCommitments(HttpServletRequest request, @RequestParam LocalDateTime date, Model model) throws Exception {
|
| 1142 |
|
1197 |
|
| 1143 |
List<TeamCommitmentModel> commitments = partnerCollectionPlanRepository.selectTeamCommitmentByDate(date.toLocalDate());
|
1198 |
List<TeamCommitmentModel> commitments = partnerCollectionPlanRepository.selectTeamCommitmentByDate(date.toLocalDate());
|
| 1144 |
|
1199 |
|