| 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.lang3.ArrayUtils;
|
- |
|
| 29 |
import org.apache.http.client.methods.CloseableHttpResponse;
|
28 |
import org.apache.http.client.methods.CloseableHttpResponse;
|
| 30 |
import org.apache.http.client.methods.HttpPost;
|
29 |
import org.apache.http.client.methods.HttpPost;
|
| 31 |
import org.apache.http.entity.StringEntity;
|
30 |
import org.apache.http.entity.StringEntity;
|
| 32 |
import org.apache.http.impl.client.CloseableHttpClient;
|
31 |
import org.apache.http.impl.client.CloseableHttpClient;
|
| 33 |
import org.apache.http.impl.client.HttpClients;
|
32 |
import org.apache.http.impl.client.HttpClients;
|
| Line 106... |
Line 105... |
| 106 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
105 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 107 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
106 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 108 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
107 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 109 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
108 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 110 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
109 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
| - |
|
110 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 111 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
111 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| 112 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
112 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
| 113 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
113 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
| 114 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
114 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| 115 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
115 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| Line 139... |
Line 139... |
| 139 |
|
139 |
|
| 140 |
@Value("${oxigen.recharge.enquiry.url}")
|
140 |
@Value("${oxigen.recharge.enquiry.url}")
|
| 141 |
private String oxigenRechargeEnquiryUrl;
|
141 |
private String oxigenRechargeEnquiryUrl;
|
| 142 |
|
142 |
|
| 143 |
@Autowired
|
143 |
@Autowired
|
| - |
|
144 |
private PartnerTypeChangeService partnerTypeChangeService;
|
| - |
|
145 |
|
| - |
|
146 |
@Autowired
|
| 144 |
private PriceDropService priceDropService;
|
147 |
private PriceDropService priceDropService;
|
| 145 |
|
148 |
|
| 146 |
@Value("${oxigen.recharge.auth.key}")
|
149 |
@Value("${oxigen.recharge.auth.key}")
|
| 147 |
private String oxigenRechargeAuthKey;
|
150 |
private String oxigenRechargeAuthKey;
|
| 148 |
|
151 |
|
| Line 696... |
Line 699... |
| 696 |
} catch (Exception e) {
|
699 |
} catch (Exception e) {
|
| 697 |
LOGGER.warn("Could not find partner with email - {}", retailer.getEmail());
|
700 |
LOGGER.warn("Could not find partner with email - {}", retailer.getEmail());
|
| 698 |
}
|
701 |
}
|
| 699 |
|
702 |
|
| 700 |
}
|
703 |
}
|
| 701 |
|
704 |
|
| 702 |
String fileName = "TargetVsSales-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
705 |
String fileName = "TargetVsSales-" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv";
|
| 703 |
for (Map.Entry<String, Set<String>> storeGuyEntry : getStoreGuyMap().entrySet()) {
|
706 |
for (Map.Entry<String, Set<String>> storeGuyEntry : getStoreGuyMap().entrySet()) {
|
| 704 |
List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
|
707 |
List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
|
| 705 |
.map(x -> partnerRowMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
708 |
.map(x -> partnerRowMap.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 706 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
|
709 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
|
| Line 742... |
Line 745... |
| 742 |
Attachment attachment1 = new Attachment(
|
745 |
Attachment attachment1 = new Attachment(
|
| 743 |
"pending-indent-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr1);
|
746 |
"pending-indent-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr1);
|
| 744 |
Utils.sendMailWithAttachments(googleMailSender, sendTo, null, "Stock Aeging Report", "PFA", attachment,
|
747 |
Utils.sendMailWithAttachments(googleMailSender, sendTo, null, "Stock Aeging Report", "PFA", attachment,
|
| 745 |
attachment1);
|
748 |
attachment1);
|
| 746 |
|
749 |
|
| 747 |
//Reports to be sent to mapped partners
|
750 |
// Reports to be sent to mapped partners
|
| 748 |
Map<String, Set<String>> storeGuysMap = getStoreGuyMap();
|
751 |
Map<String, Set<String>> storeGuysMap = getStoreGuyMap();
|
| 749 |
|
752 |
|
| 750 |
String[] sendToArray = new String[storeGuysMap.size()];
|
753 |
String[] sendToArray = new String[storeGuysMap.size()];
|
| 751 |
int i=0;
|
754 |
int i = 0;
|
| 752 |
for(String storeGuyName : storeGuysMap.keySet()) {
|
755 |
for (String storeGuyName : storeGuysMap.keySet()) {
|
| 753 |
sendToArray[i]= nameEmail.get(storeGuyName);
|
756 |
sendToArray[i] = nameEmail.get(storeGuyName);
|
| 754 |
i++;
|
757 |
i++;
|
| 755 |
}
|
758 |
}
|
| 756 |
Utils.sendMailWithAttachments(googleMailSender, sendToArray, null, "Stock Aeging Report", "PFA", attachment);
|
759 |
Utils.sendMailWithAttachments(googleMailSender, sendToArray, null, "Stock Aeging Report", "PFA", attachment);
|
| 757 |
|
- |
|
| 758 |
|
760 |
|
| 759 |
for(Map.Entry<String, Set<String>> storeGuyEntry: storeGuysMap.entrySet()) {
|
761 |
for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuysMap.entrySet()) {
|
| 760 |
Map<String, String> params = new HashMap<>();
|
762 |
Map<String, String> params = new HashMap<>();
|
| 761 |
if(storeGuyEntry.getValue().size() == 0) continue;
|
763 |
if (storeGuyEntry.getValue().size() == 0)
|
| - |
|
764 |
continue;
|
| 762 |
params.put("MANUAL_email", String.join(",", storeGuyEntry.getValue()));
|
765 |
params.put("MANUAL_email", String.join(",", storeGuyEntry.getValue()));
|
| 763 |
InputStreamSource isr3 = reporticoService.getReportInputStreamSource(ReporticoProject.FOCO,
|
766 |
InputStreamSource isr3 = reporticoService.getReportInputStreamSource(ReporticoProject.FOCO,
|
| 764 |
"focostockreport.xml", params);
|
767 |
"focostockreport.xml", params);
|
| 765 |
Attachment attache = new Attachment(
|
768 |
Attachment attache = new Attachment(
|
| 766 |
"partner-stock-report" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv", isr3);
|
769 |
"partner-stock-report" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv", isr3);
|
| 767 |
Utils.sendMailWithAttachments(googleMailSender, storeGuyEntry.getValue().toArray(new String[] {}), null, "Partner Stock Report", "PFA", attache);
|
770 |
Utils.sendMailWithAttachments(googleMailSender, storeGuyEntry.getValue().toArray(new String[] {}), null,
|
| - |
|
771 |
"Partner Stock Report", "PFA", attache);
|
| 768 |
}
|
772 |
}
|
| 769 |
|
773 |
|
| 770 |
}
|
774 |
}
|
| 771 |
|
775 |
|
| 772 |
public void sendAgeingReport() throws Exception {
|
776 |
public void sendAgeingReport() throws Exception {
|
| 773 |
sendAgeingReport("kamini.sharma@smartdukaan.com",
|
777 |
sendAgeingReport("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| 774 |
"tarun.verma@smartdukaan.com", "chaitnaya.vats@smartdukaan.com");
|
778 |
"chaitnaya.vats@smartdukaan.com");
|
| 775 |
}
|
779 |
}
|
| 776 |
|
780 |
|
| 777 |
public void moveImeisToPriceDropImeis() throws Exception {
|
781 |
public void moveImeisToPriceDropImeis() throws Exception {
|
| 778 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
782 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
| 779 |
for (PriceDrop priceDrop : priceDrops) {
|
783 |
for (PriceDrop priceDrop : priceDrops) {
|
| Line 1375... |
Line 1379... |
| 1375 |
}
|
1379 |
}
|
| 1376 |
}
|
1380 |
}
|
| 1377 |
}
|
1381 |
}
|
| 1378 |
}
|
1382 |
}
|
| 1379 |
|
1383 |
|
| 1380 |
|
- |
|
| 1381 |
public static final Map<String, List<String>> storeManagerMap = new HashMap<>();
|
1384 |
public static final Map<String, List<String>> storeManagerMap = new HashMap<>();
|
| 1382 |
|
1385 |
|
| 1383 |
public static final Map<String, String> nameEmail = new HashMap<>();
|
1386 |
public static final Map<String, String> nameEmail = new HashMap<>();
|
| 1384 |
static {
|
1387 |
static {
|
| 1385 |
nameEmail.put("Amod", "amod.sen@smartdukaan.com");
|
1388 |
nameEmail.put("Amod", "amod.sen@smartdukaan.com");
|
| Line 1398... |
Line 1401... |
| 1398 |
storeManagerMap.put("themobileplanet03@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
1401 |
storeManagerMap.put("themobileplanet03@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
| 1399 |
storeManagerMap.put("mobileplanet7599@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
1402 |
storeManagerMap.put("mobileplanet7599@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
| 1400 |
storeManagerMap.put("robintelecom.snp@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
1403 |
storeManagerMap.put("robintelecom.snp@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
| 1401 |
storeManagerMap.put("smartconnect4141@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
1404 |
storeManagerMap.put("smartconnect4141@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
| 1402 |
storeManagerMap.put("bhimsain919@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
1405 |
storeManagerMap.put("bhimsain919@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
| 1403 |
storeManagerMap.put("babitaranirk@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
1406 |
storeManagerMap.put("babitaranirk@gmail.com", Arrays.asList("Ankit", "", "Mohinder"));
|
| 1404 |
storeManagerMap.put("dharmendery079@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
1407 |
storeManagerMap.put("dharmendery079@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
| 1405 |
storeManagerMap.put("kkv.enterprises1@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
1408 |
storeManagerMap.put("kkv.enterprises1@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
| 1406 |
storeManagerMap.put("gulshersaifi74226@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
1409 |
storeManagerMap.put("gulshersaifi74226@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
| 1407 |
storeManagerMap.put("deepak.lalwani1985@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
1410 |
storeManagerMap.put("deepak.lalwani1985@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
| 1408 |
storeManagerMap.put("gupta.smartdukaan@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
1411 |
storeManagerMap.put("gupta.smartdukaan@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
| Line 1416... |
Line 1419... |
| 1416 |
storeManagerMap.put("smartdukaan.sonepat@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
1419 |
storeManagerMap.put("smartdukaan.sonepat@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
| 1417 |
storeManagerMap.put("arunmittal299@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
1420 |
storeManagerMap.put("arunmittal299@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
| 1418 |
storeManagerMap.put("gtc01100@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
1421 |
storeManagerMap.put("gtc01100@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
| 1419 |
storeManagerMap.put("sumittyagi1975@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
1422 |
storeManagerMap.put("sumittyagi1975@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
| 1420 |
storeManagerMap.put("metrofurniture342@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
1423 |
storeManagerMap.put("metrofurniture342@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
| 1421 |
storeManagerMap.put("suryaelectronicskaithal@gmail.com", Arrays.asList("PramodSharma", "", "Mohinder"));
|
1424 |
storeManagerMap.put("suryaelectronicskaithal@gmail.com", Arrays.asList("Ankit", "", "Mohinder"));
|
| 1422 |
storeManagerMap.put("mmtelecomsec16@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
1425 |
storeManagerMap.put("mmtelecomsec16@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
| 1423 |
storeManagerMap.put("omsonsindia08@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
1426 |
storeManagerMap.put("omsonsindia08@gmail.com", Arrays.asList("PramodSharma", "Dharmendar", "Mohinder"));
|
| 1424 |
storeManagerMap.put("smartenterprisespv@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
1427 |
storeManagerMap.put("smartenterprisespv@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
| 1425 |
storeManagerMap.put("cachaitnya@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
1428 |
storeManagerMap.put("cachaitnya@gmail.com", Arrays.asList("Amod", "", "Adeel"));
|
| 1426 |
storeManagerMap.put("ajaykumarkansal03@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
1429 |
storeManagerMap.put("ajaykumarkansal03@gmail.com", Arrays.asList("Manoj", "", "Adeel"));
|
| Line 1450... |
Line 1453... |
| 1450 |
storeManagerMap.put("sonisunil9050873061@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
1453 |
storeManagerMap.put("sonisunil9050873061@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
| 1451 |
storeManagerMap.put("moderncohsr@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
1454 |
storeManagerMap.put("moderncohsr@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
| 1452 |
storeManagerMap.put("raghubir.ngh@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
1455 |
storeManagerMap.put("raghubir.ngh@gmail.com", Arrays.asList("", "Ankit", "Mohinder"));
|
| 1453 |
storeManagerMap.put("aman007singla@gmail.com", Arrays.asList("", "Rajit", "Mohinder"));
|
1456 |
storeManagerMap.put("aman007singla@gmail.com", Arrays.asList("", "Rajit", "Mohinder"));
|
| 1454 |
}
|
1457 |
}
|
| - |
|
1458 |
|
| - |
|
1459 |
public void grouping() {
|
| - |
|
1460 |
for (FofoStore fofoStore : fofoStoreRepository.selectAll()) {
|
| - |
|
1461 |
System.out.println(partnerTypeChangeService.getTypeOnDate(fofoStore.getId(), LocalDate.now()));
|
| - |
|
1462 |
}
|
| - |
|
1463 |
}
|
| 1455 |
}
|
1464 |
}
|