| Line 60... |
Line 60... |
| 60 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
60 |
import com.spice.profitmandi.dao.repository.inventory.StateRepository;
|
| 61 |
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
|
61 |
import com.spice.profitmandi.dao.repository.inventory.WarehouseRepository;
|
| 62 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
62 |
import com.spice.profitmandi.dao.repository.transaction.*;
|
| 63 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
63 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 64 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
64 |
import com.spice.profitmandi.dao.repository.user.UserRepository;
|
| - |
|
65 |
import com.spice.profitmandi.dao.service.solr.FofoSolr;
|
| 65 |
import com.spice.profitmandi.service.NotificationService;
|
66 |
import com.spice.profitmandi.service.NotificationService;
|
| 66 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
67 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| 67 |
import com.spice.profitmandi.service.PartnerStatsService;
|
68 |
import com.spice.profitmandi.service.PartnerStatsService;
|
| 68 |
import com.spice.profitmandi.service.integrations.CCAvenuePaymentService;
|
69 |
import com.spice.profitmandi.service.integrations.CCAvenuePaymentService;
|
| 69 |
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
|
70 |
import com.spice.profitmandi.service.integrations.RazorpayPaymentService;
|
| Line 449... |
Line 450... |
| 449 |
@Autowired
|
450 |
@Autowired
|
| 450 |
private MandiiService mandiiService;
|
451 |
private MandiiService mandiiService;
|
| 451 |
|
452 |
|
| 452 |
@Autowired
|
453 |
@Autowired
|
| 453 |
CreditAccountRepository creditAccountRepository;
|
454 |
CreditAccountRepository creditAccountRepository;
|
| - |
|
455 |
|
| - |
|
456 |
@Autowired
|
| - |
|
457 |
private FofoSolr fofoSolr;
|
| 454 |
private static final Logger LOGGER = LogManager.getLogger(ScheduledTasks.class);
|
458 |
private static final Logger LOGGER = LogManager.getLogger(ScheduledTasks.class);
|
| 455 |
|
459 |
|
| 456 |
private String FCM_URL = "https://fcm.googleapis.com/fcm/send";
|
460 |
private String FCM_URL = "https://fcm.googleapis.com/fcm/send";
|
| 457 |
private String FCM_API_KEY = "AAAASAjNcn4:APA91bG6fWRIgYJI0L9gCjP5ynaXz2hJHYKtD9dfH7Depdv31Nd9APJwhx-OPkAJ1WSz4BGNYG8lHThLFSjDGFxIwUZv241YcAJEGDLgt86mxq9FXJe-yBRu-S0_ZwHqmX-QaVKl5F_A";
|
461 |
private String FCM_API_KEY = "AAAASAjNcn4:APA91bG6fWRIgYJI0L9gCjP5ynaXz2hJHYKtD9dfH7Depdv31Nd9APJwhx-OPkAJ1WSz4BGNYG8lHThLFSjDGFxIwUZv241YcAJEGDLgt86mxq9FXJe-yBRu-S0_ZwHqmX-QaVKl5F_A";
|
| 458 |
|
462 |
|
| Line 1882... |
Line 1886... |
| 1882 |
* subject); this.sendMailOfHtmlFormat("amit.gupta@smartdukaan.com",
|
1886 |
* subject); this.sendMailOfHtmlFormat("amit.gupta@smartdukaan.com",
|
| 1883 |
* statewiseSaleReport, cc, "Statewise" + subject);
|
1887 |
* statewiseSaleReport, cc, "Statewise" + subject);
|
| 1884 |
*/
|
1888 |
*/
|
| 1885 |
}
|
1889 |
}
|
| 1886 |
|
1890 |
|
| 1887 |
|
- |
|
| 1888 |
|
- |
|
| 1889 |
public void checkRazorPayPaymentStatus() throws Exception {
|
1891 |
public void checkRazorPayPaymentStatus() throws Exception {
|
| 1890 |
List<PendingOrder> pendingOrder = pendingOrderRepository
|
1892 |
List<PendingOrder> pendingOrder = pendingOrderRepository
|
| 1891 |
.selectAllByStatus(com.spice.profitmandi.dao.enumuration.transaction.OrderStatus.PENDING);
|
1893 |
.selectAllByStatus(com.spice.profitmandi.dao.enumuration.transaction.OrderStatus.PENDING);
|
| 1892 |
|
1894 |
|
| 1893 |
for (PendingOrder po : pendingOrder) {
|
1895 |
for (PendingOrder po : pendingOrder) {
|
| Line 2558... |
Line 2560... |
| 2558 |
if (!emailRowsMap.containsKey(y.getKey())) {
|
2560 |
if (!emailRowsMap.containsKey(y.getKey())) {
|
| 2559 |
emailRowsMap.put(y.getKey(), new ArrayList<>());
|
2561 |
emailRowsMap.put(y.getKey(), new ArrayList<>());
|
| 2560 |
}
|
2562 |
}
|
| 2561 |
List<List<? extends Serializable>> fms = x.getValue().stream()
|
2563 |
List<List<? extends Serializable>> fms = x.getValue().stream()
|
| 2562 |
.map(r -> Arrays.asList(r.getStoreCode(), r.getStoreName(), r.getBrandName(),
|
2564 |
.map(r -> Arrays.asList(r.getStoreCode(), r.getStoreName(), r.getBrandName(),
|
| 2563 |
r.getModelName(), r.getModelNumber(), r.getDp(), r.getWarehouseName(), r.getStateManager(),
|
2565 |
r.getModelName(), r.getModelNumber(), r.getDp(), r.getWarehouseName(),
|
| 2564 |
r.getTerritoryManager(), r.getPendingIndentQty(), r.getGrnStockQty(),
|
2566 |
r.getStateManager(), r.getTerritoryManager(), r.getPendingIndentQty(),
|
| 2565 |
r.getShortageQty(), r.getAvailability()))
|
2567 |
r.getGrnStockQty(), r.getShortageQty(), r.getAvailability()))
|
| 2566 |
.collect(Collectors.toList());
|
2568 |
.collect(Collectors.toList());
|
| 2567 |
emailRowsMap.get(y.getKey()).addAll(fms);
|
2569 |
emailRowsMap.get(y.getKey()).addAll(fms);
|
| 2568 |
|
2570 |
|
| 2569 |
}
|
2571 |
}
|
| 2570 |
|
2572 |
|
| 2571 |
});
|
2573 |
});
|
| 2572 |
|
2574 |
|
| 2573 |
});
|
2575 |
});
|
| 2574 |
|
2576 |
|
| 2575 |
List<String> headers = Arrays.asList("Store Code", "Store Name", "Brand", "Model Name", "Model Number", "DP",
|
2577 |
List<String> headers = Arrays.asList("Store Code", "Store Name", "Brand", "Model Name", "Model Number",
|
| 2576 |
"Warehouse Name", "State Manager", "Territory Manager", "Pending Indent", "InStock", "Shortage Qty",
|
2578 |
"DP", "Warehouse Name", "State Manager", "Territory Manager", "Pending Indent", "InStock",
|
| 2577 |
"Availability");
|
2579 |
"Shortage Qty", "Availability");
|
| 2578 |
emailRowsMap.entrySet().forEach(entry -> {
|
2580 |
emailRowsMap.entrySet().forEach(entry -> {
|
| 2579 |
|
2581 |
|
| 2580 |
ByteArrayOutputStream baos = null;
|
2582 |
ByteArrayOutputStream baos = null;
|
| 2581 |
try {
|
2583 |
try {
|
| 2582 |
baos = FileUtil.getCSVByteStream(headers, entry.getValue());
|
2584 |
baos = FileUtil.getCSVByteStream(headers, entry.getValue());
|
| Line 2974... |
Line 2976... |
| 2974 |
List<Integer> assignTo = Arrays.asList(15, 9, 54, 53);
|
2976 |
List<Integer> assignTo = Arrays.asList(15, 9, 54, 53);
|
| 2975 |
|
2977 |
|
| 2976 |
Map<Integer, AuthUser> assignAuthUserMap = authRepository.selectAllAuthUserByIds(assignTo).stream()
|
2978 |
Map<Integer, AuthUser> assignAuthUserMap = authRepository.selectAllAuthUserByIds(assignTo).stream()
|
| 2977 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
2979 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 2978 |
|
2980 |
|
| 2979 |
List<String> sendTo = Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com", "sm@smartdukaan.com");
|
2981 |
List<String> sendTo = Arrays.asList("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| - |
|
2982 |
"sm@smartdukaan.com");
|
| 2980 |
LOGGER.info("partnerProblem" + partnerProblems);
|
2983 |
LOGGER.info("partnerProblem" + partnerProblems);
|
| 2981 |
StringBuilder sb = new StringBuilder();
|
2984 |
StringBuilder sb = new StringBuilder();
|
| 2982 |
sb.append("<htl><body>");
|
2985 |
sb.append("<htl><body>");
|
| 2983 |
sb.append(
|
2986 |
sb.append(
|
| 2984 |
"<p>Number against MTD or Investment are the count of days the MTD is low VS LMTD OR Investment is below 75%.</p><br/><p>These partners needs immediate attention.</p><br/><table style='border:1px solid black';cellspacing=0>");
|
2987 |
"<p>Number against MTD or Investment are the count of days the MTD is low VS LMTD OR Investment is below 75%.</p><br/><p>These partners needs immediate attention.</p><br/><table style='border:1px solid black';cellspacing=0>");
|
| Line 3540... |
Line 3543... |
| 3540 |
@Autowired
|
3543 |
@Autowired
|
| 3541 |
FofoPaymentRepository fofoPaymentRepository;
|
3544 |
FofoPaymentRepository fofoPaymentRepository;
|
| 3542 |
|
3545 |
|
| 3543 |
@Autowired
|
3546 |
@Autowired
|
| 3544 |
CCAvenuePaymentService ccAvenuePaymentService;
|
3547 |
CCAvenuePaymentService ccAvenuePaymentService;
|
| - |
|
3548 |
|
| 3545 |
public void settleCCAvePayments() throws Exception {
|
3549 |
public void settleCCAvePayments() throws Exception {
|
| - |
|
3550 |
List<FofoPayment> fofoPayments = fofoPaymentRepository
|
| 3546 |
List<FofoPayment> fofoPayments = fofoPaymentRepository.selectAllByGatewayStatus(Gateway.CCAVENUE, PaymentStatus.INIT).stream()
|
3551 |
.selectAllByGatewayStatus(Gateway.CCAVENUE, PaymentStatus.INIT).stream()
|
| 3547 |
.filter(x->x.getCreateTimestamp().isBefore(LocalDateTime.now().minusMinutes(30l))).collect(Collectors.toList());
|
3552 |
.filter(x -> x.getCreateTimestamp().isBefore(LocalDateTime.now().minusMinutes(30l)))
|
| - |
|
3553 |
.collect(Collectors.toList());
|
| 3548 |
for (FofoPayment fofoPayment : fofoPayments) {
|
3554 |
for (FofoPayment fofoPayment : fofoPayments) {
|
| 3549 |
ccAvenuePaymentService.updatePayment(fofoPayment);
|
3555 |
ccAvenuePaymentService.updatePayment(fofoPayment);
|
| 3550 |
}
|
3556 |
}
|
| 3551 |
}
|
3557 |
}
|
| 3552 |
|
3558 |
|
| - |
|
3559 |
/*
|
| 3553 |
/*public void getCCAvenuePendingOrderStatus(int pendingOrderId) {
|
3560 |
* public void getCCAvenuePendingOrderStatus(int pendingOrderId) { PendingOrder
|
| 3554 |
PendingOrder pendingOrder = pendingOrderRepository.selectById(pendingOrderId);
|
3561 |
* pendingOrder = pendingOrderRepository.selectById(pendingOrderId);
|
| 3555 |
ccAvenuePaymentService.getPaymentStatusMap(pendingOrder);
|
3562 |
* ccAvenuePaymentService.getPaymentStatusMap(pendingOrder); }
|
| 3556 |
}*/
|
3563 |
*/
|
| 3557 |
|
3564 |
|
| 3558 |
private void calculateInterest(Loan loan, Map<LoanReferenceType, Double> loanStatusAmount, int loanStatementId)
|
3565 |
private void calculateInterest(Loan loan, Map<LoanReferenceType, Double> loanStatusAmount, int loanStatementId)
|
| 3559 |
throws ProfitMandiBusinessException {
|
3566 |
throws ProfitMandiBusinessException {
|
| 3560 |
LoanStatement loanStatement = loanStatementRepository.selectById(loanStatementId);
|
3567 |
LoanStatement loanStatement = loanStatementRepository.selectById(loanStatementId);
|
| 3561 |
|
3568 |
|
| Line 4645... |
Line 4652... |
| 4645 |
|
4652 |
|
| 4646 |
}
|
4653 |
}
|
| 4647 |
|
4654 |
|
| 4648 |
}
|
4655 |
}
|
| 4649 |
|
4656 |
|
| - |
|
4657 |
@Autowired
|
| - |
|
4658 |
private WebListingRepository webListingRepository;
|
| - |
|
4659 |
|
| - |
|
4660 |
@Autowired
|
| - |
|
4661 |
private WebProductListingRepository webProductListingRepository;
|
| - |
|
4662 |
|
| - |
|
4663 |
public void pushDataToSolr() throws Exception {
|
| - |
|
4664 |
fofoSolr.pushData();
|
| - |
|
4665 |
}
|
| - |
|
4666 |
|
| - |
|
4667 |
public void getBestSeller() throws ProfitMandiBusinessException {
|
| - |
|
4668 |
WebListing webListing = webListingRepository.selectByUrl("partner-best-sellers");
|
| - |
|
4669 |
|
| - |
|
4670 |
List<WebProductListing> webProductListings = webProductListingRepository
|
| - |
|
4671 |
.selectAllByWebListingId(webListing.getId());
|
| - |
|
4672 |
|
| - |
|
4673 |
List<Integer> catalogItemIds = orderRepository.selectAllOrderWeight(LocalDateTime.now().minusDays(30),
|
| - |
|
4674 |
LocalDateTime.now(), OrderStatus.DELIVERY_SUCCESS);
|
| - |
|
4675 |
|
| - |
|
4676 |
LOGGER.info("catalogItemIds {}", catalogItemIds);
|
| - |
|
4677 |
if (!catalogItemIds.isEmpty()) {
|
| - |
|
4678 |
webProductListingRepository.deleteByEqual(webListing.getId());
|
| - |
|
4679 |
int count = 0;
|
| - |
|
4680 |
for (Integer catalogItemId : catalogItemIds) {
|
| - |
|
4681 |
|
| - |
|
4682 |
WebProductListing webProductListing = new WebProductListing();
|
| - |
|
4683 |
webProductListing.setEntityId(catalogItemId);
|
| - |
|
4684 |
webProductListing.setWebListingId(webListing.getId());
|
| - |
|
4685 |
|
| - |
|
4686 |
webProductListing.setRank(count + 1);
|
| - |
|
4687 |
webProductListingRepository.persist(webProductListing);
|
| - |
|
4688 |
|
| - |
|
4689 |
}
|
| - |
|
4690 |
|
| - |
|
4691 |
}
|
| - |
|
4692 |
}
|
| - |
|
4693 |
|
| - |
|
4694 |
public void getPriceDrop() throws ProfitMandiBusinessException {
|
| - |
|
4695 |
WebListing webListing = webListingRepository.selectByUrl("partner-price-drop");
|
| - |
|
4696 |
|
| - |
|
4697 |
List<WebProductListing> webProductListings = webProductListingRepository
|
| - |
|
4698 |
.selectAllByWebListingId(webListing.getId());
|
| - |
|
4699 |
|
| - |
|
4700 |
List<Integer> catalogItemIds = priceDropRepository
|
| - |
|
4701 |
.selectAllByDatesBetweenSortByDate(LocalDateTime.now().minusDays(30), LocalDateTime.now()).stream()
|
| - |
|
4702 |
.map(x -> x.getCatalogItemId()).collect(Collectors.toList());
|
| - |
|
4703 |
|
| - |
|
4704 |
LOGGER.info("catalogItemIds {}", catalogItemIds);
|
| - |
|
4705 |
if (!catalogItemIds.isEmpty()) {
|
| - |
|
4706 |
webProductListingRepository.deleteByEqual(webListing.getId());
|
| - |
|
4707 |
int count = 0;
|
| - |
|
4708 |
for (Integer catalogItemId : catalogItemIds) {
|
| - |
|
4709 |
|
| - |
|
4710 |
WebProductListing webProductListing = new WebProductListing();
|
| - |
|
4711 |
webProductListing.setEntityId(catalogItemId);
|
| - |
|
4712 |
webProductListing.setWebListingId(webListing.getId());
|
| - |
|
4713 |
|
| - |
|
4714 |
webProductListing.setRank(count + 1);
|
| - |
|
4715 |
webProductListingRepository.persist(webProductListing);
|
| - |
|
4716 |
|
| - |
|
4717 |
}
|
| - |
|
4718 |
|
| - |
|
4719 |
}
|
| - |
|
4720 |
}
|
| - |
|
4721 |
|
| 4650 |
}
|
4722 |
}
|
| 4651 |
// 2284'
|
4723 |
// 2284'
|
| 4652 |
|
4724 |
|