Subversion Repositories SmartDukaan

Rev

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

Rev 15186 Rev 15230
Line 22... Line 22...
22
	private String id;
22
	private String id;
23
	private String url;
23
	private String url;
24
 
24
 
25
	public String index(){
25
	public String index(){
26
		Gson gs = new Gson();
26
		Gson gs = new Gson();
27
		Client dc = null;
27
		DtrClient dc = null;
28
		try {
28
		try {
29
			dc = new DtrClient().getClient();
29
			dc = new DtrClient();
30
			List<in.shop2020.model.v1.dtr.LivePricing> pricingObj = dc.getLatestPricing(Long.valueOf(skuBundleId), Long.valueOf(source_id));
30
			List<in.shop2020.model.v1.dtr.LivePricing> pricingObj = dc.getClient().getLatestPricing(Long.valueOf(skuBundleId), Long.valueOf(source_id));
31
			setResultJson(JSON.parse(gs.toJson(pricingObj)).toString());
31
			setResultJson(JSON.parse(gs.toJson(pricingObj)).toString());
-
 
32
			
32
		} catch (Exception e) {
33
		} catch (Exception e) {
33
			log.info(e);
34
			log.info(e);
34
		}
35
		}
-
 
36
		finally{
-
 
37
			dc.closeConnection();
-
 
38
		}
35
		return "index";
39
		return "index";
36
	}
40
	}
37
 
41
 
38
	public String latestPriceById(){
42
	public String latestPriceById(){
39
		log.info("Inside lastestPriceById");
43
		log.info("Inside lastestPriceById");
40
		log.info("Id is "+id);
44
		log.info("Id is "+id);
41
		log.info("Source id "+source_id);
45
		log.info("Source id "+source_id);
42
		log.info("Encoded Url is "+url);
46
		log.info("Encoded Url is "+url);
43
 
47
		
44
		Client dc = null;
48
		DtrClient dc = null;
45
		UserMessagePojo ump = new UserMessagePojo();
49
		UserMessagePojo ump = new UserMessagePojo();
46
		ump.setMessage("");
50
		ump.setMessage("");
47
		ump.setResult(false);
51
		ump.setResult(false);
48
		try {
52
		try {
49
			dc = new DtrClient().getClient();
53
			dc = new DtrClient();
50
			dc.updateLatestPriceForItem(Long.valueOf(id));
54
			dc.getClient().updateLatestPriceForItem(Long.valueOf(id));
51
			if (Long.valueOf(source_id) == 3){
55
			if (Long.valueOf(source_id) == 3){
52
				SnapdealProductPageParserController spp = new SnapdealProductPageParserController();
56
				SnapdealProductPageParserController spp = new SnapdealProductPageParserController();
53
				spp.setUrl(url);
57
				spp.setUrl(url);
54
				setResultJson(spp.getColorMessage());
58
				setResultJson(spp.getColorMessage());
55
			}
59
			}
Line 57... Line 61...
57
				throw new Exception();
61
				throw new Exception();
58
			}
62
			}
59
		} catch (Exception e) {
63
		} catch (Exception e) {
60
			setResultJson(ump);
64
			setResultJson(ump);
61
		}
65
		}
-
 
66
		finally{
-
 
67
			dc.closeConnection();
-
 
68
		}
62
		return "index";
69
		return "index";
63
	}
70
	}
64
 
71
 
65
	public String getSkuBundleId() {
72
	public String getSkuBundleId() {
66
		return skuBundleId;
73
		return skuBundleId;
Line 97... Line 104...
97
 
104
 
98
	public static void main (String[] args){
105
	public static void main (String[] args){
99
		LivePricingController live = new LivePricingController();
106
		LivePricingController live = new LivePricingController();
100
		live.setId("84");
107
		live.setId("84");
101
		live.setUrl("aHR0cDovL20uc25hcGRlYWwuY29tL3Byb2R1Y3Qvc3BpY2UtYm9zcy1lbnRlcnRhaW5lci0zLW01NDA2LzEwNTA2ODk2MjM/c3VwYz1TREw3MDA0MzYzMTUmdXRtX3NvdXJjZT1hZmZfcHJvZyZ1dG1fY2FtcGFpZ249YWZ0cyZvZmZlcl9pZD0xNyZhZmZfaWQ9MTc5MTUmYWZmX3N1Yj1TSEEzMTQzMTY3NzM0NQ==");
108
		live.setUrl("aHR0cDovL20uc25hcGRlYWwuY29tL3Byb2R1Y3Qvc3BpY2UtYm9zcy1lbnRlcnRhaW5lci0zLW01NDA2LzEwNTA2ODk2MjM/c3VwYz1TREw3MDA0MzYzMTUmdXRtX3NvdXJjZT1hZmZfcHJvZyZ1dG1fY2FtcGFpZ249YWZ0cyZvZmZlcl9pZD0xNyZhZmZfaWQ9MTc5MTUmYWZmX3N1Yj1TSEEzMTQzMTY3NzM0NQ==");
102
		live.setSource_id("4");
109
		live.setSource_id("3");
103
		live.latestPriceById();
110
		live.latestPriceById();
104
		System.out.println(live.getResultJson());
111
		System.out.println(live.getResultJson());
105
	}
112
	}
106
 
113
 
107
 
114