| Line 8... |
Line 8... |
| 8 |
import com.spice.profitmandi.common.util.*;
|
8 |
import com.spice.profitmandi.common.util.*;
|
| 9 |
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
|
9 |
import com.spice.profitmandi.dao.entity.dtr.CreditAccount;
|
| 10 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
10 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 11 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
11 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
| 12 |
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
|
12 |
import com.spice.profitmandi.dao.enumuration.transaction.AddWalletRequestStatus;
|
| - |
|
13 |
import com.spice.profitmandi.dao.enumuration.transaction.LoanReferenceType;
|
| - |
|
14 |
import com.spice.profitmandi.dao.enumuration.transaction.LoanSummaryType;
|
| 13 |
import com.spice.profitmandi.dao.enumuration.transaction.TransactionType;
|
15 |
import com.spice.profitmandi.dao.enumuration.transaction.TransactionType;
|
| - |
|
16 |
import com.spice.profitmandi.dao.model.SDCreditResponseOut;
|
| 14 |
import com.spice.profitmandi.dao.repository.catalog.AddWalletRequestRepository;
|
17 |
import com.spice.profitmandi.dao.repository.catalog.AddWalletRequestRepository;
|
| 15 |
import com.spice.profitmandi.dao.repository.catalog.ManualPaymentRequestRepository;
|
18 |
import com.spice.profitmandi.dao.repository.catalog.ManualPaymentRequestRepository;
|
| 16 |
import com.spice.profitmandi.dao.repository.catalog.UnsettledPaymentsRepository;
|
19 |
import com.spice.profitmandi.dao.repository.catalog.UnsettledPaymentsRepository;
|
| 17 |
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
|
20 |
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
|
| 18 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
21 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 19 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
22 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 20 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
23 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
| 21 |
import com.spice.profitmandi.dao.repository.transaction.StatementDetailModel;
|
- |
|
| 22 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
|
- |
|
| 23 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
- |
|
| 24 |
import com.spice.profitmandi.service.NotificationService;
|
24 |
import com.spice.profitmandi.service.NotificationService;
|
| 25 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
25 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 26 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
26 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
| 27 |
import com.spice.profitmandi.service.user.RetailerService;
|
27 |
import com.spice.profitmandi.service.user.RetailerService;
|
| 28 |
import com.spice.profitmandi.service.wallet.WalletService;
|
28 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| Line 56... |
Line 56... |
| 56 |
import javax.swing.*;
|
56 |
import javax.swing.*;
|
| 57 |
import javax.transaction.Transactional;
|
57 |
import javax.transaction.Transactional;
|
| 58 |
import java.io.ByteArrayInputStream;
|
58 |
import java.io.ByteArrayInputStream;
|
| 59 |
import java.io.ByteArrayOutputStream;
|
59 |
import java.io.ByteArrayOutputStream;
|
| 60 |
import java.io.InputStream;
|
60 |
import java.io.InputStream;
|
| - |
|
61 |
import java.math.BigDecimal;
|
| 61 |
import java.text.MessageFormat;
|
62 |
import java.text.MessageFormat;
|
| 62 |
import java.time.LocalDate;
|
63 |
import java.time.LocalDate;
|
| 63 |
import java.time.LocalDateTime;
|
64 |
import java.time.LocalDateTime;
|
| 64 |
import java.time.ZoneId;
|
65 |
import java.time.ZoneId;
|
| - |
|
66 |
import java.time.temporal.ChronoUnit;
|
| 65 |
import java.util.*;
|
67 |
import java.util.*;
|
| 66 |
import java.util.stream.Collectors;
|
68 |
import java.util.stream.Collectors;
|
| 67 |
|
69 |
|
| 68 |
@Controller
|
70 |
@Controller
|
| 69 |
@Transactional(rollbackOn = Throwable.class)
|
71 |
@Transactional(rollbackOn = Throwable.class)
|
| Line 86... |
Line 88... |
| 86 |
private static final int RECHARGE = 16;
|
88 |
private static final int RECHARGE = 16;
|
| 87 |
private static final int REFUND = 17;
|
89 |
private static final int REFUND = 17;
|
| 88 |
private static final int SCHEME_IN = 18;
|
90 |
private static final int SCHEME_IN = 18;
|
| 89 |
private static final int SCHEME_OUT = 19;
|
91 |
private static final int SCHEME_OUT = 19;
|
| 90 |
private static final Map<WalletReferenceType, Integer> walletReferenceMap = new HashMap<>();
|
92 |
private static final Map<WalletReferenceType, Integer> walletReferenceMap = new HashMap<>();
|
| - |
|
93 |
|
| 91 |
static {
|
94 |
static {
|
| 92 |
walletReferenceMap.put(WalletReferenceType.ACTIVATION_SCHEME, ACTIVATION_SCHEME);
|
95 |
walletReferenceMap.put(WalletReferenceType.ACTIVATION_SCHEME, ACTIVATION_SCHEME);
|
| 93 |
walletReferenceMap.put(WalletReferenceType.ADVANCE_AMOUNT, ADVANCE_AMOUNT);
|
96 |
walletReferenceMap.put(WalletReferenceType.ADVANCE_AMOUNT, ADVANCE_AMOUNT);
|
| 94 |
walletReferenceMap.put(WalletReferenceType.AUTOMATED_ADVANCE, AUTOMATED_ADVANCE);
|
97 |
walletReferenceMap.put(WalletReferenceType.AUTOMATED_ADVANCE, AUTOMATED_ADVANCE);
|
| 95 |
walletReferenceMap.put(WalletReferenceType.BRAND_PAYOUT, BRAND_PAYOUT);
|
98 |
walletReferenceMap.put(WalletReferenceType.BRAND_PAYOUT, BRAND_PAYOUT);
|
| Line 102... |
Line 105... |
| 102 |
walletReferenceMap.put(WalletReferenceType.REFUND, REFUND);
|
105 |
walletReferenceMap.put(WalletReferenceType.REFUND, REFUND);
|
| 103 |
walletReferenceMap.put(WalletReferenceType.SCHEME_IN, SCHEME_IN);
|
106 |
walletReferenceMap.put(WalletReferenceType.SCHEME_IN, SCHEME_IN);
|
| 104 |
walletReferenceMap.put(WalletReferenceType.SCHEME_OUT, SCHEME_OUT);
|
107 |
walletReferenceMap.put(WalletReferenceType.SCHEME_OUT, SCHEME_OUT);
|
| 105 |
|
108 |
|
| 106 |
}
|
109 |
}
|
| - |
|
110 |
|
| 107 |
private static final int GRAND_TOTAL = 20;
|
111 |
private static final int GRAND_TOTAL = 20;
|
| 108 |
|
112 |
|
| 109 |
private static final int CLOSING_BALANCE = 22;
|
113 |
private static final int CLOSING_BALANCE = 22;
|
| 110 |
private static final int PENDING_GRN = 23;
|
114 |
private static final int PENDING_GRN = 23;
|
| 111 |
private static final int ACTIVATED_IMEIS = 24;
|
115 |
private static final int ACTIVATED_IMEIS = 24;
|
| Line 155... |
Line 159... |
| 155 |
@Autowired
|
159 |
@Autowired
|
| 156 |
private CreditAccountRepository creditAccountRepository;
|
160 |
private CreditAccountRepository creditAccountRepository;
|
| 157 |
|
161 |
|
| 158 |
@Autowired
|
162 |
@Autowired
|
| 159 |
private NotificationService notificationService;
|
163 |
private NotificationService notificationService;
|
| - |
|
164 |
@Autowired
|
| - |
|
165 |
LoanRepository loanRepository;
|
| - |
|
166 |
@Autowired
|
| - |
|
167 |
private LoanStatementRepository loanStatementRepository;
|
| - |
|
168 |
@Autowired
|
| - |
|
169 |
SDCreditRequirementRepository sdCreditRequirementRepository;
|
| 160 |
private static final Logger LOGGER = LogManager.getLogger(WalletController.class);
|
170 |
private static final Logger LOGGER = LogManager.getLogger(WalletController.class);
|
| 161 |
|
171 |
|
| 162 |
@PostMapping(value = "/wallet/upload")
|
172 |
@PostMapping(value = "/wallet/upload")
|
| 163 |
public String uploadWalletBulk(HttpServletRequest request, @RequestPart("file") MultipartFile file, Model model)
|
173 |
public String uploadWalletBulk(HttpServletRequest request, @RequestPart("file") MultipartFile file, Model model)
|
| 164 |
throws Exception {
|
174 |
throws Exception {
|
| Line 188... |
Line 198... |
| 188 |
return "response";
|
198 |
return "response";
|
| 189 |
}
|
199 |
}
|
| 190 |
|
200 |
|
| 191 |
@RequestMapping(value = "/walletDetails", method = RequestMethod.GET)
|
201 |
@RequestMapping(value = "/walletDetails", method = RequestMethod.GET)
|
| 192 |
public String dashboard(HttpServletRequest request,
|
202 |
public String dashboard(HttpServletRequest request,
|
| 193 |
@RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString,
|
203 |
@RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString,
|
| 194 |
@RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString,
|
204 |
@RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString,
|
| 195 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
205 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 196 |
@RequestParam(name = "limit", defaultValue = "100") int limit, Model model)
|
206 |
@RequestParam(name = "limit", defaultValue = "100") int limit, Model model)
|
| 197 |
throws ProfitMandiBusinessException {
|
207 |
throws ProfitMandiBusinessException {
|
| 198 |
/*
|
208 |
/*
|
| 199 |
* boolean underMaintainance = true; if(underMaintainance) { throw new
|
209 |
* boolean underMaintainance = true; if(underMaintainance) { throw new
|
| 200 |
* ProfitMandiBusinessException("Wallet", "Wallet",
|
210 |
* ProfitMandiBusinessException("Wallet", "Wallet",
|
| 201 |
* "Wallet is under Maintenance"); }
|
211 |
* "Wallet is under Maintenance"); }
|
| 202 |
*/
|
212 |
*/
|
| 203 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
213 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
214 |
int fofoId = fofoDetails.getFofoId();
|
| 204 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
215 |
boolean isAdmin = roleManager.isAdmin(fofoDetails.getRoleIds());
|
| 205 |
UserWallet userWallet = walletService.getUserWallet(fofoDetails.getFofoId());
|
216 |
UserWallet userWallet = walletService.getUserWallet(fofoId);
|
| 206 |
|
217 |
|
| 207 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
218 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
| 208 |
LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
|
219 |
LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
|
| 209 |
|
220 |
|
| 210 |
List<UserWalletHistory> userWalletHistories = new ArrayList<>();
|
221 |
List<UserWalletHistory> userWalletHistories = new ArrayList<>();
|
| 211 |
try {
|
222 |
try {
|
| 212 |
userWalletHistories = walletService.getPaginatedUserWalletHistoryByRetailerId(fofoDetails.getFofoId(),
|
223 |
userWalletHistories = walletService.getPaginatedUserWalletHistoryByRetailerId(fofoId,
|
| 213 |
startDateTime, endDateTime, offset, limit);
|
224 |
startDateTime, endDateTime, offset, limit);
|
| 214 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
225 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 215 |
LOGGER.error("UserWallet History not found : ", profitMandiBusinessException);
|
226 |
LOGGER.error("UserWallet History not found : ", profitMandiBusinessException);
|
| 216 |
}
|
227 |
}
|
| 217 |
|
228 |
|
| Line 219... |
Line 230... |
| 219 |
try {
|
230 |
try {
|
| 220 |
countItems = walletService.getSizeByRetailerId(fofoDetails.getFofoId(), startDateTime, endDateTime);
|
231 |
countItems = walletService.getSizeByRetailerId(fofoDetails.getFofoId(), startDateTime, endDateTime);
|
| 221 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
232 |
} catch (ProfitMandiBusinessException profitMandiBusinessException) {
|
| 222 |
LOGGER.error("UserWallet not found : ", profitMandiBusinessException);
|
233 |
LOGGER.error("UserWallet not found : ", profitMandiBusinessException);
|
| 223 |
}
|
234 |
}
|
| - |
|
235 |
List<Loan> loans = loanRepository.selectAllActiveLoan();
|
| - |
|
236 |
for (Loan loan : loans) {
|
| - |
|
237 |
int loanId = loan.getId();
|
| - |
|
238 |
BigDecimal pendingAmount = loan.getPendingAmount();
|
| - |
|
239 |
BigDecimal interestAccrued = loan.getInterestAccrued();
|
| - |
|
240 |
BigDecimal interestPaid = loan.getInterestPaid();
|
| - |
|
241 |
BigDecimal totalAmount = interestAccrued.subtract(interestPaid).add(pendingAmount);
|
| - |
|
242 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementRepository.selectByFofoId(fofoId);
|
| - |
|
243 |
if (sdCreditRequirement != null) {
|
| - |
|
244 |
BigDecimal availableLimit = sdCreditRequirement.getAvailableLimit();
|
| - |
|
245 |
BigDecimal creditlimit = sdCreditRequirement.getLimit();
|
| 224 |
model.addAttribute("userWallet", userWallet);
|
246 |
model.addAttribute("userWallet", userWallet);
|
| 225 |
model.addAttribute("walletHistories", userWalletHistories);
|
247 |
model.addAttribute("walletHistories", userWalletHistories);
|
| 226 |
model.addAttribute("start", offset + 1);
|
248 |
model.addAttribute("start", offset + 1);
|
| 227 |
model.addAttribute("size", countItems);
|
249 |
model.addAttribute("size", countItems);
|
| 228 |
model.addAttribute("isAdmin", isAdmin);
|
250 |
model.addAttribute("isAdmin", isAdmin);
|
| - |
|
251 |
model.addAttribute("loans", loans);
|
| - |
|
252 |
model.addAttribute("totalAmount", totalAmount);
|
| - |
|
253 |
model.addAttribute("availableLimit", availableLimit);
|
| - |
|
254 |
model.addAttribute("creditlimit", creditlimit);
|
| 229 |
model.addAttribute(ProfitMandiConstants.START_TIME, startTimeString);
|
255 |
model.addAttribute(ProfitMandiConstants.START_TIME, startTimeString);
|
| 230 |
model.addAttribute(ProfitMandiConstants.END_TIME, endTimeString);
|
256 |
model.addAttribute(ProfitMandiConstants.END_TIME, endTimeString);
|
| - |
|
257 |
}
|
| - |
|
258 |
}
|
| 231 |
if (userWalletHistories.size() < limit) {
|
259 |
if (userWalletHistories.size() < limit) {
|
| 232 |
model.addAttribute("end", offset + userWalletHistories.size());
|
260 |
model.addAttribute("end", offset + userWalletHistories.size());
|
| 233 |
} else {
|
261 |
} else {
|
| 234 |
model.addAttribute("end", offset + limit);
|
262 |
model.addAttribute("end", offset + limit);
|
| 235 |
}
|
263 |
}
|
| 236 |
return "wallet-details";
|
264 |
return "wallet-details";
|
| 237 |
}
|
265 |
}
|
| 238 |
|
266 |
|
| 239 |
@RequestMapping(value = "/getPaginatedWalletHistory")
|
267 |
@RequestMapping(value = "/getPaginatedWalletHistory")
|
| 240 |
public String getSaleHistoryPaginated(HttpServletRequest request,
|
268 |
public String getSaleHistoryPaginated(HttpServletRequest request,
|
| 241 |
@RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString,
|
269 |
@RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString,
|
| 242 |
@RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString,
|
270 |
@RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString,
|
| 243 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
271 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 244 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
272 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 245 |
throws ProfitMandiBusinessException {
|
273 |
throws ProfitMandiBusinessException {
|
| 246 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
274 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 247 |
|
275 |
|
| 248 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
276 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
| 249 |
LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
|
277 |
LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
|
| Line 260... |
Line 288... |
| 260 |
return "wallet-history-paginated";
|
288 |
return "wallet-history-paginated";
|
| 261 |
}
|
289 |
}
|
| 262 |
|
290 |
|
| 263 |
@RequestMapping(value = "/getAddWalletRequest", method = RequestMethod.GET)
|
291 |
@RequestMapping(value = "/getAddWalletRequest", method = RequestMethod.GET)
|
| 264 |
public String getAddwalletRequest(HttpServletRequest request,
|
292 |
public String getAddwalletRequest(HttpServletRequest request,
|
| 265 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
293 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 266 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
|
294 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
|
| 267 |
List<AddWalletRequest> walletRequest = null;
|
295 |
List<AddWalletRequest> walletRequest = null;
|
| 268 |
long size = 0;
|
296 |
long size = 0;
|
| 269 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.pending);
|
297 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.pending);
|
| 270 |
LOGGER.info("walletRequest" + walletRequest);
|
298 |
LOGGER.info("walletRequest" + walletRequest);
|
| 271 |
size = addWalletRequestRepository.selectCountByStatus(AddWalletRequestStatus.pending);
|
299 |
size = addWalletRequestRepository.selectCountByStatus(AddWalletRequestStatus.pending);
|
| Line 299... |
Line 327... |
| 299 |
return "add-wallet-request";
|
327 |
return "add-wallet-request";
|
| 300 |
}
|
328 |
}
|
| 301 |
|
329 |
|
| 302 |
@RequestMapping(value = "/getPaginatedWalletRequest", method = RequestMethod.GET)
|
330 |
@RequestMapping(value = "/getPaginatedWalletRequest", method = RequestMethod.GET)
|
| 303 |
public String getPaginatedWalletRequest(HttpServletRequest request,
|
331 |
public String getPaginatedWalletRequest(HttpServletRequest request,
|
| 304 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
332 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 305 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
|
333 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
|
| 306 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
334 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 307 |
List<AddWalletRequest> walletRequest = null;
|
335 |
List<AddWalletRequest> walletRequest = null;
|
| 308 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.pending);
|
336 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.pending);
|
| 309 |
LOGGER.info("walletRequest" + walletRequest);
|
337 |
LOGGER.info("walletRequest" + walletRequest);
|
| 310 |
if (!walletRequest.isEmpty()) {
|
338 |
if (!walletRequest.isEmpty()) {
|
| Line 328... |
Line 356... |
| 328 |
return "add-wallet-request-paginated";
|
356 |
return "add-wallet-request-paginated";
|
| 329 |
}
|
357 |
}
|
| 330 |
|
358 |
|
| 331 |
@RequestMapping(value = "/getAddWalletApproved", method = RequestMethod.GET)
|
359 |
@RequestMapping(value = "/getAddWalletApproved", method = RequestMethod.GET)
|
| 332 |
public String getAddwalletRequestApproved(HttpServletRequest request,
|
360 |
public String getAddwalletRequestApproved(HttpServletRequest request,
|
| 333 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
361 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 334 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
362 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 335 |
throws ProfitMandiBusinessException {
|
363 |
throws ProfitMandiBusinessException {
|
| 336 |
List<AddWalletRequest> walletRequest = null;
|
364 |
List<AddWalletRequest> walletRequest = null;
|
| 337 |
|
365 |
|
| 338 |
long size = 0;
|
366 |
long size = 0;
|
| 339 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.approved);
|
367 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.approved);
|
| Line 367... |
Line 395... |
| 367 |
return "add-wallet-request";
|
395 |
return "add-wallet-request";
|
| 368 |
}
|
396 |
}
|
| 369 |
|
397 |
|
| 370 |
@RequestMapping(value = "/getPaginatedWalletApproved", method = RequestMethod.GET)
|
398 |
@RequestMapping(value = "/getPaginatedWalletApproved", method = RequestMethod.GET)
|
| 371 |
public String getPaginatedWalletApproved(HttpServletRequest request,
|
399 |
public String getPaginatedWalletApproved(HttpServletRequest request,
|
| 372 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
400 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 373 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
401 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 374 |
throws ProfitMandiBusinessException {
|
402 |
throws ProfitMandiBusinessException {
|
| 375 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
403 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 376 |
List<AddWalletRequest> walletRequest = null;
|
404 |
List<AddWalletRequest> walletRequest = null;
|
| 377 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.approved);
|
405 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.approved);
|
| 378 |
LOGGER.info("walletRequest" + walletRequest);
|
406 |
LOGGER.info("walletRequest" + walletRequest);
|
| Line 394... |
Line 422... |
| 394 |
return "add-wallet-request-paginated";
|
422 |
return "add-wallet-request-paginated";
|
| 395 |
}
|
423 |
}
|
| 396 |
|
424 |
|
| 397 |
@RequestMapping(value = "/getAddWalletRequestRejected", method = RequestMethod.GET)
|
425 |
@RequestMapping(value = "/getAddWalletRequestRejected", method = RequestMethod.GET)
|
| 398 |
public String getAddwalletRequestRejected(HttpServletRequest request,
|
426 |
public String getAddwalletRequestRejected(HttpServletRequest request,
|
| 399 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
427 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 400 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
428 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 401 |
throws ProfitMandiBusinessException {
|
429 |
throws ProfitMandiBusinessException {
|
| 402 |
List<AddWalletRequest> walletRequest = null;
|
430 |
List<AddWalletRequest> walletRequest = null;
|
| 403 |
|
431 |
|
| 404 |
long size = 0;
|
432 |
long size = 0;
|
| 405 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.rejected);
|
433 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.rejected);
|
| Line 432... |
Line 460... |
| 432 |
return "add-wallet-request";
|
460 |
return "add-wallet-request";
|
| 433 |
}
|
461 |
}
|
| 434 |
|
462 |
|
| 435 |
@RequestMapping(value = "/getPaginatedWalletRequestRejected", method = RequestMethod.GET)
|
463 |
@RequestMapping(value = "/getPaginatedWalletRequestRejected", method = RequestMethod.GET)
|
| 436 |
public String getPaginatedWalletRequestRejected(HttpServletRequest request,
|
464 |
public String getPaginatedWalletRequestRejected(HttpServletRequest request,
|
| 437 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
465 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 438 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
466 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model)
|
| 439 |
throws ProfitMandiBusinessException {
|
467 |
throws ProfitMandiBusinessException {
|
| 440 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
468 |
LOGGER.info("requested offset=[{}], limit = [{}]", offset, limit);
|
| 441 |
List<AddWalletRequest> walletRequest = null;
|
469 |
List<AddWalletRequest> walletRequest = null;
|
| 442 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.rejected);
|
470 |
walletRequest = addWalletRequestRepository.selectAllByStatus(offset, limit, AddWalletRequestStatus.rejected);
|
| 443 |
LOGGER.info("walletRequest" + walletRequest);
|
471 |
LOGGER.info("walletRequest" + walletRequest);
|
| Line 459... |
Line 487... |
| 459 |
return "add-wallet-request-paginated";
|
487 |
return "add-wallet-request-paginated";
|
| 460 |
}
|
488 |
}
|
| 461 |
|
489 |
|
| 462 |
@RequestMapping(value = "/addAmountToWallet", method = RequestMethod.PUT)
|
490 |
@RequestMapping(value = "/addAmountToWallet", method = RequestMethod.PUT)
|
| 463 |
public String addAmountToWallet(HttpServletRequest request, @RequestParam(name = "id", defaultValue = "0") int id,
|
491 |
public String addAmountToWallet(HttpServletRequest request, @RequestParam(name = "id", defaultValue = "0") int id,
|
| 464 |
@RequestParam(name = "walletRequestid", defaultValue = "0") int walletRequestid, Model model)
|
492 |
@RequestParam(name = "walletRequestid", defaultValue = "0") int walletRequestid, Model model)
|
| 465 |
throws Exception {
|
493 |
throws Exception {
|
| 466 |
|
494 |
|
| 467 |
AddWalletRequest addWalletRequest = addWalletRequestRepository.selectById(walletRequestid);
|
495 |
AddWalletRequest addWalletRequest = addWalletRequestRepository.selectById(walletRequestid);
|
| 468 |
if (addWalletRequest.getStatus().equals(AddWalletRequestStatus.pending)) {
|
496 |
if (addWalletRequest.getStatus().equals(AddWalletRequestStatus.pending)) {
|
| 469 |
walletService.addAmountToWallet(addWalletRequest.getRetailerId(), walletRequestid,
|
497 |
walletService.addAmountToWallet(addWalletRequest.getRetailerId(), walletRequestid,
|
| Line 481... |
Line 509... |
| 481 |
"User Id - {0}\n Name -{1}\n Email -{2}\n mobile -{3}\n Reference - {4}\n Amount - Rs.{5}",
|
509 |
"User Id - {0}\n Name -{1}\n Email -{2}\n mobile -{3}\n Reference - {4}\n Amount - Rs.{5}",
|
| 482 |
new Integer(addWalletRequest.getRetailerId()), customRetailer.getBusinessName(),
|
510 |
new Integer(addWalletRequest.getRetailerId()), customRetailer.getBusinessName(),
|
| 483 |
customRetailer.getEmail(), customRetailer.getMobileNumber(),
|
511 |
customRetailer.getEmail(), customRetailer.getMobileNumber(),
|
| 484 |
addWalletRequest.getTransaction_reference(), new Float(addWalletRequest.getAmount()));
|
512 |
addWalletRequest.getTransaction_reference(), new Float(addWalletRequest.getAmount()));
|
| 485 |
|
513 |
|
| 486 |
// this.sendMailWithAttachments(subject, messageText);
|
514 |
// this.sendMailWithAttachments(subject, messageText);
|
| 487 |
return "response";
|
515 |
return "response";
|
| 488 |
} else {
|
516 |
} else {
|
| 489 |
model.addAttribute("response1", mvcResponseSender.createResponseString(false));
|
517 |
model.addAttribute("response1", mvcResponseSender.createResponseString(false));
|
| 490 |
return "response";
|
518 |
return "response";
|
| 491 |
}
|
519 |
}
|
| 492 |
}
|
520 |
}
|
| 493 |
|
521 |
|
| 494 |
@RequestMapping(value = "/addAmountToWalletRequestRejected", method = RequestMethod.PUT)
|
522 |
@RequestMapping(value = "/addAmountToWalletRequestRejected", method = RequestMethod.PUT)
|
| 495 |
public String addAmountToWalletRequestRejected(HttpServletRequest request,
|
523 |
public String addAmountToWalletRequestRejected(HttpServletRequest request,
|
| 496 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
524 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| 497 |
|
525 |
|
| 498 |
AddWalletRequest addWalletRequest = addWalletRequestRepository.selectById(id);
|
526 |
AddWalletRequest addWalletRequest = addWalletRequestRepository.selectById(id);
|
| 499 |
if (addWalletRequest.getStatus().equals(AddWalletRequestStatus.pending)) {
|
527 |
if (addWalletRequest.getStatus().equals(AddWalletRequestStatus.pending)) {
|
| 500 |
addWalletRequest.setStatus(AddWalletRequestStatus.rejected);
|
528 |
addWalletRequest.setStatus(AddWalletRequestStatus.rejected);
|
| 501 |
addWalletRequest.setUpdateTimestamp(LocalDateTime.now());
|
529 |
addWalletRequest.setUpdateTimestamp(LocalDateTime.now());
|
| Line 519... |
Line 547... |
| 519 |
}
|
547 |
}
|
| 520 |
|
548 |
|
| 521 |
private void sendMailWithAttachments(String subject, String messageText) throws Exception {
|
549 |
private void sendMailWithAttachments(String subject, String messageText) throws Exception {
|
| 522 |
MimeMessage message = mailSender.createMimeMessage();
|
550 |
MimeMessage message = mailSender.createMimeMessage();
|
| 523 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
551 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
| 524 |
String[] email = { "neerajgupta2021@gmail.com", "adeel.yazdani@smartdukaan.com",
|
552 |
String[] email = {"neerajgupta2021@gmail.com", "adeel.yazdani@smartdukaan.com",
|
| 525 |
"kamini.sharma@smartdukaan.com", "care@smartdukaan.com", "mohinder.mutreja@smartdukaan.com" };
|
553 |
"kamini.sharma@smartdukaan.com", "care@smartdukaan.com", "mohinder.mutreja@smartdukaan.com"};
|
| 526 |
helper.setSubject(subject);
|
554 |
helper.setSubject(subject);
|
| 527 |
helper.setText(messageText);
|
555 |
helper.setText(messageText);
|
| 528 |
helper.setTo(email);
|
556 |
helper.setTo(email);
|
| 529 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smartdukaan Alerts");
|
557 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "Smartdukaan Alerts");
|
| 530 |
helper.setFrom(senderAddress);
|
558 |
helper.setFrom(senderAddress);
|
| Line 536... |
Line 564... |
| 536 |
return walletRequest.stream().map(x -> x.getRetailerId()).distinct().collect(Collectors.toList());
|
564 |
return walletRequest.stream().map(x -> x.getRetailerId()).distinct().collect(Collectors.toList());
|
| 537 |
}
|
565 |
}
|
| 538 |
|
566 |
|
| 539 |
@RequestMapping(value = "/getcreateUnsettledPayments", method = RequestMethod.GET)
|
567 |
@RequestMapping(value = "/getcreateUnsettledPayments", method = RequestMethod.GET)
|
| 540 |
public String getcreateUnsettledPayment(HttpServletRequest request,
|
568 |
public String getcreateUnsettledPayment(HttpServletRequest request,
|
| 541 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
569 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 542 |
@RequestParam(name = "limit", defaultValue = "15") int limit, Model model) throws Exception {
|
570 |
@RequestParam(name = "limit", defaultValue = "15") int limit, Model model) throws Exception {
|
| 543 |
List<UnsettledPayment> up = null;
|
571 |
List<UnsettledPayment> up = null;
|
| 544 |
|
572 |
|
| 545 |
long size = 0;
|
573 |
long size = 0;
|
| 546 |
up = unsettledPaymentsRepository.selectAllById(offset, limit);
|
574 |
up = unsettledPaymentsRepository.selectAllById(offset, limit);
|
| 547 |
|
575 |
|
| Line 566... |
Line 594... |
| 566 |
return "unsettled-payments";
|
594 |
return "unsettled-payments";
|
| 567 |
}
|
595 |
}
|
| 568 |
|
596 |
|
| 569 |
@RequestMapping(value = "/getUnsettledPaymentsByAmount", method = RequestMethod.GET)
|
597 |
@RequestMapping(value = "/getUnsettledPaymentsByAmount", method = RequestMethod.GET)
|
| 570 |
public String getUnsettledPaymentByAmount(HttpServletRequest request,
|
598 |
public String getUnsettledPaymentByAmount(HttpServletRequest request,
|
| 571 |
@RequestParam(name = "amount", defaultValue = "0") float amount,
|
599 |
@RequestParam(name = "amount", defaultValue = "0") float amount,
|
| 572 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
600 |
@RequestParam(name = "offset", defaultValue = "0") int offset,
|
| 573 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
|
601 |
@RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception {
|
| 574 |
List<UnsettledPayment> up = null;
|
602 |
List<UnsettledPayment> up = null;
|
| 575 |
|
603 |
|
| 576 |
long size = 0;
|
604 |
long size = 0;
|
| 577 |
up = unsettledPaymentsRepository.selectAllByAmount(amount, offset, limit);
|
605 |
up = unsettledPaymentsRepository.selectAllByAmount(amount, offset, limit);
|
| 578 |
|
606 |
|
| Line 597... |
Line 625... |
| 597 |
return "unsettle-payment-modal";
|
625 |
return "unsettle-payment-modal";
|
| 598 |
}
|
626 |
}
|
| 599 |
|
627 |
|
| 600 |
@RequestMapping(value = "/createUnsettledPaymentsEntries", method = RequestMethod.POST)
|
628 |
@RequestMapping(value = "/createUnsettledPaymentsEntries", method = RequestMethod.POST)
|
| 601 |
public String createUnsettledPaymentsEntries(HttpServletRequest request,
|
629 |
public String createUnsettledPaymentsEntries(HttpServletRequest request,
|
| 602 |
@RequestBody UnsettledPaymentModel unsettledPaymentModel, Model model) throws Exception {
|
630 |
@RequestBody UnsettledPaymentModel unsettledPaymentModel, Model model) throws Exception {
|
| 603 |
|
631 |
|
| 604 |
UnsettledPayment up = new UnsettledPayment();
|
632 |
UnsettledPayment up = new UnsettledPayment();
|
| 605 |
up.setTransaction_reference(unsettledPaymentModel.getTransactionReference());
|
633 |
up.setTransaction_reference(unsettledPaymentModel.getTransactionReference());
|
| 606 |
up.setAmount(unsettledPaymentModel.getAmount());
|
634 |
up.setAmount(unsettledPaymentModel.getAmount());
|
| 607 |
up.setDescription(unsettledPaymentModel.getDescription());
|
635 |
up.setDescription(unsettledPaymentModel.getDescription());
|
| Line 612... |
Line 640... |
| 612 |
return "response";
|
640 |
return "response";
|
| 613 |
}
|
641 |
}
|
| 614 |
|
642 |
|
| 615 |
@RequestMapping(value = "/removeUnsettledPaymentsEntries", method = RequestMethod.DELETE)
|
643 |
@RequestMapping(value = "/removeUnsettledPaymentsEntries", method = RequestMethod.DELETE)
|
| 616 |
public String removeUnsettledPaymentsEntries(HttpServletRequest request,
|
644 |
public String removeUnsettledPaymentsEntries(HttpServletRequest request,
|
| 617 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
645 |
@RequestParam(name = "id", defaultValue = "0") int id, Model model) throws Exception {
|
| 618 |
|
646 |
|
| 619 |
unsettledPaymentsRepository.deleteById(id);
|
647 |
unsettledPaymentsRepository.deleteById(id);
|
| 620 |
|
648 |
|
| 621 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
649 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 622 |
return "response";
|
650 |
return "response";
|
| 623 |
}
|
651 |
}
|
| 624 |
|
652 |
|
| 625 |
@RequestMapping(value = "/wallet/statement", method = RequestMethod.GET)
|
653 |
@RequestMapping(value = "/wallet/statement", method = RequestMethod.GET)
|
| 626 |
public String getWalletStatement(HttpServletRequest request, @RequestParam LocalDateTime startDate,
|
654 |
public String getWalletStatement(HttpServletRequest request, @RequestParam LocalDateTime startDate,
|
| 627 |
@RequestParam LocalDateTime endDate, Model model, @RequestParam(defaultValue = "0") int fofoId)
|
655 |
@RequestParam LocalDateTime endDate, Model model, @RequestParam(defaultValue = "0") int fofoId)
|
| 628 |
throws Exception {
|
656 |
throws Exception {
|
| 629 |
boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
|
657 |
boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
|
| 630 |
if (fofoId > 0) {
|
658 |
if (fofoId > 0) {
|
| 631 |
if (!isAdmin) {
|
659 |
if (!isAdmin) {
|
| 632 |
throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
|
660 |
throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
|
| Line 706... |
Line 734... |
| 706 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
734 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 707 |
}
|
735 |
}
|
| 708 |
|
736 |
|
| 709 |
@RequestMapping(value = "/account/closing-statements", method = RequestMethod.GET)
|
737 |
@RequestMapping(value = "/account/closing-statements", method = RequestMethod.GET)
|
| 710 |
public ResponseEntity<?> getAccountStatement(HttpServletRequest request, @RequestParam LocalDate closingDate,
|
738 |
public ResponseEntity<?> getAccountStatement(HttpServletRequest request, @RequestParam LocalDate closingDate,
|
| 711 |
Model model) throws Exception {
|
739 |
Model model) throws Exception {
|
| 712 |
boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
|
740 |
boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
|
| 713 |
if (!isAdmin) {
|
741 |
if (!isAdmin) {
|
| 714 |
throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
|
742 |
throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
|
| 715 |
}
|
743 |
}
|
| 716 |
LocalDateTime closingDateTime = closingDate.atStartOfDay().plusDays(1);
|
744 |
LocalDateTime closingDateTime = closingDate.atStartOfDay().plusDays(1);
|
| Line 760... |
Line 788... |
| 760 |
|
788 |
|
| 761 |
}
|
789 |
}
|
| 762 |
|
790 |
|
| 763 |
@RequestMapping(value = "/account/statement", method = RequestMethod.GET)
|
791 |
@RequestMapping(value = "/account/statement", method = RequestMethod.GET)
|
| 764 |
public ResponseEntity<?> getAccountStatement(HttpServletRequest request, @RequestParam LocalDateTime startDate,
|
792 |
public ResponseEntity<?> getAccountStatement(HttpServletRequest request, @RequestParam LocalDateTime startDate,
|
| 765 |
@RequestParam LocalDateTime endDate, Model model, @RequestParam(defaultValue = "0") int fofoId)
|
793 |
@RequestParam LocalDateTime endDate, Model model, @RequestParam(defaultValue = "0") int fofoId)
|
| 766 |
throws Exception {
|
794 |
throws Exception {
|
| 767 |
boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
|
795 |
boolean isAdmin = roleManager.isAdmin(cookiesProcessor.getCookiesObject(request).getRoleIds());
|
| 768 |
if (fofoId > 0) {
|
796 |
if (fofoId > 0) {
|
| 769 |
if (!isAdmin) {
|
797 |
if (!isAdmin) {
|
| 770 |
throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
|
798 |
throw new ProfitMandiBusinessException("Unauthorised access", "PartnerId", "Permission Denied");
|
| Line 801... |
Line 829... |
| 801 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
829 |
return new ResponseEntity<InputStreamResource>(inputStreamResource, headers, HttpStatus.OK);
|
| 802 |
|
830 |
|
| 803 |
}
|
831 |
}
|
| 804 |
|
832 |
|
| 805 |
private ByteArrayOutputStream populateData(InputStream is, float openingBalance, float closingBalance,
|
833 |
private ByteArrayOutputStream populateData(InputStream is, float openingBalance, float closingBalance,
|
| 806 |
String partnerName, List<UserWalletHistory> history, LocalDateTime startDate, LocalDateTime endDate,
|
834 |
String partnerName, List<UserWalletHistory> history, LocalDateTime startDate, LocalDateTime endDate,
|
| 807 |
List<StatementDetailModel> invoiceDetails) throws Exception {
|
835 |
List<StatementDetailModel> invoiceDetails) throws Exception {
|
| 808 |
XSSFWorkbook workbook = new XSSFWorkbook(is);
|
836 |
XSSFWorkbook workbook = new XSSFWorkbook(is);
|
| 809 |
CreationHelper creationHelper = workbook.getCreationHelper();
|
837 |
CreationHelper creationHelper = workbook.getCreationHelper();
|
| 810 |
CellStyle style2 = workbook.createCellStyle();
|
838 |
CellStyle style2 = workbook.createCellStyle();
|
| 811 |
style2.setDataFormat(creationHelper.createDataFormat().getFormat("mm/dd/yyyy hh:mm:ss"));
|
839 |
style2.setDataFormat(creationHelper.createDataFormat().getFormat("mm/dd/yyyy hh:mm:ss"));
|
| 812 |
|
840 |
|
| Line 900... |
Line 928... |
| 900 |
|
928 |
|
| 901 |
}
|
929 |
}
|
| 902 |
|
930 |
|
| 903 |
@RequestMapping(value = "/getWalletHistory", method = RequestMethod.GET)
|
931 |
@RequestMapping(value = "/getWalletHistory", method = RequestMethod.GET)
|
| 904 |
public String getWalletHistory(HttpServletRequest request,
|
932 |
public String getWalletHistory(HttpServletRequest request,
|
| 905 |
@RequestParam(name = "reference", defaultValue = "0") int reference,
|
933 |
@RequestParam(name = "reference", defaultValue = "0") int reference,
|
| 906 |
@RequestParam WalletReferenceType referenceType, Model model) throws Exception {
|
934 |
@RequestParam WalletReferenceType referenceType, Model model) throws Exception {
|
| 907 |
|
935 |
|
| 908 |
LOGGER.info("type" + referenceType);
|
936 |
LOGGER.info("type" + referenceType);
|
| 909 |
List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository
|
937 |
List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository
|
| 910 |
.selectAllByreferenceIdandreferenceType(reference, referenceType);
|
938 |
.selectAllByreferenceIdandreferenceType(reference, referenceType);
|
| 911 |
|
939 |
|
| Line 925... |
Line 953... |
| 925 |
|
953 |
|
| 926 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
954 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| 927 |
return "wallet-history";
|
955 |
return "wallet-history";
|
| 928 |
|
956 |
|
| 929 |
}
|
957 |
}
|
| 930 |
|
- |
|
| 931 |
@RequestMapping(value = "/getWalletHistoryByPartner", method = RequestMethod.GET)
|
958 |
@RequestMapping(value = "/getWalletHistoryByPartner", method = RequestMethod.GET)
|
| 932 |
public String getWalletHistoryByPartner(HttpServletRequest request, int fofoId,
|
959 |
public String getWalletHistoryByPartner(HttpServletRequest request, int fofoId,
|
| 933 |
@RequestParam(name = "referenceType", required = false) WalletReferenceType referenceType,
|
960 |
@RequestParam(name = "referenceType", required = false) WalletReferenceType referenceType,
|
| 934 |
@RequestParam(name = "offset", required = false, defaultValue = "0") int offset,
|
961 |
@RequestParam(name = "offset", required = false, defaultValue = "0") int offset,
|
| 935 |
@RequestParam(name = "limit", required = false, defaultValue = "30") int limit, Model model)
|
962 |
@RequestParam(name = "limit", required = false, defaultValue = "30") int limit,
|
| - |
|
963 |
Model model)
|
| 936 |
throws Exception {
|
964 |
throws Exception {
|
| 937 |
|
965 |
|
| 938 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoId);
|
966 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoId);
|
| 939 |
List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository.selectPaginatedByWalletIdReferenceType(
|
967 |
List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository.selectPaginatedByWalletIdReferenceType(
|
| 940 |
userWallet.getId(), referenceType, SortOrder.DESCENDING, offset, limit);
|
968 |
userWallet.getId(), referenceType, SortOrder.DESCENDING, offset, limit);
|
| 941 |
|
969 |
|
| 942 |
CustomRetailer customretailer = retailerService.getFofoRetailer(fofoId);
|
970 |
CustomRetailer customretailer = retailerService.getFofoRetailer(fofoId);
|
| 943 |
|
971 |
|
| - |
|
972 |
List<Loan> loans = loanRepository.selectAllActiveLoan();
|
| - |
|
973 |
for (Loan loan : loans) {
|
| - |
|
974 |
int loanId = loan.getId();
|
| - |
|
975 |
BigDecimal pendingAmount = loan.getPendingAmount();
|
| - |
|
976 |
BigDecimal interestAccrued = loan.getInterestAccrued();
|
| - |
|
977 |
BigDecimal interestPaid = loan.getInterestPaid();
|
| - |
|
978 |
BigDecimal totalAmount = interestAccrued.subtract(interestPaid).add(pendingAmount);
|
| - |
|
979 |
SDCreditRequirement sdCreditRequirement = sdCreditRequirementRepository.selectByFofoId(fofoId);
|
| - |
|
980 |
if (sdCreditRequirement != null) {
|
| - |
|
981 |
BigDecimal availableLimit = sdCreditRequirement.getAvailableLimit();
|
| - |
|
982 |
BigDecimal creditlimit = sdCreditRequirement.getLimit();
|
| 944 |
model.addAttribute("userWallet", userWallet);
|
983 |
model.addAttribute("userWallet", userWallet);
|
| 945 |
model.addAttribute("customretailer", customretailer);
|
984 |
model.addAttribute("customretailer", customretailer);
|
| 946 |
model.addAttribute("wallethistory", userWalletHistory);
|
985 |
model.addAttribute("wallethistory", userWalletHistory);
|
| - |
|
986 |
model.addAttribute("loans", loans);
|
| - |
|
987 |
model.addAttribute("totalAmount", totalAmount);
|
| - |
|
988 |
model.addAttribute("availableLimit", availableLimit);
|
| - |
|
989 |
model.addAttribute("creditlimit", creditlimit);
|
| - |
|
990 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
| - |
|
991 |
}
|
| - |
|
992 |
}
|
| - |
|
993 |
return "wallet-history";
|
| - |
|
994 |
}
|
| 947 |
|
995 |
|
| 948 |
model.addAttribute("response1", mvcResponseSender.createResponseString(true));
|
- |
|
| 949 |
return "wallet-history";
|
- |
|
| 950 |
|
996 |
|
| 951 |
}
|
- |
|
| 952 |
|
997 |
|
| 953 |
@RequestMapping(value = "/getPartnerName", method = RequestMethod.GET)
|
998 |
@RequestMapping(value = "/getPartnerName", method = RequestMethod.GET)
|
| 954 |
public String getPartnerName(HttpServletRequest request,
|
999 |
public String getPartnerName(HttpServletRequest request,
|
| 955 |
@RequestParam(name = "reference", defaultValue = "0") int reference,
|
1000 |
@RequestParam(name = "reference", defaultValue = "0") int reference,
|
| 956 |
@RequestParam WalletReferenceType referenceType, Model model) throws Exception {
|
1001 |
@RequestParam WalletReferenceType referenceType, Model model) throws Exception {
|