Browse Source

1.预警中添加sse触发、丰县逻辑修改

2.minio图片保存问题修复
pull/7/head
时子升 2 weeks ago
parent
commit
9d49aaee57
  1. 6
      dk-common/common-oss/src/main/java/org/dromara/common/oss/core/OssClient.java
  2. 5
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java
  3. 6
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfo.java
  4. 2
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java
  5. 7
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoVo.java
  6. 54
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java
  7. 16
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java
  8. 3
      dk-modules/business/src/main/java/org/dromara/business/utils/constants/MinIOConstants.java
  9. 4
      dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceServiceImpl.java
  10. 1
      dk-modules/sample/src/main/java/org/dromara/sample/media/service/IFileService.java
  11. 33
      dk-modules/sample/src/main/java/org/dromara/sample/media/service/impl/FileServiceImpl.java
  12. 17
      dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java
  13. 1
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemotePostServiceImpl.java

6
dk-common/common-oss/src/main/java/org/dromara/common/oss/core/OssClient.java

@ -363,6 +363,11 @@ public class OssClient {
return url; return url;
} }
//自定义上传prefix路径
public UploadResult uploadPrefix(byte[] data, String prefix, String suffix,String fileName, String contentType) {
return upload(new ByteArrayInputStream(data), getPath(prefix, suffix,fileName), Long.valueOf(data.length), contentType);
}
/** /**
* 上传 byte[] 数据到 Amazon S3使用指定的后缀构造对象键 * 上传 byte[] 数据到 Amazon S3使用指定的后缀构造对象键
* *
@ -649,4 +654,5 @@ public class OssClient {
return policy.replaceAll("bucketName", bucketName); return policy.replaceAll("bucketName", bucketName);
} }
} }

5
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java

@ -264,6 +264,11 @@ public class BusinessAlert {
@TableField(exist = false) @TableField(exist = false)
private String icon; private String icon;
@TableField(exist = false)
private String postCategory; //类别编码,用来过滤预警查询返回值(南通的查询南通类,丰县查询丰县)
/** /**
* 无人机方向 * 无人机方向
*/ */

6
dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfo.java

@ -4,8 +4,10 @@ import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import java.io.Serial; import java.io.Serial;
import java.util.List;
/** /**
* 预警任务-施工信息对象 business_alert_construct_info * 预警任务-施工信息对象 business_alert_construct_info
@ -83,4 +85,8 @@ public class BusinessAlertConstructInfo extends TenantEntity {
private String remark; private String remark;
@TableField(exist = false)
private List<BusinessAlertConstructInfoOss> alertConstructInfoOssList;
} }

2
dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java

@ -272,4 +272,6 @@ public class BusinessAlertBo {
*/ */
private String gimbalPitch; private String gimbalPitch;
private String postCategory; //类别编码,用来过滤预警查询返回值(南通的查询南通类,丰县查询丰县)
} }

7
dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoVo.java

@ -7,11 +7,12 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert; import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
@ -29,7 +30,7 @@ public class BusinessAlertConstructInfoVo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
@ExcelProperty(value = "") @ExcelProperty(value = "")
private Long id; private Long id;
@ -100,5 +101,7 @@ public class BusinessAlertConstructInfoVo implements Serializable {
@ExcelProperty(value = "备注") @ExcelProperty(value = "备注")
private String remark; private String remark;
private List<BusinessAlertConstructInfoOss> alertConstructInfoOssList;//文件列表
} }

54
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java

