Subversion Repositories SmartDukaan

Rev

Rev 27482 | Rev 27486 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27482 Rev 27485
Line 4... Line 4...
4
import java.io.IOException;
4
import java.io.IOException;
5
import java.time.LocalDate;
5
import java.time.LocalDate;
6
import java.time.LocalDateTime;
6
import java.time.LocalDateTime;
7
import java.time.LocalTime;
7
import java.time.LocalTime;
8
import java.time.temporal.ChronoUnit;
8
import java.time.temporal.ChronoUnit;
9
import java.time.temporal.Temporal;
-
 
10
import java.time.temporal.TemporalUnit;
-
 
11
import java.util.ArrayList;
9
import java.util.ArrayList;
12
import java.util.Arrays;
10
import java.util.Arrays;
13
import java.util.Base64;
11
import java.util.Base64;
14
import java.util.Collections;
12
import java.util.Collections;
15
import java.util.Comparator;
13
import java.util.Comparator;
Line 19... Line 17...
19
import java.util.Map;
17
import java.util.Map;
20
import java.util.Set;
18
import java.util.Set;
21
import java.util.concurrent.TimeUnit;
19
import java.util.concurrent.TimeUnit;
22
import java.util.stream.Collectors;
20
import java.util.stream.Collectors;
23
 
21
 
24
import javax.servlet.http.HttpServletRequest;
-
 
25
 
-
 
26
import org.apache.commons.io.output.ByteArrayOutputStream;
22
import org.apache.commons.io.output.ByteArrayOutputStream;
27
import org.apache.commons.lang.StringUtils;
23
import org.apache.commons.lang.StringUtils;
28
import org.apache.logging.log4j.LogManager;
24
import org.apache.logging.log4j.LogManager;
29
import org.apache.logging.log4j.Logger;
25
import org.apache.logging.log4j.Logger;
30
import org.apache.solr.common.util.Hash;
-
 
31
import org.json.JSONArray;
26
import org.json.JSONArray;
32
import org.json.JSONObject;
27
import org.json.JSONObject;
33
import org.openqa.selenium.Dimension;
28
import org.openqa.selenium.Dimension;
34
import org.openqa.selenium.OutputType;
29
import org.openqa.selenium.OutputType;
35
import org.openqa.selenium.TakesScreenshot;
30
import org.openqa.selenium.TakesScreenshot;
36
import org.openqa.selenium.WebDriver;
31
import org.openqa.selenium.WebDriver;
37
import org.openqa.selenium.chrome.ChromeDriver;
32
import org.openqa.selenium.chrome.ChromeDriver;
38
import org.openqa.selenium.chrome.ChromeOptions;
33
import org.openqa.selenium.chrome.ChromeOptions;
39
import org.springframework.beans.factory.annotation.Autowired;
34
import org.springframework.beans.factory.annotation.Autowired;
40
import org.springframework.core.io.ByteArrayResource;
35
import org.springframework.core.io.ByteArrayResource;
41
import org.springframework.http.MediaType;
-
 
42
import org.springframework.http.ResponseEntity;
-
 
43
import org.springframework.mail.javamail.JavaMailSender;
36
import org.springframework.mail.javamail.JavaMailSender;
44
import org.springframework.stereotype.Component;
37
import org.springframework.stereotype.Component;
45
import org.springframework.transaction.annotation.Transactional;
38
import org.springframework.transaction.annotation.Transactional;
46
import org.springframework.web.bind.annotation.RequestMapping;
-
 
47
import org.springframework.web.bind.annotation.RequestMethod;
-
 
48
 
39
 
49
import com.smartdukaan.cron.scheduled.SamsungIMEIActivationService;
40
import com.smartdukaan.cron.scheduled.SamsungIMEIActivationService;
50
import com.smartdukaan.cron.scheduled.ScheduledTasks;
41
import com.smartdukaan.cron.scheduled.ScheduledTasks;
51
import com.spice.profitmandi.common.enumuration.ItemType;
42
import com.spice.profitmandi.common.enumuration.ItemType;
52
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
43
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
Line 1113... Line 1104...
1113
				JSONObject metadata = new JSONObject();
1104
				JSONObject metadata = new JSONObject();
1114
				metadata.put("name", customRetailer.getBusinessName());
1105
				metadata.put("name", customRetailer.getBusinessName());
1115
				metadata.put("city", customRetailer.getAddress().getCity());
1106
				metadata.put("city", customRetailer.getAddress().getCity());
1116
				metadata.put("Code", customRetailer.getCode());
1107
				metadata.put("Code", customRetailer.getCode());
1117
				geometry.put("metadata", metadata);
1108
				geometry.put("metadata", metadata);
1118
				geometry.put("radius", 500);
1109
				geometry.put("radius", 200);
1119
 
1110
 
1120
				geofences.put(geometry);
1111
				geofences.put(geometry);
1121
				geofe.put("geofences", geofences);
1112
				geofe.put("geofences", geofences);
1122
				okhttp3.RequestBody body = okhttp3.RequestBody.create(mediaType, geofe.toString());
1113
				okhttp3.RequestBody body = okhttp3.RequestBody.create(mediaType, geofe.toString());
1123
				String authString = "Basic "
1114
				String authString = "Basic "
Line 1127... Line 1118...
1127
						.addHeader("Authorization", authString).build();
1118
						.addHeader("Authorization", authString).build();
1128
 
1119
 
1129
				Response response = client.newCall(request1).execute();
1120
				Response response = client.newCall(request1).execute();
1130
 
1121
 
1131
				JSONArray ja = new JSONArray(response.body().string());
1122
				JSONArray ja = new JSONArray(response.body().string());
1132
				LOGGER.info("ja" + ja);
1123
				LOGGER.info("geofence" + ja);
1133
				LOGGER.info("jalength" + ja.length());
1124
				LOGGER.info("jalength" + ja.length());
1134
				for (int i = 0; i < ja.length(); i++) {
1125
				for (int i = 0; i < ja.length(); i++) {
1135
					JSONObject c = ja.getJSONObject(i);
1126
					JSONObject c = ja.getJSONObject(i);
1136
					String geofenceId = c.getString("geofence_id");
1127
					String geofenceId = c.getString("geofence_id");
1137
					LOGGER.info("geofenceId" + geofenceId);
1128
					LOGGER.info("geofenceId" + geofenceId);