GetProductInfo.java 1.16 KB
import com.diligrp.orders.common.tools.MD5Utils;
import com.diligrp.titan.sdk.TitanClient;
import com.diligrp.titan.sdk.domain.Product;
import com.diligrp.titan.sdk.domain.Sku;
import com.diligrp.titan.sdk.output.BaseOutput;
import com.google.common.collect.Lists;
import org.junit.Test;

import java.util.List;



public class GetProductInfo {
    private TitanClient titanClient = new TitanClient("abc", "abc", "http://titan.api.1n4j.com");
    @Test
    public void TestGetProductInfo(){
        Long productId = 1000000142L;//8000000480L;
        BaseOutput<List<Product>> dataOutput = null;
        dataOutput = titanClient.getProductService().getProductInfo(Lists.newArrayList(productId), new String[]{"attribute"});
        for (Product product : dataOutput.getData()) {
            System.out.println(String.format("productId=%s,shopID=%s,sellerID=%s",product.getPid(),product.getVendorId(),product.getSellerID()));
            for (Sku sku : product.getSkus()) {
                System.out.println(String.format("sku=%s",sku.getSku()));
            }
        }
    }
    
    @Test
    public void md5OrderId(){
        System.out.println(MD5Utils.encode("1502260000050"));
    }
}