Subversion Repositories SmartDukaan

Rev

Rev 23147 | Rev 23296 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23147 Rev 23152
Line 274... Line 274...
274
			return new HashMap<>();
274
			return new HashMap<>();
275
		}
275
		}
276
	}
276
	}
277
	
277
	
278
	public static Map<Integer, GstRate> getStateTaxRate(List<Integer> itemIds, int stateId) throws ProfitMandiBusinessException{
278
	public static Map<Integer, GstRate> getStateTaxRate(List<Integer> itemIds, int stateId) throws ProfitMandiBusinessException{
-
 
279
		List<Long> longItemIds = new ArrayList<>();
-
 
280
		for(int itemId : itemIds){
-
 
281
			longItemIds.add(Long.valueOf(itemId));
-
 
282
		}
279
		try{
283
		try{
280
			CatalogService.Client catalogClient = getCatalogClient();
284
			CatalogService.Client catalogClient = getCatalogClient();
281
			Map<Integer, in.shop2020.model.v1.catalog.GstRate> totalTaxRateMap = catalogClient.getStateTaxRate(itemIds, stateId);
285
			Map<Long, in.shop2020.model.v1.catalog.GstRate> totalTaxRateMap = catalogClient.getStateTaxRate(longItemIds, stateId);
282
			Map<Integer, GstRate> itemIdGstRateMap = new HashMap<>();
286
			Map<Integer, GstRate> itemIdGstRateMap = new HashMap<>();
283
			for(Map.Entry<Integer, in.shop2020.model.v1.catalog.GstRate> totalTaxRateEntry : totalTaxRateMap.entrySet()){
287
			for(Map.Entry<Long, in.shop2020.model.v1.catalog.GstRate> totalTaxRateEntry : totalTaxRateMap.entrySet()){
284
				GstRate gstRate = new GstRate();
288
				GstRate gstRate = new GstRate();
285
				gstRate.setIgstRate(Double.valueOf(totalTaxRateEntry.getValue().getIgstRate()).floatValue());
289
				gstRate.setIgstRate(Double.valueOf(totalTaxRateEntry.getValue().getIgstRate()).floatValue());
286
				gstRate.setCgstRate(Double.valueOf(totalTaxRateEntry.getValue().getCgstRate()).floatValue());
290
				gstRate.setCgstRate(Double.valueOf(totalTaxRateEntry.getValue().getCgstRate()).floatValue());
287
				gstRate.setSgstRate(Double.valueOf(totalTaxRateEntry.getValue().getSgstRate()).floatValue());
291
				gstRate.setSgstRate(Double.valueOf(totalTaxRateEntry.getValue().getSgstRate()).floatValue());
288
				itemIdGstRateMap.put(totalTaxRateEntry.getKey(), gstRate);
292
				itemIdGstRateMap.put(totalTaxRateEntry.getKey().intValue(), gstRate);
289
			}
293
			}
290
			return itemIdGstRateMap;
294
			return itemIdGstRateMap;
291
		}catch(Exception e){
295
		}catch(Exception e){
292
			e.printStackTrace();
296
			e.printStackTrace();
293
			throw new ProfitMandiBusinessException(ProfitMandiConstants.ITEM_ID + ", " + ProfitMandiConstants.STATE_ID, itemIds +", " + stateId, "");
297
			throw new ProfitMandiBusinessException(ProfitMandiConstants.ITEM_ID + ", " + ProfitMandiConstants.STATE_ID, itemIds +", " + stateId, "");
294
		}
298
		}
295
	}
299
	}
296
	
300
	
297
	public static Map<Integer, Float> getIgstTaxRate(List<Integer> itemIds) throws ProfitMandiBusinessException{
301
	public static Map<Integer, Float> getIgstTaxRate(List<Integer> itemIds) throws ProfitMandiBusinessException{
-
 
302
		List<Long> longItemIds = new ArrayList<>();
-
 
303
		for(int itemId : itemIds){
-
 
304
			longItemIds.add(Long.valueOf(itemId));
-
 
305
		}
298
		try{
306
		try{
299
			CatalogService.Client catalogClient = getCatalogClient();
307
			CatalogService.Client catalogClient = getCatalogClient();
300
			Map<Integer, Double> totalTaxRateMap = catalogClient.getIgstTaxRate(itemIds);
308
			Map<Long, Double> totalTaxRateMap = catalogClient.getIgstTaxRate(longItemIds);
301
			Map<Integer, Float> itemIdIgstRateMap = new HashMap<>();
309
			Map<Integer, Float> itemIdIgstRateMap = new HashMap<>();
302
			for(Map.Entry<Integer, Double> totalTaxRateEntry : totalTaxRateMap.entrySet()){
310
			for(Map.Entry<Long, Double> totalTaxRateEntry : totalTaxRateMap.entrySet()){
303
				itemIdIgstRateMap.put(totalTaxRateEntry.getKey(), Double.valueOf(totalTaxRateEntry.getValue()).floatValue());
311
				itemIdIgstRateMap.put(totalTaxRateEntry.getKey().intValue(), Double.valueOf(totalTaxRateEntry.getValue()).floatValue());
304
			}
312
			}
305
			return itemIdIgstRateMap;
313
			return itemIdIgstRateMap;
306
		}catch(Exception e){
314
		}catch(Exception e){
307
			e.printStackTrace();
315
			e.printStackTrace();
308
			throw new ProfitMandiBusinessException(ProfitMandiConstants.ITEM_ID, itemIds, "");
316
			throw new ProfitMandiBusinessException(ProfitMandiConstants.ITEM_ID, itemIds, "");