@ -3,6 +3,7 @@ package org.dromara.business.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil; import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
@ -19,6 +20,7 @@ import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.dromara.business.api.domain.bo.RemoteBusinessAlertBo; import org.dromara.business.api.domain.bo.RemoteBusinessAlertBo;
import org.dromara.business.api.domain.vo.RemoteBusinessAlertConstructInfo; import org.dromara.business.api.domain.vo.RemoteBusinessAlertConstructInfo;
import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo; import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo;
@ -43,11 +45,14 @@ import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.resource.api.RemoteMessageService;
import org.dromara.system.api.RemoteLabelPostService; import org.dromara.system.api.RemoteLabelPostService;
import org.dromara.system.api.RemoteSubmailConfigService; import org.dromara.system.api.RemoteSubmailConfigService;
import org.dromara.system.api.RemoteUserService; import org.dromara.system.api.RemoteUserService;
import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo;
import org.dromara.system.api.domain.vo.RemoteUserVo; import org.dromara.system.api.domain.vo.RemoteUserVo;
import org.dromara.business.domain.BusinessAlertConstructInfoOss;
import org.dromara.business.mapper.BusinessAlertConstructInfoOssMapper;
import org.dromara.workflow.api.RemoteWorkflowService; import org.dromara.workflow.api.RemoteWorkflowService;
import org.dromara.workflow.api.domain.RemoteStartProcess; import org.dromara.workflow.api.domain.RemoteStartProcess;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -67,6 +72,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -85,6 +91,7 @@ import java.util.Base64;
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
@Slf4j @Slf4j
@DubboService
public class BusinessAlertServiceImpl implements IBusinessAlertService { public class BusinessAlertServiceImpl implements IBusinessAlertService {
private final BusinessAlertMapper baseMapper; private final BusinessAlertMapper baseMapper;
@ -94,6 +101,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
@Autowired @Autowired
private BusinessAlertConstructInfoMapper businessAlertConstructInfoMapper; private BusinessAlertConstructInfoMapper businessAlertConstructInfoMapper;
@Autowired
private BusinessAlertConstructInfoOssMapper businessAlertConstructInfoOssMapper;
@DubboReference(timeout = 30000) @DubboReference(timeout = 30000)
RemoteWorkflowService remoteWorkflowService; RemoteWorkflowService remoteWorkflowService;
@ -109,6 +119,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
@Autowired @Autowired
FeignDeviceGroup feignDeviceGroup; FeignDeviceGroup feignDeviceGroup;
@DubboReference
private final RemoteMessageService remoteMessageService;
/** /**
* 新增预警任务 * 新增预警任务
* *
@ -197,6 +210,25 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
map.put("jobName",alert.getJobName()); map.put("jobName",alert.getJobName());
noticeList.add(map); noticeList.add(map);
remoteStartProcessList.add(startProcess); remoteStartProcessList.add(startProcess);
//推送消息-基于部门-找用户 发送json格式
ArrayList<Long> deptIds = new ArrayList<>();
deptIds.add(Long.parseLong(alert.getDeptId()));
List<RemoteUserVo> remoteUserVos = remoteUserService.selectUsersByDeptIds(deptIds);
List<Long> userIds = remoteUserVos.stream().map(RemoteUserVo::getUserId).collect(Collectors.toList());
JSONObject jsonObject = new JSONObject();
String imagePreviewUrl = MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, alertVo.getImages(), 3600).toString();
jsonObject.put("deptId", alert.getDeptId());
jsonObject.put("deptName", alert.getDeptName());
jsonObject.put("images", imagePreviewUrl);
jsonObject.put("labelCn", alert.getLabelCn());
jsonObject.put("lat", alert.getLat());
jsonObject.put("lng", alert.getLng());
jsonObject.put("createTime", ObjectUtil.isNotEmpty(alert.getCreateTime()) ? alert.getCreateTime() : new Date());
jsonObject.put("jobName", alert.getJobName());
remoteMessageService.publishMessage(userIds, jsonObject.toString() );
System.out.println("已发送:"+ "预警内容:"+ jsonObject.toString());
} }
int startIndex = 0; // 从第 0 条开始 int startIndex = 0; // 从第 0 条开始
@ -207,6 +239,14 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
}); });
remoteSubmailConfigService.remoteSend("smsMultixsend",noticeList); remoteSubmailConfigService.remoteSend("smsMultixsend",noticeList);
//推送消息-基于部门-找用户-批量
// List<String> deptStrIds = alertVoList.stream().map(BusinessAlertVo::getDeptId).distinct().collect(Collectors.toList());
// List<Long> deptIds = deptStrIds.stream().map(Long::parseLong).collect(Collectors.toList());
// List<RemoteUserVo> remoteUserVos = remoteUserService.selectUsersByDeptIds(deptIds);
// List<Long> userIds = remoteUserVos.stream().map(RemoteUserVo::getUserId).collect(Collectors.toList());
//
// remoteMessageService.publishMessage(userIds, "预警");
} }
/** /**
@ -534,9 +574,23 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
LambdaQueryWrapper<BusinessAlertConstructInfo> qw = new LambdaQueryWrapper<BusinessAlertConstructInfo>(); LambdaQueryWrapper<BusinessAlertConstructInfo> qw = new LambdaQueryWrapper<BusinessAlertConstructInfo>();
qw.in(BusinessAlertConstructInfo::getBusinessAlertId, alertIds); qw.in(BusinessAlertConstructInfo::getBusinessAlertId, alertIds);
List<BusinessAlertConstructInfoVo> constructInfoVoList = businessAlertConstructInfoMapper.selectVoList(qw,BusinessAlertConstructInfoVo.class); List<BusinessAlertConstructInfoVo> constructInfoVoList = businessAlertConstructInfoMapper.selectVoList(qw,BusinessAlertConstructInfoVo.class);
List<Long> constructInfoIds = constructInfoVoList.stream().map(BusinessAlertConstructInfoVo::getId).collect(Collectors.toList());
List<BusinessAlertConstructInfoOss> alertConstructInfoOssList = new ArrayList<>();
if(!constructInfoIds.isEmpty()){
LambdaQueryWrapper<BusinessAlertConstructInfoOss> alertConstructOssQw = new LambdaQueryWrapper<>();
alertConstructOssQw.in(BusinessAlertConstructInfoOss::getAlertConstructInfoId,constructInfoIds);
alertConstructInfoOssList = businessAlertConstructInfoOssMapper.selectVoList(alertConstructOssQw, BusinessAlertConstructInfoOss.class);
}
for (BusinessAlert record : page.getRecords()) { for (BusinessAlert record : page.getRecords()) {
BusinessAlertConstructInfoVo businessAlertConstructInfoVo = constructInfoVoList.stream().filter(item -> item.getBusinessAlertId().equals(record.getId())).findFirst().orElse(null); BusinessAlertConstructInfoVo businessAlertConstructInfoVo = constructInfoVoList.stream().filter(item -> item.getBusinessAlertId().equals(record.getId())).findFirst().orElse(null);
if(ObjectUtil.isNotNull(businessAlertConstructInfoVo)){
List<BusinessAlertConstructInfoOss> constructInfoOssList = alertConstructInfoOssList.stream().filter(item -> item.getAlertConstructInfoId().equals(businessAlertConstructInfoVo.getId())).collect(Collectors.toList());
businessAlertConstructInfoVo.setAlertConstructInfoOssList(constructInfoOssList);
}
record.setAlertConstructInfoVo(businessAlertConstructInfoVo); record.setAlertConstructInfoVo(businessAlertConstructInfoVo);
} }
} }

16
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java

@ -428,6 +428,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//查询所有的职能岗位 //查询所有的职能岗位
List<RemotePostVo> postVoList = remotePostService.listPost(); List<RemotePostVo> postVoList = remotePostService.listPost();
postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则 postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则
//基于类别编码postCategory过滤返回值:区分南通 / 丰县等部门数据 【postCategory不能为空再过滤数据】
if(StrUtil.isNotEmpty(businessAlertBo.getPostCategory()) ){
postVoList = postVoList.stream().filter(item -> StrUtil.equals(businessAlertBo.getPostCategory(), item.getPostCategory())).toList();
}
if (ObjectUtil.isEmpty(postVoList)) { if (ObjectUtil.isEmpty(postVoList)) {
return ListUtil.empty(); return ListUtil.empty();
@ -457,6 +461,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//查询所有的职能岗位 //查询所有的职能岗位
List<RemotePostVo> postVoList = remotePostService.listPost(); List<RemotePostVo> postVoList = remotePostService.listPost();
postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则 postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则
//基于类别编码postCategory过滤返回值:区分南通 / 丰县等部门数据 【postCategory不能为空再过滤数据】
if(StrUtil.isNotEmpty(businessAlertBo.getPostCategory()) ){
postVoList = postVoList.stream().filter(item -> StrUtil.equals(businessAlertBo.getPostCategory(), item.getPostCategory())).toList();
}
List<StatObj> result = new ArrayList<>(); List<StatObj> result = new ArrayList<>();
@ -507,6 +515,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//查询所有的职能岗位 //查询所有的职能岗位
List<RemotePostVo> postVoList = remotePostService.listPost(); List<RemotePostVo> postVoList = remotePostService.listPost();
postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则 postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则
//基于类别编码postCategory过滤返回值:区分南通 / 丰县等部门数据 【postCategory不能为空再过滤数据】
if(StrUtil.isNotEmpty(businessAlertBo.getPostCategory()) ){
postVoList = postVoList.stream().filter(item -> StrUtil.equals(businessAlertBo.getPostCategory(), item.getPostCategory())).toList();
}
List<StatObj> result = new ArrayList<>(); List<StatObj> result = new ArrayList<>();
if (ObjectUtil.isEmpty(postVoList)) { if (ObjectUtil.isEmpty(postVoList)) {
@ -547,6 +559,10 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist
//查询所有的职能岗位 //查询所有的职能岗位
List<RemotePostVo> postVoList = remotePostService.listPost(); List<RemotePostVo> postVoList = remotePostService.listPost();
postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则 postVoList = postVoList.stream().filter(item -> StrUtil.equals("0",item.getStatus())).toList();//剔除禁用规则
//基于类别编码postCategory过滤返回值:区分南通 / 丰县等部门数据 【postCategory不能为空再过滤数据】
if(StrUtil.isNotEmpty(businessAlertBo.getPostCategory()) ){
postVoList = postVoList.stream().filter(item -> StrUtil.equals(businessAlertBo.getPostCategory(), item.getPostCategory())).toList();
}
List<String> monthList = getLastSixMonths(); List<String> monthList = getLastSixMonths();

3
dk-modules/business/src/main/java/org/dromara/business/utils/constants/MinIOConstants.java

@ -17,4 +17,7 @@ public interface MinIOConstants {
String BUCKET_ALERT = "alert"; String BUCKET_ALERT = "alert";
//桶名称 图斑 //桶名称 图斑
String BUCKET_PATTERN = "pattern"; String BUCKET_PATTERN = "pattern";
//南通-丰县Buskcet
String BUCKET_NANTONG = "nantongsitebucket";
} }

4
dk-modules/sample/src/main/java/org/dromara/sample/manage/service/impl/DeviceServiceImpl.java

@ -57,6 +57,7 @@ import org.springframework.util.StringUtils;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -247,6 +248,9 @@ public class DeviceServiceImpl implements IDeviceService {
if(proIds == null){ if(proIds == null){
proIds = deviceProService.listDeviceGroup(loginUser.getUserId()); proIds = deviceProService.listDeviceGroup(loginUser.getUserId());
} }
if(ObjectUtil.isEmpty(proIds)){
return new ArrayList<DeviceDTO>();
}
List<DeviceDTO> devicesList = this.getDevicesByParams( List<DeviceDTO> devicesList = this.getDevicesByParams(
DeviceQueryParam.builder() DeviceQueryParam.builder()
.workspaceId(workspaceId) .workspaceId(workspaceId)

1
dk-modules/sample/src/main/java/org/dromara/sample/media/service/IFileService.java

@ -88,6 +88,7 @@ public interface IFileService {
List<MediaFileDTO> getMediaFileDTO( String jobId,String fileType); List<MediaFileDTO> getMediaFileDTO( String jobId,String fileType);
String copyFile(String sourceBucket, String originFileUrl, String targetBucket); String copyFile(String sourceBucket, String originFileUrl, String targetBucket);
String copyFileHttp(String fileUrl, String originFileUrl, String bucketDkcy);
Double getGimbalYawDegree(String fileId); Double getGimbalYawDegree(String fileId);
} }

33
dk-modules/sample/src/main/java/org/dromara/sample/media/service/impl/FileServiceImpl.java

@ -1,11 +1,14 @@
package org.dromara.sample.media.service.impl; package org.dromara.sample.media.service.impl;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.dromara.common.core.utils.file.MimeTypeUtils;
import org.dromara.common.oss.core.OssClient; import org.dromara.common.oss.core.OssClient;
import org.dromara.common.oss.entity.UploadResult;
import org.dromara.common.oss.factory.OssFactory; import org.dromara.common.oss.factory.OssFactory;
import org.dromara.common.redis.utils.RedisOpsUtils; import org.dromara.common.redis.utils.RedisOpsUtils;
import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.satoken.utils.LoginHelper;
@ -29,8 +32,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.net.URLConnection;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -202,6 +208,33 @@ public class FileServiceImpl implements IFileService {
return fileUrl; return fileUrl;
} }
@Override
public String copyFileHttp(String aliyunUrl, String originFileUrl, String minioBucket) {
try {
URL url = new URL(aliyunUrl);
URLConnection conn = url.openConnection();
conn.setConnectTimeout(3_500);
conn.setReadTimeout(3_500);
InputStream inputStream = conn.getInputStream();
long fileSize = conn.getContentLengthLong();
String fileName = FileUtil.getName(url.getPath());
// String path = url.getPath().replace(fileName, deviceSn+ fileName); // eg: /ai/report/29847/{deviceSn+xxx.jpg}
// String originalFileName = path.substring(path.lastIndexOf("/") + 1); // qwfbGaBixI.jpg
// String suffix = originalFileName.contains(".") ? originalFileName.substring(originalFileName.lastIndexOf(".")) : ".jpg"; // fallback
// String newFileName = IdUtils.fastUUID() + suffix;
OssClient minioClient = OssFactory.instance(minioBucket);
UploadResult result = minioClient.upload(inputStream, originFileUrl, fileSize, MimeTypeUtils.IMAGE_JPG);
// MinioUtil.uploadFile(path,inputStream,);
inputStream.close();
return result.getUrl(); // 返回 MinIO 的访问地址
} catch (IOException e) {
throw new RuntimeException("上传图片失败", e);
}
}
@Override @Override
public Double getGimbalYawDegree(String fileId) { public Double getGimbalYawDegree(String fileId) {
LambdaQueryWrapper<MediaFileEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MediaFileEntity> wrapper = new LambdaQueryWrapper<>();

17
dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java

@ -214,7 +214,7 @@ public class AiCompareServiceImpl implements IAiCompareService {
aiCompareEntity.setId(frameDTO.getCompareId()); aiCompareEntity.setId(frameDTO.getCompareId());
aiCompareMapper.updateById(aiCompareEntity); aiCompareMapper.updateById(aiCompareEntity);
frameDTO.setJobName(aiCompareEntity.getJobName()); frameDTO.setJobName(aiCompareEntity.getJobName());
String originFileUrl = frameDTO.getFileUrl(); String originFileUrl = frameDTO.getFileUrl();//waiwang/b0c5dc04-6232-4762-b748-16f8e6ea04ed/DJI_202506010857_001_b0c5dc04-6232-4762-b748-16f8e6ea04ed/DJI_20250601085925_0001_V.jpeg
String fileUrl = fileService.getObjectUrlOne(MinIOConstants.BUCKET_MEDIAFILE, originFileUrl, 3600).toString(); String fileUrl = fileService.getObjectUrlOne(MinIOConstants.BUCKET_MEDIAFILE, originFileUrl, 3600).toString();
frameDTO.setFileUrl(fileUrl); frameDTO.setFileUrl(fileUrl);
String originMateFileUrl = frameDTO.getMateFileUrl(); String originMateFileUrl = frameDTO.getMateFileUrl();
@ -234,9 +234,20 @@ public class AiCompareServiceImpl implements IAiCompareService {
//图片处理 //图片处理
// fileService.get(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, 3600); // fileService.get(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, 3600);
//复制原图到指定bucket //复制原图到指定bucket //mediafile
String copyFileUrl = fileService.copyFile(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, MinIOConstants.BUCKET_DKCY); // originMateFileUrl:waiwang/b9e5ae94-e290-43af-9f66-12031580aba1/DJI_202506020949_001_b9e5ae94-e290-43af-9f66-12031580aba1/DJI_20250602095106_0001_V.jpeg
String linkType = "";
if(StrUtil.startWith(fileUrl,"http")){
linkType = "http";
//http://yq-dajiang.oss-cn-hangzhou.aliyuncs.com/waiwang/56055519-3189-4af9-b4ea-56fe06df3082/DJI_202506010952_001_56055519-3189-4af9-b4ea-56fe06df3082/DJI_20250601100131_0001_V.jpeg
String fileUrlStr = fileService.copyFileHttp(fileUrl, originFileUrl, MinIOConstants.BUCKET_DKCY);
String fileMateUrlStr = fileService.copyFileHttp(mateFileUrl, originMateFileUrl, MinIOConstants.BUCKET_DKCY);
}else{
String copyFileUrl = fileService.copyFile(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, MinIOConstants.BUCKET_DKCY);
// String copyFileUrl = fileService.copyFile(MinIOConstants.BUCKET_MEDIAFILE, originFileUrl, MinIOConstants.BUCKET_ALERT); // String copyFileUrl = fileService.copyFile(MinIOConstants.BUCKET_MEDIAFILE, originFileUrl, MinIOConstants.BUCKET_ALERT);
}
ArrayList<RemoteBusinessAlertVo> alertVoList = new ArrayList<>(); ArrayList<RemoteBusinessAlertVo> alertVoList = new ArrayList<>();
//手动简化逻辑,上传图片 //手动简化逻辑,上传图片
int frameCount =0; int frameCount =0;

1
dk-modules/system/src/main/java/org/dromara/system/dubbo/RemotePostServiceImpl.java

@ -41,6 +41,7 @@ public class RemotePostServiceImpl implements RemotePostService {
remotePostVo.setPostName(aiLabel.getPostName()); remotePostVo.setPostName(aiLabel.getPostName());
remotePostVo.setPostCode(aiLabel.getPostCode()); remotePostVo.setPostCode(aiLabel.getPostCode());
remotePostVo.setStatus(aiLabel.getStatus()); remotePostVo.setStatus(aiLabel.getStatus());
remotePostVo.setPostCategory(aiLabel.getPostCategory());
return remotePostVo; return remotePostVo;
}) })
.collect(Collectors.toList()); .collect(Collectors.toList());

Loading…
Cancel
Save