| Line 68... |
Line 68... |
| 68 |
private static final Map<Integer, String> helpMap = new HashMap<>(6);
|
68 |
private static final Map<Integer, String> helpMap = new HashMap<>(6);
|
| 69 |
private static final Map<Integer, String> dthIdAliasMap = new HashMap<>(7);
|
69 |
private static final Map<Integer, String> dthIdAliasMap = new HashMap<>(7);
|
| 70 |
private static Map<Long, List<RechargePlan>> operatorPlanMap = new HashMap<>(20);
|
70 |
private static Map<Long, List<RechargePlan>> operatorPlanMap = new HashMap<>(20);
|
| 71 |
private static Map<Long, String> mobileProvidersMap;
|
71 |
private static Map<Long, String> mobileProvidersMap;
|
| 72 |
private static Map<Long, String> dthProvidersMap;
|
72 |
private static Map<Long, String> dthProvidersMap;
|
| 73 |
// private static final String SMS_GATEWAY =
|
- |
|
| 74 |
// "http://103.15.179.45:8085/SMSGateway/sendingSMS";
|
73 |
//private static final String SMS_GATEWAY = "http://103.15.179.45:8085/SMSGateway/sendingSMS";
|
| 75 |
private static final String SMS_GATEWAY = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS";
|
74 |
private static final String SMS_GATEWAY = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS";
|
| 76 |
private static Map<Long, String> allProviders;
|
75 |
private static Map<Long, String> allProviders;
|
| 77 |
public static Map<RechargeOrderStatus, String> rechargeStatusMap = new HashMap<>();
|
76 |
public static Map<RechargeOrderStatus, String> rechargeStatusMap = new HashMap<>();
|
| 78 |
public static OrderStatusGroups ORDER_STATUS_GROUPS = new OrderStatusGroups();
|
77 |
public static OrderStatusGroups ORDER_STATUS_GROUPS = new OrderStatusGroups();
|
| 79 |
|
78 |
|
| 80 |
static {
|
79 |
static {
|
| 81 |
helpMap.put(Integer.valueOf(1), "Your VC number starts with 0 and is 11 digits long.");
|
80 |
helpMap.put(Integer.valueOf(1), "Your VC number starts with 0 and is 11 digits long.");
|
| 82 |
helpMap.put(Integer.valueOf(2), "Smart card number starts with 2 and is 12 digits long.");
|
81 |
helpMap.put(Integer.valueOf(2), "Smart card number starts with 2 and is 12 digits long.");
|
| 83 |
helpMap.put(Integer.valueOf(3), "Smart card number starts with 4 and is 11 digits long.");
|
82 |
helpMap.put(Integer.valueOf(3), "Smart card number starts with 4 and is 11 digits long.");
|
| 84 |
helpMap.put(Integer.valueOf(4), "Subscriber ID starts with 1 and is 10 digits long.");
|
83 |
helpMap.put(Integer.valueOf(4), "Subscriber ID starts with 1 and is 10 digits long.");
|
| Line 306... |
Line 305... |
| 306 |
} catch (Exception e) {
|
305 |
} catch (Exception e) {
|
| 307 |
return "";
|
306 |
return "";
|
| 308 |
}
|
307 |
}
|
| 309 |
return iconUrl == null ? "" : iconUrl;
|
308 |
return iconUrl == null ? "" : iconUrl;
|
| 310 |
}
|
309 |
}
|
| 311 |
|
310 |
|
| 312 |
public static Map<Integer, GstRate> getStateTaxRate(List<Integer> itemIds, int stateId)
|
311 |
public static Map<Integer, GstRate> getStateTaxRate(List<Integer> itemIds, int stateId) throws ProfitMandiBusinessException{
|
| 313 |
throws ProfitMandiBusinessException {
|
- |
|
| 314 |
List<Long> longItemIds = new ArrayList<>();
|
312 |
List<Long> longItemIds = new ArrayList<>();
|
| 315 |
for (int itemId : itemIds) {
|
313 |
for(int itemId : itemIds){
|
| 316 |
longItemIds.add(Long.valueOf(itemId));
|
314 |
longItemIds.add(Long.valueOf(itemId));
|
| 317 |
}
|
315 |
}
|
| 318 |
try {
|
316 |
try{
|
| - |
|
317 |
CatalogService.Client catalogClient = getCatalogClient();
|
| - |
|
318 |
Map<Long, in.shop2020.model.v1.catalog.GstRate> totalTaxRateMap = catalogClient.getStateTaxRate(longItemIds, stateId);
|
| 319 |
Map<Integer, GstRate> itemIdGstRateMap = new HashMap<>();
|
319 |
Map<Integer, GstRate> itemIdGstRateMap = new HashMap<>();
|
| 320 |
for (int itemId : itemIds) {
|
320 |
for(Map.Entry<Long, in.shop2020.model.v1.catalog.GstRate> totalTaxRateEntry : totalTaxRateMap.entrySet()){
|
| 321 |
GstRate gstRate = new GstRate();
|
321 |
GstRate gstRate = new GstRate();
|
| 322 |
gstRate.setIgstRate(12f);
|
322 |
gstRate.setIgstRate(Double.valueOf(totalTaxRateEntry.getValue().getIgstRate()).floatValue());
|
| 323 |
gstRate.setCgstRate(0);
|
323 |
gstRate.setCgstRate(Double.valueOf(totalTaxRateEntry.getValue().getCgstRate()).floatValue());
|
| 324 |
gstRate.setSgstRate(0);
|
324 |
gstRate.setSgstRate(Double.valueOf(totalTaxRateEntry.getValue().getSgstRate()).floatValue());
|
| 325 |
itemIdGstRateMap.put(itemId, gstRate);
|
325 |
itemIdGstRateMap.put(totalTaxRateEntry.getKey().intValue(), gstRate);
|
| 326 |
}
|
326 |
}
|
| 327 |
return itemIdGstRateMap;
|
327 |
return itemIdGstRateMap;
|
| 328 |
} catch (Exception e) {
|
328 |
}catch(Exception e){
|
| 329 |
e.printStackTrace();
|
329 |
e.printStackTrace();
|
| 330 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.ITEM_ID + ", " + ProfitMandiConstants.STATE_ID,
|
330 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.ITEM_ID + ", " + ProfitMandiConstants.STATE_ID, itemIds +", " + stateId, "THRFT_1000");
|
| 331 |
itemIds + ", " + stateId, "THRFT_1000");
|
- |
|
| 332 |
}
|
- |
|
| 333 |
}
|
- |
|
| 334 |
|
- |
|
| 335 |
public static Map<Integer, Float> getIgstTaxRate(List<Integer> itemIds) throws ProfitMandiBusinessException {
|
- |
|
| 336 |
List<Long> longItemIds = new ArrayList<>();
|
- |
|
| 337 |
for (int itemId : itemIds) {
|
- |
|
| 338 |
longItemIds.add(Long.valueOf(itemId));
|
- |
|
| 339 |
}
|
- |
|
| 340 |
Map<Integer, Float> itemIdIgstRateMap = new HashMap<>();
|
- |
|
| 341 |
for (int itemId : itemIds) {
|
- |
|
| 342 |
// To be reverted
|
- |
|
| 343 |
itemIdIgstRateMap.put(itemId, 12f);
|
- |
|
| 344 |
}
|
331 |
}
|
| 345 |
return itemIdIgstRateMap;
|
- |
|
| 346 |
}
|
332 |
}
|
| 347 |
|
333 |
|
| 348 |
public static Map<Integer, Float> getStateRate(List<Integer> itemIds) throws ProfitMandiBusinessException {
|
334 |
public static Map<Integer, Float> getIgstTaxRate(List<Integer> itemIds) throws ProfitMandiBusinessException{
|
| 349 |
List<Long> longItemIds = new ArrayList<>();
|
335 |
List<Long> longItemIds = new ArrayList<>();
|
| 350 |
for (int itemId : itemIds) {
|
336 |
for(int itemId : itemIds){
|
| 351 |
longItemIds.add(Long.valueOf(itemId));
|
337 |
longItemIds.add(Long.valueOf(itemId));
|
| 352 |
}
|
338 |
}
|
| - |
|
339 |
try{
|
| - |
|
340 |
CatalogService.Client catalogClient = getCatalogClient();
|
| - |
|
341 |
Map<Long, Double> totalTaxRateMap = catalogClient.getIgstTaxRate(longItemIds);
|
| 353 |
Map<Integer, Float> itemIdIgstRateMap = new HashMap<>();
|
342 |
Map<Integer, Float> itemIdIgstRateMap = new HashMap<>();
|
| - |
|
343 |
for(Map.Entry<Long, Double> totalTaxRateEntry : totalTaxRateMap.entrySet()){
|
| - |
|
344 |
itemIdIgstRateMap.put(totalTaxRateEntry.getKey().intValue(), 12f);
|
| - |
|
345 |
}
|
| 354 |
for (int itemId : itemIds) {
|
346 |
return itemIdIgstRateMap;
|
| 355 |
// To be reverted
|
347 |
}catch(Exception e){
|
| 356 |
itemIdIgstRateMap.put(itemId, 12f);
|
348 |
e.printStackTrace();
|
| - |
|
349 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.ITEM_ID, itemIds, "THRFT_1001");
|
| 357 |
}
|
350 |
}
|
| 358 |
return itemIdIgstRateMap;
|
- |
|
| 359 |
}
|
351 |
}
|
| 360 |
|
352 |
|
| 361 |
private static CatalogService.Client getCatalogClient() throws Exception {
|
353 |
private static CatalogService.Client getCatalogClient() throws Exception{
|
| 362 |
try {
|
354 |
try{
|
| 363 |
CatalogClient client = new CatalogClient();
|
355 |
CatalogClient client = new CatalogClient();
|
| 364 |
CatalogService.Client catalogClient = client.getClient();
|
356 |
CatalogService.Client catalogClient = client.getClient();
|
| 365 |
return catalogClient;
|
357 |
return catalogClient;
|
| 366 |
} catch (Exception e) {
|
358 |
}catch (Exception e) {
|
| 367 |
throw e;
|
359 |
throw e;
|
| 368 |
}
|
360 |
}
|
| 369 |
}
|
361 |
}
|
| 370 |
|
362 |
|
| 371 |
private static WarehouseService.Client getWarehouseClient() throws Exception {
|
363 |
private static WarehouseService.Client getWarehouseClient() throws Exception {
|