| Line 62... |
Line 62... |
| 62 |
private FofoStoreRepository fofoStoreRepository;
|
62 |
private FofoStoreRepository fofoStoreRepository;
|
| 63 |
@Autowired
|
63 |
@Autowired
|
| 64 |
private RetailerService retailerService;
|
64 |
private RetailerService retailerService;
|
| 65 |
|
65 |
|
| 66 |
@Override
|
66 |
@Override
|
| 67 |
public void sendMailToRBM(double netAmountInHand, double totalPayableAmount, int fofoId) throws Exception {
|
67 |
public ProfitMandiConstants.BID_ENUM sendMailToRBM(double netAmountInHand, double totalPayableAmount, int fofoId) throws Exception {
|
| 68 |
User user = userRepository.selectById(fofoId);
|
68 |
User user = userRepository.selectById(fofoId);
|
| 69 |
int rbmId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, fofoId);
|
69 |
int rbmId = csService.getAuthUserId(ProfitMandiConstants.TICKET_CATEGORY_RBM, EscalationType.L1, fofoId);
|
| 70 |
AuthUser authUser = authRepository.selectById(rbmId);
|
70 |
AuthUser authUser = authRepository.selectById(rbmId);
|
| 71 |
String[] emailTo;
|
71 |
String[] emailTo;
|
| 72 |
String[] ccTo;
|
72 |
String[] ccTo;
|
| Line 86... |
Line 86... |
| 86 |
+ "top up your wallet with an amount of Rs.%s to proceed with the dispatch.",
|
86 |
+ "top up your wallet with an amount of Rs.%s to proceed with the dispatch.",
|
| 87 |
user.getName(), user.getName(), totalPayableAmount, (totalPayableAmount - netAmountInHand)
|
87 |
user.getName(), user.getName(), totalPayableAmount, (totalPayableAmount - netAmountInHand)
|
| 88 |
);
|
88 |
);
|
| 89 |
|
89 |
|
| 90 |
Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
|
90 |
Utils.sendMailWithAttachments(mailSender, emailTo, ccTo, subject, message);
|
| - |
|
91 |
return ProfitMandiConstants.BID_ENUM.PROCESSING;
|
| 91 |
}
|
92 |
}
|
| 92 |
|
93 |
|
| 93 |
@Override
|
94 |
@Override
|
| 94 |
public void sendSummaryMailToUserAndManagers(int userId, List<Bid> bids, Liquidation liquidation) throws Exception {
|
95 |
public void sendSummaryMailToUserAndManagers(int userId, List<Bid> bids, Liquidation liquidation) throws Exception {
|
| 95 |
if (bids.size() > 0) {
|
96 |
if (bids.size() > 0) {
|
| Line 192... |
Line 193... |
| 192 |
sb.append("</table>");
|
193 |
sb.append("</table>");
|
| 193 |
|
194 |
|
| 194 |
return sb.toString();
|
195 |
return sb.toString();
|
| 195 |
}
|
196 |
}
|
| 196 |
|
197 |
|
| 197 |
public void cancelYesterdayProcessBid(Bid bid) throws Exception {
|
198 |
public ProfitMandiConstants.BID_ENUM cancelYesterdayProcessBid(Bid bid) throws Exception {
|
| 198 |
LOGGER.info("Cancelling the bid of: {}",bid);
|
199 |
LOGGER.info("Cancelling the bid of: {}",bid);
|
| 199 |
bid.setStatus(ProfitMandiConstants.BID_ENUM.CANCELLED);
|
200 |
bid.setStatus(ProfitMandiConstants.BID_ENUM.CANCELLED);
|
| 200 |
Liquidation liquidation = liquidationRepository.selectLiquidationById(bid.getLiquidationId());
|
201 |
Liquidation liquidation = liquidationRepository.selectLiquidationById(bid.getLiquidationId());
|
| 201 |
List<Bid> bids = bidRepository.selectBidByLiquidationId(bid.getLiquidationId());
|
202 |
List<Bid> bids = bidRepository.selectBidByLiquidationId(bid.getLiquidationId());
|
| 202 |
this.sendSummaryMailToUserAndManagers(liquidation.getCreatedBy(), bids, liquidation);
|
203 |
this.sendSummaryMailToUserAndManagers(liquidation.getCreatedBy(), bids, liquidation);
|
| 203 |
this.notifyPartner(bid.getFofoId(), bid, ProfitMandiConstants.BID_ENUM.CANCELLED);
|
204 |
this.notifyPartner(bid.getFofoId(), bid, ProfitMandiConstants.BID_ENUM.CANCELLED);
|
| - |
|
205 |
return bid.getStatus();
|
| 204 |
}
|
206 |
}
|
| 205 |
|
207 |
|
| 206 |
private String generateWhatsAppBidMessage(String fofoName, Bid bidData, double topBidAmount, ProfitMandiConstants.BID_ENUM status) {
|
208 |
private String generateWhatsAppBidMessage(String fofoName, Bid bidData, double topBidAmount, ProfitMandiConstants.BID_ENUM status) {
|
| 207 |
String bidTime = StringUtils.toLocalDateTime(String.valueOf(bidData.getCreatedAt()));
|
209 |
String bidTime = StringUtils.toLocalDateTime(String.valueOf(bidData.getCreatedAt()));
|
| 208 |
String bidAmount = String.format("%.2f", bidData.getBiddingAmount());
|
210 |
String bidAmount = String.format("%.2f", bidData.getBiddingAmount());
|