| Line 44... |
Line 44... |
| 44 |
import com.spice.profitmandi.dao.enumuration.transaction.SanctionStatus;
|
44 |
import com.spice.profitmandi.dao.enumuration.transaction.SanctionStatus;
|
| 45 |
import com.spice.profitmandi.dao.model.SDCreditResponseOut;
|
45 |
import com.spice.profitmandi.dao.model.SDCreditResponseOut;
|
| 46 |
import com.spice.profitmandi.dao.model.SanctionRequestModel;
|
46 |
import com.spice.profitmandi.dao.model.SanctionRequestModel;
|
| 47 |
import com.spice.profitmandi.dao.model.SdCreditRequirementModel;
|
47 |
import com.spice.profitmandi.dao.model.SdCreditRequirementModel;
|
| 48 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
48 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| - |
|
49 |
import com.spice.profitmandi.dao.repository.cs.CsService;
|
| 49 |
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
|
50 |
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
|
| 50 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
51 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 51 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
52 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
| 52 |
import com.spice.profitmandi.dao.repository.fofo.CurrentPartnerDailyInvestmentRepository;
|
53 |
import com.spice.profitmandi.dao.repository.fofo.CurrentPartnerDailyInvestmentRepository;
|
| 53 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
54 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| Line 56... |
Line 57... |
| 56 |
import com.spice.profitmandi.dao.repository.transaction.SanctionRequestRepository;
|
57 |
import com.spice.profitmandi.dao.repository.transaction.SanctionRequestRepository;
|
| 57 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
58 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
| 58 |
import com.spice.profitmandi.service.NotificationService;
|
59 |
import com.spice.profitmandi.service.NotificationService;
|
| 59 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
60 |
import com.spice.profitmandi.service.transaction.SDCreditService;
|
| 60 |
import com.spice.profitmandi.service.user.RetailerService;
|
61 |
import com.spice.profitmandi.service.user.RetailerService;
|
| - |
|
62 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| - |
|
63 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 61 |
|
64 |
|
| 62 |
@Controller
|
65 |
@Controller
|
| 63 |
@Transactional(rollbackOn = Throwable.class)
|
66 |
@Transactional(rollbackOn = Throwable.class)
|
| 64 |
public class SDCreditController {
|
67 |
public class SDCreditController {
|
| 65 |
|
68 |
|
| Line 100... |
Line 103... |
| 100 |
private UserWalletRepository userWalletRepository;
|
103 |
private UserWalletRepository userWalletRepository;
|
| 101 |
|
104 |
|
| 102 |
@Autowired
|
105 |
@Autowired
|
| 103 |
LoanRepository loanRepository;
|
106 |
LoanRepository loanRepository;
|
| 104 |
|
107 |
|
| - |
|
108 |
@Autowired
|
| - |
|
109 |
private CookiesProcessor cookiesProcessor;
|
| - |
|
110 |
|
| - |
|
111 |
@Autowired
|
| - |
|
112 |
private CsService csService;
|
| - |
|
113 |
|
| 105 |
private static final Logger LOGGER = LogManager.getLogger(SDCreditController.class);
|
114 |
private static final Logger LOGGER = LogManager.getLogger(SDCreditController.class);
|
| 106 |
|
115 |
|
| 107 |
@RequestMapping(value = "/getSDCreditReq", method = RequestMethod.GET)
|
116 |
@RequestMapping(value = "/getSDCreditReq", method = RequestMethod.GET)
|
| 108 |
public String getSDCreditReq(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
117 |
public String getSDCreditReq(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 109 |
|
118 |
|
| Line 315... |
Line 324... |
| 315 |
|
324 |
|
| 316 |
return "sanction-request-row";
|
325 |
return "sanction-request-row";
|
| 317 |
|
326 |
|
| 318 |
}
|
327 |
}
|
| 319 |
|
328 |
|
| - |
|
329 |
List<String> emails = Arrays.asList("kamini.sharma@smartdukaan.com", "neeraj.gupta@smartdukaan.com",
|
| - |
|
330 |
"amit.gupta@smartdukaan.com");
|
| - |
|
331 |
|
| 320 |
@RequestMapping(value = "/getLoans", method = RequestMethod.GET)
|
332 |
@RequestMapping(value = "/getLoans", method = RequestMethod.GET)
|
| 321 |
public String getLoans(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
333 |
public String getLoans(HttpServletRequest request, Model model) throws ProfitMandiBusinessException {
|
| 322 |
List<Loan> loans = loanRepository.selectAllLoan();
|
- |
|
| 323 |
|
334 |
|
| - |
|
335 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| - |
|
336 |
String email = loginDetails.getEmailId();
|
| - |
|
337 |
|
| - |
|
338 |
AuthUser authUser = authRepository.selectByEmailOrMobile(email);
|
| - |
|
339 |
Map<String, Set<Integer>> storeGuyMap = csService.getAuthUserPartnerIdMapping();
|
| - |
|
340 |
|
| - |
|
341 |
Set<Integer> fofoIds = storeGuyMap.get(authUser.getEmailId());
|
| - |
|
342 |
|
| - |
|
343 |
if (emails.contains(authUser.getEmailId())) {
|
| - |
|
344 |
fofoIds = storeGuyMap.get("tarun.verma@smartdukaan.com");
|
| - |
|
345 |
LOGGER.info("fofoIds" + fofoIds);
|
| - |
|
346 |
}
|
| - |
|
347 |
|
| - |
|
348 |
LOGGER.info("fofoIds" + fofoIds);
|
| - |
|
349 |
if (fofoIds == null) {
|
| - |
|
350 |
throw new ProfitMandiBusinessException("you are not authorized", "", "you are not authorized" + " " + "");
|
| - |
|
351 |
}
|
| - |
|
352 |
|
| - |
|
353 |
List<Loan> loans = loanRepository.selectAllLoans(new ArrayList<>(fofoIds));
|
| - |
|
354 |
|
| 324 |
Set<Integer> fofoIds = loans.stream().map(x -> x.getFofoId()).collect(Collectors.toSet());
|
355 |
List<Integer> loanFofoIds = loans.stream().map(x -> x.getFofoId()).collect(Collectors.toList());
|
| 325 |
|
356 |
|
| 326 |
List<SDCreditRequirement> sdCreditRequirements = sdCreditRequirementRepository
|
357 |
List<SDCreditRequirement> sdCreditRequirements = sdCreditRequirementRepository
|
| 327 |
.selectByFofoIds(new ArrayList<>(fofoIds));
|
358 |
.selectByFofoIds(new ArrayList<>(loanFofoIds));
|
| 328 |
|
359 |
|
| 329 |
Map<Integer, Long> loanCountMap = loans.stream()
|
360 |
Map<Integer, Long> loanCountMap = loans.stream()
|
| 330 |
.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.counting()));
|
361 |
.collect(Collectors.groupingBy(x -> x.getFofoId(), Collectors.counting()));
|
| 331 |
|
362 |
|
| 332 |
Map<Integer, UserWallet> userWalletMap = userWalletRepository.selectByRetailerIds(fofoIds).stream()
|
363 |
Map<Integer, UserWallet> userWalletMap = userWalletRepository.selectByRetailerIds(fofoIds).stream()
|