| Line 23... |
Line 23... |
| 23 |
import javax.mail.MessagingException;
|
23 |
import javax.mail.MessagingException;
|
| 24 |
import javax.mail.internet.InternetAddress;
|
24 |
import javax.mail.internet.InternetAddress;
|
| 25 |
import javax.mail.internet.MimeMessage;
|
25 |
import javax.mail.internet.MimeMessage;
|
| 26 |
|
26 |
|
| 27 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
27 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| - |
|
28 |
import org.apache.commons.lang.StringUtils;
|
| 28 |
import org.apache.http.client.methods.CloseableHttpResponse;
|
29 |
import org.apache.http.client.methods.CloseableHttpResponse;
|
| 29 |
import org.apache.http.client.methods.HttpPost;
|
30 |
import org.apache.http.client.methods.HttpPost;
|
| 30 |
import org.apache.http.entity.StringEntity;
|
31 |
import org.apache.http.entity.StringEntity;
|
| 31 |
import org.apache.http.impl.client.CloseableHttpClient;
|
32 |
import org.apache.http.impl.client.CloseableHttpClient;
|
| 32 |
import org.apache.http.impl.client.HttpClients;
|
33 |
import org.apache.http.impl.client.HttpClients;
|
| Line 85... |
Line 86... |
| 85 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
86 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| 86 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
87 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
| 87 |
import com.spice.profitmandi.dao.entity.user.Address;
|
88 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 88 |
import com.spice.profitmandi.dao.entity.user.Device;
|
89 |
import com.spice.profitmandi.dao.entity.user.Device;
|
| 89 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
90 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| - |
|
91 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 90 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
92 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| 91 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
93 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 92 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
94 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| 93 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
95 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 94 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
96 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
| Line 146... |
Line 148... |
| 146 |
@Value("${oxigen.recharge.enquiry.url}")
|
148 |
@Value("${oxigen.recharge.enquiry.url}")
|
| 147 |
private String oxigenRechargeEnquiryUrl;
|
149 |
private String oxigenRechargeEnquiryUrl;
|
| 148 |
|
150 |
|
| 149 |
@Autowired
|
151 |
@Autowired
|
| 150 |
private PartnerTypeChangeService partnerTypeChangeService;
|
152 |
private PartnerTypeChangeService partnerTypeChangeService;
|
| 151 |
|
153 |
|
| 152 |
@Autowired
|
154 |
@Autowired
|
| 153 |
private AuthRepository authRepository;
|
155 |
private AuthRepository authRepository;
|
| 154 |
|
156 |
|
| 155 |
@Autowired
|
157 |
@Autowired
|
| 156 |
private PriceDropService priceDropService;
|
158 |
private PriceDropService priceDropService;
|
| 157 |
|
159 |
|
| 158 |
@Autowired
|
160 |
@Autowired
|
| 159 |
private CsService csService;
|
161 |
private CsService csService;
|
| 160 |
|
162 |
|
| 161 |
@Value("${oxigen.recharge.auth.key}")
|
163 |
@Value("${oxigen.recharge.auth.key}")
|
| 162 |
private String oxigenRechargeAuthKey;
|
164 |
private String oxigenRechargeAuthKey;
|
| Line 197... |
Line 199... |
| 197 |
@Autowired
|
199 |
@Autowired
|
| 198 |
private ReporticoService reporticoService;
|
200 |
private ReporticoService reporticoService;
|
| 199 |
|
201 |
|
| 200 |
@Autowired
|
202 |
@Autowired
|
| 201 |
private PartnerInvestmentService partnerInvestmentService;
|
203 |
private PartnerInvestmentService partnerInvestmentService;
|
| 202 |
|
204 |
|
| 203 |
@Autowired
|
205 |
@Autowired
|
| 204 |
private PositionRepository positionRepository;
|
206 |
private PositionRepository positionRepository;
|
| 205 |
|
207 |
|
| 206 |
@Autowired
|
208 |
@Autowired
|
| 207 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
209 |
private FofoOrderItemRepository fofoOrderItemRepository;
|
| Line 563... |
Line 565... |
| 563 |
for (UserWalletHistory uwh : uwhs) {
|
565 |
for (UserWalletHistory uwh : uwhs) {
|
| 564 |
System.out.println(String.format("%d\t%d\t%s\t%s\t%s", uwh.getAmount(), uwh.getReference(),
|
566 |
System.out.println(String.format("%d\t%d\t%s\t%s\t%s", uwh.getAmount(), uwh.getReference(),
|
| 565 |
uwh.getReferenceType(), uwh.getTimestamp().toString(), uwh.getDescription()));
|
567 |
uwh.getReferenceType(), uwh.getTimestamp().toString(), uwh.getDescription()));
|
| 566 |
}
|
568 |
}
|
| 567 |
LOGGER.info("Schemes process successfully.");
|
569 |
LOGGER.info("Schemes process successfully.");
|
| 568 |
if(dryRun) {
|
570 |
if (dryRun) {
|
| 569 |
throw new Exception();
|
571 |
throw new Exception();
|
| 570 |
}
|
572 |
}
|
| 571 |
}
|
573 |
}
|
| 572 |
|
574 |
|
| 573 |
public void processRechargeCashback() throws Throwable {
|
575 |
public void processRechargeCashback() throws Throwable {
|
| Line 591... |
Line 593... |
| 591 |
rechargeTransactionRepository.persist(rt);
|
593 |
rechargeTransactionRepository.persist(rt);
|
| 592 |
}
|
594 |
}
|
| 593 |
LOGGER.info("Cashbacks for Recharge processed Successfully");
|
595 |
LOGGER.info("Cashbacks for Recharge processed Successfully");
|
| 594 |
}
|
596 |
}
|
| 595 |
|
597 |
|
| - |
|
598 |
private class SaleRoles {
|
| - |
|
599 |
|
| - |
|
600 |
private List<String> l1;
|
| - |
|
601 |
private List<String> l2;
|
| - |
|
602 |
|
| - |
|
603 |
public SaleRoles() {
|
| - |
|
604 |
l1 = new ArrayList<>();
|
| - |
|
605 |
l2 = new ArrayList<>();
|
| - |
|
606 |
}
|
| - |
|
607 |
|
| - |
|
608 |
public List<String> getL1() {
|
| - |
|
609 |
return l1;
|
| - |
|
610 |
}
|
| - |
|
611 |
|
| - |
|
612 |
public void setL1(List<String> l1) {
|
| - |
|
613 |
this.l1 = l1;
|
| - |
|
614 |
}
|
| - |
|
615 |
|
| - |
|
616 |
public List<String> getL2() {
|
| - |
|
617 |
return l2;
|
| - |
|
618 |
}
|
| - |
|
619 |
|
| - |
|
620 |
public void setL2(List<String> l2) {
|
| - |
|
621 |
this.l2 = l2;
|
| - |
|
622 |
}
|
| - |
|
623 |
|
| - |
|
624 |
}
|
| - |
|
625 |
|
| 596 |
public void sendPartnerInvestmentDetails(List<String> sendTo) throws Exception {
|
626 |
public void sendPartnerInvestmentDetails(List<String> sendTo) throws Exception {
|
| 597 |
if (sendTo == null) {
|
627 |
if (sendTo == null) {
|
| 598 |
sendTo = Arrays.asList("tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com",
|
628 |
sendTo = Arrays.asList("tarun.verma@smartdukaan.com", "kamini.sharma@smartdukaan.com",
|
| 599 |
"amit.gupta@shop2020.in", "amod.sen@smartdukaan.com");
|
629 |
"amit.gupta@shop2020.in", "amod.sen@smartdukaan.com");
|
| 600 |
}
|
630 |
}
|
| 601 |
LocalDate yesterDay = LocalDate.now().minusDays(1);
|
631 |
LocalDate yesterDay = LocalDate.now().minusDays(1);
|
| 602 |
List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
|
632 |
List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
|
| 603 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService
|
633 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService
|
| 604 |
.getFofoRetailers(fofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
634 |
.getFofoRetailers(fofoStores.stream().map(x -> x.getId()).collect(Collectors.toList()));
|
| 605 |
|
635 |
|
| 606 |
List<String> headers = Arrays.asList("Code", "Firm Name", "Store Name", "State Manager", "Teritory Manager",
|
636 |
List<String> headers = Arrays.asList("Code", "Firm Name", "Store Name", "State Manager", "Teritory/Team Lead",
|
| 607 |
"Team Leader", "Wallet Amount", "In Stock Amount", "Return In Transit Stock", "Unbilled Amount",
|
637 |
"Wallet Amount", "In Stock Amount", "Return In Transit Stock", "Unbilled Amount", "Grn Pending Amount",
|
| 608 |
"Grn Pending Amount", "Min Investment", "Investment Amount", "Investment Short", "Unbilled Qty");
|
638 |
"Min Investment", "Investment Amount", "Investment Short", "Unbilled Qty");
|
| 609 |
List<List<? extends Serializable>> rows = new ArrayList<>();
|
639 |
List<List<? extends Serializable>> rows = new ArrayList<>();
|
| 610 |
Map<String, List<? extends Serializable>> partnerRow = new HashMap<>();
|
640 |
Map<String, List<? extends Serializable>> partnerRow = new HashMap<>();
|
| - |
|
641 |
|
| - |
|
642 |
Map<String, SaleRoles> partnerEmailSalesMap = this.getPartnerEmailSalesMap();
|
| - |
|
643 |
|
| 611 |
for (FofoStore fofoStore : fofoStores) {
|
644 |
for (FofoStore fofoStore : fofoStores) {
|
| - |
|
645 |
PartnerDailyInvestment partnerDailyInvestment = partnerInvestmentService.getInvestment(fofoStore.getId(),
|
| - |
|
646 |
1);
|
| 612 |
if (!fofoStore.isActive())
|
647 |
partnerDailyInvestment.setDate(yesterDay);
|
| 613 |
continue;
|
648 |
try {
|
| - |
|
649 |
partnerDailyInvestmentRepository.persist(partnerDailyInvestment);
|
| - |
|
650 |
} catch (Exception e) {
|
| - |
|
651 |
// ignore the exceptions during persist
|
| - |
|
652 |
}
|
| - |
|
653 |
|
| 614 |
CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
|
654 |
CustomRetailer retailer = customRetailerMap.get(fofoStore.getId());
|
| 615 |
if (retailer == null || storeManagerMap.get(retailer.getEmail()) == null) {
|
655 |
if (retailer == null || partnerEmailSalesMap.get(retailer.getEmail()) == null) {
|
| 616 |
LOGGER.info("Could not find retailer with retailer Id {}", fofoStore.getId());
|
656 |
LOGGER.info("Could not find retailer with retailer Id {}", fofoStore.getId());
|
| 617 |
continue;
|
657 |
continue;
|
| 618 |
}
|
658 |
}
|
| 619 |
PartnerDailyInvestment partnerDailyInvestment = partnerInvestmentService.getInvestment(fofoStore.getId(),
|
- |
|
| 620 |
1);
|
- |
|
| 621 |
partnerDailyInvestment.setDate(yesterDay);
|
- |
|
| 622 |
partnerDailyInvestmentRepository.persist(partnerDailyInvestment);
|
- |
|
| 623 |
|
659 |
|
| 624 |
List<? extends Serializable> row = Arrays.asList(fofoStore.getCode(), retailer.getBusinessName(),
|
660 |
List<? extends Serializable> row = Arrays.asList(fofoStore.getCode(), retailer.getBusinessName(),
|
| 625 |
"SmartDukaan-" + fofoStore.getCode().replaceAll("[a-zA-Z]+", ""),
|
661 |
"SmartDukaan-" + fofoStore.getCode().replaceAll("[a-zA-Z]+", ""),
|
| 626 |
storeManagerMap.get(retailer.getEmail()).get(2), storeManagerMap.get(retailer.getEmail()).get(1),
|
662 |
StringUtils.join(partnerEmailSalesMap.get(retailer.getEmail()).getL2(), ", "),
|
| 627 |
storeManagerMap.get(retailer.getEmail()).get(0), partnerDailyInvestment.getWalletAmount(),
|
663 |
StringUtils.join(partnerEmailSalesMap.get(retailer.getEmail()).getL2(), ", "),
|
| 628 |
partnerDailyInvestment.getInStockAmount(), 0, partnerDailyInvestment.getUnbilledAmount(),
|
664 |
partnerDailyInvestment.getWalletAmount(), partnerDailyInvestment.getInStockAmount(), 0,
|
| 629 |
partnerDailyInvestment.getGrnPendingAmount(), partnerDailyInvestment.getMinInvestment(),
|
665 |
partnerDailyInvestment.getUnbilledAmount(), partnerDailyInvestment.getGrnPendingAmount(),
|
| 630 |
partnerDailyInvestment.getTotalInvestment(), partnerDailyInvestment.getShortInvestment(),
|
666 |
partnerDailyInvestment.getMinInvestment(), partnerDailyInvestment.getTotalInvestment(),
|
| 631 |
partnerDailyInvestment.getUnbilledQty());
|
667 |
partnerDailyInvestment.getShortInvestment(), partnerDailyInvestment.getUnbilledQty());
|
| 632 |
partnerRow.put(retailer.getEmail(), row);
|
668 |
partnerRow.put(retailer.getEmail(), row);
|
| 633 |
rows.add(row);
|
669 |
rows.add(row);
|
| 634 |
|
670 |
|
| 635 |
}
|
671 |
}
|
| 636 |
Map<String, Set<String>> storeGuyMap = new HashMap<>();
|
- |
|
| 637 |
for (Map.Entry<String, List<String>> entry : storeManagerMap.entrySet()) {
|
- |
|
| 638 |
String storeEmail = entry.getKey();
|
- |
|
| 639 |
List<String> storeGuys = entry.getValue();
|
- |
|
| 640 |
for (String storeGuy : storeGuys) {
|
- |
|
| 641 |
if (!storeGuyMap.containsKey(storeGuy)) {
|
- |
|
| 642 |
storeGuyMap.put(storeGuy, new HashSet<>());
|
- |
|
| 643 |
}
|
- |
|
| 644 |
storeGuyMap.get(storeGuy).add(storeEmail);
|
- |
|
| 645 |
}
|
- |
|
| 646 |
}
|
- |
|
| 647 |
storeGuyMap.remove("");
|
- |
|
| 648 |
|
672 |
|
| 649 |
String fileName = "InvestmentSummary-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
673 |
String fileName = "InvestmentSummary-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
| - |
|
674 |
|
| 650 |
for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuyMap.entrySet()) {
|
675 |
for (Map.Entry<String, Set<String>> storeGuyEntry : csService.getAuthUserPartnerEmailMapping().entrySet()) {
|
| 651 |
List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
|
676 |
List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
|
| 652 |
.map(x -> partnerRow.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
677 |
.map(x -> partnerRow.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 653 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
|
678 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
|
| 654 |
String[] sendToArray = new String[] { nameEmail.get(storeGuyEntry.getKey()) };
|
679 |
String[] sendToArray = (String[]) storeGuyEntry.getValue().toArray();
|
| 655 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA",
|
680 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA",
|
| 656 |
fileName, new ByteArrayResource(baos.toByteArray()));
|
681 |
fileName, new ByteArrayResource(baos.toByteArray()));
|
| 657 |
}
|
682 |
}
|
| 658 |
|
683 |
|
| 659 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
684 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
| Line 661... |
Line 686... |
| 661 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA", fileName,
|
686 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA", fileName,
|
| 662 |
new ByteArrayResource(baos.toByteArray()));
|
687 |
new ByteArrayResource(baos.toByteArray()));
|
| 663 |
|
688 |
|
| 664 |
}
|
689 |
}
|
| 665 |
|
690 |
|
| - |
|
691 |
private Map<String, SaleRoles> getPartnerEmailSalesMap() {
|
| - |
|
692 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
| - |
|
693 |
|
| - |
|
694 |
List<Position> positions = positionRepository
|
| - |
|
695 |
.selectPositionByCategoryId(ProfitMandiConstants.TICKET_CATEGORY_SALES);
|
| - |
|
696 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream()
|
| - |
|
697 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| - |
|
698 |
Map<Integer, List<CustomRetailer>> positionIdRetailerMap = csService.getPositionCustomRetailerMap(positions);
|
| - |
|
699 |
for (Position position : positions) {
|
| - |
|
700 |
List<CustomRetailer> crList = positionIdRetailerMap.get(position.getId());
|
| - |
|
701 |
for (CustomRetailer cr : crList) {
|
| - |
|
702 |
if (!partnerEmailSalesMap.containsKey(cr.getEmail())) {
|
| - |
|
703 |
partnerEmailSalesMap.put(cr.getEmail(), new SaleRoles());
|
| - |
|
704 |
}
|
| - |
|
705 |
SaleRoles saleRoles = partnerEmailSalesMap.get(cr.getEmail());
|
| - |
|
706 |
AuthUser authUser = authUsersMap.get(position.getAuthUserId());
|
| - |
|
707 |
String name = authUser.getFirstName() + " " + authUser.getLastName();
|
| - |
|
708 |
if (position.getEscalationType().equals(EscalationType.L1)) {
|
| - |
|
709 |
saleRoles.getL1().add(name);
|
| - |
|
710 |
} else if (position.getEscalationType().equals(EscalationType.L2)) {
|
| - |
|
711 |
saleRoles.getL2().add(name);
|
| - |
|
712 |
}
|
| - |
|
713 |
}
|
| - |
|
714 |
}
|
| - |
|
715 |
return partnerEmailSalesMap;
|
| - |
|
716 |
}
|
| - |
|
717 |
|
| 666 |
public void sendPartnerInvestmentDetails() throws Exception {
|
718 |
public void sendPartnerInvestmentDetails() throws Exception {
|
| 667 |
this.sendPartnerInvestmentDetails(null);
|
719 |
this.sendPartnerInvestmentDetails(null);
|
| 668 |
|
720 |
|
| 669 |
}
|
721 |
}
|
| 670 |
|
722 |
|
| Line 686... |
Line 738... |
| 686 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService
|
738 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService
|
| 687 |
.getFofoRetailers(new ArrayList<>(fofoStoresMap.keySet()));
|
739 |
.getFofoRetailers(new ArrayList<>(fofoStoresMap.keySet()));
|
| 688 |
|
740 |
|
| 689 |
Map<String, CustomRetailer> customRetailerEmailMap = customRetailerMap.values().stream()
|
741 |
Map<String, CustomRetailer> customRetailerEmailMap = customRetailerMap.values().stream()
|
| 690 |
.collect(Collectors.toMap(x -> x.getEmail(), x -> x));
|
742 |
.collect(Collectors.toMap(x -> x.getEmail(), x -> x));
|
| - |
|
743 |
|
| - |
|
744 |
Map<String, SaleRoles> partnerEmailSalesMap = this.getPartnerEmailSalesMap();
|
| 691 |
|
745 |
|
| 692 |
List<String> headers = Arrays.asList("Code", "Firm Name", "Store Name", "Current Category", "State Manager", "Teritory Manager",
|
746 |
List<String> headers = Arrays.asList("Code", "Firm Name", "Store Name", "Current Category", "State Manager",
|
| 693 |
"Team Leader", "Targeted Category", "Targeted Value", "Target Achieved", "Achived Percentage",
|
747 |
"Teritory Manager", "Team Leader", "Targeted Category", "Targeted Value", "Target Achieved",
|
| 694 |
"Remaining Target", "Today's Target", "Today's achievement");
|
748 |
"Achived Percentage", "Remaining Target", "Today's Target", "Today's achievement");
|
| 695 |
|
749 |
|
| 696 |
List<List<? extends Serializable>> rows = new ArrayList<>();
|
750 |
List<List<? extends Serializable>> rows = new ArrayList<>();
|
| 697 |
Map<String, List<Serializable>> partnerRowMap = new HashMap<>();
|
751 |
Map<String, List<Serializable>> partnerRowMap = new HashMap<>();
|
| 698 |
for (Map.Entry<String, List<? extends Serializable>> partnerSalesTargetRowEntry : partnerSalesTargetRowsMap
|
752 |
for (Map.Entry<String, List<? extends Serializable>> partnerSalesTargetRowEntry : partnerSalesTargetRowsMap
|
| 699 |
.entrySet()) {
|
753 |
.entrySet()) {
|
| Line 701... |
Line 755... |
| 701 |
FofoStore fofoStore = fofoStoresMap.get(retailer.getPartnerId());
|
755 |
FofoStore fofoStore = fofoStoresMap.get(retailer.getPartnerId());
|
| 702 |
Serializable code = fofoStore.getCode();
|
756 |
Serializable code = fofoStore.getCode();
|
| 703 |
Serializable storeName = "SmartDukaan-" + fofoStore.getCode().replaceAll("[a-zA-Z]", "");
|
757 |
Serializable storeName = "SmartDukaan-" + fofoStore.getCode().replaceAll("[a-zA-Z]", "");
|
| 704 |
Serializable businessName = retailer.getBusinessName();
|
758 |
Serializable businessName = retailer.getBusinessName();
|
| 705 |
try {
|
759 |
try {
|
| 706 |
Serializable stateManager = storeManagerMap.get(retailer.getEmail()).get(2);
|
760 |
Serializable stateManager = StringUtils.join(partnerEmailSalesMap.get(retailer.getEmail()).getL2(), ", ");
|
| 707 |
Serializable territoryManager = storeManagerMap.get(retailer.getEmail()).get(1);
|
761 |
Serializable territoryManager = StringUtils.join(partnerEmailSalesMap.get(retailer.getEmail()).getL1(), ", ");
|
| 708 |
Serializable teamLeader = storeManagerMap.get(retailer.getEmail()).get(0);
|
- |
|
| 709 |
List<Serializable> row = new ArrayList<>(
|
762 |
List<Serializable> row = new ArrayList<>(
|
| 710 |
Arrays.asList(code, businessName, storeName, stateManager, territoryManager, teamLeader));
|
763 |
Arrays.asList(code, businessName, storeName, stateManager, territoryManager));
|
| 711 |
if (partnerSalesTargetRowsMap.get(retailer.getEmail()) != null) {
|
764 |
if (partnerSalesTargetRowsMap.get(retailer.getEmail()) != null) {
|
| 712 |
row.addAll(partnerSalesTargetRowsMap.get(retailer.getEmail()));
|
765 |
row.addAll(partnerSalesTargetRowsMap.get(retailer.getEmail()));
|
| 713 |
partnerRowMap.put(retailer.getEmail(), row);
|
766 |
partnerRowMap.put(retailer.getEmail(), row);
|
| 714 |
rows.add(row);
|
767 |
rows.add(row);
|
| 715 |
}
|
768 |
}
|
| Line 746... |
Line 799... |
| 746 |
Attachment attachment1 = new Attachment(
|
799 |
Attachment attachment1 = new Attachment(
|
| 747 |
"pending-indent-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr1);
|
800 |
"pending-indent-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr1);
|
| 748 |
Utils.sendMailWithAttachments(googleMailSender, sendTo, null, "Stock Aeging Report", "PFA", attachment,
|
801 |
Utils.sendMailWithAttachments(googleMailSender, sendTo, null, "Stock Aeging Report", "PFA", attachment,
|
| 749 |
attachment1);
|
802 |
attachment1);
|
| 750 |
|
803 |
|
| 751 |
//Reports to be sent to mapped partners
|
804 |
// Reports to be sent to mapped partners
|
| 752 |
Map<String, Set<String>> storeGuysMap = csService.getAuthUserPartnerEmailMapping();
|
805 |
Map<String, Set<String>> storeGuysMap = csService.getAuthUserPartnerEmailMapping();
|
| 753 |
|
806 |
|
| 754 |
String[] sendToArray = new String[storeGuysMap.size()];
|
- |
|
| 755 |
int i = 0;
|
- |
|
| 756 |
for (String storeGuyName : storeGuysMap.keySet()) {
|
- |
|
| 757 |
sendToArray[i] = nameEmail.get(storeGuyName);
|
- |
|
| 758 |
i++;
|
- |
|
| 759 |
}
|
- |
|
| 760 |
Utils.sendMailWithAttachments(googleMailSender, sendToArray, null, "Stock Aeging Report", "PFA", attachment);
|
807 |
Utils.sendMailWithAttachments(googleMailSender, (String[])storeGuysMap.keySet().toArray(), null, "Stock Aeging Report", "PFA", attachment);
|
| 761 |
|
808 |
|
| 762 |
for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuysMap.entrySet()) {
|
809 |
for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuysMap.entrySet()) {
|
| 763 |
Map<String, String> params = new HashMap<>();
|
810 |
Map<String, String> params = new HashMap<>();
|
| 764 |
if (storeGuyEntry.getValue().size() == 0)
|
811 |
if (storeGuyEntry.getValue().size() == 0)
|
| 765 |
continue;
|
812 |
continue;
|
| Line 1381... |
Line 1428... |
| 1381 |
}
|
1428 |
}
|
| 1382 |
}
|
1429 |
}
|
| 1383 |
}
|
1430 |
}
|
| 1384 |
}
|
1431 |
}
|
| 1385 |
|
1432 |
|
| 1386 |
public static final Map<String, List<String>> storeManagerMap = new HashMap<>();
|
- |
|
| 1387 |
|
- |
|
| 1388 |
public static final Map<String, String> nameEmail = new HashMap<>();
|
- |
|
| 1389 |
static {
|
- |
|
| 1390 |
nameEmail.put("Amod", "amod.sen@smartdukaan.com");
|
- |
|
| 1391 |
nameEmail.put("Parmod", "parmod.kumar@smartdukaan.com");
|
- |
|
| 1392 |
nameEmail.put("Anis", "md.anis@smartdukaan.com");
|
- |
|
| 1393 |
nameEmail.put("Manoj", "manoj.singh@smartdukaan.com");
|
- |
|
| 1394 |
nameEmail.put("Adeel", "adeel.yazdani@smartdukaan.com");
|
- |
|
| 1395 |
nameEmail.put("Mohinder", "mohinder.mutreja@smartdukaan.com");
|
- |
|
| 1396 |
nameEmail.put("Dharmendar", "dharmender.verma@smartdukaan.com");
|
- |
|
| 1397 |
nameEmail.put("Rajat", "rajat.gupta@smartdukaan.com");
|
- |
|
| 1398 |
nameEmail.put("Ankit", "ankit.bhatia@smartdukaan.com");
|
- |
|
| 1399 |
nameEmail.put("Rajit", "rajit.alag@smartdukaan.com");
|
- |
|
| 1400 |
nameEmail.put("Gulshan", "gulshan.kumar@smartdukaan.com");
|
- |
|
| 1401 |
nameEmail.put("PramodSharma", "parmod.sharma@smartdukaan.com");
|
- |
|
| 1402 |
nameEmail.put("Sohan", "sohan.lal@smartdukaan.com");
|
- |
|
| 1403 |
nameEmail.put("Ajay", "ajay.kumar@smartdukaan.com");
|
- |
|
| 1404 |
// nameEmail.put("Gulshan","");
|
- |
|
| 1405 |
|
- |
|
| 1406 |
storeManagerMap.put("themobileplanet03@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
- |
|
| 1407 |
storeManagerMap.put("mobileplanet7599@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1408 |
storeManagerMap.put("robintelecom.snp@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1409 |
storeManagerMap.put("smartconnect4141@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
- |
|
| 1410 |
storeManagerMap.put("bhimsain919@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1411 |
storeManagerMap.put("babitaranirk@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
- |
|
| 1412 |
storeManagerMap.put("dharmendery079@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1413 |
storeManagerMap.put("kkv.enterprises1@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
- |
|
| 1414 |
storeManagerMap.put("gulshersaifi74226@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
- |
|
| 1415 |
storeManagerMap.put("deepak.lalwani1985@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1416 |
storeManagerMap.put("gupta.smartdukaan@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
- |
|
| 1417 |
storeManagerMap.put("sachinindri2006@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1418 |
storeManagerMap.put("kambojanil83@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
- |
|
| 1419 |
storeManagerMap.put("uppal.neeraj82@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1420 |
storeManagerMap.put("thefonehousekarnal@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1421 |
storeManagerMap.put("richa9910763006@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1422 |
storeManagerMap.put("smartdukangzb@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1423 |
storeManagerMap.put("lovelymobile183@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1424 |
storeManagerMap.put("smartdukaan.sonepat@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1425 |
storeManagerMap.put("arunmittal299@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1426 |
storeManagerMap.put("gtc01100@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1427 |
storeManagerMap.put("sumittyagi1975@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1428 |
storeManagerMap.put("metrofurniture342@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1429 |
storeManagerMap.put("suryaelectronicskaithal@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
- |
|
| 1430 |
storeManagerMap.put("mmtelecomsec16@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
- |
|
| 1431 |
storeManagerMap.put("omsonsindia08@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1432 |
storeManagerMap.put("smartenterprisespv@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
- |
|
| 1433 |
storeManagerMap.put("cachaitnya@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
- |
|
| 1434 |
storeManagerMap.put("ajaykumarkansal03@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1435 |
storeManagerMap.put("spurwar73@gmail.com", Arrays.asList("", "Rajat", "Adeel"));
|
- |
|
| 1436 |
storeManagerMap.put("Shreemobile.ind@gmail.com", Arrays.asList("", "Rajat", "Adeel"));
|
- |
|
| 1437 |
storeManagerMap.put("felixenterprises2017@rediffmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1438 |
storeManagerMap.put("nareandergupta@gmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1439 |
storeManagerMap.put("shreebalajielectronic2019@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1440 |
storeManagerMap.put("saranshary@gmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1441 |
storeManagerMap.put("gambhirsmartphone@gmail.com", Arrays.asList("", "Gulshan", "Adeel"));
|
- |
|
| 1442 |
storeManagerMap.put("Priyankaenterprises9910@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1443 |
storeManagerMap.put("pawan.dhimaan@gmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1444 |
storeManagerMap.put("lakshaydhulla62@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1445 |
storeManagerMap.put("parastelecom.stp@gmail.com", Arrays.asList("", "Rajat", "Adeel"));
|
- |
|
| 1446 |
storeManagerMap.put("talwarmukesh298@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1447 |
storeManagerMap.put("sahilnarang0009@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
- |
|
| 1448 |
storeManagerMap.put("supertelecomjind@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1449 |
storeManagerMap.put("saketnagpal@gmail.com", Arrays.asList("", "Rajit", "Mohinder"));
|
- |
|
| 1450 |
storeManagerMap.put("DEEPAKGOYAL702.DG@GMAIL.COM", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1451 |
storeManagerMap.put("sambhav350@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1452 |
storeManagerMap.put("mayankarora98133@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1453 |
storeManagerMap.put("vijaymobilityandmoew@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1454 |
storeManagerMap.put("amitv70003@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1455 |
storeManagerMap.put("newagelucknow.123@gmail.com", Arrays.asList("", "Rajat", "Adeel"));
|
- |
|
| 1456 |
storeManagerMap.put("Newagetechnologygomtinagar@gmail.com", Arrays.asList("", "Rajat", "Adeel"));
|
- |
|
| 1457 |
storeManagerMap.put("rohitbatra106@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
- |
|
| 1458 |
storeManagerMap.put("sonisunil9050873061@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1459 |
storeManagerMap.put("moderncohsr@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1460 |
storeManagerMap.put("raghubir.ngh@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1461 |
storeManagerMap.put("aman007singla@gmail.com", Arrays.asList("", "Rajit", "Mohinder"));
|
- |
|
| 1462 |
|
- |
|
| 1463 |
storeManagerMap.put("suryaelectronicskaithal@gmail.com", Arrays.asList("Sohan", "Ankit", "Mohinder"));
|
- |
|
| 1464 |
storeManagerMap.put("amitv70003@gmail.com", Arrays.asList("Sohan", "Ankit", "Mohinder"));
|
- |
|
| 1465 |
storeManagerMap.put("uppal.neeraj82@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1466 |
storeManagerMap.put("DEEPAKGOYAL702.DG@GMAIL.COM", Arrays.asList("Sohan", "Ankit", "Mohinder"));
|
- |
|
| 1467 |
storeManagerMap.put("supertelecomjind@gmail.com", Arrays.asList("Sohan", "Ankit", "Mohinder"));
|
- |
|
| 1468 |
storeManagerMap.put("saranshary@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1469 |
storeManagerMap.put("sonisunil9050873061@gmail.com", Arrays.asList("Sohan", "Ankit", "Mohinder"));
|
- |
|
| 1470 |
storeManagerMap.put("mayankarora98133@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1471 |
storeManagerMap.put("babitaranirk@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
- |
|
| 1472 |
storeManagerMap.put("KK Enterprises", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1473 |
storeManagerMap.put("kambojanil83@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1474 |
storeManagerMap.put("robintelecom.snp@gmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1475 |
storeManagerMap.put("gtc01100@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1476 |
storeManagerMap.put("sahilnarang0009@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1477 |
storeManagerMap.put("metrofurniture342@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1478 |
storeManagerMap.put("omsonsindia08@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1479 |
storeManagerMap.put("sachinindri2006@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1480 |
storeManagerMap.put("smartdukaan.sonepat@gmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1481 |
storeManagerMap.put("sambhav350@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1482 |
storeManagerMap.put("talwarmukesh298@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1483 |
storeManagerMap.put("bhimsain919@gmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1484 |
storeManagerMap.put("rohitbatra106@gmail.com", Arrays.asList("Ajay", "Dharmendar", "Mohinder"));
|
- |
|
| 1485 |
storeManagerMap.put("thefonehousekarnal@gmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1486 |
storeManagerMap.put("mobileplanet7599@gmail.com", Arrays.asList("", "Dharmendar", "Mohinder"));
|
- |
|
| 1487 |
storeManagerMap.put("raghubir.ngh@gmail.com", Arrays.asList("Ajay", "Rajit", "Mohinder"));
|
- |
|
| 1488 |
storeManagerMap.put("saketnagpal@gmail.com", Arrays.asList("Ajay", "Rajit", "Mohinder"));
|
- |
|
| 1489 |
storeManagerMap.put("dharmendery079@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1490 |
storeManagerMap.put("sumittyagi1975@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1491 |
storeManagerMap.put("deepak.lalwani1985@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1492 |
storeManagerMap.put("Priyankaenterprises9910@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1493 |
storeManagerMap.put("richa9910763006@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1494 |
storeManagerMap.put("lovelymobile183@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1495 |
storeManagerMap.put("ajaykumarkansal03@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
- |
|
| 1496 |
storeManagerMap.put("gupta.smartdukaan@gmail.com", Arrays.asList("", "", "Adeel"));
|
- |
|
| 1497 |
storeManagerMap.put("smartenterprisespv@gmail.com", Arrays.asList("", "", "Adeel"));
|
- |
|
| 1498 |
storeManagerMap.put("ysinghal34@gmail.com", Arrays.asList("", "", "Adeel"));
|
- |
|
| 1499 |
storeManagerMap.put("dishatelecommars@gmail.com", Arrays.asList("", "", "Adeel"));
|
- |
|
| 1500 |
storeManagerMap.put("gulshersaifi74226@gmail.com", Arrays.asList("", "", "Adeel"));
|
- |
|
| 1501 |
storeManagerMap.put("mmtelecomsec16@gmail.com", Arrays.asList("", "", "Adeel"));
|
- |
|
| 1502 |
storeManagerMap.put("cachaitnya@gmail.com", Arrays.asList("", "", "Adeel"));
|
- |
|
| 1503 |
storeManagerMap.put("KHURANAMOBILE753@GMAIL.COM", Arrays.asList("Sohan", "Ankit", "Mohinder"));
|
- |
|
| 1504 |
|
- |
|
| 1505 |
}
|
- |
|
| 1506 |
|
- |
|
| 1507 |
public void grouping() throws Exception {
|
1433 |
public void grouping() throws Exception {
|
| - |
|
1434 |
/*
|
| 1508 |
/*for (FofoStore fofoStore : fofoStoreRepository.selectAll()) {
|
1435 |
* for (FofoStore fofoStore : fofoStoreRepository.selectAll()) {
|
| 1509 |
LOGGER.info("{}, {}", fofoStore.getId(),
|
1436 |
* LOGGER.info("{}, {}", fofoStore.getId(),
|
| 1510 |
partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now().plusDays(1)));
|
1437 |
* partnerTypeChangeService.getTypeOnDate(fofoStore.getId(),
|
| - |
|
1438 |
* LocalDate.now().plusDays(1))); UserWallet userWallet =
|
| 1511 |
UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoStore.getId());
|
1439 |
* userWalletRepository.selectByRetailerId(fofoStore.getId());
|
| 1512 |
if(userWallet==null) continue;
|
1440 |
* if(userWallet==null) continue;
|
| 1513 |
System.out.printf("Store Code %s, Wallet amount %d, Sum amount %f%n", fofoStore.getCode(), userWallet.getAmount(), walletService.getWalletAmount(fofoStore.getId()));
|
1441 |
* System.out.printf("Store Code %s, Wallet amount %d, Sum amount %f%n",
|
| - |
|
1442 |
* fofoStore.getCode(), userWallet.getAmount(),
|
| - |
|
1443 |
* walletService.getWalletAmount(fofoStore.getId())); }
|
| 1514 |
}*/
|
1444 |
*/
|
| 1515 |
for (Map.Entry<String, Set<String>> storeGuyEntry : csService.getAuthUserPartnerEmailMapping().entrySet()) {
|
1445 |
for (Map.Entry<String, Set<String>> storeGuyEntry : csService.getAuthUserPartnerEmailMapping().entrySet()) {
|
| 1516 |
System.out.println(storeGuyEntry.getKey() + " = " + storeGuyEntry.getValue());
|
1446 |
System.out.println(storeGuyEntry.getKey() + " = " + storeGuyEntry.getValue());
|
| 1517 |
}
|
1447 |
}
|
| 1518 |
}
|
1448 |
}
|
| 1519 |
}
|
1449 |
}
|