| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.common.util;
|
1 |
package com.spice.profitmandi.common.util;
|
| 2 |
|
2 |
|
| 3 |
import java.io.File;
|
- |
|
| 4 |
import java.io.IOException;
|
- |
|
| 5 |
import java.io.Serializable;
|
- |
|
| 6 |
import java.time.LocalTime;
|
- |
|
| 7 |
import java.util.ArrayList;
|
- |
|
| 8 |
import java.util.Collections;
|
- |
|
| 9 |
import java.util.HashMap;
|
- |
|
| 10 |
import java.util.HashSet;
|
- |
|
| 11 |
import java.util.List;
|
- |
|
| 12 |
import java.util.Map;
|
- |
|
| 13 |
import java.util.Set;
|
- |
|
| 14 |
import java.util.TreeSet;
|
- |
|
| 15 |
import java.util.regex.Matcher;
|
- |
|
| 16 |
import java.util.regex.Pattern;
|
- |
|
| 17 |
|
- |
|
| 18 |
import javax.mail.Multipart;
|
- |
|
| 19 |
import javax.mail.internet.InternetAddress;
|
- |
|
| 20 |
import javax.mail.internet.MimeBodyPart;
|
- |
|
| 21 |
import javax.mail.internet.MimeMessage;
|
- |
|
| 22 |
import javax.mail.internet.MimeMultipart;
|
- |
|
| 23 |
|
- |
|
| 24 |
import org.apache.commons.io.FileUtils;
|
- |
|
| 25 |
import org.apache.commons.lang3.StringEscapeUtils;
|
- |
|
| 26 |
import org.apache.logging.log4j.LogManager;
|
- |
|
| 27 |
import org.apache.logging.log4j.Logger;
|
- |
|
| 28 |
import org.apache.thrift.TException;
|
- |
|
| 29 |
import org.apache.thrift.transport.TTransportException;
|
- |
|
| 30 |
import org.springframework.core.io.InputStreamSource;
|
- |
|
| 31 |
import org.springframework.mail.javamail.JavaMailSender;
|
- |
|
| 32 |
import org.springframework.mail.javamail.MimeMessageHelper;
|
- |
|
| 33 |
|
- |
|
| 34 |
import com.google.gson.Gson;
|
3 |
import com.google.gson.Gson;
|
| 35 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
4 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 36 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
- |
|
| 37 |
import com.spice.profitmandi.common.web.client.RestClient;
|
5 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 38 |
import com.spice.profitmandi.thrift.clients.CatalogClient;
|
6 |
import com.spice.profitmandi.thrift.clients.CatalogClient;
|
| 39 |
import com.spice.profitmandi.thrift.clients.InventoryClient;
|
7 |
import com.spice.profitmandi.thrift.clients.InventoryClient;
|
| 40 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
8 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
| 41 |
import com.spice.profitmandi.thrift.clients.UserClient;
|
- |
|
| 42 |
import com.spice.profitmandi.thrift.clients.WarehouseClient;
|
9 |
import com.spice.profitmandi.thrift.clients.WarehouseClient;
|
| 43 |
|
- |
|
| 44 |
import in.shop2020.model.v1.catalog.CatalogService;
|
10 |
import in.shop2020.model.v1.catalog.CatalogService;
|
| 45 |
import in.shop2020.model.v1.inventory.InventoryService;
|
11 |
import in.shop2020.model.v1.inventory.InventoryService;
|
| 46 |
import in.shop2020.model.v1.inventory.StateInfo;
|
12 |
import in.shop2020.model.v1.inventory.StateInfo;
|
| 47 |
import in.shop2020.model.v1.inventory.Warehouse;
|
13 |
import in.shop2020.model.v1.inventory.Warehouse;
|
| 48 |
import in.shop2020.model.v1.order.OrderStatusGroups;
|
14 |
import in.shop2020.model.v1.order.OrderStatusGroups;
|
| 49 |
import in.shop2020.model.v1.order.RechargeOrderStatus;
|
15 |
import in.shop2020.model.v1.order.RechargeOrderStatus;
|
| 50 |
import in.shop2020.model.v1.order.RechargePlan;
|
16 |
import in.shop2020.model.v1.order.RechargePlan;
|
| 51 |
import in.shop2020.model.v1.order.SellerInfo;
|
- |
|
| 52 |
import in.shop2020.model.v1.order.WarehouseAddress;
|
17 |
import in.shop2020.model.v1.order.WarehouseAddress;
|
| 53 |
import in.shop2020.model.v1.user.Sex;
|
- |
|
| 54 |
import in.shop2020.model.v1.user.User;
|
- |
|
| 55 |
import in.shop2020.model.v1.user.UserContextException;
|
- |
|
| 56 |
import in.shop2020.warehouse.InventoryItem;
|
18 |
import in.shop2020.warehouse.InventoryItem;
|
| 57 |
import in.shop2020.warehouse.WarehouseService;
|
19 |
import in.shop2020.warehouse.WarehouseService;
|
| - |
|
20 |
import org.apache.commons.io.FileUtils;
|
| - |
|
21 |
import org.apache.commons.lang3.StringEscapeUtils;
|
| - |
|
22 |
import org.apache.logging.log4j.LogManager;
|
| - |
|
23 |
import org.apache.logging.log4j.Logger;
|
| - |
|
24 |
import org.springframework.core.io.InputStreamSource;
|
| - |
|
25 |
import org.springframework.mail.javamail.JavaMailSender;
|
| - |
|
26 |
import org.springframework.mail.javamail.MimeMessageHelper;
|
| - |
|
27 |
|
| - |
|
28 |
import javax.mail.Multipart;
|
| - |
|
29 |
import javax.mail.internet.InternetAddress;
|
| - |
|
30 |
import javax.mail.internet.MimeBodyPart;
|
| - |
|
31 |
import javax.mail.internet.MimeMessage;
|
| - |
|
32 |
import javax.mail.internet.MimeMultipart;
|
| - |
|
33 |
import java.io.File;
|
| - |
|
34 |
import java.io.IOException;
|
| - |
|
35 |
import java.io.Serializable;
|
| - |
|
36 |
import java.time.LocalTime;
|
| - |
|
37 |
import java.util.*;
|
| - |
|
38 |
import java.util.concurrent.ConcurrentHashMap;
|
| - |
|
39 |
import java.util.function.Function;
|
| - |
|
40 |
import java.util.function.Predicate;
|
| - |
|
41 |
import java.util.regex.Matcher;
|
| - |
|
42 |
import java.util.regex.Pattern;
|
| 58 |
|
43 |
|
| 59 |
public class Utils {
|
44 |
public class Utils {
|
| 60 |
|
45 |
|
| 61 |
private static final float FLOAT_EPSILON = 0.001f;
|
46 |
private static final float FLOAT_EPSILON = 0.001f;
|
| 62 |
|
47 |
|
| Line 477... |
Line 462... |
| 477 |
}
|
462 |
}
|
| 478 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
|
463 |
InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
|
| 479 |
helper.setFrom(senderAddress);
|
464 |
helper.setFrom(senderAddress);
|
| 480 |
mailSender.send(message);
|
465 |
mailSender.send(message);
|
| 481 |
}
|
466 |
}
|
| 482 |
|
467 |
|
| 483 |
public static int compareFloat(float f1, float f2) {
|
468 |
public static int compareFloat(float f1, float f2) {
|
| 484 |
if((f1 -f2 < FLOAT_EPSILON) || (f1 -f2 < -FLOAT_EPSILON)) {
|
469 |
if ((f1 - f2 < FLOAT_EPSILON) || (f1 - f2 < -FLOAT_EPSILON)) {
|
| 485 |
return 0;
|
470 |
return 0;
|
| 486 |
}
|
471 |
}
|
| 487 |
return Float.compare(f1, f2);
|
472 |
return Float.compare(f1, f2);
|
| 488 |
}
|
473 |
}
|
| 489 |
|
474 |
|
| - |
|
475 |
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
| - |
|
476 |
Set<Object> seen = ConcurrentHashMap.newKeySet();
|
| - |
|
477 |
return t -> seen.add(keyExtractor.apply(t));
|
| - |
|
478 |
}
|
| - |
|
479 |
|
| - |
|
480 |
|
| 490 |
}
|
481 |
}
|
| 491 |
|
482 |
|