|
|
@ -2,6 +2,8 @@ package in.gov.chennaicorporation.gccoffice.vendor.service; |
|
|
|
|
|
|
|
|
import java.net.HttpURLConnection; |
|
|
import java.net.HttpURLConnection; |
|
|
import java.net.URL; |
|
|
import java.net.URL; |
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
import java.sql.PreparedStatement; |
|
|
import java.sql.PreparedStatement; |
|
|
import java.sql.Statement; |
|
|
import java.sql.Statement; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
@ -236,20 +238,34 @@ public class createventService { |
|
|
private String sendWhatsappMsg(String mob_no, String status, String vendor_req_number) { |
|
|
private String sendWhatsappMsg(String mob_no, String status, String vendor_req_number) { |
|
|
String urlString = ""; |
|
|
String urlString = ""; |
|
|
|
|
|
|
|
|
if ("Approved".equals(status)) { |
|
|
|
|
|
urlString = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" |
|
|
|
|
|
+ mob_no |
|
|
|
|
|
+ "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=You+are+recognized+as+a+roadside+vendor.+Registration+number%3A+" |
|
|
|
|
|
+ vendor_req_number + ".&isTemplate=true&footer=GCC+-+IT+Cell"; |
|
|
|
|
|
} else { |
|
|
|
|
|
urlString = "https://media.smsgupshup.com/GatewayAPI/rest?userid=2000233507&password=h2YjFNcJ&send_to=" |
|
|
|
|
|
+ mob_no |
|
|
|
|
|
+ "&v=1.1&format=json&msg_type=TEXT&method=SENDMESSAGE&msg=Your+application+is+rejected+because+your+roadside+vendor+details+are+incorrect.+%0A%0ARegistration+Number%3A+" |
|
|
|
|
|
+ vendor_req_number + "."; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
String placeholders = |
|
|
|
|
|
URLEncoder.encode( |
|
|
|
|
|
vendor_req_number, |
|
|
|
|
|
StandardCharsets.UTF_8.toString()); |
|
|
|
|
|
|
|
|
|
|
|
String mobile = |
|
|
|
|
|
URLEncoder.encode( |
|
|
|
|
|
mob_no, |
|
|
|
|
|
StandardCharsets.UTF_8.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ("Approved".equals(status)) { |
|
|
|
|
|
urlString = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=5c995535-6244-11f0-98fc-02c8a5e042bd&from=919445061913&to="+mobile+"&templateid=3636390&type=template&placeholders="+placeholders; |
|
|
|
|
|
} else { |
|
|
|
|
|
urlString = "https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=5c995535-6244-11f0-98fc-02c8a5e042bd&from=919445061913&to="+mobile+"&templateid=3636392&type=template&placeholders="+placeholders; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String res = hitURL(urlString); |
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
return ""; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String res = hitURL(urlString); |
|
|
|
|
|
return res; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private String hitURL(String urlString) { |
|
|
private String hitURL(String urlString) { |
|
|
@ -514,11 +530,16 @@ public class createventService { |
|
|
*/ |
|
|
*/ |
|
|
if ("Approved".equalsIgnoreCase(status)) { |
|
|
if ("Approved".equalsIgnoreCase(status)) { |
|
|
|
|
|
|
|
|
|
|
|
Integer expiryYears = jdbcTemplate.queryForObject( |
|
|
|
|
|
"SELECT idcard_expire_year FROM info_details WHERE isactive = 1 AND isdelete=0 LIMIT 1", |
|
|
|
|
|
Integer.class |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
String uidNo = zone + "_" + ward + "_" + currentYear + "_" + generatedId; |
|
|
String uidNo = zone + "_" + ward + "_" + currentYear + "_" + generatedId; |
|
|
|
|
|
|
|
|
jdbcTemplate.update( |
|
|
jdbcTemplate.update( |
|
|
"UPDATE vendor_request_list SET uid_no=? WHERE id=?", |
|
|
|
|
|
uidNo, generatedId); |
|
|
|
|
|
|
|
|
"UPDATE vendor_request_list SET uid_no=?,expire_date = DATE_ADD(CURDATE(), INTERVAL ? YEAR) WHERE id=?", |
|
|
|
|
|
uidNo,expiryYears, generatedId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
@ -817,12 +838,7 @@ public class createventService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean giveCertificate(Integer vdid, |
|
|
|
|
|
String zone, |
|
|
|
|
|
String ward, |
|
|
|
|
|
String street_id, |
|
|
|
|
|
String street_name, |
|
|
|
|
|
String cby) { |
|
|
|
|
|
|
|
|
public boolean giveCertificate(Integer vdid,String zone,String ward, String street_id,String street_name,String cby,String mob_no,String vendor_req_id) { |
|
|
|
|
|
|
|
|
Integer expiryYears = jdbcTemplate.queryForObject( |
|
|
Integer expiryYears = jdbcTemplate.queryForObject( |
|
|
"SELECT certificate_expire_year FROM info_details WHERE isactive = 1 AND isdelete=0 LIMIT 1", |
|
|
"SELECT certificate_expire_year FROM info_details WHERE isactive = 1 AND isdelete=0 LIMIT 1", |
|
|
@ -837,18 +853,25 @@ public class createventService { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
|
|
|
|
|
|
int rows = jdbcTemplate.update( |
|
|
|
|
|
sql, |
|
|
|
|
|
vdid, |
|
|
|
|
|
zone, |
|
|
|
|
|
ward, |
|
|
|
|
|
street_id, |
|
|
|
|
|
street_name, |
|
|
|
|
|
cby, |
|
|
|
|
|
expiryYears |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
int rows = jdbcTemplate.update(sql,vdid,zone,ward,street_id,street_name,cby,expiryYears); |
|
|
|
|
|
|
|
|
|
|
|
if(rows > 0) { |
|
|
|
|
|
String result=sendWhstsappMsgForCertificate(mob_no,vendor_req_id); |
|
|
|
|
|
if(result.equals("200")) { |
|
|
|
|
|
System.out.println(" Whatsapp Message Triggered "+vendor_req_id); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
System.out.println("Whatsapp Message Failed for "+vendor_req_id); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return rows > 0; |
|
|
|
|
|
|
|
|
//return rows > 0; |
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
|
@ -859,6 +882,40 @@ public class createventService { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String sendWhstsappMsgForCertificate(String mob_no, String vendor_req_id) { |
|
|
|
|
|
String urlString = ""; |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String placeholders = |
|
|
|
|
|
URLEncoder.encode( |
|
|
|
|
|
vendor_req_id, |
|
|
|
|
|
StandardCharsets.UTF_8.toString()); |
|
|
|
|
|
|
|
|
|
|
|
// String buttonPlaceholder = |
|
|
|
|
|
// URLEncoder.encode( |
|
|
|
|
|
// complaintNumber+ "|~|" +complaintNumber, |
|
|
|
|
|
// StandardCharsets.UTF_8.toString()); |
|
|
|
|
|
|
|
|
|
|
|
String mobile = |
|
|
|
|
|
URLEncoder.encode( |
|
|
|
|
|
mob_no, |
|
|
|
|
|
StandardCharsets.UTF_8.toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
urlString="https://sendapiv1.pinbot.ai/pinwa/sendMessage?apikey=5c995535-6244-11f0-98fc-02c8a5e042bd&from=919445061913&to="+mobile+"&templateid=3636407&type=template&placeholders="+placeholders+"&button_placeholder=https://gccservices.in/streetvendorlicense"; |
|
|
|
|
|
|
|
|
|
|
|
String res = hitURL(urlString); |
|
|
|
|
|
return res; |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
return ""; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public List<Map<String, Object>> getapprovedcertificates(String zone, String ward, String street_id) { |
|
|
public List<Map<String, Object>> getapprovedcertificates(String zone, String ward, String street_id) { |
|
|
|
|
|
|
|
|
StringBuilder sql = new StringBuilder( |
|
|
StringBuilder sql = new StringBuilder( |
|
|
|