Subversion Repositories SmartDukaan

Rev

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

Rev 25533 Rev 25534
Line 664... Line 664...
664
		// throw new Exception();
664
		// throw new Exception();
665
	}
665
	}
666
 
666
 
667
	public void fixWallet() throws Exception {
667
	public void fixWallet() throws Exception {
668
		List<FofoStore> fofoStores = fofoStoreRepository.selectAll();
668
		List<FofoStore> fofoStores = fofoStoreRepository.selectAll();
669
		System.out.println("id\tcode\tname\tcity\tstate\tsaved wallet\tcalculated wallet\tdifference");
669
		System.out.println("id\tcode\tname\tcity\tstate\twallet amount\tsum\twallet amount-sum");
670
		for (FofoStore fofoStore : fofoStores) {
670
		for (FofoStore fofoStore : fofoStores) {
671
			UserWallet uw = userWalletRepository.selectByRetailerId(fofoStore.getId());
671
			UserWallet uw = userWalletRepository.selectByRetailerId(fofoStore.getId());
672
			User user = userRepository.selectById(fofoStore.getId());
672
			User user = userRepository.selectById(fofoStore.getId());
673
			if(user==null) {
673
			if(user==null) {
674
				LOGGER.info("store does not exist", fofoStore.getCode());
674
				LOGGER.info("store does not exist", fofoStore.getCode());
675
			}
675
			}
676
			Address address = addressRepository.selectById(user.getAddressId());
676
			Address address = addressRepository.selectById(user.getAddressId());
677
			int calculated = (int)userWalletHistoryRepository.selectSumByWallet(uw.getId());
677
			int calculated = (int)userWalletHistoryRepository.selectSumByWallet(uw.getId());
678
			System.out.printf("%d\t%s\t%s\t%s\t%s\t%d\t%d\t%d%n", fofoStore.getId(), fofoStore.getCode(), 
678
			System.out.printf("%d\t%s\t%s\t%s\t%s\t%d\t%d\t%d%n", fofoStore.getId(), fofoStore.getCode(), 
679
					address.getCity(), address.getName(), address.getState(), uw.getAmount(), calculated, 
679
					address.getCity(), address.getName(), address.getState(), uw.getAmount(), calculated, 
680
					calculated - uw.getAmount());
680
					uw.getAmount() - calculated);
681
		}
681
		}
682
	}
682
	}
683
}
683
}
684
 
684
 
685
//7015845171
685
//7015845171
686
686