| Line 108... |
Line 108... |
| 108 |
}
|
108 |
}
|
| 109 |
|
109 |
|
| 110 |
@Override
|
110 |
@Override
|
| 111 |
public void notifyPartner(int fofoId, Bid bid, ProfitMandiConstants.BID_ENUM status) throws Exception {
|
111 |
public void notifyPartner(int fofoId, Bid bid, ProfitMandiConstants.BID_ENUM status) throws Exception {
|
| 112 |
User user = userRepository.selectById(fofoId);
|
112 |
User user = userRepository.selectById(fofoId);
|
| - |
|
113 |
LOGGER.info("user: {}",user);
|
| 113 |
List<Bid> topBid = bidRepository.selectBidByLiquidationId(bid.getLiquidationId());
|
114 |
List<Bid> topBid = bidRepository.selectBidByLiquidationId(bid.getLiquidationId());
|
| 114 |
String message = this.generateWhatsAppBidMessage(user.getName(), bid, topBid.get(0).getBiddingAmount(), status);
|
115 |
String message = this.generateWhatsAppBidMessage(user.getName(), bid, topBid.get(0).getBiddingAmount(), status);
|
| - |
|
116 |
LOGGER.info("sendPushNotification: {}",topBid.get(0));
|
| 115 |
this.sendPushNotification(message, "Bid Update!", Arrays.asList(fofoId));
|
117 |
this.sendPushNotification(message, "Bid Update!", Arrays.asList(fofoId));
|
| 116 |
//String mobile = user.getMobileNumber();
|
118 |
//String mobile = user.getMobileNumber();
|
| 117 |
//notificationService.sendWhatsappMessage(message, "Bid Update!", mobile);
|
119 |
//notificationService.sendWhatsappMessage(message, "Bid Update!", mobile);
|
| 118 |
}
|
120 |
}
|
| 119 |
|
121 |
|
| Line 128... |
Line 130... |
| 128 |
}
|
130 |
}
|
| 129 |
}
|
131 |
}
|
| 130 |
|
132 |
|
| 131 |
@Override
|
133 |
@Override
|
| 132 |
public void sendPushNotification(String message, String title, List<Integer> fofoIds) throws Exception {
|
134 |
public void sendPushNotification(String message, String title, List<Integer> fofoIds) throws Exception {
|
| - |
|
135 |
LOGGER.info("fofoIds stating: {}",fofoIds);
|
| 133 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
136 |
SendNotificationModel sendNotificationModel = new SendNotificationModel();
|
| 134 |
sendNotificationModel.setCampaignName(title);
|
137 |
sendNotificationModel.setCampaignName(title);
|
| 135 |
sendNotificationModel.setMessage(message);
|
138 |
sendNotificationModel.setMessage(message);
|
| 136 |
sendNotificationModel.setType("url");
|
139 |
sendNotificationModel.setType("url");
|
| 137 |
sendNotificationModel.setTitle(title);
|
140 |
sendNotificationModel.setTitle(title);
|
| Line 143... |
Line 146... |
| 143 |
userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds); //Arrays.asList(171912487)
|
146 |
userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds); //Arrays.asList(171912487)
|
| 144 |
} else {
|
147 |
} else {
|
| 145 |
fofoIds = fofoStoreRepository.selectActiveStores().stream().map(x->x.getId()).collect(toList());
|
148 |
fofoIds = fofoStoreRepository.selectActiveStores().stream().map(x->x.getId()).collect(toList());
|
| 146 |
userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds);
|
149 |
userIds = userAccountRepository.selectUserIdsByRetailerIds(fofoIds);
|
| 147 |
}
|
150 |
}
|
| - |
|
151 |
LOGGER.info("fofoIds: {}",fofoIds);
|
| 148 |
|
152 |
|
| 149 |
sendNotificationModel.setUserIds(userIds);
|
153 |
sendNotificationModel.setUserIds(userIds);
|
| 150 |
notificationService.sendNotification(sendNotificationModel);
|
154 |
notificationService.sendNotification(sendNotificationModel);
|
| 151 |
notificationService.sendNotificationToSystemUsers(sendNotificationModel);
|
155 |
notificationService.sendNotificationToSystemUsers(sendNotificationModel);
|
| 152 |
}
|
156 |
}
|
| Line 189... |
Line 193... |
| 189 |
|
193 |
|
| 190 |
return sb.toString();
|
194 |
return sb.toString();
|
| 191 |
}
|
195 |
}
|
| 192 |
|
196 |
|
| 193 |
public void cancelYesterdayProcessBid(Bid bid) throws Exception {
|
197 |
public void cancelYesterdayProcessBid(Bid bid) throws Exception {
|
| - |
|
198 |
LOGGER.info("Cancelling the bid of: {}",bid);
|
| 194 |
bid.setStatus(ProfitMandiConstants.BID_ENUM.CANCELLED);
|
199 |
bid.setStatus(ProfitMandiConstants.BID_ENUM.CANCELLED);
|
| 195 |
Liquidation liquidation = liquidationRepository.selectLiquidationById(bid.getLiquidationId());
|
200 |
Liquidation liquidation = liquidationRepository.selectLiquidationById(bid.getLiquidationId());
|
| 196 |
List<Bid> bids = bidRepository.selectBidByLiquidationId(bid.getLiquidationId());
|
201 |
List<Bid> bids = bidRepository.selectBidByLiquidationId(bid.getLiquidationId());
|
| 197 |
this.sendSummaryMailToUserAndManagers(liquidation.getCreatedBy(), bids, liquidation);
|
202 |
this.sendSummaryMailToUserAndManagers(liquidation.getCreatedBy(), bids, liquidation);
|
| 198 |
this.notifyPartner(bid.getFofoId(), bid, ProfitMandiConstants.BID_ENUM.CANCELLED);
|
203 |
this.notifyPartner(bid.getFofoId(), bid, ProfitMandiConstants.BID_ENUM.CANCELLED);
|
| Line 225... |
Line 230... |
| 225 |
"Bid Details:\n"+
|
230 |
"Bid Details:\n"+
|
| 226 |
"Bid Amount: Rs. %s\n"+
|
231 |
"Bid Amount: Rs. %s\n"+
|
| 227 |
"Quantity: %s\n"+
|
232 |
"Quantity: %s\n"+
|
| 228 |
"Bid Time: %s\n"+
|
233 |
"Bid Time: %s\n"+
|
| 229 |
"\n"+
|
234 |
"\n"+
|
| 230 |
"Qualified Bid Amount: ₹%s\n"+
|
235 |
"Qualified Bid Amount: Rs. %s\n"+
|
| 231 |
"Thank you for your participation. Stay tuned for more opportunities!";
|
236 |
"Thank you for your participation. Stay tuned for more opportunities!";
|
| 232 |
message = String.format(message, fofoName, bidData.getItemName(), bidAmount, bidData.getQuantity(), bidTime, String.format("%.2f", topBidAmount));
|
237 |
message = String.format(message, fofoName, bidData.getItemName(), bidAmount, bidData.getQuantity(), bidTime, String.format("%.2f", topBidAmount));
|
| 233 |
}
|
238 |
}
|
| 234 |
else if (status.equals(ProfitMandiConstants.BID_ENUM.PENDING)) {
|
239 |
else if (status.equals(ProfitMandiConstants.BID_ENUM.PENDING)) {
|
| 235 |
message = "Hi %s,\n"+
|
240 |
message = "Hi %s,\n"+
|