| 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\twallet amount\tsum\twallet amount-sum");
|
669 |
System.out.println("id\tcode\tactive\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 |
continue;
|
675 |
continue;
|
| 676 |
}
|
676 |
}
|
| - |
|
677 |
Address address = null;
|
| - |
|
678 |
try {
|
| 677 |
Address address = addressRepository.selectById(user.getAddressId());
|
679 |
address = addressRepository.selectById(user.getAddressId());
|
| - |
|
680 |
} catch(Exception e) {
|
| - |
|
681 |
LOGGER.info("Could not find address for Store", fofoStore.getCode());
|
| - |
|
682 |
address = new Address();
|
| - |
|
683 |
}
|
| 678 |
int calculated = (int)userWalletHistoryRepository.selectSumByWallet(uw.getId());
|
684 |
int calculated = (int)userWalletHistoryRepository.selectSumByWallet(uw.getId());
|
| 679 |
System.out.printf("%d\t%s\t%s\t%s\t%s\t%d\t%d\t%d%n", fofoStore.getId(), fofoStore.getCode(),
|
685 |
System.out.printf("%d\t%s\t%b\t%s\t%s\t%s\t%d\t%d\t%d%n", fofoStore.getId(), fofoStore.getCode(),
|
| 680 |
address.getCity(), address.getName(), address.getState(), uw.getAmount(), calculated,
|
686 |
fofoStore.isActive(), address.getCity(), address.getName(), address.getState(), uw.getAmount(), calculated,
|
| 681 |
uw.getAmount() - calculated);
|
687 |
uw.getAmount() - calculated);
|
| 682 |
}
|
688 |
}
|
| 683 |
}
|
689 |
}
|
| 684 |
}
|
690 |
}
|
| 685 |
|
691 |
|