| Line 20... |
Line 20... |
| 20 |
import com.spice.profitmandi.common.util.Utils;
|
20 |
import com.spice.profitmandi.common.util.Utils;
|
| 21 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
21 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 22 |
import com.spice.profitmandi.common.web.client.RestClient;
|
22 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 23 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
23 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
| 24 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
24 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| - |
|
25 |
import com.spice.profitmandi.dao.entity.auth.PartnerCollectionRemark;
|
| 25 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
26 |
import com.spice.profitmandi.dao.entity.catalog.FocusedModel;
|
| 26 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
27 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 27 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
28 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 28 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
29 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 29 |
import com.spice.profitmandi.dao.entity.cs.Ticket;
|
30 |
import com.spice.profitmandi.dao.entity.cs.Ticket;
|
| Line 33... |
Line 34... |
| 33 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
34 |
import com.spice.profitmandi.dao.entity.inventory.ReporticoCacheTable;
|
| 34 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCIS;
|
35 |
import com.spice.profitmandi.dao.entity.inventory.SaholicCIS;
|
| 35 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
36 |
import com.spice.profitmandi.dao.entity.inventory.SaholicPOItem;
|
| 36 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
37 |
import com.spice.profitmandi.dao.entity.transaction.*;
|
| 37 |
import com.spice.profitmandi.dao.entity.user.*;
|
38 |
import com.spice.profitmandi.dao.entity.user.*;
|
| - |
|
39 |
import com.spice.profitmandi.dao.enumuration.auth.CollectionRemark;
|
| 38 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
40 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 39 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
41 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 40 |
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
|
42 |
import com.spice.profitmandi.dao.enumuration.dtr.RefferalStatus;
|
| 41 |
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
|
43 |
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
|
| 42 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
44 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| 43 |
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
|
45 |
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
|
| 44 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
46 |
import com.spice.profitmandi.dao.model.PartnerDetailModel;
|
| - |
|
47 |
import com.spice.profitmandi.dao.model.PartnerCollectionRemarkModel;
|
| 45 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
48 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 46 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
49 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| 47 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
50 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| - |
|
51 |
import com.spice.profitmandi.dao.repository.auth.PartnerCollectionRemarkRepository;
|
| 48 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
52 |
import com.spice.profitmandi.dao.repository.catalog.*;
|
| 49 |
import com.spice.profitmandi.dao.repository.cs.*;
|
53 |
import com.spice.profitmandi.dao.repository.cs.*;
|
| 50 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
54 |
import com.spice.profitmandi.dao.repository.dtr.*;
|
| 51 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
55 |
import com.spice.profitmandi.dao.repository.fofo.*;
|
| 52 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
56 |
import com.spice.profitmandi.dao.repository.inventory.ReporticoCacheTableRepository;
|
| Line 2710... |
Line 2714... |
| 2710 |
sb.append("</tbody></table></body></html>");
|
2714 |
sb.append("</tbody></table></body></html>");
|
| 2711 |
|
2715 |
|
| 2712 |
return sb.toString();
|
2716 |
return sb.toString();
|
| 2713 |
}
|
2717 |
}
|
| 2714 |
|
2718 |
|
| - |
|
2719 |
private String getMessageForUncontacblePartner(List<PartnerCollectionRemark> pcrs)
|
| - |
|
2720 |
throws ProfitMandiBusinessException {
|
| - |
|
2721 |
StringBuilder sb = new StringBuilder();
|
| - |
|
2722 |
sb.append("<html><body><p>Alert</p><p>Not Responding Partner:-</p>"
|
| - |
|
2723 |
+ "<br/><table style='border:1px solid black ;padding: 5px';>");
|
| - |
|
2724 |
sb.append("<tbody>\n" + " <tr>\n"
|
| - |
|
2725 |
+ " <th style='border:1px solid black;padding: 5px'>PartnerName</th>\n"
|
| - |
|
2726 |
+ " <th style='border:1px solid black;padding: 5px'>from</th>\n"
|
| - |
|
2727 |
|
| - |
|
2728 |
+ " </tr>");
|
| - |
|
2729 |
for (PartnerCollectionRemark entry : pcrs) {
|
| - |
|
2730 |
|
| - |
|
2731 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(entry.getFofoId());
|
| - |
|
2732 |
|
| - |
|
2733 |
sb.append("<tr>");
|
| - |
|
2734 |
sb.append("<td style='border:1px solid black;padding: 5px'>" + customRetailer.getBusinessName() + "("
|
| - |
|
2735 |
+ customRetailer.getCode() + ")" + "</td>");
|
| - |
|
2736 |
|
| - |
|
2737 |
sb.append("<td style='border:1px solid black;padding: 5px'>"
|
| - |
|
2738 |
+ entry.getCreateTimestamp().format(DateTimeFormatter.ofPattern("dd/MM/yyyy")) + "</td>");
|
| - |
|
2739 |
|
| - |
|
2740 |
sb.append("</tr>");
|
| - |
|
2741 |
|
| - |
|
2742 |
}
|
| - |
|
2743 |
|
| - |
|
2744 |
sb.append("</tbody></table></body></html>");
|
| - |
|
2745 |
|
| - |
|
2746 |
return sb.toString();
|
| - |
|
2747 |
}
|
| - |
|
2748 |
|
| 2715 |
public void reverseWallet() throws Exception {
|
2749 |
public void reverseWallet() throws Exception {
|
| 2716 |
LocalDate localDate = LocalDate.of(2020, 10, 28);
|
2750 |
LocalDate localDate = LocalDate.of(2020, 10, 28);
|
| 2717 |
List<UserWalletHistory> uwhList = userWalletHistoryRepository.selectAllByDateType(localDate.atStartOfDay(),
|
2751 |
List<UserWalletHistory> uwhList = userWalletHistoryRepository.selectAllByDateType(localDate.atStartOfDay(),
|
| 2718 |
localDate.plusDays(1).atStartOfDay(),
|
2752 |
localDate.plusDays(1).atStartOfDay(),
|
| 2719 |
Arrays.asList(WalletReferenceType.SCHEME_IN, WalletReferenceType.SCHEME_OUT));
|
2753 |
Arrays.asList(WalletReferenceType.SCHEME_IN, WalletReferenceType.SCHEME_OUT));
|
| Line 3224... |
Line 3258... |
| 3224 |
creditAccountRepository.persist(creditAccount);
|
3258 |
creditAccountRepository.persist(creditAccount);
|
| 3225 |
}
|
3259 |
}
|
| 3226 |
}
|
3260 |
}
|
| 3227 |
}
|
3261 |
}
|
| 3228 |
|
3262 |
|
| - |
|
3263 |
@Autowired
|
| - |
|
3264 |
private PartnerCollectionRemarkRepository partnerCollectionRemarkRepository;
|
| - |
|
3265 |
|
| - |
|
3266 |
public void reviewUncontactablePartner()
|
| - |
|
3267 |
throws ProfitMandiBusinessException, MessagingException, UnsupportedEncodingException {
|
| - |
|
3268 |
|
| - |
|
3269 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService.getFofoRetailers(true);
|
| - |
|
3270 |
|
| - |
|
3271 |
List<Integer> pcrms = partnerCollectionRemarkRepository
|
| - |
|
3272 |
.selectMaxRemarkId(new ArrayList<>(customRetailerMap.keySet()));
|
| - |
|
3273 |
|
| - |
|
3274 |
if (!pcrms.isEmpty()) {
|
| - |
|
3275 |
Map<Integer, PartnerCollectionRemark> partnerCollectionRemarksMap = partnerCollectionRemarkRepository
|
| - |
|
3276 |
.selectByIds(pcrms).stream().filter(x -> x.getRemark().equals(CollectionRemark.NOT_RESPONDING))
|
| - |
|
3277 |
.collect(Collectors.toMap(x -> x.getFofoId(), x -> x));
|
| - |
|
3278 |
|
| - |
|
3279 |
if (!partnerCollectionRemarksMap.isEmpty()) {
|
| - |
|
3280 |
for (Map.Entry<String, Set<Integer>> storeGuyEntry : csService.getAuthUserPartnerIdMapping()
|
| - |
|
3281 |
.entrySet()) {
|
| - |
|
3282 |
List<PartnerCollectionRemark> filteredRows = storeGuyEntry.getValue().stream()
|
| - |
|
3283 |
.map(x -> partnerCollectionRemarksMap.get(x)).filter(x -> x != null)
|
| - |
|
3284 |
.collect(Collectors.toList());
|
| - |
|
3285 |
String subject = "Uncontacble Partner";
|
| - |
|
3286 |
String messageText = this.getMessageForUncontacblePartner(filteredRows);
|
| - |
|
3287 |
|
| - |
|
3288 |
MimeMessage message = mailSender.createMimeMessage();
|
| - |
|
3289 |
MimeMessageHelper helper = new MimeMessageHelper(message, true);
|
| - |
|
3290 |
String[] email = new String[] { storeGuyEntry.getKey() };
|
| - |
|
3291 |
|
| - |
|
3292 |
helper.setSubject(subject);
|
| - |
|
3293 |
helper.setText(messageText, true);
|
| - |
|
3294 |
helper.setTo(email);
|
| - |
|
3295 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com",
|
| - |
|
3296 |
"Smartdukaan Alerts");
|
| - |
|
3297 |
helper.setFrom(senderAddress);
|
| - |
|
3298 |
mailSender.send(message);
|
| - |
|
3299 |
|
| - |
|
3300 |
LOGGER.info("filteredRows {}", filteredRows);
|
| - |
|
3301 |
|
| - |
|
3302 |
}
|
| - |
|
3303 |
}
|
| - |
|
3304 |
}
|
| - |
|
3305 |
}
|
| - |
|
3306 |
|
| 3229 |
}
|
3307 |
}
|
| 3230 |
|
3308 |
|
| 3231 |
//2284
|
3309 |
//2284
|
| 3232 |
|
3310 |
|