calculate THEORETICAL_TURNOVER
4 fils de conversation non résolus
4 fils de conversation non résolus
Closes MYD-655
Rapports de requête de fusion
Activité
Filtrer l'activité
assigned to @chaimaa.hassoune
added 4 commits
-
2c1e9c79...3efa2415 - 3 commits from branch
develop
- 1f825fc4 - Merge branch 'develop' into 'feature/MYD-655'
-
2c1e9c79...3efa2415 - 3 commits from branch
42 logger.error("Invalid ItemSource value: {}", sourceStr); 43 throw e; 44 } 45 }) 46 .collect(Collectors.toList()); 47 } 48 49 double revenue = statisticsService.calculateTheoreticalRevenue(itemSources, startDate, endDate); 50 logger.info("Calculated theoretical revenue: {}", revenue); 51 return ResponseEntity.ok(revenue); 52 } catch (IllegalArgumentException e) { 53 logger.error("Invalid request parameters: {}", e.getMessage()); 54 return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(0.0); 55 } catch (TechnicalException e) { 56 logger.error("Technical error occurred: {}", e.getMessage()); 57 return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(0.0); 39 try { 40 return ItemSource.valueOf(sourceStr.toUpperCase()); 41 } catch (IllegalArgumentException e) { 42 logger.error("Invalid ItemSource value: {}", sourceStr); 43 throw e; 44 } 45 }) 46 .collect(Collectors.toList()); 47 } 48 49 double revenue = statisticsService.calculateTheoreticalRevenue(itemSources, startDate, endDate); 50 logger.info("Calculated theoretical revenue: {}", revenue); 51 return ResponseEntity.ok(revenue); 52 } catch (IllegalArgumentException e) { 53 logger.error("Invalid request parameters: {}", e.getMessage()); 54 return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(0.0); 226 226 } 227 227 } 228 228 229 public GiftCardDTO getGiftCardById(Long productId) { 230 String url = nameUrl.getAddonsService() + NameUri.ADDONS + AddonsServicePath.getGiftCardById(productId); 231 232 try { 233 ResponseEntity<GiftCardDTO> response = mcRestTemplateService.getForObject(url, GiftCardDTO.class); 234 HttpStatus statusCode = (HttpStatus) response.getStatusCode(); 235 236 if (statusCode == HttpStatus.OK) { 237 return response.getBody(); 238 } else if (statusCode == HttpStatus.NOT_FOUND) { 239 logger.warn("GiftCard not found with ID: {}. Skipping.", productId); 240 return null; 232 try { 233 ResponseEntity<GiftCardDTO> response = mcRestTemplateService.getForObject(url, GiftCardDTO.class); 234 HttpStatus statusCode = (HttpStatus) response.getStatusCode(); 235 236 if (statusCode == HttpStatus.OK) { 237 return response.getBody(); 238 } else if (statusCode == HttpStatus.NOT_FOUND) { 239 logger.warn("GiftCard not found with ID: {}. Skipping.", productId); 240 return null; 241 } else { 242 logger.error("Failed to retrieve gift card with ID: {}. HTTP Status: {}", productId, statusCode); 243 return null; 244 } 245 } catch (Exception e) { 246 logger.error("Exception while fetching gift card with ID: {}. Error: {}", productId, e.getMessage()); 247 return null;
Veuillez vous inscrire ou vous connecter pour répondre