| Line 297... |
Line 297... |
| 297 |
private PartnerTypeChangeRepository partnerTypeChangeRepository;
|
297 |
private PartnerTypeChangeRepository partnerTypeChangeRepository;
|
| 298 |
|
298 |
|
| 299 |
@Autowired
|
299 |
@Autowired
|
| 300 |
private SchemeService schemeService;
|
300 |
private SchemeService schemeService;
|
| 301 |
|
301 |
|
| 302 |
private static final String[] STOCK_AGEING_MAIL_LIST = new String[] { "uday.singh@smartudkaan.com", "mohinder.mutreja@smartdukaan.com",
|
302 |
private static final String[] STOCK_AGEING_MAIL_LIST = new String[] { "uday.singh@smartudkaan.com",
|
| 303 |
"ankit.bhatia@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
303 |
"mohinder.mutreja@smartdukaan.com", "ankit.bhatia@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| 304 |
"kuldeep.kumar@smartdukaan.com", "manish.gupta@smartdukaan.com" };
|
304 |
"kuldeep.kumar@smartdukaan.com", "manish.gupta@smartdukaan.com" };
|
| 305 |
|
305 |
|
| 306 |
private static final String[] ITEMWISE_PENDING_INDENT_MAIL_LIST = new String[] { "kamini.sharma@smartdukaan.com",
|
306 |
private static final String[] ITEMWISE_PENDING_INDENT_MAIL_LIST = new String[] { "kamini.sharma@smartdukaan.com",
|
| 307 |
"tarun.verma@smartdukaan.com", "uday.singh@smartdukaan.com", "kuldeep.kumar@smartdukaan.com",
|
307 |
"tarun.verma@smartdukaan.com", "uday.singh@smartdukaan.com", "kuldeep.kumar@smartdukaan.com",
|
| 308 |
"niranjan.kala@smartdukaan.com" };
|
308 |
"niranjan.kala@smartdukaan.com" };
|
| Line 782... |
Line 782... |
| 782 |
rt.setCashbackReference(referenceId);
|
782 |
rt.setCashbackReference(referenceId);
|
| 783 |
rechargeTransactionRepository.persist(rt);
|
783 |
rechargeTransactionRepository.persist(rt);
|
| 784 |
}
|
784 |
}
|
| 785 |
LOGGER.info("Cashbacks for Recharge processed Successfully");
|
785 |
LOGGER.info("Cashbacks for Recharge processed Successfully");
|
| 786 |
}
|
786 |
}
|
| 787 |
|
787 |
|
| 788 |
public void rollOutUpgardedMargins() throws Exception {
|
788 |
public void rollOutUpgardedMarginsNextMonth() throws Exception {
|
| 789 |
LocalDate startOfPreviousMonth = LocalDate.now().with(ChronoField.DAY_OF_MONTH, 1).minusMonths(1);
|
789 |
LocalDate startOfPreviousMonth = LocalDate.now().with(ChronoField.DAY_OF_MONTH, 1).minusMonths(1);
|
| 790 |
|
790 |
|
| 791 |
List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
|
791 |
List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
|
| 792 |
for(FofoStore store : stores) {
|
792 |
for (FofoStore store : stores) {
|
| 793 |
int fofoId = store.getId();
|
793 |
int fofoId = store.getId();
|
| 794 |
|
794 |
|
| 795 |
PartnerType startOfMonthPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfPreviousMonth);
|
795 |
PartnerType startOfMonthPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, startOfPreviousMonth);
|
| 796 |
PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnMonth(fofoId, YearMonth.from(startOfPreviousMonth.atStartOfDay()));
|
796 |
PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnMonth(fofoId,
|
| - |
|
797 |
YearMonth.from(startOfPreviousMonth.atStartOfDay()));
|
| - |
|
798 |
if (!startOfMonthPartnerType.nextPartnerTypes().contains(todayPartnerType)) {
|
| - |
|
799 |
continue;
|
| - |
|
800 |
}
|
| 797 |
if(!startOfMonthPartnerType.equals(todayPartnerType)) {
|
801 |
if (!startOfMonthPartnerType.equals(todayPartnerType)) {
|
| 798 |
LOGGER.info("Partner Type has been changed for code {} from {} to {}", store.getCode(), startOfMonthPartnerType, todayPartnerType);
|
802 |
LOGGER.info("Partner Type has been changed for code {} from {} to {}", store.getCode(),
|
| - |
|
803 |
startOfMonthPartnerType, todayPartnerType);
|
| 799 |
//List<FofoOrder> fofoOrders = fofoOrderRepository.selectByFofoId(fofoId, yesterday.withDayOfMonth(1).atStartOfDay(), yesterday.atTime(LocalTime.MAX), 0,0);
|
804 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectByFofoId(fofoId,
|
| 800 |
/*
|
- |
|
| - |
|
805 |
startOfPreviousMonth.atStartOfDay(), startOfPreviousMonth.plusMonths(1).atStartOfDay(), 0, 0);
|
| 801 |
* for(FofoOrder fofoOrder : fofoOrders) {
|
806 |
for (FofoOrder fofoOrder : fofoOrders) {
|
| 802 |
* schemeService.processSchemeOut(fofoOrder.getId(), fofoId); }
|
807 |
schemeService.processSchemeOut(fofoOrder.getId(), fofoId);
|
| 803 |
*/
|
- |
|
| 804 |
}
|
808 |
}
|
| - |
|
809 |
|
| - |
|
810 |
}
|
| - |
|
811 |
}
|
| - |
|
812 |
}
|
| - |
|
813 |
public void rollOutUpgardedMargins() throws Exception {
|
| - |
|
814 |
LocalDate today = LocalDate.now();
|
| - |
|
815 |
LocalDate yesterday = today.minusDays(1);
|
| - |
|
816 |
int upgradedCount = 0;
|
| - |
|
817 |
List<FofoStore> stores = fofoStoreRepository.selectActiveStores();
|
| - |
|
818 |
StringBuilder sb = new StringBuilder();
|
| - |
|
819 |
for (FofoStore store : stores) {
|
| - |
|
820 |
int fofoId = store.getId();
|
| - |
|
821 |
|
| - |
|
822 |
PartnerType yesterdayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, yesterday);
|
| - |
|
823 |
PartnerType todayPartnerType = partnerTypeChangeService.getTypeOnDate(fofoId, today);
|
| - |
|
824 |
if (!yesterdayPartnerType.nextPartnerTypes().contains(todayPartnerType)) {
|
| - |
|
825 |
continue;
|
| - |
|
826 |
}
|
| - |
|
827 |
if (!yesterdayPartnerType.equals(todayPartnerType)) {
|
| - |
|
828 |
upgradedCount++;
|
| - |
|
829 |
sb.append(String.format("Partner Type has been changed for code %s from %s to %s", store.getCode(), yesterdayPartnerType.toString(), todayPartnerType.toString()));
|
| - |
|
830 |
sb.append("<br>");
|
| - |
|
831 |
LOGGER.info("Partner Type has been changed for code {} from {} to {}", store.getCode(),
|
| - |
|
832 |
yesterdayPartnerType, todayPartnerType);
|
| - |
|
833 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectByFofoId(fofoId,
|
| - |
|
834 |
yesterday.withDayOfMonth(1).atStartOfDay(), yesterday.atStartOfDay(), 0, 0);
|
| - |
|
835 |
for (FofoOrder fofoOrder : fofoOrders) {
|
| - |
|
836 |
schemeService.processSchemeOut(fofoOrder.getId(), fofoId);
|
| - |
|
837 |
}
|
| - |
|
838 |
|
| - |
|
839 |
}
|
| - |
|
840 |
}
|
| - |
|
841 |
if(upgradedCount > 0) {
|
| - |
|
842 |
sendMailHtmlFormat(new String[] {"amit.gupta@smartdukaan.com", "tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com"}, sb.toString(), null, "Few Partners Category have been Upgraded");
|
| - |
|
843 |
} else {
|
| - |
|
844 |
sendMailHtmlFormat(new String[] {"amit.gupta@smartdukaan.com", "tarun.verma@smartdukaan.com", "neeraj.gupta@smartdukaan.com"}, sb.toString(), null, "No partners Category have been upgraded today");
|
| 805 |
}
|
845 |
}
|
| 806 |
}
|
846 |
}
|
| 807 |
|
847 |
|
| 808 |
private class SaleRoles {
|
848 |
private class SaleRoles {
|
| 809 |
|
849 |
|
| Line 1295... |
Line 1335... |
| 1295 |
|
1335 |
|
| 1296 |
}
|
1336 |
}
|
| 1297 |
}
|
1337 |
}
|
| 1298 |
|
1338 |
|
| 1299 |
}
|
1339 |
}
|
| 1300 |
|
1340 |
|
| 1301 |
@Autowired
|
1341 |
@Autowired
|
| 1302 |
StateRepository stateRepository;
|
1342 |
StateRepository stateRepository;
|
| 1303 |
|
1343 |
|
| 1304 |
public void gst() throws Exception {
|
1344 |
public void gst() throws Exception {
|
| 1305 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectBetweenSaleDate(LocalDate.of(2021, 8, 16).atStartOfDay(),
|
1345 |
List<FofoOrder> fofoOrders = fofoOrderRepository.selectBetweenSaleDate(LocalDate.of(2021, 8, 16).atStartOfDay(),
|
| Line 1332... |
Line 1372... |
| 1332 |
|
1372 |
|
| 1333 |
for (FofoOrderItem foi : fofoOrderItems) {
|
1373 |
for (FofoOrderItem foi : fofoOrderItems) {
|
| 1334 |
float sgstRate = foi.getSgstRate();
|
1374 |
float sgstRate = foi.getSgstRate();
|
| 1335 |
float cgstRate = foi.getCgstRate();
|
1375 |
float cgstRate = foi.getCgstRate();
|
| 1336 |
float igstRate = foi.getIgstRate();
|
1376 |
float igstRate = foi.getIgstRate();
|
| 1337 |
if (stateId == null && igstRate==0) {
|
1377 |
if (stateId == null && igstRate == 0) {
|
| 1338 |
|
1378 |
|
| - |
|
1379 |
foi.setSgstRate(0);
|
| 1339 |
foi.setSgstRate(0); foi.setCgstRate(0);
|
1380 |
foi.setCgstRate(0);
|
| 1340 |
foi.setIgstRate(itemIdIgstTaxRateMap.get(foi.getItemId()));
|
1381 |
foi.setIgstRate(itemIdIgstTaxRateMap.get(foi.getItemId()));
|
| 1341 |
|
1382 |
|
| 1342 |
LOGGER.info("Invoice {}, Date {}", fofoOrder.getInvoiceNumber(), fofoOrder.getCreateTimestamp());
|
1383 |
LOGGER.info("Invoice {}, Date {}", fofoOrder.getInvoiceNumber(), fofoOrder.getCreateTimestamp());
|
| 1343 |
LOGGER.info("customerAddress.getState() {}, retailerAddress.getState() {}", customerAddress.getState(), retailerAddress.getState());
|
1384 |
LOGGER.info("customerAddress.getState() {}, retailerAddress.getState() {}",
|
| - |
|
1385 |
customerAddress.getState(), retailerAddress.getState());
|
| 1344 |
LOGGER.info("Rates getIgstRate() {}", itemIdIgstTaxRateMap.get(foi.getItemId()));
|
1386 |
LOGGER.info("Rates getIgstRate() {}", itemIdIgstTaxRateMap.get(foi.getItemId()));
|
| 1345 |
|
1387 |
|
| 1346 |
} else if (stateId != null && sgstRate==0 && cgstRate == 0){
|
1388 |
} else if (stateId != null && sgstRate == 0 && cgstRate == 0) {
|
| 1347 |
|
1389 |
|
| 1348 |
foi.setIgstRate(0);
|
1390 |
foi.setIgstRate(0);
|
| 1349 |
foi.setCgstRate(itemIdStateTaxRateMap.get(foi.getItemId()).getCgstRate());
|
1391 |
foi.setCgstRate(itemIdStateTaxRateMap.get(foi.getItemId()).getCgstRate());
|
| 1350 |
foi.setSgstRate(itemIdStateTaxRateMap.get(foi.getItemId()).getSgstRate());
|
1392 |
foi.setSgstRate(itemIdStateTaxRateMap.get(foi.getItemId()).getSgstRate());
|
| 1351 |
|
1393 |
|
| 1352 |
LOGGER.info("Invoice {}, Date {}", fofoOrder.getInvoiceNumber(), fofoOrder.getCreateTimestamp());
|
1394 |
LOGGER.info("Invoice {}, Date {}", fofoOrder.getInvoiceNumber(), fofoOrder.getCreateTimestamp());
|
| 1353 |
LOGGER.info("customerAddress.getState() {}, retailerAddress.getState() {}", customerAddress.getState(), retailerAddress.getState());
|
1395 |
LOGGER.info("customerAddress.getState() {}, retailerAddress.getState() {}",
|
| - |
|
1396 |
customerAddress.getState(), retailerAddress.getState());
|
| - |
|
1397 |
LOGGER.info("Rates getCgstRate() {}, getSgstRate() {}",
|
| - |
|
1398 |
itemIdStateTaxRateMap.get(foi.getItemId()).getCgstRate(),
|
| 1354 |
LOGGER.info("Rates getCgstRate() {}, getSgstRate() {}", itemIdStateTaxRateMap.get(foi.getItemId()).getCgstRate(), itemIdStateTaxRateMap.get(foi.getItemId()).getSgstRate());
|
1399 |
itemIdStateTaxRateMap.get(foi.getItemId()).getSgstRate());
|
| 1355 |
}
|
1400 |
}
|
| 1356 |
}
|
1401 |
}
|
| 1357 |
}
|
1402 |
}
|
| 1358 |
|
1403 |
|
| 1359 |
}
|
1404 |
}
|