| Line 23... |
Line 23... |
| 23 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
23 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
| 24 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
24 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
| 25 |
import com.spice.profitmandi.service.wallet.WalletService;
|
25 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 26 |
import com.spice.profitmandi.web.model.LoginDetails;
|
26 |
import com.spice.profitmandi.web.model.LoginDetails;
|
| 27 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
27 |
import com.spice.profitmandi.web.util.CookiesProcessor;
|
| 28 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
- |
|
| 29 |
|
28 |
|
| 30 |
@Controller
|
29 |
@Controller
|
| 31 |
@Transactional(rollbackFor = Throwable.class)
|
30 |
@Transactional(rollbackFor = Throwable.class)
|
| 32 |
public class WalletController {
|
31 |
public class WalletController {
|
| 33 |
|
32 |
|
| 34 |
@Autowired
|
33 |
@Autowired
|
| 35 |
CookiesProcessor cookiesProcessor;
|
34 |
private CookiesProcessor cookiesProcessor;
|
| 36 |
|
35 |
|
| 37 |
@Autowired
|
36 |
@Autowired
|
| 38 |
MVCResponseSender mvcResponseSender;
|
37 |
private WalletService walletService;
|
| 39 |
|
38 |
|
| 40 |
@Autowired
|
39 |
@Autowired
|
| 41 |
WalletService walletService;
|
- |
|
| 42 |
|
- |
|
| 43 |
@Autowired
|
- |
|
| 44 |
UserWalletRepository userWalletRepository;
|
40 |
private UserWalletRepository userWalletRepository;
|
| 45 |
|
41 |
|
| 46 |
private static final Logger LOGGER = LoggerFactory.getLogger(WalletController.class);
|
42 |
private static final Logger LOGGER = LoggerFactory.getLogger(WalletController.class);
|
| 47 |
|
43 |
|
| 48 |
@RequestMapping(value = "/walletDetails", method = RequestMethod.GET)
|
44 |
@RequestMapping(value = "/walletDetails", method = RequestMethod.GET)
|
| 49 |
public String dashboard(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws Exception{
|
45 |
public String dashboard(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue = "10") int limit, Model model) throws ProfitMandiBusinessException{
|
| 50 |
LoginDetails fofoDetails;
|
- |
|
| 51 |
try {
|
- |
|
| 52 |
fofoDetails = cookiesProcessor.getCookiesObject(request);
|
46 |
LoginDetails fofoDetails = cookiesProcessor.getCookiesObject(request);
|
| 53 |
} catch (ProfitMandiBusinessException e) {
|
- |
|
| 54 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
- |
|
| 55 |
return "response";
|
- |
|
| 56 |
}
|
- |
|
| 57 |
|
47 |
|
| 58 |
UserWallet userWallet = null;
|
48 |
UserWallet userWallet = null;
|
| 59 |
try{
|
49 |
try{
|
| 60 |
userWallet = userWalletRepository.selectByRetailerId(fofoDetails.getFofoId());
|
50 |
userWallet = userWalletRepository.selectByRetailerId(fofoDetails.getFofoId());
|
| 61 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
51 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
| Line 93... |
Line 83... |
| 93 |
}
|
83 |
}
|
| 94 |
return "wallet-details";
|
84 |
return "wallet-details";
|
| 95 |
}
|
85 |
}
|
| 96 |
|
86 |
|
| 97 |
@RequestMapping(value = "/getPaginatedWalletHistory")
|
87 |
@RequestMapping(value = "/getPaginatedWalletHistory")
|
| 98 |
public String getSaleHistoryPaginated(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = ProfitMandiConstants.INVOICE_NUMBER, defaultValue="") String invoiceNumber, @RequestParam(name = "searchType", defaultValue = "") String searchType, Model model) throws Exception{
|
88 |
public String getSaleHistoryPaginated(HttpServletRequest request, @RequestParam(name = ProfitMandiConstants.START_TIME, required = false) String startTimeString, @RequestParam(name = ProfitMandiConstants.END_TIME, required = false) String endTimeString, @RequestParam(name = "offset", defaultValue = "0") int offset, @RequestParam(name = "limit", defaultValue="10") int limit, @RequestParam(name = ProfitMandiConstants.INVOICE_NUMBER, defaultValue="") String invoiceNumber, @RequestParam(name = "searchType", defaultValue = "") String searchType, Model model) throws ProfitMandiBusinessException{
|
| 99 |
LoginDetails loginDetails;
|
- |
|
| 100 |
try {
|
- |
|
| 101 |
loginDetails = cookiesProcessor.getCookiesObject(request);
|
89 |
LoginDetails loginDetails = cookiesProcessor.getCookiesObject(request);
|
| 102 |
} catch (ProfitMandiBusinessException e) {
|
- |
|
| 103 |
model.addAttribute("loginResponse", mvcResponseSender.createResponseString("RTLR_1009", false, "/login"));
|
- |
|
| 104 |
return "response";
|
- |
|
| 105 |
}
|
90 |
|
| 106 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
91 |
LocalDateTime startDateTime = StringUtils.toDateTime(startTimeString);
|
| 107 |
LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
|
92 |
LocalDateTime endDateTime = StringUtils.toDateTime(endTimeString);
|
| 108 |
|
93 |
|
| 109 |
List<UserWalletHistory> userWalletHistories = new ArrayList<>();
|
94 |
List<UserWalletHistory> userWalletHistories = new ArrayList<>();
|
| 110 |
try{
|
95 |
try{
|
| 111 |
userWalletHistories = walletService.getPaginatedUserWalletHistoryByRetailerId(loginDetails.getFofoId(), startDateTime, endDateTime, offset, limit);
|
96 |
userWalletHistories = walletService.getPaginatedUserWalletHistoryByRetailerId(loginDetails.getFofoId(), startDateTime, endDateTime, offset, limit);
|
| 112 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
97 |
}catch(ProfitMandiBusinessException profitMandiBusinessException){
|
| 113 |
LOGGER.error("UserWallet History not found : ", profitMandiBusinessException);
|
98 |
LOGGER.error("UserWallet History not found : ", profitMandiBusinessException);
|
| 114 |
}
|
99 |
}
|
| 115 |
|
100 |
|
| 116 |
//List<FofoOrder> saleHistories = fofoOrderRepository.selectByFofoId(loginDetails.getFofoId(), startDateTime, endDateTime, offset, limit);
|
- |
|
| 117 |
model.addAttribute("walletHistories", userWalletHistories);
|
101 |
model.addAttribute("walletHistories", userWalletHistories);
|
| 118 |
return "wallet-history-paginated";
|
102 |
return "wallet-history-paginated";
|
| 119 |
}
|
103 |
}
|
| 120 |
|
104 |
|
| 121 |
}
|
105 |
}
|