Commit c3861fba authored by psawant's avatar psawant

PLACE_API format implementation

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@192956 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 5b0a1498
......@@ -2041,7 +2041,7 @@ implements CustomerLocal, CustomerRemote
if (key.equalsIgnoreCase("address_components"))
{
org.json.simple.JSONArray adddrcomp = (org.json.simple.JSONArray) parser.parse(value);
HashMap<String, String> fields=setFields(adddrcomp);
HashMap<String, String> fields= getAddressDetailMap( adddrcomp, conn );
String cityAdr = fields.get("city");
valueXmlString.append("<city><![CDATA[" + cityAdr + "]]></city>");
String stateCodeAdr = fields.get("state_code");
......@@ -2054,12 +2054,12 @@ implements CustomerLocal, CustomerRemote
else if (key.equalsIgnoreCase("adr_address"))
{
System.out.println("value in adr_address"+value);
HashMap<String, String> Address = addressSplit( value );
String Adr1=Address.get("First");
HashMap<String, String> Address = getAddressMap( value );
String Adr1=Address.get("addr1");
valueXmlString.append("<addr1><![CDATA[" + Adr1 + "]]></addr1>");
String Adr2=Address.get("Second");
String Adr2=Address.get("addr2");
valueXmlString.append("<addr2><![CDATA["+ Adr2 +"]]></addr2>");
String Adr3=Address.get("Third");
String Adr3=Address.get("addr3");
valueXmlString.append("<addr3><![CDATA["+ Adr3 +"]]></addr3>");
}
else if (key.equalsIgnoreCase("formatted_phone_number"))
......@@ -2070,11 +2070,8 @@ implements CustomerLocal, CustomerRemote
else if (key.equalsIgnoreCase("name"))
{
System.out.println("Value name" + (value));
custName = value;
valueXmlString.append("<cust_name><![CDATA[" + value + "]]></cust_name>");
if(chqName == null || chqName.trim().length() <= 0)
{
valueXmlString.append("<chq_name><![CDATA[" + value + "]]></chq_name>");
}
}
}
}
......@@ -2082,6 +2079,10 @@ implements CustomerLocal, CustomerRemote
{
System.out.println("exeception in the cust_name "+e.getMessage());
}
if(chqName == null || chqName.trim().length() <= 0)
{
valueXmlString.append("<chq_name><![CDATA[" + custName + "]]></chq_name>");
}
}
//changed by Pooja.S on[2-Nov-2018] to set the address and fields by using Json End
}
......@@ -2753,9 +2754,11 @@ implements CustomerLocal, CustomerRemote
//Added by AMEY on 24/09/2018 [start] to get data from supplier default master from cust_type
//changed by Pooja.S on[2-Nov-2018] to set the address anf fields by using Json Start
private HashMap<String, String> addressSplit(String value )
private HashMap<String, String> getAddressMap(String value )
{
HashMap<String, String> map=new HashMap();
try
{
HashMap<String, String> map=new HashMap<>();
String firstString = "",finalString="", secondString = "", secString = "", thirdString = "", thiString = "",addr="";
String Address1="",Address2="",Address3="";
String FinalS= value.substring(0,value.indexOf("<span class=\"locality\">"));
......@@ -2822,26 +2825,26 @@ implements CustomerLocal, CustomerRemote
Address2="";
Address3="";
}
map.put("First", Address1);
map.put("Second", Address2);
map.put("Third", Address3);
map.put("addr1", Address1);
map.put("addr2", Address2);
map.put("addr3", Address3);
}
catch (Exception e)
{
e.printStackTrace();
}
return map;
}
private HashMap< String, String > setFields( org.json.simple.JSONArray adddrcomp)
private HashMap< String, String > getAddressDetailMap( org.json.simple.JSONArray adddrcomp, Connection conn )
{
HashMap<String, String> map=new HashMap<>();
HashMap<String, String> map=new HashMap();
String keyaddr = "", valueaddr = "", longName = "";
String sql="";
ResultSet rs=null;
PreparedStatement pstm=null;
Connection conn=null;
try
{
conn = getConnection();
conn.setAutoCommit(false);
System.out.println("valueaddr " + (adddrcomp.size()));
org.json.simple.JSONObject addrJson = null;
......@@ -2878,7 +2881,6 @@ implements CustomerLocal, CustomerRemote
if (type.equalsIgnoreCase("locality"))
{
map.put("city", longName);
}
else if ( type.equalsIgnoreCase("administrative_area_level_1") )
{
......@@ -2898,7 +2900,6 @@ implements CustomerLocal, CustomerRemote
if ( region.length() > 0 )
{
map.put( "state_code" , region );
}
}
else if (type.equalsIgnoreCase("country"))
......@@ -2910,10 +2911,9 @@ implements CustomerLocal, CustomerRemote
pstm = conn.prepareStatement(sql);
pstm.setString(1, longName);
rs = pstm.executeQuery();
if (rs.next()) {
if (rs.next())
{
countryC=rs.getString("count_code");
}
rs.close();
rs = null;
......@@ -2923,14 +2923,12 @@ implements CustomerLocal, CustomerRemote
if(countryC.length() > 0)
{
map.put("count_code", countryC);
}
}
else if (type.equalsIgnoreCase("postal_code"))
{
map.put("pin", longName );
System.out.println("in postal_code " + longName);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment