Subversion Repositories SmartDukaan

Rev

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

Rev 10307 Rev 11015
Line 2... Line 2...
2
 
2
 
3
import in.shop2020.config.ConfigException;
3
import in.shop2020.config.ConfigException;
4
import in.shop2020.model.v1.catalog.CatalogService.Client;
4
import in.shop2020.model.v1.catalog.CatalogService.Client;
5
import in.shop2020.model.v1.catalog.CatalogServiceException;
5
import in.shop2020.model.v1.catalog.CatalogServiceException;
6
import in.shop2020.model.v1.catalog.Item;
6
import in.shop2020.model.v1.catalog.Item;
-
 
7
import in.shop2020.model.v1.catalog.MarketplaceHistory;
7
import in.shop2020.model.v1.catalog.MarketplaceItems;
8
import in.shop2020.model.v1.catalog.MarketplaceItems;
8
import in.shop2020.model.v1.catalog.MarketplacePercentage;
9
import in.shop2020.model.v1.catalog.MarketplacePercentage;
9
import in.shop2020.model.v1.catalog.SnapdealItem;
10
import in.shop2020.model.v1.catalog.SnapdealItem;
10
import in.shop2020.model.v1.catalog.SnapdealItemDetails;
11
import in.shop2020.model.v1.catalog.SnapdealItemDetails;
11
import in.shop2020.model.v1.inventory.InventoryServiceException;
12
import in.shop2020.model.v1.inventory.InventoryServiceException;
12
import in.shop2020.model.v1.inventory.InventoryType;
13
import in.shop2020.model.v1.inventory.InventoryType;
13
import in.shop2020.model.v1.inventory.ItemInventory;
14
import in.shop2020.model.v1.inventory.ItemInventory;
14
import in.shop2020.model.v1.inventory.OOSStatus;
15
import in.shop2020.model.v1.inventory.OOSStatus;
15
import in.shop2020.model.v1.inventory.Warehouse;
16
import in.shop2020.model.v1.inventory.Warehouse;
16
import in.shop2020.model.v1.inventory.WarehouseType;
17
import in.shop2020.model.v1.inventory.WarehouseType;
-
 
18
import in.shop2020.model.v1.order.OrderSource;
17
import in.shop2020.model.v1.order.SnapdealOrder;
19
import in.shop2020.model.v1.order.SnapdealOrder;
18
import in.shop2020.support.utils.ReportsUtils;
20
import in.shop2020.support.utils.ReportsUtils;
19
import in.shop2020.support.utils.UpdateSDPricingUsingPanel;
21
import in.shop2020.support.utils.UpdateSDPricingUsingPanel;
20
import in.shop2020.thrift.clients.CatalogClient;
22
import in.shop2020.thrift.clients.CatalogClient;
21
import in.shop2020.thrift.clients.InventoryClient;
23
import in.shop2020.thrift.clients.InventoryClient;
Line 61... Line 63...
61
import org.json.JSONException;
63
import org.json.JSONException;
62
import org.json.JSONObject;
64
import org.json.JSONObject;
63
import org.slf4j.Logger;
65
import org.slf4j.Logger;
64
import org.slf4j.LoggerFactory;
66
import org.slf4j.LoggerFactory;
65
 
67
 
-
 
68
import com.google.gson.Gson;
66
import com.opensymphony.xwork2.ValidationAwareSupport;
69
import com.opensymphony.xwork2.ValidationAwareSupport;
67
 
70
 
68
@SuppressWarnings({"unused","deprecation"})
71
@SuppressWarnings({"unused","deprecation"})
69
 
72
 
