| Line 1136... |
Line 1136... |
| 1136 |
public void sendDailySalesReportNotificationToPartner()
|
1136 |
public void sendDailySalesReportNotificationToPartner()
|
| 1137 |
throws ProfitMandiBusinessException, MessagingException, IOException {
|
1137 |
throws ProfitMandiBusinessException, MessagingException, IOException {
|
| 1138 |
LocalDateTime now = LocalDateTime.now();
|
1138 |
LocalDateTime now = LocalDateTime.now();
|
| 1139 |
LocalDateTime from = LocalDateTime.of(now.getYear(), now.getMonth(), now.getDayOfMonth(), 00, 00);
|
1139 |
LocalDateTime from = LocalDateTime.of(now.getYear(), now.getMonth(), now.getDayOfMonth(), 00, 00);
|
| 1140 |
Map<Integer, Double> salesByFofoIdMap = new HashMap<>();
|
1140 |
Map<Integer, Double> salesByFofoIdMap = new HashMap<>();
|
| 1141 |
List<Integer> fofoIds = targetService.getfofoIdsFromfofoStore();
|
1141 |
List<Integer> fofoIds = fofoStoreRepository.selectAll().stream().filter(x->x.isActive()).map(x->x.getId()).collect(Collectors.toList());
|
| 1142 |
List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
|
1142 |
List<PartnerTargetDetails> partnerTargetDetails = partnerTargetRepository
|
| 1143 |
.selectAllGeEqAndLeEqStartDateAndEndDate(now);
|
1143 |
.selectAllGeEqAndLeEqStartDateAndEndDate(now);
|
| 1144 |
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h a");
|
1144 |
DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("h a");
|
| 1145 |
|
1145 |
|
| 1146 |
Map<Integer, Float> dailyTarget = new HashMap<>();
|
1146 |
Map<Integer, Float> dailyTarget = new HashMap<>();
|
| Line 1212... |
Line 1212... |
| 1212 |
+ " <th style='border:1px solid black;padding: 5px'>Partner</th>\n"
|
1212 |
+ " <th style='border:1px solid black;padding: 5px'>Partner</th>\n"
|
| 1213 |
+ " <th style='border:1px solid black;padding: 5px'>Daily Target</th>\n"
|
1213 |
+ " <th style='border:1px solid black;padding: 5px'>Daily Target</th>\n"
|
| 1214 |
+ " <th style='border:1px solid black;padding: 5px'>Sale</th>\n"
|
1214 |
+ " <th style='border:1px solid black;padding: 5px'>Sale</th>\n"
|
| 1215 |
+ " </tr>");
|
1215 |
+ " </tr>");
|
| 1216 |
for (Integer fofoId : salesByFofoIdMap.keySet()) {
|
1216 |
for (Integer fofoId : salesByFofoIdMap.keySet()) {
|
| - |
|
1217 |
try
|
| - |
|
1218 |
{
|
| - |
|
1219 |
String PartnerName=retailerService.getFofoRetailer(fofoId).getBusinessName();
|
| 1217 |
sb.append("<tr>");
|
1220 |
sb.append("<tr>");
|
| 1218 |
sb.append("<td style='border:1px solid black;padding: 5px'>"
|
1221 |
sb.append("<td style='border:1px solid black;padding: 5px'>"
|
| 1219 |
+ retailerService.getFofoRetailer(fofoId).getBusinessName() + "</td>");
|
1222 |
+ PartnerName + "</td>");
|
| 1220 |
if (dailyTarget != null && dailyTarget.get(fofoId) != null) {
|
1223 |
if (dailyTarget != null && dailyTarget.get(fofoId) != null) {
|
| 1221 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + dailyTarget.get(fofoId) + "</td>");
|
1224 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + dailyTarget.get(fofoId) + "</td>");
|
| 1222 |
} else {
|
1225 |
} else {
|
| 1223 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + 0.0 + "</td>");
|
1226 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + 0.0 + "</td>");
|
| 1224 |
}
|
1227 |
}
|
| 1225 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + salesByFofoIdMap.get(fofoId) + "</td>");
|
1228 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + salesByFofoIdMap.get(fofoId) + "</td>");
|
| 1226 |
|
1229 |
|
| 1227 |
sb.append("</tr>");
|
1230 |
sb.append("</tr>");
|
| - |
|
1231 |
}
|
| - |
|
1232 |
catch(Exception e)
|
| - |
|
1233 |
{
|
| - |
|
1234 |
e.printStackTrace();
|
| - |
|
1235 |
}
|
| - |
|
1236 |
|
| 1228 |
}
|
1237 |
}
|
| 1229 |
|
1238 |
|
| 1230 |
sb.append("</tbody></table></body></html>");
|
1239 |
sb.append("</tbody></table></body></html>");
|
| 1231 |
return sb.toString();
|
1240 |
return sb.toString();
|
| 1232 |
}
|
1241 |
}
|