TASK:模块化;

This commit is contained in:
shahaibo
2025-05-06 17:30:01 +08:00
parent a84fe12a28
commit 6d6768e6cb
5 changed files with 302 additions and 21 deletions

View File

@@ -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);
}