Subversion Repositories SmartDukaan

Rev

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

Rev 26292 Rev 26294
Line 475... Line 475...
475
		return "feature";
475
		return "feature";
476
 
476
 
477
	}
477
	}
478
 
478
 
479
	@PostMapping(value = "/imei/upload")
479
	@PostMapping(value = "/imei/upload")
480
	public boolean uploadContent(HttpServletRequest request, @RequestPart("file") MultipartFile file, Model model)
480
	public String uploadContent(HttpServletRequest request, @RequestPart("file") MultipartFile file, Model model)
481
			throws Exception {
481
			throws Exception {
482
		/*if(brand==null) {
482
		/*if(brand==null) {
483
			throw new ProfitMandiBusinessException("Please select brand", "Brand empty", "Brand required");
483
			throw new ProfitMandiBusinessException("Please select brand", "Brand empty", "Brand required");
484
		}*/
484
		}*/
485
		List<CSVRecord> masterDataList = readFile(file);
485
		List<CSVRecord> masterDataList = readFile(file);
Line 493... Line 493...
493
				if (inventoryItem.getLastScanType().equals(com.spice.profitmandi.dao.enumuration.fofo.ScanType.SALE)
493
				if (inventoryItem.getLastScanType().equals(com.spice.profitmandi.dao.enumuration.fofo.ScanType.SALE)
494
						|| inventoryItem.getGoodQuantity() + inventoryItem.getBadQuantity() == 1) {
494
						|| inventoryItem.getGoodQuantity() + inventoryItem.getBadQuantity() == 1) {
495
					inventoryItem.setActivationTimestamp(imeisActivationMap.get(inventoryItem.getSerialNumber()));
495
					inventoryItem.setActivationTimestamp(imeisActivationMap.get(inventoryItem.getSerialNumber()));
496
				}
496
				}
497
			}
497
			}
-
 
498
			model.addAttribute("response", true);
498
		});
499
		});
499
		return true;
500
		return "response";
500
	}
501
	}
501
 
502
 
502
	private List<CSVRecord> readFile(MultipartFile file) throws Exception {
503
	private List<CSVRecord> readFile(MultipartFile file) throws Exception {
503
		List<CSVRecord> records = null;
504
		List<CSVRecord> records = null;
504
		try (CSVParser parser = new CSVParser(new InputStreamReader(file.getInputStream()), CSVFormat.DEFAULT)) {
505
		try (CSVParser parser = new CSVParser(new InputStreamReader(file.getInputStream()), CSVFormat.DEFAULT)) {