From 065142057ba3983af899991085e37ac1ec502320 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 19 九月 2023 14:06:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java | 55 +++++++++++++++++++++++++++----------------------------
1 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
index cb494e3..6cd7616 100644
--- a/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/sy/service/impl/ArdSyCarServiceImpl.java
@@ -1,11 +1,11 @@
package com.ruoyi.sy.service.impl;
-import java.awt.geom.Point2D;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
+import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Predicate;
@@ -17,24 +17,22 @@
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.utils.gis.GisUtil;
+import com.ruoyi.utils.gis.Point;
import com.ruoyi.scheduling.domian.SchedulingParam;
import com.ruoyi.sy.domain.ArdSyCarDay;
import com.ruoyi.sy.mapper.ArdSyCarDayMapper;
-import com.ruoyi.utils.tools.GisTool;
+import com.ruoyi.utils.minio.MinioUtil;
import com.ruoyi.utils.websocket.util.WebSocketUtils;
-import com.ruoyi.device.hiksdk.config.MinioClientSingleton;
-import com.ruoyi.storage.minio.utils.MinioUtils;
import com.ruoyi.sy.domain.ArdSyUser;
import com.ruoyi.sy.gps31.PositionContainer;
import com.ruoyi.sy.mapper.ArdSyUserMapper;
-import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.common.core.domain.entity.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.utils.forest.SYClient;
import com.ruoyi.utils.result.Results;
import io.minio.GetPresignedObjectUrlArgs;
-import io.minio.ListObjectsArgs;
-import io.minio.PutObjectArgs;
import io.minio.Result;
import io.minio.http.Method;
import io.minio.messages.Item;
@@ -145,7 +143,7 @@
objectNames.add(ardSyCar.getCarPicture().split("/sycar/")[1]);
}
}
- MinioUtils.removeObjects("sycar", objectNames);
+ MinioUtil.removeObjects("sycar", objectNames);
return ardSyCarMapper.deleteArdSyCarByIds(ids);
}
@@ -262,12 +260,12 @@
@Override
public List<Map<String, String>> getAllCarModel() {
- boolean exsit = MinioUtils.exitsBucket("sycar");
+ boolean exsit = MinioUtil.exitsBucket("sycar");
if (exsit) {
List<Map<String, String>> listObjetcName = new ArrayList<>();
try {
- ListObjectsArgs listObjectsArgs = ListObjectsArgs.builder().prefix("carmodel/").bucket("sycar").build();
- Iterable<Result<Item>> myObjects = MinioClientSingleton.getMinioClient().listObjects(listObjectsArgs);
+ // ListObjectsArgs listObjectsArgs = ListObjectsArgs.builder().prefix("carmodel/").bucket("sycar").build();
+ Iterable<Result<Item>> myObjects = MinioUtil.getObjectsByBucket("sycar","carmodel");
for (Result<Item> result : myObjects) {
Item item = result.get();
Map<String, String> map = new HashMap();
@@ -330,16 +328,16 @@
if (ardSyCarr.getCarPicture() != null || !ardSyCarr.getCarPicture().equals("")) {
String objectName = ardSyCarr.getCarPicture().split("/sycar/")[1];
objectNames.add(objectName);
- MinioUtils.removeObjects("sycar", objectNames);
+ MinioUtil.removeObjects("sycar", objectNames);
}
}
//鍒ゆ柇鏂囦欢鏄惁涓虹┖
if (null == carPicture || 0 == carPicture.getSize()) {
return "";
}
- boolean exsit = MinioUtils.exitsBucket("sycar");
+ boolean exsit = MinioUtil.exitsBucket("sycar");
if (!exsit) {
- boolean bucket = MinioUtils.createBucket("sycar");
+ boolean bucket = MinioUtil.createBucket("sycar");
}
//鏂囦欢鍚�
String originalFilename = carPicture.getOriginalFilename();
@@ -348,14 +346,15 @@
try {
InputStream inputStream = carPicture.getInputStream();
/*涓婁紶瀵硅薄*/
- PutObjectArgs putObjectArgs = PutObjectArgs
- .builder()
- .bucket("sycar")
- .object(fileName)
- .stream(inputStream, carPicture.getSize(), -1)
- .contentType(carPicture.getContentType())
- .build();
- MinioClientSingleton.getMinioClient().putObject(putObjectArgs);
+// PutObjectArgs putObjectArgs = PutObjectArgs
+// .builder()
+// .bucket("sycar")
+// .object(fileName)
+// .stream(inputStream, carPicture.getSize(), -1)
+// .contentType(carPicture.getContentType())
+// .build();
+// MinioConfig.getMinioClient().putObject(putObjectArgs);
+ MinioUtil.uploadObject("sycar",fileName,inputStream,carPicture.getSize(),carPicture.getContentType());
inputStream.close();
/*鑾峰彇url*/
GetPresignedObjectUrlArgs getPresignedObjectUrlArgs = GetPresignedObjectUrlArgs
@@ -364,8 +363,8 @@
.object(fileName)
.method(Method.GET)
.build();
- String presignedObjectUrl = MinioClientSingleton.getMinioClient().getPresignedObjectUrl(getPresignedObjectUrlArgs);
- String ObjectUrl = presignedObjectUrl.substring(0, presignedObjectUrl.indexOf("?"));
+ //String presignedObjectUrl = MinioConfig.getMinioClient().getPresignedObjectUrl(getPresignedObjectUrlArgs);
+ String ObjectUrl = MinioUtil.getBucketObjectUrl("sycar", fileName);
if (id != null && !id.equals("")) {//id涓洪潪蹇呰
ArdSyCar ardSyCar = new ArdSyCar();
ardSyCar.setId(id);
@@ -1083,7 +1082,7 @@
List<Map<String, Object>> carGPSMap = (List<Map<String, Object>>) carGPSTrack.get("list");
Double lng = Double.valueOf((String) carGPSMap.get(0).get("lng"));
Double lat = Double.valueOf((String) carGPSMap.get(0).get("lat"));
- double distance = GisTool.getDistance( new double[]{longitude,latitude}, new double[]{lng, lat});
+ double distance = GisUtil.getDistance( new double[]{longitude,latitude}, new double[]{lng, lat});
if (distance <= radius) {
carMap.put("longitude",lng);
carMap.put("latitude",lat);
@@ -1099,7 +1098,7 @@
public List<Map<String, Object>> getNearCarWithPolygon(SchedulingParam param) {
List<Map<String, Object>> filteredList = new ArrayList<>();
try {
- List<Point2D> partitionLocation = param.getPartitionLocation();
+ List<Point> partitionLocation = param.getPartitionLocation();
if (partitionLocation == null) {
log.debug("澶氳竟褰㈠潗鏍囬泦鍚堜负绌�");
return null;
@@ -1141,8 +1140,8 @@
List<Map<String, Object>> carGPSMap = (List<Map<String, Object>>) carGPSTrack.get("list");
Double lng = Double.valueOf((String) carGPSMap.get(0).get("lng"));
Double lat = Double.valueOf((String) carGPSMap.get(0).get("lat"));
- Point2D point2D = new Point2D.Double(lng, lat);
- boolean inPolygon = GisTool.isInPolygon(point2D, partitionLocation);
+ Point point = new Point(lng,lat);
+ boolean inPolygon = GisUtil.isInPolygon(point, partitionLocation);
if (inPolygon) {
carMap.put("longitude", lng);
carMap.put("latitude", lat);
--
Gitblit v1.9.3