| Line 60... |
Line 60... |
| 60 |
import com.spice.profitmandi.common.util.Utils;
|
60 |
import com.spice.profitmandi.common.util.Utils;
|
| 61 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
61 |
import com.spice.profitmandi.common.util.Utils.Attachment;
|
| 62 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
62 |
import com.spice.profitmandi.dao.Interface.Campaign;
|
| 63 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeJsonConverter;
|
63 |
import com.spice.profitmandi.dao.convertor.LocalDateTimeJsonConverter;
|
| 64 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
64 |
import com.spice.profitmandi.dao.entity.auth.AuthUser;
|
| - |
|
65 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 65 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
66 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 66 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
67 |
import com.spice.profitmandi.dao.entity.cs.Position;
|
| 67 |
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
|
68 |
import com.spice.profitmandi.dao.entity.dtr.DailyRecharge;
|
| 68 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
69 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaign;
|
| 69 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaigns;
|
70 |
import com.spice.profitmandi.dao.entity.dtr.NotificationCampaigns;
|
| Line 81... |
Line 82... |
| 81 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
82 |
import com.spice.profitmandi.dao.entity.fofo.PartnerTargetDetails;
|
| 82 |
import com.spice.profitmandi.dao.entity.fofo.Purchase;
|
83 |
import com.spice.profitmandi.dao.entity.fofo.Purchase;
|
| 83 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
84 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
| 84 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
85 |
import com.spice.profitmandi.dao.entity.fofo.SchemeInOut;
|
| 85 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
86 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
| - |
|
87 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
| 86 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
88 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| 87 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
89 |
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
|
| 88 |
import com.spice.profitmandi.dao.entity.user.Address;
|
90 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 89 |
import com.spice.profitmandi.dao.entity.user.Device;
|
91 |
import com.spice.profitmandi.dao.entity.user.Device;
|
| 90 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
92 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 91 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
93 |
import com.spice.profitmandi.dao.enumuration.cs.EscalationType;
|
| 92 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
94 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| - |
|
95 |
import com.spice.profitmandi.dao.enumuration.transaction.PriceDropImeiStatus;
|
| 93 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
96 |
import com.spice.profitmandi.dao.model.SimpleCampaign;
|
| 94 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
97 |
import com.spice.profitmandi.dao.model.SimpleCampaignParams;
|
| 95 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
98 |
import com.spice.profitmandi.dao.repository.auth.AuthRepository;
|
| 96 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
99 |
import com.spice.profitmandi.dao.repository.catalog.DeviceRepository;
|
| 97 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
100 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| Line 118... |
Line 121... |
| 118 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
121 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 119 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
122 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| 120 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
123 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
| 121 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
124 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
| 122 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
125 |
import com.spice.profitmandi.dao.repository.transaction.OrderRepository;
|
| - |
|
126 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropIMEIRepository;
|
| 123 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
127 |
import com.spice.profitmandi.dao.repository.transaction.PriceDropRepository;
|
| 124 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
|
128 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletHistoryRepository;
|
| 125 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
129 |
import com.spice.profitmandi.dao.repository.transaction.UserWalletRepository;
|
| 126 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
130 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 127 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
131 |
import com.spice.profitmandi.service.PartnerInvestmentService;
|
| Line 192... |
Line 196... |
| 192 |
|
196 |
|
| 193 |
@Autowired
|
197 |
@Autowired
|
| 194 |
private PurchaseRepository purchaseRepository;
|
198 |
private PurchaseRepository purchaseRepository;
|
| 195 |
|
199 |
|
| 196 |
@Autowired
|
200 |
@Autowired
|
| - |
|
201 |
private PriceDropIMEIRepository priceDropIMEIRepository;
|
| - |
|
202 |
|
| - |
|
203 |
@Autowired
|
| - |
|
204 |
PriceDropRepository priceDropRepository;
|
| - |
|
205 |
|
| - |
|
206 |
@Autowired
|
| 197 |
private SchemeService schemeService;
|
207 |
private SchemeService schemeService;
|
| 198 |
|
208 |
|
| - |
|
209 |
private static final String[] STOCK_AGEING_MAIL_LIST = new String[] { "amod.sen@smartdukaan.com",
|
| - |
|
210 |
"adeel.yazdani@smartdukaan.com", "manoj.singh@smartdukaan.com", "kamini.sharma@smartdukaan.com",
|
| - |
|
211 |
"mohinder.mutreja@smartdukaan.com", " ankit.bhatia@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| - |
|
212 |
"chaitnaya.vats@smartdukaan.com", "kuldeep.kumar@smartdukaan.com" };
|
| - |
|
213 |
|
| - |
|
214 |
private static final String[] ITEMWISE_PENDING_INDENT_MAIL_LIST = new String[] { "kamini.sharma@smartdukaan.com",
|
| - |
|
215 |
"tarun.verma@smartdukaan.com", "chaitnaya.vats@smartdukaan.com", "kuldeep.kumar@smartdukaan.com" };
|
| - |
|
216 |
|
| 199 |
@Autowired
|
217 |
@Autowired
|
| 200 |
private ReporticoService reporticoService;
|
218 |
private ReporticoService reporticoService;
|
| 201 |
|
219 |
|
| 202 |
@Autowired
|
220 |
@Autowired
|
| 203 |
private PartnerInvestmentService partnerInvestmentService;
|
221 |
private PartnerInvestmentService partnerInvestmentService;
|
| Line 285... |
Line 303... |
| 285 |
|
303 |
|
| 286 |
@Autowired
|
304 |
@Autowired
|
| 287 |
private JavaMailSender mailSender;
|
305 |
private JavaMailSender mailSender;
|
| 288 |
|
306 |
|
| 289 |
@Autowired
|
307 |
@Autowired
|
| 290 |
private PriceDropRepository priceDropRepository;
|
- |
|
| 291 |
|
- |
|
| 292 |
@Autowired
|
- |
|
| 293 |
private PartnerTargetRepository partnerTargetRepository;
|
308 |
private PartnerTargetRepository partnerTargetRepository;
|
| 294 |
|
309 |
|
| 295 |
@Autowired
|
310 |
@Autowired
|
| 296 |
@Qualifier(value = "googleMailSender")
|
311 |
@Qualifier(value = "googleMailSender")
|
| 297 |
private JavaMailSender googleMailSender;
|
312 |
private JavaMailSender googleMailSender;
|
| Line 674... |
Line 689... |
| 674 |
|
689 |
|
| 675 |
for (Map.Entry<String, Set<String>> storeGuyEntry : csService.getAuthUserPartnerEmailMapping().entrySet()) {
|
690 |
for (Map.Entry<String, Set<String>> storeGuyEntry : csService.getAuthUserPartnerEmailMapping().entrySet()) {
|
| 676 |
List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
|
691 |
List<List<? extends Serializable>> filteredRows = storeGuyEntry.getValue().stream()
|
| 677 |
.map(x -> partnerRow.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
692 |
.map(x -> partnerRow.get(x)).filter(x -> x != null).collect(Collectors.toList());
|
| 678 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
|
693 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, filteredRows);
|
| 679 |
String[] sendToArray = new String[] {storeGuyEntry.getKey()};
|
694 |
String[] sendToArray = new String[] { storeGuyEntry.getKey() };
|
| 680 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA",
|
695 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Franchise Investment Summary", "PFA",
|
| 681 |
fileName, new ByteArrayResource(baos.toByteArray()));
|
696 |
fileName, new ByteArrayResource(baos.toByteArray()));
|
| 682 |
}
|
697 |
}
|
| 683 |
|
698 |
|
| 684 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
699 |
ByteArrayOutputStream baos = FileUtil.getCSVByteStream(headers, rows);
|
| 685 |
String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
|
700 |
String[] sendToArray = sendTo.toArray(new String[sendTo.size()]);
|
| 686 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Partner Investment Summary", "PFA", fileName,
|
701 |
Utils.sendMailWithAttachment(googleMailSender, sendToArray, null, "Franchise Investment Summary", "PFA",
|
| 687 |
new ByteArrayResource(baos.toByteArray()));
|
702 |
fileName, new ByteArrayResource(baos.toByteArray()));
|
| 688 |
|
703 |
|
| 689 |
}
|
704 |
}
|
| 690 |
|
705 |
|
| 691 |
private Map<String, SaleRoles> getPartnerEmailSalesMap() {
|
706 |
private Map<String, SaleRoles> getPartnerEmailSalesMap() {
|
| 692 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
707 |
Map<String, SaleRoles> partnerEmailSalesMap = new HashMap<>();
|
| Line 696... |
Line 711... |
| 696 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream()
|
711 |
Map<Integer, AuthUser> authUsersMap = authRepository.selectAllActiveUser().stream()
|
| 697 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
712 |
.collect(Collectors.toMap(x -> x.getId(), x -> x));
|
| 698 |
Map<Integer, List<CustomRetailer>> positionIdRetailerMap = csService.getPositionCustomRetailerMap(positions);
|
713 |
Map<Integer, List<CustomRetailer>> positionIdRetailerMap = csService.getPositionCustomRetailerMap(positions);
|
| 699 |
for (Position position : positions) {
|
714 |
for (Position position : positions) {
|
| 700 |
List<CustomRetailer> crList = positionIdRetailerMap.get(position.getId());
|
715 |
List<CustomRetailer> crList = positionIdRetailerMap.get(position.getId());
|
| 701 |
if(crList==null) continue;
|
716 |
if (crList == null)
|
| - |
|
717 |
continue;
|
| 702 |
for (CustomRetailer cr : crList) {
|
718 |
for (CustomRetailer cr : crList) {
|
| 703 |
if (!partnerEmailSalesMap.containsKey(cr.getEmail())) {
|
719 |
if (!partnerEmailSalesMap.containsKey(cr.getEmail())) {
|
| 704 |
partnerEmailSalesMap.put(cr.getEmail(), new SaleRoles());
|
720 |
partnerEmailSalesMap.put(cr.getEmail(), new SaleRoles());
|
| 705 |
}
|
721 |
}
|
| 706 |
SaleRoles saleRoles = partnerEmailSalesMap.get(cr.getEmail());
|
722 |
SaleRoles saleRoles = partnerEmailSalesMap.get(cr.getEmail());
|
| Line 739... |
Line 755... |
| 739 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService
|
755 |
Map<Integer, CustomRetailer> customRetailerMap = retailerService
|
| 740 |
.getFofoRetailers(new ArrayList<>(fofoStoresMap.keySet()));
|
756 |
.getFofoRetailers(new ArrayList<>(fofoStoresMap.keySet()));
|
| 741 |
|
757 |
|
| 742 |
Map<String, CustomRetailer> customRetailerEmailMap = customRetailerMap.values().stream()
|
758 |
Map<String, CustomRetailer> customRetailerEmailMap = customRetailerMap.values().stream()
|
| 743 |
.collect(Collectors.toMap(x -> x.getEmail(), x -> x));
|
759 |
.collect(Collectors.toMap(x -> x.getEmail(), x -> x));
|
| 744 |
|
760 |
|
| 745 |
Map<String, SaleRoles> partnerEmailSalesMap = this.getPartnerEmailSalesMap();
|
761 |
Map<String, SaleRoles> partnerEmailSalesMap = this.getPartnerEmailSalesMap();
|
| 746 |
|
762 |
|
| 747 |
List<String> headers = Arrays.asList("Code", "Firm Name", "Store Name", "Current Category", "State Manager",
|
763 |
List<String> headers = Arrays.asList("Code", "Firm Name", "Store Name", "Current Category", "State Manager",
|
| 748 |
"Teritory Manager", "Team Leader", "Targeted Category", "Targeted Value", "Target Achieved",
|
764 |
"Teritory Manager", "Team Leader", "Targeted Category", "Targeted Value", "Target Achieved",
|
| 749 |
"Achived Percentage", "Remaining Target", "Today's Target", "Today's achievement");
|
765 |
"Achived Percentage", "Remaining Target", "Today's Target", "Today's achievement");
|
| Line 756... |
Line 772... |
| 756 |
FofoStore fofoStore = fofoStoresMap.get(retailer.getPartnerId());
|
772 |
FofoStore fofoStore = fofoStoresMap.get(retailer.getPartnerId());
|
| 757 |
Serializable code = fofoStore.getCode();
|
773 |
Serializable code = fofoStore.getCode();
|
| 758 |
Serializable storeName = "SmartDukaan-" + fofoStore.getCode().replaceAll("[a-zA-Z]", "");
|
774 |
Serializable storeName = "SmartDukaan-" + fofoStore.getCode().replaceAll("[a-zA-Z]", "");
|
| 759 |
Serializable businessName = retailer.getBusinessName();
|
775 |
Serializable businessName = retailer.getBusinessName();
|
| 760 |
try {
|
776 |
try {
|
| 761 |
Serializable stateManager = StringUtils.join(partnerEmailSalesMap.get(retailer.getEmail()).getL2(), ", ");
|
777 |
Serializable stateManager = StringUtils.join(partnerEmailSalesMap.get(retailer.getEmail()).getL2(),
|
| - |
|
778 |
", ");
|
| 762 |
Serializable territoryManager = StringUtils.join(partnerEmailSalesMap.get(retailer.getEmail()).getL1(), ", ");
|
779 |
Serializable territoryManager = StringUtils.join(partnerEmailSalesMap.get(retailer.getEmail()).getL1(),
|
| - |
|
780 |
", ");
|
| 763 |
List<Serializable> row = new ArrayList<>(
|
781 |
List<Serializable> row = new ArrayList<>(
|
| 764 |
Arrays.asList(code, businessName, storeName, stateManager, territoryManager));
|
782 |
Arrays.asList(code, businessName, storeName, stateManager, territoryManager));
|
| 765 |
if (partnerSalesTargetRowsMap.get(retailer.getEmail()) != null) {
|
783 |
if (partnerSalesTargetRowsMap.get(retailer.getEmail()) != null) {
|
| 766 |
row.addAll(partnerSalesTargetRowsMap.get(retailer.getEmail()));
|
784 |
row.addAll(partnerSalesTargetRowsMap.get(retailer.getEmail()));
|
| 767 |
partnerRowMap.put(retailer.getEmail(), row);
|
785 |
partnerRowMap.put(retailer.getEmail(), row);
|
| Line 797... |
Line 815... |
| 797 |
"ItemwiseOverallPendingIndent.xml");
|
815 |
"ItemwiseOverallPendingIndent.xml");
|
| 798 |
Attachment attachment = new Attachment(
|
816 |
Attachment attachment = new Attachment(
|
| 799 |
"ageing-report-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr);
|
817 |
"ageing-report-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr);
|
| 800 |
Attachment attachment1 = new Attachment(
|
818 |
Attachment attachment1 = new Attachment(
|
| 801 |
"pending-indent-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr1);
|
819 |
"pending-indent-" + FormattingUtils.formatDate(LocalDateTime.now().minusDays(1)) + ".csv", isr1);
|
| - |
|
820 |
|
| 802 |
Utils.sendMailWithAttachments(googleMailSender, sendTo, null, "Stock Aeging Report", "PFA", attachment,
|
821 |
Utils.sendMailWithAttachments(googleMailSender, STOCK_AGEING_MAIL_LIST, null, "Stock Ageing Report", "PFA",
|
| 803 |
attachment1);
|
822 |
attachment);
|
| - |
|
823 |
Utils.sendMailWithAttachments(googleMailSender, ITEMWISE_PENDING_INDENT_MAIL_LIST, null,
|
| - |
|
824 |
"Itemwise Pending indent", "PFA", attachment1);
|
| 804 |
|
825 |
|
| 805 |
// Reports to be sent to mapped partners
|
826 |
// Reports to be sent to mapped partners
|
| 806 |
Map<String, Set<String>> storeGuysMap = csService.getAuthUserPartnerEmailMapping();
|
827 |
Map<String, Set<String>> storeGuysMap = csService.getAuthUserPartnerEmailMapping();
|
| 807 |
|
828 |
|
| 808 |
Utils.sendMailWithAttachments(googleMailSender, storeGuysMap.keySet().toArray(new String[0]), null, "Stock Aeging Report", "PFA", attachment);
|
- |
|
| 809 |
|
- |
|
| 810 |
for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuysMap.entrySet()) {
|
829 |
for (Map.Entry<String, Set<String>> storeGuyEntry : storeGuysMap.entrySet()) {
|
| 811 |
Map<String, String> params = new HashMap<>();
|
830 |
Map<String, String> params = new HashMap<>();
|
| 812 |
if (storeGuyEntry.getValue().size() == 0)
|
831 |
if (storeGuyEntry.getValue().size() == 0)
|
| 813 |
continue;
|
832 |
continue;
|
| 814 |
params.put("MANUAL_email", String.join(",", storeGuyEntry.getValue()));
|
833 |
params.put("MANUAL_email", String.join(",", storeGuyEntry.getValue()));
|
| 815 |
InputStreamSource isr3 = reporticoService.getReportInputStreamSource(ReporticoProject.FOCO,
|
834 |
InputStreamSource isr3 = reporticoService.getReportInputStreamSource(ReporticoProject.FOCO,
|
| 816 |
"focostockreport.xml", params);
|
835 |
"focostockreport.xml", params);
|
| 817 |
Attachment attache = new Attachment(
|
836 |
Attachment attache = new Attachment(
|
| 818 |
"partner-stock-report" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv", isr3);
|
837 |
"Franchise-stock-report" + FormattingUtils.formatDate(LocalDateTime.now()) + ".csv", isr3);
|
| 819 |
System.out.println(storeGuyEntry.getValue());
|
838 |
System.out.println(storeGuyEntry.getValue());
|
| 820 |
Utils.sendMailWithAttachments(googleMailSender, storeGuyEntry.getValue().toArray(new String[0]), null,
|
839 |
Utils.sendMailWithAttachments(googleMailSender, new String[] { storeGuyEntry.getKey() }, null,
|
| 821 |
"Partner Stock Report", "PFA", attache);
|
840 |
"Franchise Stock Report", "PFA", attache);
|
| 822 |
}
|
841 |
}
|
| 823 |
|
842 |
|
| 824 |
}
|
843 |
}
|
| 825 |
|
844 |
|
| 826 |
public void sendAgeingReport() throws Exception {
|
845 |
public void sendAgeingReport() throws Exception {
|
| 827 |
sendAgeingReport("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
846 |
sendAgeingReport("kamini.sharma@smartdukaan.com", "tarun.verma@smartdukaan.com",
|
| 828 |
"chaitnaya.vats@smartdukaan.com", "amod.sen@smartdukaan.com");
|
847 |
"chaitnaya.vats@smartdukaan.com");
|
| 829 |
}
|
848 |
}
|
| 830 |
|
849 |
|
| 831 |
public void moveImeisToPriceDropImeis() throws Exception {
|
850 |
public void moveImeisToPriceDropImeis() throws Exception {
|
| 832 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
851 |
List<PriceDrop> priceDrops = priceDropRepository.selectAll();
|
| 833 |
for (PriceDrop priceDrop : priceDrops) {
|
852 |
for (PriceDrop priceDrop : priceDrops) {
|
| Line 1430... |
Line 1449... |
| 1430 |
}
|
1449 |
}
|
| 1431 |
}
|
1450 |
}
|
| 1432 |
}
|
1451 |
}
|
| 1433 |
|
1452 |
|
| 1434 |
public void grouping() throws Exception {
|
1453 |
public void grouping() throws Exception {
|
| - |
|
1454 |
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("MM-dd-yyyy hh:mm");
|
| - |
|
1455 |
List<PriceDropIMEI> priceDropImeis = priceDropIMEIRepository.selectByStatus(PriceDropImeiStatus.APPROVED);
|
| - |
|
1456 |
System.out.println(String.join("\t",
|
| - |
|
1457 |
Arrays.asList("IMEI", "ItemId", "Brand", "Model Name", "Model Number", "Franchise Id", "Franchise Name",
|
| - |
|
1458 |
"Grn On", "Price Dropped On", "Approved On", "Dropped Value", "Returned On", "Is Doa")));
|
| - |
|
1459 |
Map<Integer, CustomRetailer> retailersMap = retailerService.getFofoRetailers();
|
| - |
|
1460 |
for (PriceDropIMEI priceDropIMEI : priceDropImeis) {
|
| - |
|
1461 |
HashSet<String> imeis = new HashSet<>();
|
| - |
|
1462 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropIMEI.getPriceDropId());
|
| - |
|
1463 |
imeis.add(priceDropIMEI.getImei());
|
| - |
|
1464 |
List<InventoryItem> inventoryItems = inventoryItemRepository
|
| - |
|
1465 |
.selectByFofoIdSerialNumbers(priceDropIMEI.getPartnerId(), imeis, false);
|
| - |
|
1466 |
InventoryItem inventoryItem = inventoryItems.get(0);
|
| - |
|
1467 |
CustomRetailer customRetailer = retailersMap.get(inventoryItem.getFofoId());
|
| - |
|
1468 |
if (inventoryItem.getLastScanType().equals(ScanType.DOA_OUT)
|
| - |
|
1469 |
|| inventoryItem.getLastScanType().equals(ScanType.PURCHASE_RET)) {
|
| - |
|
1470 |
// check if pricedrop has been rolled out
|
| - |
|
1471 |
List<UserWalletHistory> uwh = walletService.getAllByReference(inventoryItem.getFofoId(),
|
| - |
|
1472 |
priceDropIMEI.getPriceDropId(), WalletReferenceType.PRICE_DROP);
|
| - |
|
1473 |
if (uwh.size() > 0) {
|
| - |
|
1474 |
Item item = itemRepository.selectById(inventoryItem.getId());
|
| - |
|
1475 |
System.out.println(String.join("\t",
|
| - |
|
1476 |
Arrays.asList(priceDropIMEI.getImei(), inventoryItem.getItemId() + "", item.getBrand(),
|
| - |
|
1477 |
item.getModelName(), item.getModelNumber(), inventoryItem.getFofoId() + "",
|
| - |
|
1478 |
customRetailer.getBusinessName(), inventoryItem.getCreateTimestamp().format(dtf),
|
| - |
|
1479 |
priceDrop.getAffectedOn().format(dtf),
|
| - |
|
1480 |
priceDropIMEI.getUpdateTimestamp().format(dtf),
|
| - |
|
1481 |
inventoryItem.getUpdateTimestamp().format(dtf),
|
| - |
|
1482 |
inventoryItem.getLastScanType().equals(ScanType.DOA_OUT) + "")));
|
| - |
|
1483 |
}
|
| - |
|
1484 |
}
|
| - |
|
1485 |
}
|
| 1435 |
/*
|
1486 |
/*
|
| 1436 |
* for (FofoStore fofoStore : fofoStoreRepository.selectAll()) {
|
1487 |
* for (FofoStore fofoStore : fofoStoreRepository.selectAll()) {
|
| 1437 |
* LOGGER.info("{}, {}", fofoStore.getId(),
|
1488 |
* LOGGER.info("{}, {}", fofoStore.getId(),
|
| 1438 |
* partnerTypeChangeService.getTypeOnDate(fofoStore.getId(),
|
1489 |
* partnerTypeChangeService.getTypeOnDate(fofoStore.getId(),
|
| 1439 |
* LocalDate.now().plusDays(1))); UserWallet userWallet =
|
1490 |
* LocalDate.now().plusDays(1))); UserWallet userWallet =
|
| Line 1441... |
Line 1492... |
| 1441 |
* if(userWallet==null) continue;
|
1492 |
* if(userWallet==null) continue;
|
| 1442 |
* System.out.printf("Store Code %s, Wallet amount %d, Sum amount %f%n",
|
1493 |
* System.out.printf("Store Code %s, Wallet amount %d, Sum amount %f%n",
|
| 1443 |
* fofoStore.getCode(), userWallet.getAmount(),
|
1494 |
* fofoStore.getCode(), userWallet.getAmount(),
|
| 1444 |
* walletService.getWalletAmount(fofoStore.getId())); }
|
1495 |
* walletService.getWalletAmount(fofoStore.getId())); }
|
| 1445 |
*/
|
1496 |
*/
|
| - |
|
1497 |
|
| - |
|
1498 |
/*
|
| - |
|
1499 |
* for (Map.Entry<String, Set<String>> storeGuyEntry :
|
| 1446 |
for (Map.Entry<String, Set<String>> storeGuyEntry : csService.getAuthUserPartnerEmailMapping().entrySet()) {
|
1500 |
* csService.getAuthUserPartnerEmailMapping().entrySet()) {
|
| 1447 |
System.out.println(storeGuyEntry.getKey() + " = " + storeGuyEntry.getValue());
|
1501 |
* System.out.println(storeGuyEntry.getKey() + " = " +
|
| - |
|
1502 |
* storeGuyEntry.getValue()); }
|
| 1448 |
}
|
1503 |
*/
|
| 1449 |
}
|
1504 |
}
|
| 1450 |
}
|
1505 |
}
|