Subversion Repositories SmartDukaan

Rev

Rev 35458 | Rev 35480 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35458 Rev 35466
Line 2334... Line 2334...
2334
 
2334
 
2335
    @RequestMapping(value = "/getActivatedImeiUpdationDate", method = RequestMethod.GET)
2335
    @RequestMapping(value = "/getActivatedImeiUpdationDate", method = RequestMethod.GET)
2336
    public String getActivatedImeiUpdationDate(HttpServletRequest request, Model model) throws Exception {
2336
    public String getActivatedImeiUpdationDate(HttpServletRequest request, Model model) throws Exception {
2337
 
2337
 
2338
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
2338
        Map<Integer, String> warehouseMap = ProfitMandiConstants.WAREHOUSE_MAP;
-
 
2339
        List<String> brands = ProfitMandiConstants.BRANDS;
2339
 
2340
 
2340
        List<ActivationImeiUpdationModel> activationImeiUpdations = activatedImeiRepository.selectActivatedUpdationDate();
2341
        List<ActivationImeiUpdationModel> activationImeiUpdations = activatedImeiRepository.selectActivatedUpdationDate();
-
 
2342
 
-
 
2343
        // Create a map for quick lookup of existing results
-
 
2344
        Map<String, ActivationImeiUpdationModel> resultMap = activationImeiUpdations.stream()
-
 
2345
                .collect(Collectors.toMap(
-
 
2346
                        m -> m.getWarehouseId() + "_" + m.getBrand(),
-
 
2347
                        m -> m
-
 
2348
                ));
-
 
2349
 
-
 
2350
        // Merge with master data - add missing combinations with null timestamp
-
 
2351
        List<ActivationImeiUpdationModel> completeList = new ArrayList<>();
-
 
2352
        for (Integer warehouseId : warehouseMap.keySet()) {
-
 
2353
            for (String brand : brands) {
-
 
2354
                String key = warehouseId + "_" + brand;
-
 
2355
                ActivationImeiUpdationModel existing = resultMap.get(key);
-
 
2356
                if (existing != null) {
-
 
2357
                    completeList.add(existing);
-
 
2358
                } else {
-
 
2359
                    completeList.add(new ActivationImeiUpdationModel(warehouseId, brand, null));
-
 
2360
                }
-
 
2361
            }
-
 
2362
        }
-
 
2363
 
2341
        model.addAttribute("warehouseMap", warehouseMap);
2364
        model.addAttribute("warehouseMap", warehouseMap);
2342
        model.addAttribute("activationImeiUpdations", activationImeiUpdations);
2365
        model.addAttribute("activationImeiUpdations", completeList);
2343
        return "activation-updation-timestamp";
2366
        return "activation-updation-timestamp";
2344
 
2367
 
2345
    }
2368
    }
2346
 
2369
 
2347
    private List<Integer> getFofoIds(LoginDetails loginDetails) throws ProfitMandiBusinessException {
2370
    private List<Integer> getFofoIds(LoginDetails loginDetails) throws ProfitMandiBusinessException {