|
|
@@ -21,6 +21,7 @@ import org.springframework.ai.chat.client.ChatClient;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
@@ -92,12 +93,14 @@ public class TreeServiceImpl implements TreeService {
|
|
|
return (int) Math.round(EARTH_RADIUS * c);
|
|
|
}
|
|
|
|
|
|
- @Async("mobileTaskExecutor")
|
|
|
+
|
|
|
@Override
|
|
|
public void create(TreeCreateReq req) {
|
|
|
+ // 前端传入的是 WGS-84 坐标(天地图 img_w),DB 存储 GCJ-02,需转换
|
|
|
+ double[] gcj = CoordUtil.wgs84ToGcj02(req.getLongitude().doubleValue(), req.getLatitude().doubleValue());
|
|
|
TreeAddressReq addressReq = new TreeAddressReq();
|
|
|
- addressReq.setLatitude(req.getLatitude());
|
|
|
- addressReq.setLongitude(req.getLongitude());
|
|
|
+ addressReq.setLatitude(BigDecimal.valueOf(gcj[1]));
|
|
|
+ addressReq.setLongitude(BigDecimal.valueOf(gcj[0]));
|
|
|
String address = upmsFeignClient.getAddressByAltitudeAndLongitude(addressReq).getData();
|
|
|
String description = this.getDescription(address);
|
|
|
WishingTree tree = new WishingTree();
|
|
|
@@ -105,8 +108,8 @@ public class TreeServiceImpl implements TreeService {
|
|
|
tree.setAddress(address);
|
|
|
tree.setDescription(description);
|
|
|
tree.setSummary(description);
|
|
|
- tree.setLongitude(req.getLongitude());
|
|
|
- tree.setLatitude(req.getLatitude());
|
|
|
+ tree.setLongitude(BigDecimal.valueOf(gcj[0]));
|
|
|
+ tree.setLatitude(BigDecimal.valueOf(gcj[1]));
|
|
|
tree.setRadius(req.getRadius() != null ? req.getRadius() : 100);
|
|
|
tree.setCoverImage(req.getCoverImage());
|
|
|
tree.setIsActive(1);
|