|
|
@@ -13,6 +13,7 @@ import cn.qinys.platform.openfeign.UpmsFeignClient;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import org.springframework.ai.chat.client.ChatClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
@@ -29,6 +30,9 @@ public class WishTreeServiceImpl implements WishTreeService {
|
|
|
|
|
|
@Resource
|
|
|
UpmsFeignClient upmsFeignClient;
|
|
|
+ @Resource
|
|
|
+ ChatClient chatClient;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Long createWishTree(WishingTreeCreateReq req) {
|
|
|
@@ -38,6 +42,11 @@ public class WishTreeServiceImpl implements WishTreeService {
|
|
|
Result<String> address = upmsFeignClient.getAddressByAltitudeAndLongitude(new GeoAddressReq(req.getLongitude(), req.getLatitude()));
|
|
|
tree.setAddress(address.getData());
|
|
|
}
|
|
|
+ String summary = this.getDescription(tree.getAddress());
|
|
|
+ tree.setSummary(summary);
|
|
|
+ if (!StringUtils.hasText(tree.getDescription())) {
|
|
|
+ tree.setDescription(summary);
|
|
|
+ }
|
|
|
wishingTreeMapper.insert(tree);
|
|
|
return tree.getId();
|
|
|
}
|
|
|
@@ -51,4 +60,13 @@ public class WishTreeServiceImpl implements WishTreeService {
|
|
|
.orderByDesc("id");
|
|
|
return wishingTreeMapper.selectTreePage(page, wrapper);
|
|
|
}
|
|
|
+
|
|
|
+ private String getDescription(String address) {
|
|
|
+ if (!StringUtils.hasText(address)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return chatClient.prompt().user(address).call().content();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|