Skip to content

Commit c9f9fb8

Browse files
committed
FullStack Spring Boot
1 parent d32ed92 commit c9f9fb8

File tree

9 files changed

+825
-49
lines changed

9 files changed

+825
-49
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.urunov.payload.order;
2+
3+
import lombok.*;
4+
5+
import java.util.Map;
6+
7+
/**
8+
* User: hamdamboy
9+
* Project: Shopping
10+
* Github: @urunov
11+
*/
12+
13+
14+
@Data
15+
@Getter
16+
@Setter
17+
@NoArgsConstructor
18+
@ToString
19+
public class DeliveryPriceResponse {
20+
21+
private String deliveryPrice;
22+
private String foundRightAddress;
23+
private Map<String, String > coorMap;
24+
25+
public DeliveryPriceResponse(String deliveryPrice, String foundRightAddress, Map<String, String> coorMap)
26+
{
27+
this.deliveryPrice = deliveryPrice;
28+
this.foundRightAddress = foundRightAddress;
29+
this.coorMap = coorMap;
30+
}
31+
32+
33+
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,48 @@
11
package com.urunov.service.taxiMaster;
22

3+
import org.json.simple.JSONObject;
4+
35
/**
46
* Created by:
57
* User: hamdamboy
68
* Project: IntelliJ IDEA
79
* Github: @urunov
810
*/
911
public class Address {
12+
13+
public String street;
14+
public String house;
15+
public Double lat;
16+
public Double lon;
17+
public int sd;
18+
19+
public Address()
20+
{
21+
street = "";
22+
house = "";
23+
lat = 0.0;
24+
lon = 0.0;
25+
sd = 100;
26+
}
27+
28+
public Address(JSONObject jsonObject)
29+
{
30+
if(jsonObject == null || jsonObject.get("street") == null || jsonObject.get("houese") == null || jsonObject.get("coords") == null) {
31+
street = "";
32+
house = "";
33+
lat = 0.0;
34+
lon = 0.0;
35+
sd = 100;
36+
}
37+
38+
street = (String) jsonObject.get("street");
39+
house = (String) jsonObject.get("house");
40+
JSONObject coords = (JSONObject) jsonObject.get("coords");
41+
lat = (Double) coords.get("lat");
42+
lon = (Double) coords.get("lon");
43+
}
44+
45+
public String getAddr(){
46+
return street + ", " + house;
47+
}
1048
}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
package com.urunov.service.taxiMaster;
22

3+
import org.json.simple.JSONArray;
4+
import org.json.simple.JSONObject;
5+
6+
import java.util.ArrayList;
7+
import java.util.List;
8+
39
/**
410
* Created by:
511
* User: hamdamboy
612
* Project: IntelliJ IDEA
713
* Github: @urunov
814
*/
915
public class AddressParser {
16+
17+
public static Address analyzeAddresses(String query, JSONArray jsonAddress){
18+
19+
List<Address> addresses = new ArrayList<Address>();
20+
for(int i=0; i < jsonAddress.size(); i++)
21+
{
22+
Address address = new Address((JSONObject) jsonAddress.get(i));
23+
address.sd = Math.round(StringSimilarity.editDisanceWord(address.getAddr(), query));
24+
addresses.add(address);
25+
}
26+
}
1027
}

0 commit comments

Comments
 (0)