Subversion Repositories SmartDukaan

Rev

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

Rev 25559 Rev 25609
Line 1... Line 1...
1
package com.spice.profitmandi.service.wallet;
1
package com.spice.profitmandi.service.wallet;
2
 
2
 
3
import java.time.LocalDateTime;
3
import java.time.LocalDateTime;
-
 
4
import java.util.ArrayList;
4
import java.util.HashMap;
5
import java.util.HashMap;
5
import java.util.List;
6
import java.util.List;
6
import java.util.Map;
7
import java.util.Map;
7
import java.util.Set;
8
import java.util.Set;
8
 
9
 
Line 34... Line 35...
34
	ProfitMandiBusinessException pbse = new ProfitMandiBusinessException("Wallet", "Wallet",
35
	ProfitMandiBusinessException pbse = new ProfitMandiBusinessException("Wallet", "Wallet",
35
			"Wallet is under maintainance, please try after some time");
36
			"Wallet is under maintainance, please try after some time");
36
 
37
 
37
	@Autowired
38
	@Autowired
38
	private UserAccountRepository userAccountRepository;
39
	private UserAccountRepository userAccountRepository;
39
	
40
 
40
	@Autowired
41
	@Autowired
41
	private WalletService walletService;
42
	private WalletService walletService;
42
 
43
 
43
	@Autowired
44
	@Autowired
44
	private UserWalletRepository userWalletRepository;
45
	private UserWalletRepository userWalletRepository;
Line 262... Line 263...
262
	}
263
	}
263
 
264
 
264
	@Override
265
	@Override
265
	public int getWalletAmount(int retailerId) throws ProfitMandiBusinessException {
266
	public int getWalletAmount(int retailerId) throws ProfitMandiBusinessException {
266
		UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
267
		UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
267
		if(userWallet==null) {
268
		if (userWallet == null) {
268
			return 0;
269
			return 0;
269
		}
270
		}
270
		return (int)userWalletHistoryRepository.selectSumByWallet(userWallet.getId());
271
		return (int) userWalletHistoryRepository.selectSumByWallet(userWallet.getId());
-
 
272
	}
-
 
273
 
-
 
274
	@Override
-
 
275
	public List<UserWalletHistory> getAllByReference(int fofoId, int reference, WalletReferenceType walletReferenceType)
-
 
276
			throws ProfitMandiBusinessException {
-
 
277
		UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoId);
-
 
278
		if (userWallet == null) {
-
 
279
			return new ArrayList<UserWalletHistory>();
-
 
280
		}
-
 
281
		return userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(userWallet.getId(), reference,
-
 
282
				walletReferenceType);
271
	}
283
	}
272
 
284
 
273
}
285
}