View Javadoc
1   package org.oxerr.youzan.dto.item;
2   
3   import java.io.Serializable;
4   import java.math.BigDecimal;
5   import java.time.Instant;
6   
7   import org.oxerr.youzan.dto.deserializer.InstantDeserializer;
8   
9   import com.fasterxml.jackson.annotation.JsonProperty;
10  import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
11  
12  /**
13   * <a href="http://open.youzan.com/structparam?struct=GoodsSku">Sku数据结构</a>.
14   */
15  public class GoodsSku implements Serializable {
16  
17  	private static final long serialVersionUID = 2016061901L;
18  
19  	/**
20  	 * Sku所对应的销售属性的中文名字串,
21  	 * 格式如:pid1:vid1:pid_name1:vid_name1;pid2:vid2:pid_name2:vid_name2……
22  	 */
23  	private String propertiesName;
24  
25  	/**
26  	 * Sku在系统中的唯一编号,可以在开发者的系统中用作 Sku 的唯一ID,但不能用于调用接口
27  	 */
28  	private String skuUniqueCode;
29  
30  	/**
31  	 * 商品在付款减库存的状态下,该Sku上未付款的订单数量
32  	 */
33  	private Long withHoldQuantity;
34  
35  	/**
36  	 * 属于这个Sku的商品的数量
37  	 */
38  	private Long quantity;
39  
40  	/**
41  	 * 商品的这个Sku的价格;精确到2位小数;单位:元。
42  	 */
43  	private BigDecimal price;
44  
45  	/**
46  	 * Sku创建日期,时间格式:yyyy-MM-dd HH:mm:ss
47  	 */
48  	private Instant created;
49  
50  	/**
51  	 * Sku所对应的销售属性的Json字符串(需另行解析),
52  	 * 该字段内容与properties_name字段除了格式不一样,内容完全一致。
53  	 * 由于产品规格信息难以避免涉及到‘:’、‘,’、‘;’这些与解析规则冲突的字符,所以增加该字段。
54  	 * 格式定义:
55  	 * <pre>
56  	 * [
57  	 * 	{
58  	 * 		"kid": "20000",
59  	 * 		"vid": "3275069",
60  	 * 		"k": "品牌",
61  	 * 		"v": "盈讯"
62  	 * 	},
63  	 * 	{
64  	 * 		"kid": "1753146",
65  	 *		"vid": "3485013",
66  	 *		"k": "型号",
67  	 *		"v": "F908"
68  	 *	}
69  	 *	......
70  	 * ]
71  	 * </pre>
72  	 */
73  	private String propertiesNameJson;
74  
75  	/**
76  	 * Sku最后修改日期,时间格式:yyyy-MM-dd HH:mm:ss
77  	 */
78  	private Instant modified;
79  
80  	/**
81  	 * Sku的ID,sku_id 在系统里并不是唯一的,结合商品ID一起使用才是唯一的。
82  	 */
83  	private Long skuId;
84  
85  	/**
86  	 * Sku所属商品的数字编号
87  	 */
88  	private Long numIid;
89  
90  	/**
91  	 * 商家编码(商家为Sku设置的外部编号)
92  	 */
93  	private String outerId;
94  
95  	public GoodsSku() {
96  	}
97  
98  	public GoodsSku(
99  		@JsonProperty("properties_name") final String propertiesName,
100 		@JsonProperty("sku_unique_code") final String skuUniqueCode,
101 		@JsonProperty("with_hold_quantity") final Long withHoldQuantity,
102 		@JsonProperty("quantity") final Long quantity,
103 		@JsonProperty("price") final BigDecimal price,
104 		@JsonProperty("created")
105 		@JsonDeserialize(using = InstantDeserializer.class)
106 		final Instant created,
107 		@JsonProperty("properties_name_json") final String propertiesNameJson,
108 		@JsonProperty("modified")
109 		@JsonDeserialize(using = InstantDeserializer.class)
110 		final Instant modified,
111 		@JsonProperty("sku_id") final Long skuId,
112 		@JsonProperty("num_iid") final Long numIid,
113 		@JsonProperty("outer_id") final String outerId
114 	) {
115 		this.propertiesName = propertiesName;
116 		this.skuUniqueCode = skuUniqueCode;
117 		this.withHoldQuantity = withHoldQuantity;
118 		this.quantity = quantity;
119 		this.price = price;
120 		this.created = created;
121 		this.propertiesNameJson = propertiesNameJson;
122 		this.modified = modified;
123 		this.skuId = skuId;
124 		this.numIid = numIid;
125 		this.outerId = outerId;
126 	}
127 
128 	public String getPropertiesName() {
129 		return propertiesName;
130 	}
131 
132 	public void setPropertiesName(String propertiesName) {
133 		this.propertiesName = propertiesName;
134 	}
135 
136 	public String getSkuUniqueCode() {
137 		return skuUniqueCode;
138 	}
139 
140 	public void setSkuUniqueCode(String skuUniqueCode) {
141 		this.skuUniqueCode = skuUniqueCode;
142 	}
143 
144 	public Long getWithHoldQuantity() {
145 		return withHoldQuantity;
146 	}
147 
148 	public void setWithHoldQuantity(Long withHoldQuantity) {
149 		this.withHoldQuantity = withHoldQuantity;
150 	}
151 
152 	public Long getQuantity() {
153 		return quantity;
154 	}
155 
156 	public void setQuantity(Long quantity) {
157 		this.quantity = quantity;
158 	}
159 
160 	public BigDecimal getPrice() {
161 		return price;
162 	}
163 
164 	public void setPrice(BigDecimal price) {
165 		this.price = price;
166 	}
167 
168 	public Instant getCreated() {
169 		return created;
170 	}
171 
172 	public void setCreated(Instant created) {
173 		this.created = created;
174 	}
175 
176 	public String getPropertiesNameJson() {
177 		return propertiesNameJson;
178 	}
179 
180 	public void setPropertiesNameJson(String propertiesNameJson) {
181 		this.propertiesNameJson = propertiesNameJson;
182 	}
183 
184 	public Instant getModified() {
185 		return modified;
186 	}
187 
188 	public void setModified(Instant modified) {
189 		this.modified = modified;
190 	}
191 
192 	public Long getSkuId() {
193 		return skuId;
194 	}
195 
196 	public void setSkuId(Long skuId) {
197 		this.skuId = skuId;
198 	}
199 
200 	public Long getNumIid() {
201 		return numIid;
202 	}
203 
204 	public void setNumIid(Long numIid) {
205 		this.numIid = numIid;
206 	}
207 
208 	public String getOuterId() {
209 		return outerId;
210 	}
211 
212 	public void setOuterId(String outerId) {
213 		this.outerId = outerId;
214 	}
215 
216 }