| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import java.time.LocalDateTime;
|
3 |
import java.time.LocalDateTime;
|
| 4 |
import java.util.ArrayList;
|
4 |
import java.util.ArrayList;
|
| 5 |
import java.util.Arrays;
|
5 |
import java.util.Arrays;
|
| 6 |
import java.util.HashMap;
|
6 |
import java.util.HashMap;
|
| 7 |
import java.util.LinkedHashMap;
|
- |
|
| 8 |
import java.util.List;
|
7 |
import java.util.List;
|
| 9 |
import java.util.Map;
|
8 |
import java.util.Map;
|
| 10 |
import java.util.stream.Collectors;
|
9 |
import java.util.stream.Collectors;
|
| 11 |
|
10 |
|
| 12 |
import javax.servlet.http.HttpServletRequest;
|
11 |
import javax.servlet.http.HttpServletRequest;
|
| 13 |
import javax.transaction.Transactional;
|
12 |
import javax.transaction.Transactional;
|
| 14 |
|
13 |
|
| - |
|
14 |
import org.apache.commons.io.output.ByteArrayOutputStream;
|
| - |
|
15 |
import org.apache.commons.lang.StringUtils;
|
| 15 |
import org.apache.http.HttpResponse;
|
16 |
import org.apache.http.HttpResponse;
|
| 16 |
import org.apache.logging.log4j.LogManager;
|
17 |
import org.apache.logging.log4j.LogManager;
|
| 17 |
import org.apache.logging.log4j.Logger;
|
18 |
import org.apache.logging.log4j.Logger;
|
| 18 |
import org.json.JSONArray;
|
19 |
import org.json.JSONArray;
|
| 19 |
import org.springframework.beans.factory.annotation.Autowired;
|
20 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 20 |
import org.springframework.beans.factory.annotation.Qualifier;
|
21 |
import org.springframework.beans.factory.annotation.Qualifier;
|
| - |
|
22 |
import org.springframework.core.io.ByteArrayResource;
|
| - |
|
23 |
import org.springframework.http.HttpHeaders;
|
| 21 |
import org.springframework.http.HttpStatus;
|
24 |
import org.springframework.http.HttpStatus;
|
| 22 |
import org.springframework.http.ResponseEntity;
|
25 |
import org.springframework.http.ResponseEntity;
|
| 23 |
import org.springframework.stereotype.Controller;
|
26 |
import org.springframework.stereotype.Controller;
|
| 24 |
import org.springframework.ui.Model;
|
27 |
import org.springframework.ui.Model;
|
| 25 |
import org.springframework.web.bind.annotation.PathVariable;
|
28 |
import org.springframework.web.bind.annotation.PathVariable;
|
| 26 |
import org.springframework.web.bind.annotation.RequestBody;
|
29 |
import org.springframework.web.bind.annotation.RequestBody;
|
| 27 |
import org.springframework.web.bind.annotation.RequestMapping;
|
30 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 28 |
import org.springframework.web.bind.annotation.RequestMethod;
|
31 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| - |
|
32 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 29 |
|
33 |
|
| 30 |
import com.fasterxml.jackson.core.type.TypeReference;
|
34 |
import com.fasterxml.jackson.databind.JavaType;
|
| 31 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
35 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 32 |
import com.fasterxml.jackson.databind.ObjectReader;
|
36 |
import com.fasterxml.jackson.databind.ObjectReader;
|
| 33 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
37 |
import com.spice.profitmandi.common.enumuration.ReporticoProject;
|
| 34 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
38 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 35 |
import com.spice.profitmandi.common.model.ClosingStockOnDate;
|
39 |
import com.spice.profitmandi.common.model.ClosingStockOnDate;
|
| 36 |
import com.spice.profitmandi.common.model.GrnPendingDataModel;
|
40 |
import com.spice.profitmandi.common.model.GrnPendingDataModel;
|
| - |
|
41 |
import com.spice.profitmandi.common.model.ImeiDropSummaryModel;
|
| 37 |
import com.spice.profitmandi.common.model.ItemDescriptionModel;
|
42 |
import com.spice.profitmandi.common.model.ItemDescriptionModel;
|
| 38 |
import com.spice.profitmandi.common.model.PartnerImeiNotSold;
|
43 |
import com.spice.profitmandi.common.model.PartnerImeiNotSold;
|
| 39 |
import com.spice.profitmandi.common.model.PriceDropModel;
|
44 |
import com.spice.profitmandi.common.model.PriceDropModel;
|
| 40 |
import com.spice.profitmandi.common.model.ReporticoResponseModel;
|
45 |
import com.spice.profitmandi.common.model.ReporticoResponseModel;
|
| 41 |
import com.spice.profitmandi.common.services.ReporticoService;
|
46 |
import com.spice.profitmandi.common.services.ReporticoService;
|
| - |
|
47 |
import com.spice.profitmandi.common.util.FileUtil;
|
| 42 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
48 |
import com.spice.profitmandi.common.util.FormattingUtils;
|
| 43 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
49 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 44 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
50 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 45 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
- |
|
| 46 |
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
|
51 |
import com.spice.profitmandi.dao.entity.inventory.VendorItemPricing;
|
| 47 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
52 |
import com.spice.profitmandi.dao.entity.transaction.LineItemImei;
|
| 48 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
53 |
import com.spice.profitmandi.dao.entity.transaction.PriceDrop;
|
| 49 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
54 |
import com.spice.profitmandi.dao.entity.transaction.PriceDropIMEI;
|
| 50 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
55 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| Line 57... |
Line 62... |
| 57 |
import com.spice.profitmandi.service.pricing.PriceDropService;
|
62 |
import com.spice.profitmandi.service.pricing.PriceDropService;
|
| 58 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
63 |
import com.spice.profitmandi.service.transaction.TransactionService;
|
| 59 |
import com.spice.profitmandi.service.wallet.WalletService;
|
64 |
import com.spice.profitmandi.service.wallet.WalletService;
|
| 60 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
65 |
import com.spice.profitmandi.web.util.MVCResponseSender;
|
| 61 |
|
66 |
|
| 62 |
import in.shop2020.model.v1.order.WalletReferenceType;
|
- |
|
| 63 |
|
- |
|
| 64 |
@Controller
|
67 |
@Controller
|
| 65 |
@Transactional
|
68 |
@Transactional
|
| 66 |
public class PriceDropController {
|
69 |
public class PriceDropController {
|
| 67 |
|
70 |
|
| 68 |
private static final Logger LOGGER = LogManager.getLogger(PriceDropController.class);
|
71 |
private static final Logger LOGGER = LogManager.getLogger(PriceDropController.class);
|
| 69 |
|
72 |
|
| 70 |
@Autowired
|
73 |
@Autowired
|
| 71 |
private PriceDropRepository priceDropRepository;
|
74 |
private PriceDropRepository priceDropRepository;
|
| 72 |
|
75 |
|
| - |
|
76 |
@Autowired
|
| 73 |
private ObjectMapper objectMapper = new ObjectMapper();
|
77 |
private ObjectMapper objectMapper;
|
| 74 |
|
78 |
|
| 75 |
@Autowired
|
79 |
@Autowired
|
| 76 |
private PriceDropIMEIRepository priceDropIMEIRepository;
|
80 |
private PriceDropIMEIRepository priceDropIMEIRepository;
|
| 77 |
|
81 |
|
| 78 |
@Autowired
|
82 |
@Autowired
|
| Line 166... |
Line 170... |
| 166 |
* "No IMEI is Eligible For PriceDrop"); }
|
170 |
* "No IMEI is Eligible For PriceDrop"); }
|
| 167 |
*
|
171 |
*
|
| 168 |
* }
|
172 |
* }
|
| 169 |
*/
|
173 |
*/
|
| 170 |
|
174 |
|
| - |
|
175 |
@RequestMapping(value = "/price-drop/imes/download")
|
| - |
|
176 |
public ResponseEntity<ByteArrayResource> downloadPriceDropImeis(HttpServletRequest request,
|
| - |
|
177 |
@RequestParam LocalDateTime affectedDate, @RequestParam int itemId) throws Exception {
|
| - |
|
178 |
Item item = itemRepository.selectById(itemId);
|
| - |
|
179 |
ByteArrayOutputStream baos = getByteArrayOutputStream(affectedDate,
|
| - |
|
180 |
item.getCatalogItemId());
|
| - |
|
181 |
final HttpHeaders headers = new HttpHeaders();
|
| - |
|
182 |
headers.set("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
| - |
|
183 |
headers.set("Content-disposition", "inline; filename=imei-" + item.getItemDescriptionNoColor() + ".csv");
|
| - |
|
184 |
byte[] byteArray = baos.toByteArray();
|
| - |
|
185 |
headers.setContentLength(byteArray.length);
|
| - |
|
186 |
return new ResponseEntity<ByteArrayResource>(new ByteArrayResource(byteArray), headers, HttpStatus.OK);
|
| - |
|
187 |
}
|
| - |
|
188 |
|
| 171 |
@RequestMapping(value = "/paymentAgainstPriceDrop/{priceDropId}/{processedamount}", method = RequestMethod.POST)
|
189 |
@RequestMapping(value = "/paymentAgainstPriceDrop/{priceDropId}/{processedamount}", method = RequestMethod.POST)
|
| 172 |
public String paymentAgainstPriceDropIMEI(HttpServletRequest request, @PathVariable int priceDropId,
|
190 |
public String paymentAgainstPriceDropIMEI(HttpServletRequest request, @PathVariable int priceDropId,
|
| 173 |
@PathVariable int processedamount, Model model) throws Exception {
|
191 |
@PathVariable int processedamount, Model model) throws Exception {
|
| 174 |
|
192 |
|
| 175 |
int noOfIMEIForPartner = 1;
|
193 |
int noOfIMEIForPartner = 1;
|
| 176 |
Map<Integer, Integer> noOfPriceDropToPartners = new HashMap<>();
|
194 |
Map<Integer, Integer> noOfPriceDropToPartners = new HashMap<>();
|
| 177 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
|
195 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
|
| 178 |
Item item = itemRepository.selectById(priceDrop.getItemId());
|
196 |
List<Item> items = itemRepository.selectAllByCatalogItemId(priceDrop.getCatalogItemId());
|
| 179 |
List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository.selectByPriceDropId(priceDrop.getId());
|
197 |
List<PriceDropIMEI> priceDropIMEIs = priceDropIMEIRepository.selectByPriceDropId(priceDrop.getId());
|
| 180 |
List<String> imeis = priceDropIMEIs.stream().map(x -> x.getImei()).collect(Collectors.toList());
|
198 |
List<String> imeis = priceDropIMEIs.stream().map(x -> x.getImei()).collect(Collectors.toList());
|
| 181 |
List<LineItemImei> lineItemImeis = lineItemImeisRepository.selectByIMEI(imeis);
|
199 |
List<LineItemImei> lineItemImeis = lineItemImeisRepository.selectByIMEI(imeis);
|
| 182 |
Map<String, Integer> priceDropIMEIfofoIds = priceDropService.getIMEIAndfofoIdForPriceDrop(lineItemImeis,
|
200 |
Map<String, Integer> priceDropIMEIfofoIds = priceDropService.getIMEIAndfofoIdForPriceDrop(lineItemImeis,
|
| 183 |
priceDrop);
|
201 |
priceDrop);
|
| Line 189... |
Line 207... |
| 189 |
} else {
|
207 |
} else {
|
| 190 |
noOfPriceDropToPartners.put(fofoId, noOfIMEIForPartner);
|
208 |
noOfPriceDropToPartners.put(fofoId, noOfIMEIForPartner);
|
| 191 |
}
|
209 |
}
|
| 192 |
|
210 |
|
| 193 |
}
|
211 |
}
|
| 194 |
for (Map.Entry<Integer, Integer> noOfPriceDropToPartner : noOfPriceDropToPartners.entrySet()) {
|
- |
|
| 195 |
String description = String.format("Price Drop amount added for %s, total %d pcs.",
|
- |
|
| 196 |
item.getItemDescription(), noOfPriceDropToPartner.getValue());
|
- |
|
| 197 |
walletService.addAmountToWallet(noOfPriceDropToPartner.getKey(), priceDrop.getId(),
|
- |
|
| 198 |
WalletReferenceType.PRICE_DROP, description,
|
- |
|
| 199 |
(noOfPriceDropToPartner.getValue() * processedamount));
|
- |
|
| 200 |
LOGGER.info(
|
- |
|
| 201 |
"Price Drop amount [{}] has been added with retailerId [{}]'s wallet, referenceId [{}], No Of serialNumber [{}]",
|
- |
|
| 202 |
(noOfPriceDropToPartner.getValue() * processedamount), noOfPriceDropToPartner.getKey(),
|
- |
|
| 203 |
priceDrop.getId(), noOfPriceDropToPartner.getValue());
|
- |
|
| 204 |
}
|
- |
|
| 205 |
priceDrop.setProcessTimestamp(LocalDateTime.now());
|
212 |
priceDrop.setProcessTimestamp(LocalDateTime.now());
|
| 206 |
priceDrop.setPartnerPayout(processedamount);
|
213 |
priceDrop.setPartnerPayout(processedamount);
|
| 207 |
priceDropRepository.persist(priceDrop);
|
214 |
priceDropRepository.persist(priceDrop);
|
| 208 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
215 |
model.addAttribute("response", mvcResponseSender.createResponseString(true));
|
| 209 |
return "response";
|
216 |
return "response";
|
| Line 243... |
Line 250... |
| 243 |
vip.setMop(priceDropModel.getMop());
|
250 |
vip.setMop(priceDropModel.getMop());
|
| 244 |
vip.setNlc(priceDropModel.getNlc());
|
251 |
vip.setNlc(priceDropModel.getNlc());
|
| 245 |
vip.setTp(priceDropModel.getTp());
|
252 |
vip.setTp(priceDropModel.getTp());
|
| 246 |
vendorItemPricingRepository.persist(vip);
|
253 |
vendorItemPricingRepository.persist(vip);
|
| 247 |
}
|
254 |
}
|
| 248 |
PriceDrop priceDrop = new PriceDrop();
|
- |
|
| 249 |
priceDrop.setAffectedOn(priceDropModel.getAffectedDate());
|
- |
|
| 250 |
priceDrop.setAmount(priceDropModel.getPd());
|
- |
|
| 251 |
priceDrop.setCreatedOn(LocalDateTime.now());
|
- |
|
| 252 |
priceDrop.setItemId(item.getId());
|
- |
|
| 253 |
priceDropRepository.persist(priceDrop);
|
- |
|
| 254 |
transactionService.updatePriceDrop(item.getId(), newDp);
|
255 |
transactionService.updatePriceDrop(item.getId(), newDp);
|
| 255 |
}
|
256 |
}
|
| - |
|
257 |
PriceDrop priceDrop = new PriceDrop();
|
| - |
|
258 |
priceDrop.setAffectedOn(priceDropModel.getAffectedDate());
|
| - |
|
259 |
priceDrop.setAmount(priceDropModel.getPd());
|
| - |
|
260 |
priceDrop.setCreatedOn(LocalDateTime.now());
|
| - |
|
261 |
priceDrop.setCatalogItemId(currentItem.getCatalogItemId());
|
| - |
|
262 |
priceDropRepository.persist(priceDrop);
|
| 256 |
response = true;
|
263 |
response = true;
|
| 257 |
} else {
|
264 |
} else {
|
| 258 |
throw new ProfitMandiBusinessException("Price Drop", priceDropModel.getPd(),
|
265 |
throw new ProfitMandiBusinessException("Price Drop", priceDropModel.getPd(),
|
| 259 |
"Price Drop Cannot be more than Current DP");
|
266 |
"Price Drop Cannot be more than Current DP");
|
| 260 |
}
|
267 |
}
|
| Line 266... |
Line 273... |
| 266 |
@RequestMapping(value = "/downloadtotalPriceDropIMEI/{priceDropId}", method = RequestMethod.GET)
|
273 |
@RequestMapping(value = "/downloadtotalPriceDropIMEI/{priceDropId}", method = RequestMethod.GET)
|
| 267 |
public ResponseEntity<?> downloadTotalPriceDropIMEI(HttpServletRequest request, @PathVariable int priceDropId,
|
274 |
public ResponseEntity<?> downloadTotalPriceDropIMEI(HttpServletRequest request, @PathVariable int priceDropId,
|
| 268 |
Model model) throws ProfitMandiBusinessException, Exception {
|
275 |
Model model) throws ProfitMandiBusinessException, Exception {
|
| 269 |
|
276 |
|
| 270 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
|
277 |
PriceDrop priceDrop = priceDropRepository.selectById(priceDropId);
|
| - |
|
278 |
|
| - |
|
279 |
return new ResponseEntity<Boolean>(true, null, HttpStatus.OK);
|
| - |
|
280 |
}
|
| - |
|
281 |
|
| - |
|
282 |
private ByteArrayOutputStream getByteArrayOutputStream(LocalDateTime affectedOn, Integer catalogItemId)
|
| - |
|
283 |
throws Exception {
|
| 271 |
Map<String, String> params = new HashMap<>();
|
284 |
Map<String, String> params = new HashMap<>();
|
| 272 |
params.put("MANUAL_criteria1_FROMDATE", FormattingUtils.formatReporitcoDate(priceDrop.getAffectedOn()));
|
285 |
params.put("MANUAL_criteria1_FROMDATE", FormattingUtils.formatReporitcoDate(affectedOn));
|
| - |
|
286 |
List<Item> items = itemRepository.selectAllByCatalogItemId(catalogItemId);
|
| - |
|
287 |
List<String> itemIds = items.stream().map(x -> String.valueOf(x.getId())).collect(Collectors.toList());
|
| 273 |
params.put("MANUAL_itemId", String.valueOf(priceDrop.getItemId()));
|
288 |
params.put("MANUAL_itemId", StringUtils.join(itemIds, ","));
|
| 274 |
Map<String, String> params1 = new HashMap<>();
|
289 |
Map<String, String> params1 = new HashMap<>();
|
| 275 |
params1.put("MANUAL_criteriaDate_FROMDATE", FormattingUtils.formatReporitcoDate(priceDrop.getAffectedOn()));
|
290 |
params1.put("MANUAL_criteriaDate_FROMDATE", FormattingUtils.formatReporitcoDate(affectedOn));
|
| 276 |
params1.put("MANUAL_criteriaItemId", String.valueOf(priceDrop.getItemId()));
|
291 |
params1.put("MANUAL_criteriaItemId", StringUtils.join(itemIds, ","));
|
| 277 |
|
292 |
|
| 278 |
Map<String, String> params2 = new HashMap<>();
|
293 |
Map<String, String> params2 = new HashMap<>();
|
| 279 |
params2.put("MANUAL_Criteria2_FROMDATE", FormattingUtils.formatReporitcoDate(priceDrop.getAffectedOn()));
|
294 |
params2.put("MANUAL_Criteria2_FROMDATE", FormattingUtils.formatReporitcoDate(affectedOn));
|
| 280 |
params2.put("MANUAL_Criteria1", String.valueOf(priceDrop.getItemId()));
|
295 |
params2.put("MANUAL_Criteria1", StringUtils.join(itemIds, ","));
|
| 281 |
List<GrnPendingDataModel> grnPendingList = getReports(GrnPendingDataModel.class, ReporticoProject.FOCO, "imeispendinggrn.xml", params);
|
296 |
List<? extends ImeiDropSummaryModel> grnPendingList = getReports(GrnPendingDataModel.class,
|
| - |
|
297 |
ReporticoProject.FOCO, "imeispendinggrn.xml", params);
|
| 282 |
List<PartnerImeiNotSold> partnerImeiNotSoldList = getReports(PartnerImeiNotSold.class, ReporticoProject.FOCO, "PartnerIMEINotSold.xml", params1);
|
298 |
List<? extends ImeiDropSummaryModel> partnerImeiNotSoldList = getReports(PartnerImeiNotSold.class,
|
| - |
|
299 |
ReporticoProject.FOCO, "PartnerIMEINotSold.xml", params1);
|
| 283 |
List<ClosingStockOnDate> itemStockOnDateList = getReports(ClosingStockOnDate.class, ReporticoProject.WAREHOUSENEW, "itemstockondate.xml", params2);
|
300 |
List<? extends ImeiDropSummaryModel> itemStockOnDateList = getReports(ClosingStockOnDate.class,
|
| 284 |
return new ResponseEntity<Boolean>(true, null, HttpStatus.OK);
|
301 |
ReporticoProject.WAREHOUSENEW, "itemstockondate.xml", params2);
|
| 285 |
//List<Strng>
|
- |
|
| 286 |
/*
|
- |
|
| 287 |
* ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
302 |
List<ImeiDropSummaryModel> mergedImeis = new ArrayList<>();
|
| 288 |
* ExcelUtils.writePriceDropForAllIMEI(priceDropIMEIAndItemId,
|
303 |
mergedImeis.addAll(grnPendingList);
|
| 289 |
* byteArrayOutputStream); final HttpHeaders headers = new HttpHeaders();
|
304 |
mergedImeis.addAll(partnerImeiNotSoldList);
|
| 290 |
* headers.set("Content-Type",
|
305 |
mergedImeis.addAll(itemStockOnDateList);
|
| 291 |
* "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
306 |
List<List<Object>> rows = new ArrayList<>();
|
| 292 |
* headers.set("Content-disposition", "inline; filename=totalPriceDropIMEI" +
|
307 |
for (ImeiDropSummaryModel imeiDropSummaryModel : mergedImeis) {
|
| 293 |
* priceDrop.getItemId() + ".xlsx");
|
308 |
List<Object> row = new ArrayList<>();
|
| 294 |
* headers.setContentLength(byteArrayOutputStream.toByteArray().length); final
|
309 |
row.add(imeiDropSummaryModel.getSerialNumber());
|
| 295 |
* InputStream inputStream = new
|
310 |
row.add(imeiDropSummaryModel.getStoreName());
|
| 296 |
* ByteArrayInputStream(byteArrayOutputStream.toByteArray()); final
|
311 |
row.add(imeiDropSummaryModel.getPartnerCode());
|
| 297 |
* InputStreamResource inputStreamResource = new
|
312 |
row.add(imeiDropSummaryModel.getItemId());
|
| 298 |
* InputStreamResource(inputStream); return new
|
313 |
row.add(imeiDropSummaryModel.getBrand());
|
| 299 |
* ResponseEntity<InputStreamResource>(inputStreamResource, headers,
|
314 |
row.add(imeiDropSummaryModel.getModelName());
|
| 300 |
* HttpStatus.OK); } else { priceDrop.setProcessTimestamp(LocalDateTime.now());
|
315 |
row.add(imeiDropSummaryModel.getModelNumber());
|
| 301 |
* throw new ProfitMandiBusinessException("IMEI", 1,
|
316 |
row.add(imeiDropSummaryModel.getColor());
|
| - |
|
317 |
row.add(FormattingUtils.formatReporitcoDate(imeiDropSummaryModel.getLastScanned()));
|
| 302 |
* "IMEI not Found For PriceDrop"); }
|
318 |
rows.add(row);
|
| 303 |
*/
|
319 |
}
|
| - |
|
320 |
|
| - |
|
321 |
return FileUtil.getCSVByteStream(Arrays.asList("IMEI Number", "Store Name", "Store Code", "Item ID", "Brand",
|
| - |
|
322 |
"Model Name", "Model Number", "Color", "Last Scanned"), rows);
|
| 304 |
}
|
323 |
}
|
| 305 |
|
324 |
|
| 306 |
private <T> List<T> getReports(Class<T> className, ReporticoProject project, String reportName,
|
325 |
private <T> List<T> getReports(Class<T> className, ReporticoProject project, String reportName,
|
| 307 |
Map<String, String> params) throws Exception {
|
326 |
Map<String, String> params) throws Exception {
|
| 308 |
HttpResponse reportResponse = reporticoService.getJsonFile(project, reportName, params);
|
327 |
HttpResponse reportResponse = reporticoService.getJsonFile(project, reportName, params);
|
| 309 |
TypeReference<ReporticoResponseModel<T>> typeReference = new TypeReference<ReporticoResponseModel<T>>() {
|
328 |
JavaType type = objectMapper.getTypeFactory().constructParametricType(ReporticoResponseModel.class, className);
|
| 310 |
};
|
- |
|
| 311 |
ObjectReader or = objectMapper.readerFor(typeReference);
|
329 |
ObjectReader or = objectMapper.readerFor(type);
|
| 312 |
ReporticoResponseModel<T> responseObj = or.readValue(reportResponse.getEntity().getContent());
|
330 |
ReporticoResponseModel<T> responseObj = or.readValue(reportResponse.getEntity().getContent());
|
| 313 |
return responseObj.getData();
|
331 |
return responseObj.getData();
|
| 314 |
}
|
332 |
}
|
| 315 |
|
333 |
|
| 316 |
private boolean validatePriceDrop(PriceDropModel priceDropModel) throws ProfitMandiBusinessException {
|
334 |
private boolean validatePriceDrop(PriceDropModel priceDropModel) throws ProfitMandiBusinessException {
|
| Line 319... |
Line 337... |
| 319 |
return true;
|
337 |
return true;
|
| 320 |
}
|
338 |
}
|
| 321 |
return false;
|
339 |
return false;
|
| 322 |
}
|
340 |
}
|
| 323 |
|
341 |
|
| 324 |
private Map<String, String> getpriceDropIMEIAndItemDescription(PriceDrop priceDrop)
|
- |
|
| 325 |
throws ProfitMandiBusinessException {
|
- |
|
| 326 |
Map<String, String> priceDropIMEIAndItemId = new LinkedHashMap<>();
|
- |
|
| 327 |
List<InventoryItem> inventoryInStock = inventoryService.getInventoryInStock(priceDrop.getItemId(),
|
- |
|
| 328 |
priceDrop.getAffectedOn());
|
- |
|
| 329 |
return priceDropIMEIAndItemId;
|
- |
|
| 330 |
}
|
- |
|
| 331 |
|
- |
|
| 332 |
}
|
342 |
}
|