TASK:mixi;

This commit is contained in:
shahaibo
2025-05-08 21:51:35 +08:00
parent 7cf077ec2f
commit 5fea73356e
2 changed files with 25 additions and 16 deletions

View File

@@ -211,9 +211,8 @@ public class PythonService {
throw new BusinessException("Generate Collocation exception!");
}
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(response));
Boolean result = jsonObject.getBoolean("successful");
if (result) {
Integer code = jsonObject.getInteger("code");
if (code != null && code == 200) {
System.out.println(bodyStr.trim());
// JSONObject jsonObject1 = JSONObject.parseObject(bodyStr.trim());
List<GenerateCollocationOutVO> collocationOutList = processJson(bodyStr.trim());

View File

@@ -1690,20 +1690,30 @@ public class TProductService extends ServiceImpl<TProductMapper, TProduct> {
data.forEach((k,v) -> {
JSONObject attributes = data.getJSONObject(k);
String item = attributes.getString("Item");
attributes.forEach((k1,v1) -> {
if (!k1.equals("Item")) {
TProductAttribute tProductAttribute = new TProductAttribute();
tProductAttribute.setProductId(Long.valueOf(k));
tProductAttribute.setAttributeType(k1);
JSONArray attributesArray = attributes.getJSONArray(k1);
if (attributesArray.size() > 0) {
tProductAttribute.setAttributeValue(attributesArray.getString(0));
tProductAttribute.setAttributeItem(item);
tProductAttribute.setCreateDate(DateUtil.getByTimeZone(timeZone));
result.add(tProductAttribute);
if (StringUtils.isEmpty(item)) {
TProductAttribute tProductAttribute = new TProductAttribute();
tProductAttribute.setProductId(Long.valueOf(k));
tProductAttribute.setAttributeType("Type");
tProductAttribute.setAttributeValue("Pants");
tProductAttribute.setAttributeItem("bottom");
tProductAttribute.setCreateDate(DateUtil.getByTimeZone(timeZone));
result.add(tProductAttribute);
}else {
attributes.forEach((k1,v1) -> {
if (!k1.equals("Item")) {
TProductAttribute tProductAttribute = new TProductAttribute();
tProductAttribute.setProductId(Long.valueOf(k));
tProductAttribute.setAttributeType(k1);
JSONArray attributesArray = attributes.getJSONArray(k1);
if (attributesArray.size() > 0) {
tProductAttribute.setAttributeValue(attributesArray.getString(0));
tProductAttribute.setAttributeItem(item);
tProductAttribute.setCreateDate(DateUtil.getByTimeZone(timeZone));
result.add(tProductAttribute);
}
}
}
});
});
}
});
return result;
// productIdToMap.getJSONObject("data").forEach((k, v) -> {