70
@InterceptorRefs({
73
@InterceptorRefs({
Line 128... Line 131...
128
	private String vat;
131
	private String vat;
129
	private String comparsionResult;
132
	private String comparsionResult;
130
	private String maxSp;
133
	private String maxSp;
131
	private String nDaySale;
134
	private String nDaySale;
132
	private static String live;
135
	private static String live;
-
 
136
    private List<MarketplaceHistory> compData;
-
 
137
    private String productName;
-
 
138
    private String startDate;
-
 
139
    private String endDate;
133
 
140
 
134
	public String getnDaySale() {
141
    public String getnDaySale() {
135
		return nDaySale;
142
		return nDaySale;
136
	}
143
	}
137
 
144
 
138
	public void setnDaySale(String nDaySale) {
145
	public void setnDaySale(String nDaySale) {
139
		this.nDaySale = nDaySale;
146
		this.nDaySale = nDaySale;
Line 169... Line 176...
169
 
176
 
170
	public String getVat() {
177
	public String getVat() {
171
		return vat;
178
		return vat;
172
	}
179
	}
173
 
180
 
174
	public void setVat(String vat) {
181
	public void setStartDate(String startDate) {
175
		this.vat = vat;
182
		this.startDate = startDate;
176
	}
183
	}
-
 
184
	
-
 
185
	public String getStartDate() {
-
 
186
        return startDate;
-
 
187
    }
-
 
188
	
-
 
189
	public void setEndDate(String endDate) {
-
 
190
        this.endDate = endDate;
-
 
191
    }
-
 
192
    
-
 
193
    public String getEndDate() {
-
 
194
        return endDate;
-
 
195
    }
-
 
196
 
-
 
197
    public void setVat(String vat) {
-
 
198
        this.vat = vat;
-
 
199
    }
177
 
200
 
178
	public String getOtherCost() {
201
	public String getOtherCost() {
179
		return otherCost;
202
		return otherCost;
180
	}
203
	}
181
 
204
 
Line 341... Line 364...
341
		Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
364
		Client CatalogClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
342
		MarketplaceItems mpItemDetails = CatalogClient.getMarketplacedetailsForItem(Long.valueOf(id), 7);
365
		MarketplaceItems mpItemDetails = CatalogClient.getMarketplacedetailsForItem(Long.valueOf(id), 7);
343
		lastCheckedTimeStampForItem(mpItemDetails.getLastCheckedTimestamp());
366
		lastCheckedTimeStampForItem(mpItemDetails.getLastCheckedTimestamp());
344
		return mpItemDetails;
367
		return mpItemDetails;
345
	}
368
	}
-
 
369
	
-
 
370
	public String getDate(long timestamp){
-
 
371
	    return new java.util.Date(timestamp).toLocaleString();
-
 
372
	    
-
 
373
	}
346
 
374
 
347
	public void lastUpdatedInventoryTimeStampForItem(long timestamp){
375
	public void lastUpdatedInventoryTimeStampForItem(long timestamp){
348
		setLastUpdatedInventoryTimestamp(new java.util.Date(timestamp).toLocaleString());
376
		setLastUpdatedInventoryTimestamp(new java.util.Date(timestamp).toLocaleString());
349
	}
377
	}
350
 
378
 
Line 674... Line 702...
674
 
702
 
675
 
703
 
676
	public String getAddNewItemForm(){
704
	public String getAddNewItemForm(){
677
		return "snapdeal-add-item";
705
		return "snapdeal-add-item";
678
	}
706
	}
-
 
707
	
-
 
708
	/*public String getCompetitionAnalyis() throws NumberFormatException, TException{
-
 
709
	    Client cc = new CatalogClient().getClient();
-
 
710
	    compData = cc.getMarketplaceHistory(7, 0, Long.valueOf(itemId));
-
 
711
	    //Gson gson = new Gson();
-
 
712
	    //competitionJson = gson.toJson(compData);
-
 
713
	    return "competition-details";
-
 
714
	    
-
 
715
	}*/
679
 
716
 
680
	public String getItemDetailsInJson() throws NumberFormatException, CatalogServiceException, TException, JSONException, InventoryServiceException{
717
	public String getItemDetailsInJson() throws NumberFormatException, CatalogServiceException, TException, JSONException, InventoryServiceException{
681
		Client catalogClientProd = new CatalogClient().getClient();
718
		Client catalogClientProd = new CatalogClient().getClient();
682
		Client catalogClient =new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
719
		Client catalogClient =new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
683
		SnapdealItem snapdealItem = catalogClient.getSnapdealItem(Long.valueOf(itemId));
720
		SnapdealItem snapdealItem = catalogClient.getSnapdealItem(Long.valueOf(itemId));
Line 1215... Line 1252...
1215
		}
1252
		}
1216
 
1253
 
1217
		if (StringUtils.equals(id, "snapdeal-options")){
1254
		if (StringUtils.equals(id, "snapdeal-options")){
1218
			return "snapdeal-options";
1255
			return "snapdeal-options";
1219
		}
1256
		}
-
 
1257
		
-
 
1258
		if (StringUtils.equals(id, "competition-analysis")){
-
 
1259
		    //setAnalysisData(Long.valueOf(itemId));
-
 
1260
		    
-
 
1261
            return "competition-details";
-
 
1262
        }
-
 
1263
		
1220
		if (StringUtils.equals(id, "item-table")){
1264
		if (StringUtils.equals(id, "item-table")){
1221
			return "snapdeal-item-table";
1265
			return "snapdeal-item-table";
1222
		}
1266
		}
1223
 
1267
 
1224
		return "id";
1268
		return "id";
1225
	}
1269
	}
-
 
1270
	
-
 
1271
//	public void setAnalysisData(long itemId){
-
 
1272
//        try {
-
 
1273
//            Client cc = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
-
 
1274
//            compData = cc.getMarketplaceHistory(7, 0, itemId);
-
 
1275
//        } catch (Exception e) {
-
 
1276
//            // TODO Auto-generated catch block
-
 
1277
//            logger.error("Unable to set analysis data for itemId "+itemId +" "+e);
-
 
1278
//        }
-
 
1279
//        //Gson gson = new Gson();
-
 
1280
//        //competitionJson = gson.toJson(compData);
-
 
1281
//        
-
 
1282
//	}
-
 
1283
	
-
 
1284
	public String getCountForCompetitionData(String itemId) throws TException, NumberFormatException, CatalogServiceException{
-
 
1285
	    Client cc = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
-
 
1286
	    Item item = cc.getItem(Long.valueOf(itemId));
-
 
1287
	    setProductName(getVaildName(item.getBrand())+" "+getVaildName(item.getModelName())+" "+getVaildName(item.getModelNumber())+" "+getVaildName(item.getColor()));
-
 
1288
	    return String.valueOf(cc.getCountForMarketplaceHistory(7, Long.valueOf(itemId)));
-
 
1289
	}
-
 
1290
	
-
 
1291
	public void setProductName(String productName){
-
 
1292
	    this.productName = productName;
-
 
1293
	}
-
 
1294
	
-
 
1295
	public String getProductName(){
-
 
1296
	    return productName;
-
 
1297
	}
-
 
1298
	
-
 
1299
	
-
 
1300
	public String fetchCompetitionData(){
-
 
1301
	    try {
-
 
1302
            Client cc = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
-
 
1303
            compData = cc.getMarketplaceHistory(7, Long.valueOf(next), Long.valueOf(itemId));
-
 
1304
        } catch (Exception e) {
-
 
1305
            // TODO Auto-generated catch block
-
 
1306
            logger.error("Unable to set analysis data for itemId "+itemId +" "+e);
-
 
1307
        }
-
 
1308
        return "snapdeal-competition-table";
-
 
1309
	    
-
 
1310
	}
-
 
1311
	
-
 
1312
	public String fetchCompetitionDataTest(){
-
 
1313
        try {
-
 
1314
            Client cc = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port").getClient();
-
 
1315
            compData = cc.getMarketplaceHistoryByDate(7, Long.valueOf(startDate), Long.valueOf(endDate),999999L,999999L,Long.valueOf(itemId));
-
 
1316
        } catch (Exception e) {
-
 
1317
            // TODO Auto-generated catch block
-
 
1318
            logger.error("Unable to set analysis data for itemId "+itemId +" "+e);
-
 
1319
        }
-
 
1320
        return "snapdeal-duplicate-records";
-
 
1321
        
-
 
1322
    }
-
 
1323
	
-
 
1324
	
-
 
1325
	public List<MarketplaceHistory> getAnalysisData() {
-
 
1326
        return compData;
-
 
1327
    }
1226
 
1328
 
1227
	public void setId(String id) {
1329
	public void setId(String id) {
1228
		this.id = id;
1330
		this.id = id;
1229
	}
1331
	}
1230
 
1332