| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| 38 |
import com.google.gson.Gson;
|
38 |
import com.google.gson.Gson;
|
| 39 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
39 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 40 |
import com.spice.profitmandi.common.model.GstRate;
|
40 |
import com.spice.profitmandi.common.model.GstRate;
|
| 41 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
41 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| - |
|
42 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 42 |
import com.spice.profitmandi.thrift.clients.CatalogClient;
|
43 |
import com.spice.profitmandi.thrift.clients.CatalogClient;
|
| 43 |
import com.spice.profitmandi.thrift.clients.InventoryClient;
|
44 |
import com.spice.profitmandi.thrift.clients.InventoryClient;
|
| 44 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
45 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
| 45 |
import com.spice.profitmandi.thrift.clients.UserClient;
|
46 |
import com.spice.profitmandi.thrift.clients.UserClient;
|
| 46 |
import com.spice.profitmandi.thrift.clients.WarehouseClient;
|
47 |
import com.spice.profitmandi.thrift.clients.WarehouseClient;
|
| Line 79... |
Line 80... |
| 79 |
private static final String SMS_GATEWAY = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS";
|
80 |
private static final String SMS_GATEWAY = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS";
|
| 80 |
private static Map<Long, String> allProviders;
|
81 |
private static Map<Long, String> allProviders;
|
| 81 |
public static Map<RechargeOrderStatus, String> rechargeStatusMap = new HashMap<>();
|
82 |
public static Map<RechargeOrderStatus, String> rechargeStatusMap = new HashMap<>();
|
| 82 |
public static OrderStatusGroups ORDER_STATUS_GROUPS = new OrderStatusGroups();
|
83 |
public static OrderStatusGroups ORDER_STATUS_GROUPS = new OrderStatusGroups();
|
| 83 |
public static final String SYSTEM_PARTNER = "testpxps@gmail.com";
|
84 |
public static final String SYSTEM_PARTNER = "testpxps@gmail.com";
|
| - |
|
85 |
private static final RestClient rc = new RestClient();
|
| 84 |
|
86 |
|
| 85 |
static {
|
87 |
static {
|
| 86 |
helpMap.put(Integer.valueOf(1), "Your VC number starts with 0 and is 11 digits long.");
|
88 |
helpMap.put(Integer.valueOf(1), "Your VC number starts with 0 and is 11 digits long.");
|
| 87 |
helpMap.put(Integer.valueOf(2), "Smart card number starts with 2 and is 12 digits long.");
|
89 |
helpMap.put(Integer.valueOf(2), "Smart card number starts with 2 and is 12 digits long.");
|
| 88 |
helpMap.put(Integer.valueOf(3), "Smart card number starts with 4 and is 11 digits long.");
|
90 |
helpMap.put(Integer.valueOf(3), "Smart card number starts with 4 and is 11 digits long.");
|
| Line 198... |
Line 200... |
| 198 |
|
200 |
|
| 199 |
public static String getProvider(long operatorId) {
|
201 |
public static String getProvider(long operatorId) {
|
| 200 |
return allProviders.get(operatorId);
|
202 |
return allProviders.get(operatorId);
|
| 201 |
}
|
203 |
}
|
| 202 |
|
204 |
|
| 203 |
public static void sendSms(String text, String mobileNumber) throws URISyntaxException, IOException {
|
205 |
public static void sendSms(String text, String mobileNumber) throws Exception {
|
| 204 |
URIBuilder generalSearchUrl = new URIBuilder(SMS_GATEWAY);
|
206 |
Map<String, String> paramsMap = new HashMap<>();
|
| 205 |
generalSearchUrl.addParameter("Mobile", "91" + mobileNumber);
|
207 |
paramsMap.put("Mobile", "91" + mobileNumber);
|
| 206 |
generalSearchUrl.addParameter("Username", "smartdukaan");
|
208 |
paramsMap.put("Username", "smartdukaan");
|
| 207 |
generalSearchUrl.addParameter("Password", "spice@123");
|
209 |
paramsMap.put("Password", "spice@123");
|
| 208 |
generalSearchUrl.addParameter("SenderID", "SMTDKN");
|
210 |
paramsMap.put("SenderID", "SMTDKN");
|
| 209 |
generalSearchUrl.setParameter("Message", text);
|
211 |
paramsMap.put("Message", text);
|
| 210 |
generalSearchUrl.setParameter("MessageType", "txt");
|
212 |
paramsMap.put("MessageType", "txt");
|
| 211 |
URL url = generalSearchUrl.build().toURL();
|
- |
|
| 212 |
System.out.println(url);
|
- |
|
| 213 |
InputStream is = url.openStream();
|
- |
|
| 214 |
String response;
|
- |
|
| 215 |
try {
|
- |
|
| 216 |
response = IOUtils.toString(is, "UTF-8");
|
- |
|
| 217 |
System.out.println("response sms gateway " + response);
|
213 |
System.out.println(rc.getResponse(SMS_GATEWAY, paramsMap, null));
|
| 218 |
} finally {
|
- |
|
| 219 |
is.close();
|
- |
|
| 220 |
}
|
- |
|
| 221 |
}
|
214 |
}
|
| 222 |
|
215 |
|
| 223 |
public static void sendMailWithAttachments(JavaMailSender mailSender, String emailTo, String[] cc, String subject,
|
216 |
public static void sendMailWithAttachments(JavaMailSender mailSender, String emailTo, String[] cc, String subject,
|
| 224 |
String body, List<File> attachments) throws Exception {
|
217 |
String body, List<File> attachments) throws Exception {
|
| 225 |
MimeMessage message = mailSender.createMimeMessage();
|
218 |
MimeMessage message = mailSender.createMimeMessage();
|