| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.service.wallet;
|
1 |
package com.spice.profitmandi.service.wallet;
|
| 2 |
|
2 |
|
| 3 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
3 |
import com.spice.profitmandi.common.enumuration.MessageType;
|
| 4 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
4 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
5 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 5 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
6 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 6 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
7 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
| 7 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
8 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 8 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
9 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| 9 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
10 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
| Line 11... |
Line 12... |
| 11 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
12 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 12 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
13 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 13 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
|
14 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
|
| 14 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
15 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
| 15 |
import com.spice.profitmandi.service.NotificationService;
|
16 |
import com.spice.profitmandi.service.NotificationService;
|
| - |
|
17 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 16 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
18 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
| 17 |
import org.apache.logging.log4j.LogManager;
|
19 |
import org.apache.logging.log4j.LogManager;
|
| 18 |
import org.apache.logging.log4j.Logger;
|
20 |
import org.apache.logging.log4j.Logger;
|
| 19 |
import org.springframework.beans.factory.annotation.Autowired;
|
21 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 20 |
import org.springframework.stereotype.Component;
|
22 |
import org.springframework.stereotype.Component;
|
| Line 141... |
Line 143... |
| 141 |
UserWallet userWallet = this.getUserWalletByUserId(userId);
|
143 |
UserWallet userWallet = this.getUserWalletByUserId(userId);
|
| 142 |
List<UserWalletHistory> userWalletHistories = userWalletHistoryRepository.selectByWalletId(userWallet.getId());
|
144 |
List<UserWalletHistory> userWalletHistories = userWalletHistoryRepository.selectByWalletId(userWallet.getId());
|
| 143 |
return userWalletHistories;
|
145 |
return userWalletHistories;
|
| 144 |
}
|
146 |
}
|
| 145 |
|
147 |
|
| - |
|
148 |
@Autowired
|
| - |
|
149 |
PartnerInvestmentService partnerInvestmentService;
|
| - |
|
150 |
|
| - |
|
151 |
//Definition is now changed, active also means valid investment should be ok
|
| 146 |
private boolean isActive(int userId) {
|
152 |
private boolean isActive(int userId) {
|
| 147 |
boolean active = true;
|
153 |
boolean active = true;
|
| 148 |
try {
|
154 |
try {
|
| 149 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userId);
|
155 |
FofoStore fs = fofoStoreRepository.selectByRetailerId(userId);
|
| 150 |
active = fs.isActive();
|
156 |
active = fs.isActive() && partnerInvestmentService.isInvestmentOk(userId, 10, ProfitMandiConstants.CUTOFF_INVESTMENT);
|
| 151 |
} catch (Exception e) {
|
157 |
} catch (Exception e) {
|
| 152 |
|
158 |
|
| 153 |
}
|
159 |
}
|
| 154 |
return active;
|
160 |
return active;
|
| 155 |
}
|
161 |
}
|