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!"); throw new BusinessException("Generate Collocation exception!");
} }
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(response)); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(response));
Boolean result = jsonObject.getBoolean("successful"); Integer code = jsonObject.getInteger("code");
if (code != null && code == 200) {
if (result) {
System.out.println(bodyStr.trim()); System.out.println(bodyStr.trim());
// JSONObject jsonObject1 = JSONObject.parseObject(bodyStr.trim()); // JSONObject jsonObject1 = JSONObject.parseObject(bodyStr.trim());
List<GenerateCollocationOutVO> collocationOutList = processJson(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) -> { data.forEach((k,v) -> {
JSONObject attributes = data.getJSONObject(k); JSONObject attributes = data.getJSONObject(k);
String item = attributes.getString("Item"); String item = attributes.getString("Item");
attributes.forEach((k1,v1) -> { if (StringUtils.isEmpty(item)) {
if (!k1.equals("Item")) { TProductAttribute tProductAttribute = new TProductAttribute();
TProductAttribute tProductAttribute = new TProductAttribute(); tProductAttribute.setProductId(Long.valueOf(k));
tProductAttribute.setProductId(Long.valueOf(k)); tProductAttribute.setAttributeType("Type");
tProductAttribute.setAttributeType(k1); tProductAttribute.setAttributeValue("Pants");
JSONArray attributesArray = attributes.getJSONArray(k1); tProductAttribute.setAttributeItem("bottom");
if (attributesArray.size() > 0) { tProductAttribute.setCreateDate(DateUtil.getByTimeZone(timeZone));
tProductAttribute.setAttributeValue(attributesArray.getString(0)); result.add(tProductAttribute);
tProductAttribute.setAttributeItem(item); }else {
tProductAttribute.setCreateDate(DateUtil.getByTimeZone(timeZone)); attributes.forEach((k1,v1) -> {
result.add(tProductAttribute); 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; return result;
// productIdToMap.getJSONObject("data").forEach((k, v) -> { // productIdToMap.getJSONObject("data").forEach((k, v) -> {