| Line 189... |
Line 189... |
| 189 |
vendorCatalogPricingService.parseBulkVendorCatalogPricing(file, authId);
|
189 |
vendorCatalogPricingService.parseBulkVendorCatalogPricing(file, authId);
|
| 190 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
190 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 191 |
return "response";
|
191 |
return "response";
|
| 192 |
}
|
192 |
}
|
| 193 |
|
193 |
|
| - |
|
194 |
@PostMapping(value = "/bulkVendorCatalogPricing/verify")
|
| - |
|
195 |
public String bulkVerifyVendorCatalogPricing(HttpServletRequest request, @RequestPart("file") MultipartFile file, Model model)
|
| - |
|
196 |
throws Exception {
|
| - |
|
197 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
198 |
int authId = authRepository.selectByEmailOrMobile(loginDetails.getEmailId()).getId();
|
| - |
|
199 |
LOGGER.info("bulk pricing approval by authId - {}", authId);
|
| - |
|
200 |
vendorCatalogPricingService.approveBulkVendorCatalogPricing(file, authId);
|
| - |
|
201 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| - |
|
202 |
return "response";
|
| - |
|
203 |
}
|
| - |
|
204 |
|
| 194 |
@GetMapping("/bulkVendorCatalogPricing/downloadReferenceFile")
|
205 |
@GetMapping("/bulkVendorCatalogPricing/downloadReferenceFile")
|
| 195 |
public ResponseEntity<?> downloadReferenceFile() throws IOException {
|
206 |
public ResponseEntity<?> downloadReferenceFile() throws IOException {
|
| 196 |
ClassPathResource dummyFile = new ClassPathResource("vendor-catalog-pricing-file.xlsx"); // Make sure the file is in the resources folder
|
207 |
ClassPathResource dummyFile = new ClassPathResource("vendor-catalog-pricing-file.xlsx"); // Make sure the file is in the resources folder
|
| 197 |
return ResponseEntity.ok()
|
208 |
return ResponseEntity.ok()
|
| 198 |
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=dummy-file.xlsx")
|
209 |
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=dummy-file.xlsx")
|
| Line 252... |
Line 263... |
| 252 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
263 |
AuthUser authUser = authRepository.selectByEmailOrMobile(loginDetails.getEmailId());
|
| 253 |
|
264 |
|
| 254 |
VendorCatalogPricingLog vendorCatalogPricingLog = vendorCatalogPricingLogRepository.selectById(id);
|
265 |
VendorCatalogPricingLog vendorCatalogPricingLog = vendorCatalogPricingLogRepository.selectById(id);
|
| 255 |
|
266 |
|
| 256 |
if (status.equals(VendorCatalogPricingStatus.APPROVED)) {
|
267 |
if (status.equals(VendorCatalogPricingStatus.APPROVED)) {
|
| 257 |
List<VendorCatalogPricingLog> vendorCatalogPricingLogsOnEffectedDate = vendorCatalogPricingLogRepository.selectByEffectedDateAndCatalogId(vendorCatalogPricingLog.getVendorId(), vendorCatalogPricingLog.getCatalogId(), vendorCatalogPricingLog.getEffectedOn());
|
268 |
vendorCatalogPricingService.approveVendorCatalogPricingLog(vendorCatalogPricingLog, authUser.getId());
|
| 258 |
Optional<VendorCatalogPricingLog> optionalVendorCatalogPricingLog = vendorCatalogPricingLogsOnEffectedDate.stream().filter(x -> x.getStatus().equals(VendorCatalogPricingStatus.APPROVED)).findAny();
|
- |
|
| 259 |
if (optionalVendorCatalogPricingLog.isPresent()) {
|
- |
|
| 260 |
VendorCatalogPricingLog approvedPricingLog = optionalVendorCatalogPricingLog.get();
|
- |
|
| 261 |
approvedPricingLog.setStatus(VendorCatalogPricingStatus.REJECTED);
|
- |
|
| 262 |
approvedPricingLog.setUpdatedTimestamp(LocalDateTime.now());
|
- |
|
| 263 |
}
|
269 |
} else {
|
| 264 |
|
- |
|
| 265 |
}
|
- |
|
| 266 |
vendorCatalogPricingLog.setStatus(status);
|
270 |
vendorCatalogPricingLog.setStatus(status);
|
| 267 |
vendorCatalogPricingLog.setUpdatedTimestamp(LocalDateTime.now());
|
271 |
vendorCatalogPricingLog.setUpdatedTimestamp(LocalDateTime.now());
|
| 268 |
if (vendorCatalogPricingLog.getStatus().equals(VendorCatalogPricingStatus.APPROVED)) {
|
- |
|
| 269 |
vendorCatalogPricingLog.setApprovedBy(authUser.getId());
|
- |
|
| 270 |
vendorCatalogPricingLog.setApprovedTimestamp(LocalDateTime.now());
|
- |
|
| 271 |
vendorCatalogPricingService.createVendorCatalogPricing(vendorCatalogPricingLog);
|
- |
|
| 272 |
}
|
272 |
}
|
| 273 |
|
273 |
|
| 274 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
274 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 275 |
return "response";
|
275 |
return "response";
|
| 276 |
}
|
276 |
}
|