TASK:模块化;
This commit is contained in:
@@ -73,9 +73,21 @@ public class ProductImageServiceImpl implements ProductImageService {
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject obj = data.getJSONObject(i);
|
||||
JSONObject attribute = obj.getJSONObject("attribute");
|
||||
AttributeRecognitionJSON attrJSON = attribute.toJavaObject(AttributeRecognitionJSON.class);
|
||||
ProductImageAttribute attr = toAttrDict(attrJSON);
|
||||
String gender = library.getLevel2Type();
|
||||
String category = null;
|
||||
if (gender.equals("Female")) {
|
||||
category = obj.getString("category_female");
|
||||
}else if (gender.equals("Male")) {
|
||||
category = obj.getString("category_male");
|
||||
}
|
||||
String imgUrl = obj.getString("img_url");
|
||||
// JSONObject attribute = obj.getJSONObject("attribute");
|
||||
// AttributeRecognitionJSON attrJSON = attribute.toJavaObject(AttributeRecognitionJSON.class);
|
||||
// ProductImageAttribute attr = toAttrDict(attrJSON);
|
||||
ProductImageAttribute attr = new ProductImageAttribute();
|
||||
attr.setGender(gender);
|
||||
attr.setCategory(category);
|
||||
attr.setImgUrl(imgUrl);
|
||||
attr.setLibraryId(libraryId);
|
||||
productImageAttributeMapper.insert(attr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user