| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron.migrations;
|
1 |
package com.smartdukaan.cron.migrations;
|
| 2 |
|
2 |
|
| 3 |
import java.io.File;
|
3 |
import java.io.File;
|
| 4 |
import java.io.FileInputStream;
|
4 |
import java.io.FileInputStream;
|
| 5 |
import java.io.IOException;
|
5 |
import java.io.IOException;
|
| 6 |
import java.io.InputStream;
|
- |
|
| 7 |
import java.time.LocalDate;
|
6 |
import java.time.LocalDate;
|
| 8 |
import java.time.LocalDateTime;
|
7 |
import java.time.LocalDateTime;
|
| 9 |
import java.time.LocalTime;
|
8 |
import java.time.LocalTime;
|
| 10 |
import java.time.Month;
|
9 |
import java.time.Month;
|
| 11 |
import java.time.temporal.ChronoUnit;
|
10 |
import java.time.temporal.ChronoUnit;
|
| Line 19... |
Line 18... |
| 19 |
import java.util.List;
|
18 |
import java.util.List;
|
| 20 |
import java.util.Map;
|
19 |
import java.util.Map;
|
| 21 |
import java.util.Set;
|
20 |
import java.util.Set;
|
| 22 |
import java.util.concurrent.TimeUnit;
|
21 |
import java.util.concurrent.TimeUnit;
|
| 23 |
import java.util.stream.Collectors;
|
22 |
import java.util.stream.Collectors;
|
| 24 |
import java.util.stream.IntStream;
|
- |
|
| 25 |
|
23 |
|
| 26 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
24 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| 27 |
import org.apache.commons.lang.StringUtils;
|
25 |
import org.apache.commons.lang.StringUtils;
|
| 28 |
import org.apache.logging.log4j.LogManager;
|
26 |
import org.apache.logging.log4j.LogManager;
|
| 29 |
import org.apache.logging.log4j.Logger;
|
27 |
import org.apache.logging.log4j.Logger;
|
| 30 |
import org.apache.poi.ss.usermodel.CellType;
|
- |
|
| 31 |
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
|
- |
|
| 32 |
import org.apache.poi.xssf.usermodel.XSSFRow;
|
- |
|
| 33 |
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
- |
|
| 34 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
- |
|
| 35 |
import org.json.JSONArray;
|
28 |
import org.json.JSONArray;
|
| 36 |
import org.json.JSONObject;
|
29 |
import org.json.JSONObject;
|
| 37 |
import org.openqa.selenium.Dimension;
|
30 |
import org.openqa.selenium.Dimension;
|
| 38 |
import org.openqa.selenium.OutputType;
|
31 |
import org.openqa.selenium.OutputType;
|
| 39 |
import org.openqa.selenium.TakesScreenshot;
|
32 |
import org.openqa.selenium.TakesScreenshot;
|
| Line 50... |
Line 43... |
| 50 |
import com.smartdukaan.cron.scheduled.SamsungIMEIActivationService;
|
43 |
import com.smartdukaan.cron.scheduled.SamsungIMEIActivationService;
|
| 51 |
import com.smartdukaan.cron.scheduled.ScheduledTasks;
|
44 |
import com.smartdukaan.cron.scheduled.ScheduledTasks;
|
| 52 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
45 |
import com.spice.profitmandi.common.enumuration.ItemType;
|
| 53 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
46 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 54 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
47 |
import com.spice.profitmandi.common.model.CustomRetailer;
|
| 55 |
import com.spice.profitmandi.common.model.PartnerTargetModel;
|
- |
|
| 56 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
48 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| - |
|
49 |
import com.spice.profitmandi.common.services.mandii.Gender;
|
| - |
|
50 |
import com.spice.profitmandi.common.services.mandii.MandiiService;
|
| - |
|
51 |
import com.spice.profitmandi.common.services.mandii.MandiiUser;
|
| 57 |
import com.spice.profitmandi.common.util.FileUtil;
|
52 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 58 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
53 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 59 |
import com.spice.profitmandi.common.util.Utils;
|
54 |
import com.spice.profitmandi.common.util.Utils;
|
| 60 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
55 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 61 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
56 |
import com.spice.profitmandi.dao.entity.catalog.Offer;
|
| 62 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
57 |
import com.spice.profitmandi.dao.entity.catalog.Scheme;
|
| 63 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
58 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 64 |
import com.spice.profitmandi.dao.entity.catalog.TargetSlab;
|
- |
|
| 65 |
import com.spice.profitmandi.dao.entity.dtr.PaymentOptionTransaction;
|
59 |
import com.spice.profitmandi.dao.entity.dtr.PaymentOptionTransaction;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
60 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.DebitNote;
|
61 |
import com.spice.profitmandi.dao.entity.fofo.DebitNote;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
62 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
| 69 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
63 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| Line 98... |
Line 92... |
| 98 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
92 |
import com.spice.profitmandi.dao.enumuration.catalog.AmountType;
|
| 99 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
93 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 100 |
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
|
94 |
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
|
| 101 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
95 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| 102 |
import com.spice.profitmandi.dao.model.ContentPojo;
|
96 |
import com.spice.profitmandi.dao.model.ContentPojo;
|
| 103 |
import com.spice.profitmandi.dao.model.CreateOfferRequest;
|
- |
|
| 104 |
import com.spice.profitmandi.dao.model.MediaPojo;
|
97 |
import com.spice.profitmandi.dao.model.MediaPojo;
|
| 105 |
import com.spice.profitmandi.dao.repository.GenericRepository;
|
98 |
import com.spice.profitmandi.dao.repository.GenericRepository;
|
| 106 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
99 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 107 |
import com.spice.profitmandi.dao.repository.catalog.ManualPaymentRequestRepository;
|
100 |
import com.spice.profitmandi.dao.repository.catalog.ManualPaymentRequestRepository;
|
| 108 |
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
|
101 |
import com.spice.profitmandi.dao.repository.catalog.OfferRepository;
|
| Line 120... |
Line 113... |
| 120 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
113 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| 121 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
114 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 122 |
import com.spice.profitmandi.dao.repository.fofo.InvoiceNumberGenerationSequenceRepository;
|
115 |
import com.spice.profitmandi.dao.repository.fofo.InvoiceNumberGenerationSequenceRepository;
|
| 123 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
116 |
import com.spice.profitmandi.dao.repository.fofo.PartnerDailyInvestmentRepository;
|
| 124 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
117 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTargetRepository;
|
| - |
|
118 |
import com.spice.profitmandi.dao.repository.fofo.PartnerTypeChangeService;
|
| 125 |
import com.spice.profitmandi.dao.repository.fofo.PrebookingOrderRepository;
|
119 |
import com.spice.profitmandi.dao.repository.fofo.PrebookingOrderRepository;
|
| 126 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
120 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseRepository;
|
| 127 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
121 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
| 128 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
122 |
import com.spice.profitmandi.dao.repository.fofo.ScanRecordRepository;
|
| 129 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
123 |
import com.spice.profitmandi.dao.repository.fofo.SchemeInOutRepository;
|
| Line 1219... |
Line 1213... |
| 1219 |
List<WarehouseInventoryItem> lavaInventoryItems = warehouseInventoryItemRepository.getSerialNumbers("Lava",
|
1213 |
List<WarehouseInventoryItem> lavaInventoryItems = warehouseInventoryItemRepository.getSerialNumbers("Lava",
|
| 1220 |
LocalDate.of(2020, Month.SEPTEMBER, 1).atStartOfDay(), LocalDateTime.now());
|
1214 |
LocalDate.of(2020, Month.SEPTEMBER, 1).atStartOfDay(), LocalDateTime.now());
|
| 1221 |
LOGGER.info("Lava Inventory Size is {}", lavaInventoryItems.size());
|
1215 |
LOGGER.info("Lava Inventory Size is {}", lavaInventoryItems.size());
|
| 1222 |
}
|
1216 |
}
|
| 1223 |
|
1217 |
|
| 1224 |
public void createOffers(String fileName) throws Exception {
|
- |
|
| 1225 |
Map<CreateOfferRequest, List<PartnerTargetModel>> offerPartnerTargetMap = this.parseFromExcel(fileName);
|
- |
|
| 1226 |
for(Map.Entry<CreateOfferRequest, List<PartnerTargetModel>> partnerTargetEntry: offerPartnerTargetMap.entrySet()) {
|
- |
|
| 1227 |
CreateOfferRequest createOfferRequest = partnerTargetEntry.getKey();
|
- |
|
| 1228 |
Map<List<Integer>, List<Integer>> targetPartnerMap = partnerTargetEntry.getValue().stream().collect(Collectors.groupingBy(PartnerTargetModel::getTargets, Collectors.mapping(PartnerTargetModel::getFofoId, Collectors.toList())));
|
- |
|
| 1229 |
for (Map.Entry<List<Integer>, List<Integer>> targetPartnersEntry : targetPartnerMap.entrySet()) {
|
- |
|
| 1230 |
List<Integer> fofoIds = createOfferRequest.getPartnerCriteria().getFofoIds();
|
- |
|
| 1231 |
List<Integer> filterFofoIds = targetPartnersEntry.getValue().stream().filter(x->!fofoIds.contains(x)).collect(Collectors.toList());
|
- |
|
| 1232 |
List<Integer> targets = targetPartnersEntry.getKey();
|
- |
|
| 1233 |
|
- |
|
| 1234 |
createOfferRequest.getPartnerCriteria().setFofoIds(filterFofoIds);
|
- |
|
| 1235 |
int counter = 0;
|
- |
|
| 1236 |
for (com.spice.profitmandi.dao.model.TargetSlab targetSlab : createOfferRequest.getTargetSlabs()) {
|
- |
|
| 1237 |
targetSlab.setOnwardsAmount(targets.get(counter));
|
- |
|
| 1238 |
counter++;
|
- |
|
| 1239 |
}
|
- |
|
| 1240 |
offerService.addOfferService(createOfferRequest);
|
- |
|
| 1241 |
LOGGER.info(createOfferRequest.getPartnerCriteria().getFofoIds());
|
- |
|
| 1242 |
LOGGER.info(createOfferRequest.getTargetSlabs());
|
- |
|
| 1243 |
}
|
- |
|
| 1244 |
}
|
- |
|
| 1245 |
}
|
- |
|
| 1246 |
|
- |
|
| 1247 |
private Map<CreateOfferRequest, List<PartnerTargetModel>> parseFromExcel(String fileName) throws ProfitMandiBusinessException {
|
- |
|
| 1248 |
|
- |
|
| 1249 |
Map<CreateOfferRequest, List<PartnerTargetModel>> offerPartnerTargetMap = new HashMap<>();
|
- |
|
| 1250 |
XSSFWorkbook myWorkBook = null;
|
- |
|
| 1251 |
try {
|
- |
|
| 1252 |
FileInputStream fileInputStream = new FileInputStream(fileName);
|
- |
|
| 1253 |
myWorkBook = new XSSFWorkbook(fileInputStream);
|
- |
|
| 1254 |
myWorkBook.setMissingCellPolicy(MissingCellPolicy.RETURN_BLANK_AS_NULL);
|
- |
|
| 1255 |
for(int i=0; i< myWorkBook.getNumberOfSheets();i++) {
|
- |
|
| 1256 |
|
- |
|
| 1257 |
XSSFSheet mySheet = myWorkBook.getSheetAt(i);
|
- |
|
| 1258 |
int offerId = Integer.parseInt(mySheet.getSheetName());
|
- |
|
| 1259 |
CreateOfferRequest existingOffer = offerService.getOffer(offerId);
|
- |
|
| 1260 |
List<PartnerTargetModel> partnerTargetModels = new ArrayList<>();
|
- |
|
| 1261 |
offerPartnerTargetMap.put(existingOffer, partnerTargetModels);
|
- |
|
| 1262 |
|
- |
|
| 1263 |
LOGGER.info("rowCellNum {}", mySheet.getLastRowNum());
|
- |
|
| 1264 |
for (int rowNumber = 1; rowNumber <= mySheet.getLastRowNum(); rowNumber++) {
|
- |
|
| 1265 |
XSSFRow row = mySheet.getRow(rowNumber);
|
- |
|
| 1266 |
LOGGER.info("row {}", row);
|
- |
|
| 1267 |
PartnerTargetModel partnerTargetModel = new PartnerTargetModel();
|
- |
|
| 1268 |
|
- |
|
| 1269 |
if (row.getCell(0) != null && row.getCell(0).getCellTypeEnum() == CellType.NUMERIC) {
|
- |
|
| 1270 |
partnerTargetModel.setFofoId((int) row.getCell(0).getNumericCellValue());
|
- |
|
| 1271 |
} else {
|
- |
|
| 1272 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(
|
- |
|
| 1273 |
"FOFO ID", row.getCell(0).toString(), "TGLSTNG_VE_1010");
|
- |
|
| 1274 |
LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
- |
|
| 1275 |
throw profitMandiBusinessException;
|
- |
|
| 1276 |
}
|
- |
|
| 1277 |
List<Integer> targets = new ArrayList<>();
|
- |
|
| 1278 |
for (int cellNumber = 1; cellNumber <= existingOffer.getTargetSlabs().size(); cellNumber++) {
|
- |
|
| 1279 |
if (row.getCell(cellNumber) != null
|
- |
|
| 1280 |
&& row.getCell(cellNumber).getCellTypeEnum() == CellType.NUMERIC) {
|
- |
|
| 1281 |
targets.add((int) row.getCell(cellNumber).getNumericCellValue());
|
- |
|
| 1282 |
} else {
|
- |
|
| 1283 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(
|
- |
|
| 1284 |
"Target Column issue at " + rowNumber + ", " + cellNumber, row.getCell(cellNumber),
|
- |
|
| 1285 |
"Invalid target");
|
- |
|
| 1286 |
LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
- |
|
| 1287 |
throw profitMandiBusinessException;
|
- |
|
| 1288 |
}
|
- |
|
| 1289 |
}
|
- |
|
| 1290 |
partnerTargetModel.setTargets(targets);
|
- |
|
| 1291 |
partnerTargetModels.add(partnerTargetModel);
|
- |
|
| 1292 |
}
|
- |
|
| 1293 |
}
|
- |
|
| 1294 |
myWorkBook.close();
|
- |
|
| 1295 |
} catch ( ProfitMandiBusinessException pbse) {
|
- |
|
| 1296 |
throw pbse;
|
- |
|
| 1297 |
} catch (IOException ioException) {
|
- |
|
| 1298 |
ioException.printStackTrace();
|
- |
|
| 1299 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.EXCEL_FILE, ioException.getMessage(),
|
- |
|
| 1300 |
"EXL_VE_1000");
|
- |
|
| 1301 |
} finally {
|
- |
|
| 1302 |
if (myWorkBook != null) {
|
- |
|
| 1303 |
try {
|
- |
|
| 1304 |
myWorkBook.close();
|
- |
|
| 1305 |
} catch (IOException e) {
|
- |
|
| 1306 |
// TODO Auto-generated catch block
|
- |
|
| 1307 |
e.printStackTrace();
|
- |
|
| 1308 |
}
|
- |
|
| 1309 |
}
|
- |
|
| 1310 |
}
|
- |
|
| 1311 |
LOGGER.info("offerPartnerTargetMap {}", offerPartnerTargetMap);
|
- |
|
| 1312 |
return offerPartnerTargetMap;
|
- |
|
| 1313 |
}
|
- |
|
| 1314 |
|
- |
|
| 1315 |
@Autowired
|
1218 |
@Autowired
|
| 1316 |
private WarehouseScanRepository warehouseScanRepository;
|
1219 |
private WarehouseScanRepository warehouseScanRepository;
|
| 1317 |
|
1220 |
|
| 1318 |
@Autowired
|
1221 |
@Autowired
|
| 1319 |
private WarehouseInventoryService warehouseInventoryService;
|
1222 |
private WarehouseInventoryService warehouseInventoryService;
|
| Line 1505... |
Line 1408... |
| 1505 |
@Autowired
|
1408 |
@Autowired
|
| 1506 |
PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
|
1409 |
PartnerDailyInvestmentRepository partnerDailyInvestmentRepository;
|
| 1507 |
|
1410 |
|
| 1508 |
public void addInvestment() {
|
1411 |
public void addInvestment() {
|
| 1509 |
List<LocalDate> dates = Arrays.asList(
|
1412 |
List<LocalDate> dates = Arrays.asList(
|
| 1510 |
LocalDate.of(2021, 11, 26)
|
1413 |
LocalDate.of(2021, 12, 19)
|
| 1511 |
);
|
1414 |
);
|
| 1512 |
// List<Integer> fofoIds = Arrays.asList(175136207, 175138910, 175138967,
|
1415 |
// List<Integer> fofoIds = Arrays.asList(175136207, 175138910, 175138967,
|
| 1513 |
// 175138990, 175138999);
|
1416 |
// 175138990, 175138999);
|
| 1514 |
for (LocalDate date : dates) {
|
1417 |
for (LocalDate date : dates) {
|
| 1515 |
LOGGER.info("Date - {}", date);
|
1418 |
LOGGER.info("Date - {}", date);
|
| Line 1584... |
Line 1487... |
| 1584 |
if(fofoOrder.getCancelledTimestamp()!=null) {
|
1487 |
if(fofoOrder.getCancelledTimestamp()!=null) {
|
| 1585 |
orderService.reverseScheme(fofoOrder);
|
1488 |
orderService.reverseScheme(fofoOrder);
|
| 1586 |
}
|
1489 |
}
|
| 1587 |
}
|
1490 |
}
|
| 1588 |
|
1491 |
|
| - |
|
1492 |
@Autowired
|
| - |
|
1493 |
PartnerTypeChangeService partnerTypeChangeService;
|
| - |
|
1494 |
public void runMe() {
|
| - |
|
1495 |
System.out.println("runme ==== " + fofoOrderItemRepository.selectSumMopGroupByRetailer(LocalDate.of(2021, 11, 1).atStartOfDay(), LocalDate.of(2021, 12, 1).atStartOfDay(), 175138408, false));
|
| - |
|
1496 |
System.out.println("change " +
|
| - |
|
1497 |
|
| - |
|
1498 |
private Map<CreateOfferRequest, List<PartnerTargetModel>> parseFromExcel(String fileName) throws ProfitMandiBusinessException {
|
| - |
|
1499 |
|
| - |
|
1500 |
Map<CreateOfferRequest, List<PartnerTargetModel>> offerPartnerTargetMap = new HashMap<>();
|
| - |
|
1501 |
XSSFWorkbook myWorkBook = null;
|
| - |
|
1502 |
try {
|
| - |
|
1503 |
FileInputStream fileInputStream = new FileInputStream(fileName);
|
| - |
|
1504 |
myWorkBook = new XSSFWorkbook(fileInputStream);
|
| - |
|
1505 |
myWorkBook.setMissingCellPolicy(MissingCellPolicy.RETURN_BLANK_AS_NULL);
|
| - |
|
1506 |
for(int i=0; i< myWorkBook.getNumberOfSheets();i++) {
|
| - |
|
1507 |
|
| - |
|
1508 |
XSSFSheet mySheet = myWorkBook.getSheetAt(i);
|
| - |
|
1509 |
int offerId = Integer.parseInt(mySheet.getSheetName());
|
| - |
|
1510 |
CreateOfferRequest existingOffer = offerService.getOffer(offerId);
|
| - |
|
1511 |
List<PartnerTargetModel> partnerTargetModels = new ArrayList<>();
|
| - |
|
1512 |
offerPartnerTargetMap.put(existingOffer, partnerTargetModels);
|
| - |
|
1513 |
|
| - |
|
1514 |
LOGGER.info("rowCellNum {}", mySheet.getLastRowNum());
|
| - |
|
1515 |
for (int rowNumber = 1; rowNumber <= mySheet.getLastRowNum(); rowNumber++) {
|
| - |
|
1516 |
XSSFRow row = mySheet.getRow(rowNumber);
|
| - |
|
1517 |
LOGGER.info("row {}", row);
|
| - |
|
1518 |
PartnerTargetModel partnerTargetModel = new PartnerTargetModel();
|
| - |
|
1519 |
|
| - |
|
1520 |
if (row.getCell(0) != null && row.getCell(0).getCellTypeEnum() == CellType.NUMERIC) {
|
| - |
|
1521 |
partnerTargetModel.setFofoId((int) row.getCell(0).getNumericCellValue());
|
| - |
|
1522 |
} else {
|
| - |
|
1523 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(
|
| - |
|
1524 |
"FOFO ID", row.getCell(0).toString(), "TGLSTNG_VE_1010");
|
| - |
|
1525 |
LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| - |
|
1526 |
throw profitMandiBusinessException;
|
| - |
|
1527 |
}
|
| - |
|
1528 |
List<Integer> targets = new ArrayList<>();
|
| - |
|
1529 |
for (int cellNumber = 1; cellNumber <= existingOffer.getTargetSlabs().size(); cellNumber++) {
|
| - |
|
1530 |
if (row.getCell(cellNumber) != null
|
| - |
|
1531 |
&& row.getCell(cellNumber).getCellTypeEnum() == CellType.NUMERIC) {
|
| - |
|
1532 |
targets.add((int) row.getCell(cellNumber).getNumericCellValue());
|
| - |
|
1533 |
} else {
|
| - |
|
1534 |
ProfitMandiBusinessException profitMandiBusinessException = new ProfitMandiBusinessException(
|
| - |
|
1535 |
"Target Column issue at " + rowNumber + ", " + cellNumber, row.getCell(cellNumber),
|
| - |
|
1536 |
"Invalid target");
|
| - |
|
1537 |
LOGGER.error("Excel file parse error : ", profitMandiBusinessException);
|
| - |
|
1538 |
throw profitMandiBusinessException;
|
| - |
|
1539 |
}
|
| - |
|
1540 |
}
|
| - |
|
1541 |
partnerTargetModel.setTargets(targets);
|
| - |
|
1542 |
partnerTargetModels.add(partnerTargetModel);
|
| - |
|
1543 |
}
|
| - |
|
1544 |
}
|
| - |
|
1545 |
myWorkBook.close();
|
| - |
|
1546 |
} catch ( ProfitMandiBusinessException pbse) {
|
| - |
|
1547 |
throw pbse;
|
| - |
|
1548 |
} catch (IOException ioException) {
|
| - |
|
1549 |
ioException.printStackTrace();
|
| - |
|
1550 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.EXCEL_FILE, ioException.getMessage(),
|
| - |
|
1551 |
"EXL_VE_1000");
|
| - |
|
1552 |
} finally {
|
| - |
|
1553 |
if (myWorkBook != null) {
|
| - |
|
1554 |
try {
|
| - |
|
1555 |
myWorkBook.close();
|
| - |
|
1556 |
} catch (IOException e) {
|
| - |
|
1557 |
// TODO Auto-generated catch block
|
| - |
|
1558 |
e.printStackTrace();
|
| - |
|
1559 |
}
|
| - |
|
1560 |
}
|
| - |
|
1561 |
}
|
| - |
|
1562 |
LOGGER.info("offerPartnerTargetMap {}", offerPartnerTargetMap);
|
| - |
|
1563 |
return offerPartnerTargetMap;
|
| - |
|
1564 |
}
|
| - |
|
1565 |
partnerTypeChangeService.getTypeOnDate(175138408, LocalDate.now()));
|
| - |
|
1566 |
}
|
| - |
|
1567 |
|
| - |
|
1568 |
public void createOffers(FileInputStream stream) throws Exception {
|
| - |
|
1569 |
offerService.createOffers(stream);
|
| - |
|
1570 |
}
|
| - |
|
1571 |
|
| - |
|
1572 |
@Autowired
|
| - |
|
1573 |
MandiiService mandiiService;
|
| - |
|
1574 |
|
| - |
|
1575 |
@Autowired
|
| - |
|
1576 |
com.spice.profitmandi.dao.repository.dtr.UserRepository dtrUserRepository;
|
| - |
|
1577 |
|
| - |
|
1578 |
public void mandiiUser(String firstName, String lastName, String pan, String dob, String aadhaar, String gender, String father) throws Exception {
|
| - |
|
1579 |
FofoStore fs = fofoStoreRepository.selectByPan(pan);
|
| - |
|
1580 |
CustomRetailer cr = retailerService.getFofoRetailer(fs.getId());
|
| - |
|
1581 |
com.spice.profitmandi.dao.entity.dtr.User dtrUser = dtrUserRepository.selectByEmailId(cr.getEmail());
|
| - |
|
1582 |
MandiiUser mandiiUser = mandiiService.getUser(dtrUser.getFirstName(),dtrUser.getLastName(),cr.getEmail(),pan,cr.getMobileNumber(),
|
| - |
|
1583 |
LocalDate.parse(dob), cr.getAddress().getLine1() + " " + cr.getAddress().getLine2(),cr.getAddress().getCity(), cr.getAddress().getState(), cr.getAddress().getPinCode());
|
| - |
|
1584 |
mandiiUser.setFatherName(father);
|
| - |
|
1585 |
if(StringUtils.isNotEmpty(firstName)) {
|
| - |
|
1586 |
mandiiUser.setFirstName(firstName);
|
| - |
|
1587 |
mandiiUser.setLastName(lastName);
|
| - |
|
1588 |
}
|
| - |
|
1589 |
if(StringUtils.isNotEmpty(father)) {
|
| - |
|
1590 |
mandiiUser.setFatherName(father);
|
| - |
|
1591 |
}
|
| - |
|
1592 |
if(StringUtils.isNotEmpty(aadhaar)) {
|
| - |
|
1593 |
mandiiUser.setAadharNumber(aadhaar);
|
| - |
|
1594 |
}
|
| - |
|
1595 |
mandiiUser.setGender(Gender.valueOf(gender));
|
| - |
|
1596 |
mandiiService.createAccount(cr.getBusinessName(), mandiiUser);
|
| - |
|
1597 |
}
|
| - |
|
1598 |
|
| 1589 |
}
|
1599 |
}
|
| 1590 |
|
1600 |
|
| 1591 |
//7015845171
|
1601 |
//7015845171
|
| 1592 |
|
1602 |
|