| Line 1081... |
Line 1081... |
| 1081 |
public void createGeofence() throws IOException, ProfitMandiBusinessException {
|
1081 |
public void createGeofence() throws IOException, ProfitMandiBusinessException {
|
| 1082 |
|
1082 |
|
| 1083 |
// List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
|
1083 |
// List<FofoStore> fofoStores = fofoStoreRepository.selectActiveStores();
|
| 1084 |
// for (FofoStore fofoStore : fofoStores) {
|
1084 |
// for (FofoStore fofoStore : fofoStores) {
|
| 1085 |
// if (fofoStore.getLatitude() != null && fofoStore.getLongitude() != null) {
|
1085 |
// if (fofoStore.getLatitude() != null && fofoStore.getLongitude() != null) {
|
| 1086 |
// CustomRetailer customRetailer =
|
- |
|
| 1087 |
// retailerService.getFofoRetailer(fofoStore.getId());
|
1086 |
CustomRetailer customRetailer = retailerService.getFofoRetailer(175138812);
|
| 1088 |
OkHttpClient client = new OkHttpClient();
|
1087 |
OkHttpClient client = new OkHttpClient();
|
| 1089 |
okhttp3.MediaType mediaType = okhttp3.MediaType.parse("application/json");
|
1088 |
okhttp3.MediaType mediaType = okhttp3.MediaType.parse("application/json");
|
| 1090 |
JSONObject geofe = new JSONObject();
|
1089 |
JSONObject geofe = new JSONObject();
|
| 1091 |
JSONArray geofences = new JSONArray();
|
1090 |
JSONArray geofences = new JSONArray();
|
| 1092 |
JSONObject geometry = new JSONObject();
|
1091 |
JSONObject geometry = new JSONObject();
|
| 1093 |
JSONObject geo = new JSONObject();
|
1092 |
JSONObject geo = new JSONObject();
|
| 1094 |
JSONArray coordinates = new JSONArray();
|
1093 |
JSONArray coordinates = new JSONArray();
|
| 1095 |
ArrayList<Double> crds = new ArrayList<>();
|
1094 |
ArrayList<Double> crds = new ArrayList<>();
|
| 1096 |
// crds.add(Double.parseDouble(fofoStore.getLongitude()));
|
1095 |
// crds.add(Double.parseDouble(fofoStore.getLongitude()));
|
| 1097 |
// crds.add(Double.parseDouble(fofoStore.getLatitude()));
|
1096 |
// crds.add(Double.parseDouble(fofoStore.getLatitude()));
|
| 1098 |
crds.add(77.3771954997187);
|
1097 |
crds.add(79.739197);
|
| 1099 |
crds.add(28.516045882182738);
|
1098 |
crds.add(27.961215);
|
| 1100 |
// crds.add(77.08596155373755);
|
1099 |
// crds.add(77.08596155373755);
|
| 1101 |
// crds.add(28.64944201113976);
|
1100 |
// crds.add(28.64944201113976);
|
| 1102 |
// coordinates.put(fofoStore.getLongitude());
|
1101 |
// coordinates.put(fofoStore.getLongitude());
|
| 1103 |
// coordinates.put(fofoStore.getLatitude());
|
1102 |
// coordinates.put(fofoStore.getLatitude());
|
| 1104 |
geo.put("type", "Point");
|
1103 |
geo.put("type", "Point");
|
| 1105 |
geo.put("coordinates", crds);
|
1104 |
geo.put("coordinates", crds);
|
| 1106 |
geometry.put("geometry", geo);
|
1105 |
geometry.put("geometry", geo);
|
| 1107 |
JSONObject metadata = new JSONObject();
|
1106 |
JSONObject metadata = new JSONObject();
|
| 1108 |
metadata.put("name", "SMARTDUKAAN HO");
|
1107 |
metadata.put("name", customRetailer.getBusinessName());
|
| 1109 |
// metadata.put("city", customRetailer.getAddress().getCity());
|
1108 |
metadata.put("city", customRetailer.getAddress().getCity());
|
| 1110 |
// metadata.put("Code", customRetailer.getCode());
|
1109 |
metadata.put("Code", customRetailer.getCode());
|
| 1111 |
geometry.put("metadata", metadata);
|
1110 |
geometry.put("metadata", metadata);
|
| 1112 |
geometry.put("radius", 200);
|
1111 |
geometry.put("radius", 200);
|
| 1113 |
|
1112 |
|
| 1114 |
geofences.put(geometry);
|
1113 |
geofences.put(geometry);
|
| 1115 |
geofe.put("geofences", geofences);
|
1114 |
geofe.put("geofences", geofences);
|