Browse Source

预警信息扩展-提交预警记录+文件

pull/6/head
时子升 1 month ago
parent
commit
f3b0e734e8
  1. 3
      dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java
  2. 85
      dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertConstructInfo.java
  3. 4
      dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertVo.java
  4. 106
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoController.java
  5. 86
      dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlertConstructInfo.java
  6. 87
      dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoBo.java
  7. 104
      dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertConstructInfoVo.java
  8. 4
      dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java
  9. 15
      dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoMapper.java
  10. 69
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoService.java
  11. 2
      dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java
  12. 138
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoServiceImpl.java
  13. 42
      dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java
  14. 183
      dk-modules/business/src/main/java/org/dromara/business/utils/MinioUtil.java
  15. 7
      dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoMapper.xml
  16. 2
      dk-modules/sample/src/main/java/org/dromara/sample/media/service/IFileService.java
  17. 17
      dk-modules/sample/src/main/java/org/dromara/sample/media/service/impl/FileServiceImpl.java
  18. 183
      dk-modules/sample/src/main/java/org/dromara/sample/utils/MinioUtil.java
  19. 123
      dk-modules/sample/src/main/java/org/dromara/sample/wayline/service/impl/AiCompareServiceImpl.java

3
dk-api/api-business/src/main/java/org/dromara/business/api/RemoteBusinessAlertService.java

@ -16,8 +16,9 @@ public interface RemoteBusinessAlertService {
/**
* 生成预警待验证状态
* activeProfile :用于处理南通/丰县数据类型 default是原始处理流如果非default就会将businessType处理为2
*/
Boolean saveBusinessAlert(List<RemoteBusinessAlertVo> alertVoList);
Boolean saveBusinessAlert(List<RemoteBusinessAlertVo> alertVoList,String activeProfile);
/**
* 更新此条预警审批时候的状态
* @param businessId 业务id(预警工单)

85
dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertConstructInfo.java

@ -0,0 +1,85 @@
package org.dromara.business.api.domain.vo;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 预警任务-施工信息对象 business_alert_construct_info
*
* @author szs
* @date 2025-05-21
*/
@Data
public class RemoteBusinessAlertConstructInfo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
private String tenantId;
/**
* 1:图片比对预警 2AI实时预警
*/
private Long businessType;
/**
* job任务id
*/
private String jobId;
/**
* 预警名称
*/
private String jobName;
/**
* 预警任务id
*/
private Long businessAlertId;
/**
* 施工名称
*/
private String constructName;
/**
* 施工单位
*/
private String constructDept;
/**
* 施工单位负责人
*/
private String constructLeader;
/**
* 联系电话
*/
private String phonenumber;
/**
* 施工地址
*/
private String address;
/**
* 所属管道
*/
private String pipeline;
/**
* 备注
*/
private String remark;
}

4
dk-api/api-business/src/main/java/org/dromara/business/api/domain/vo/RemoteBusinessAlertVo.java

@ -189,5 +189,9 @@ public class RemoteBusinessAlertVo implements Serializable {
*/
private Integer handleSource;
//预警扩展施工信息
private RemoteBusinessAlertConstructInfo remoteAlertConstructInfo;
// private Map<String,Object> infoMap;
}

106
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertConstructInfoController.java

@ -0,0 +1,106 @@
package org.dromara.business.controller;
import java.util.List;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo;
import org.dromara.business.domain.bo.BusinessAlertConstructInfoBo;
import org.dromara.business.service.IBusinessAlertConstructInfoService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
/**
* 预警任务-施工信息
* 前端访问路由地址为:/business/alertConstructInfo
*
* @author szs
* @date 2025-05-21
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/alertConstructInfo")
public class BusinessAlertConstructInfoController extends BaseController {
private final IBusinessAlertConstructInfoService businessAlertConstructInfoService;
/**
* 查询预警任务-施工信息列表
*/
@SaCheckPermission("business:businessAlertConstructInfo:list")
@GetMapping("/list")
public TableDataInfo<BusinessAlertConstructInfoVo> list(BusinessAlertConstructInfoBo bo, PageQuery pageQuery) {
return businessAlertConstructInfoService.queryPageList(bo, pageQuery);
}
/**
* 导出预警任务-施工信息列表
*/
@SaCheckPermission("business:businessAlertConstructInfo:export")
@Log(title = "预警任务-施工信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(BusinessAlertConstructInfoBo bo, HttpServletResponse response) {
List<BusinessAlertConstructInfoVo> list = businessAlertConstructInfoService.queryList(bo);
ExcelUtil.exportExcel(list, "预警任务-施工信息", BusinessAlertConstructInfoVo.class, response);
}
/**
* 获取预警任务-施工信息详细信息
*
* @param id 主键
*/
@SaCheckPermission("business:businessAlertConstructInfo:query")
@GetMapping("/{id}")
public R<BusinessAlertConstructInfoVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(businessAlertConstructInfoService.queryById(id));
}
/**
* 新增预警任务-施工信息
*/
@SaCheckPermission("business:businessAlertConstructInfo:add")
@Log(title = "预警任务-施工信息", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusinessAlertConstructInfoBo bo) {
return toAjax(businessAlertConstructInfoService.insertByBo(bo));
}
/**
* 修改预警任务-施工信息
*/
@SaCheckPermission("business:businessAlertConstructInfo:edit")
@Log(title = "预警任务-施工信息", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusinessAlertConstructInfoBo bo) {
return toAjax(businessAlertConstructInfoService.updateByBo(bo));
}
/**
* 删除预警任务-施工信息
*
* @param ids 主键串
*/
@SaCheckPermission("business:businessAlertConstructInfo:remove")
@Log(title = "预警任务-施工信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
return toAjax(businessAlertConstructInfoService.deleteWithValidByIds(List.of(ids), true));
}
}

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

@ -0,0 +1,86 @@
package org.dromara.business.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 预警任务-施工信息对象 business_alert_construct_info
*
* @author szs
* @date 2025-05-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("business_alert_construct_info")
public class BusinessAlertConstructInfo extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "id")
private Long id;
/**
* 1:图片比对预警 2AI实时预警
*/
private Long businessType;
/**
* job任务id
*/
private String jobId;
/**
* 预警名称
*/
private String jobName;
/**
* 预警任务id
*/
private Long businessAlertId;
/**
* 施工名称
*/
private String constructName;
/**
* 施工单位
*/
private String constructDept;
/**
* 施工单位负责人
*/
private String constructLeader;
/**
* 联系电话
*/
private String phonenumber;
/**
* 施工地址
*/
private String address;
/**
* 所属管道
*/
private String pipeline;
/**
* 备注
*/
private String remark;
}

87
dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertConstructInfoBo.java

@ -0,0 +1,87 @@
package org.dromara.business.domain.bo;
import org.dromara.business.domain.BusinessAlertConstructInfo;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 预警任务-施工信息业务对象 business_alert_construct_info
*
* @author szs
* @date 2025-05-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = BusinessAlertConstructInfo.class, reverseConvertGenerate = false)
public class BusinessAlertConstructInfoBo extends BaseEntity {
/**
*
*/
@NotNull(message = "不能为空", groups = { EditGroup.class })
private Long id;
/**
* 1:图片比对预警 2AI实时预警
*/
private Long businessType;
/**
* job任务id
*/
private String jobId;
/**
* 预警名称
*/
private String jobName;
/**
* 预警任务id
*/
@NotNull(message = "预警任务id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long businessAlertId;
/**
* 施工名称
*/
@NotBlank(message = "施工名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String constructName;
/**
* 施工单位
*/
private String constructDept;
/**
* 施工单位负责人
*/
private String constructLeader;
/**
* 联系电话
*/
private String phonenumber;
/**
* 施工地址
*/
private String address;
/**
* 所属管道
*/
private String pipeline;
/**
* 备注
*/
private String remark;
}

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

@ -0,0 +1,104 @@
package org.dromara.business.domain.vo;
import org.dromara.business.domain.BusinessAlertConstructInfo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 预警任务-施工信息视图对象 business_alert_construct_info
*
* @author szs
* @date 2025-05-21
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BusinessAlertConstructInfo.class)
public class BusinessAlertConstructInfoVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "")
private Long id;
/**
* 1:图片比对预警 2AI实时预警
*/
@ExcelProperty(value = "1:图片比对预警 2:AI实时预警")
private Long businessType;
/**
* job任务id
*/
@ExcelProperty(value = "job任务id")
private String jobId;
/**
* 预警名称
*/
@ExcelProperty(value = "预警名称")
private String jobName;
/**
* 预警任务id
*/
@ExcelProperty(value = "预警任务id")
private Long businessAlertId;
/**
* 施工名称
*/
@ExcelProperty(value = "施工名称")
private String constructName;
/**
* 施工单位
*/
@ExcelProperty(value = "施工单位")
private String constructDept;
/**
* 施工单位负责人
*/
@ExcelProperty(value = "施工单位负责人")
private String constructLeader;
/**
* 联系电话
*/
@ExcelProperty(value = "联系电话")
private String phonenumber;
/**
* 施工地址
*/
@ExcelProperty(value = "施工地址")
private String address;
/**
* 所属管道
*/
@ExcelProperty(value = "所属管道")
private String pipeline;
/**
* 备注
*/
@ExcelProperty(value = "备注")
private String remark;
}

4
dk-modules/business/src/main/java/org/dromara/business/dubbo/RemoteBusinessAlertServiceImpl.java

@ -29,8 +29,8 @@ public class RemoteBusinessAlertServiceImpl implements RemoteBusinessAlertServic
@Override
public Boolean saveBusinessAlert(List<RemoteBusinessAlertVo> alertVoList) {
return businessAlertService.batchAddBusinessAlert(alertVoList);
public Boolean saveBusinessAlert(List<RemoteBusinessAlertVo> alertVoList, String activeProfile) {
return businessAlertService.batchAddBusinessAlert(alertVoList, activeProfile);
}
/**

15
dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertConstructInfoMapper.java

@ -0,0 +1,15 @@
package org.dromara.business.mapper;
import org.dromara.business.domain.BusinessAlertConstructInfo;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 预警任务-施工信息Mapper接口
*
* @author szs
* @date 2025-05-21
*/
public interface BusinessAlertConstructInfoMapper extends BaseMapperPlus<BusinessAlertConstructInfo, BusinessAlertConstructInfoVo> {
}

69
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertConstructInfoService.java

@ -0,0 +1,69 @@
package org.dromara.business.service;
import org.dromara.business.domain.BusinessAlertConstructInfo;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo;
import org.dromara.business.domain.bo.BusinessAlertConstructInfoBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 预警任务-施工信息Service接口
*
* @author szs
* @date 2025-05-21
*/
public interface IBusinessAlertConstructInfoService {
/**
* 查询预警任务-施工信息
*
* @param id 主键
* @return 预警任务-施工信息
*/
BusinessAlertConstructInfoVo queryById(Long id);
/**
* 分页查询预警任务-施工信息列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 预警任务-施工信息分页列表
*/
TableDataInfo<BusinessAlertConstructInfoVo> queryPageList(BusinessAlertConstructInfoBo bo, PageQuery pageQuery);
/**
* 查询符合条件的预警任务-施工信息列表
*
* @param bo 查询条件
* @return 预警任务-施工信息列表
*/
List<BusinessAlertConstructInfoVo> queryList(BusinessAlertConstructInfoBo bo);
/**
* 新增预警任务-施工信息
*
* @param bo 预警任务-施工信息
* @return 是否新增成功
*/
Boolean insertByBo(BusinessAlertConstructInfoBo bo);
/**
* 修改预警任务-施工信息
*
* @param bo 预警任务-施工信息
* @return 是否修改成功
*/
Boolean updateByBo(BusinessAlertConstructInfoBo bo);
/**
* 校验并批量删除预警任务-施工信息信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

2
dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java

@ -47,7 +47,7 @@ public interface IBusinessAlertService {
* @param alertVoList 预警任务
* @return 是否新增成功
*/
Boolean batchAddBusinessAlert(List<RemoteBusinessAlertVo> alertVoList);
Boolean batchAddBusinessAlert(List<RemoteBusinessAlertVo> alertVoList, String activeProfile);
/**
* 修改预警任务

138
dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertConstructInfoServiceImpl.java

@ -0,0 +1,138 @@
package org.dromara.business.service.impl;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.dromara.business.domain.bo.BusinessAlertConstructInfoBo;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo;
import org.dromara.business.domain.BusinessAlertConstructInfo;
import org.dromara.business.mapper.BusinessAlertConstructInfoMapper;
import org.dromara.business.service.IBusinessAlertConstructInfoService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 预警任务-施工信息Service业务层处理
*
* @author szs
* @date 2025-05-21
*/
@RequiredArgsConstructor
@Service
public class BusinessAlertConstructInfoServiceImpl implements IBusinessAlertConstructInfoService {
private final BusinessAlertConstructInfoMapper baseMapper;
/**
* 查询预警任务-施工信息
*
* @param id 主键
* @return 预警任务-施工信息
*/
@Override
public BusinessAlertConstructInfoVo queryById(Long id){
return baseMapper.selectVoById(id);
}
/**
* 分页查询预警任务-施工信息列表
*
* @param bo 查询条件
* @param pageQuery 分页参数
* @return 预警任务-施工信息分页列表
*/
@Override
public TableDataInfo<BusinessAlertConstructInfoVo> queryPageList(BusinessAlertConstructInfoBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<BusinessAlertConstructInfo> lqw = buildQueryWrapper(bo);
Page<BusinessAlertConstructInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的预警任务-施工信息列表
*
* @param bo 查询条件
* @return 预警任务-施工信息列表
*/
@Override
public List<BusinessAlertConstructInfoVo> queryList(BusinessAlertConstructInfoBo bo) {
LambdaQueryWrapper<BusinessAlertConstructInfo> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private LambdaQueryWrapper<BusinessAlertConstructInfo> buildQueryWrapper(BusinessAlertConstructInfoBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<BusinessAlertConstructInfo> lqw = Wrappers.lambdaQuery();
lqw.eq(bo.getBusinessType() != null, BusinessAlertConstructInfo::getBusinessType, bo.getBusinessType());
lqw.eq(StringUtils.isNotBlank(bo.getJobId()), BusinessAlertConstructInfo::getJobId, bo.getJobId());
lqw.like(StringUtils.isNotBlank(bo.getJobName()), BusinessAlertConstructInfo::getJobName, bo.getJobName());
lqw.eq(bo.getBusinessAlertId() != null, BusinessAlertConstructInfo::getBusinessAlertId, bo.getBusinessAlertId());
lqw.like(StringUtils.isNotBlank(bo.getConstructName()), BusinessAlertConstructInfo::getConstructName, bo.getConstructName());
lqw.eq(StringUtils.isNotBlank(bo.getConstructDept()), BusinessAlertConstructInfo::getConstructDept, bo.getConstructDept());
lqw.eq(StringUtils.isNotBlank(bo.getConstructLeader()), BusinessAlertConstructInfo::getConstructLeader, bo.getConstructLeader());
lqw.eq(StringUtils.isNotBlank(bo.getPhonenumber()), BusinessAlertConstructInfo::getPhonenumber, bo.getPhonenumber());
lqw.eq(StringUtils.isNotBlank(bo.getAddress()), BusinessAlertConstructInfo::getAddress, bo.getAddress());
lqw.eq(StringUtils.isNotBlank(bo.getPipeline()), BusinessAlertConstructInfo::getPipeline, bo.getPipeline());
return lqw;
}
/**
* 新增预警任务-施工信息
*
* @param bo 预警任务-施工信息
* @return 是否新增成功
*/
@Override
public Boolean insertByBo(BusinessAlertConstructInfoBo bo) {
BusinessAlertConstructInfo add = MapstructUtils.convert(bo, BusinessAlertConstructInfo.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
}
return flag;
}
/**
* 修改预警任务-施工信息
*
* @param bo 预警任务-施工信息
* @return 是否修改成功
*/
@Override
public Boolean updateByBo(BusinessAlertConstructInfoBo bo) {
BusinessAlertConstructInfo update = MapstructUtils.convert(bo, BusinessAlertConstructInfo.class);
validEntityBeforeSave(update);
return baseMapper.updateById(update) > 0;
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(BusinessAlertConstructInfo entity){
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除预警任务-施工信息信息
*
* @param ids 待删除的主键集合
* @param isValid 是否进行有效性校验
* @return 是否删除成功
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;
}
}

42
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.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -12,11 +13,14 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.business.api.domain.bo.RemoteBusinessAlertBo;
import org.dromara.business.api.domain.vo.RemoteBusinessAlertConstructInfo;
import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo;
import org.dromara.business.config.ProjectTablePrefixConfig;
import org.dromara.business.domain.BusinessAlert;
import org.dromara.business.domain.bo.BusinessAlertBo;
import org.dromara.business.domain.vo.BusinessAlertConstructInfoVo;
import org.dromara.business.domain.vo.BusinessAlertVo;
import org.dromara.business.mapper.BusinessAlertConstructInfoMapper;
import org.dromara.business.mapper.BusinessAlertMapper;
import org.dromara.business.service.IBusinessAlertService;
import org.dromara.business.utils.BatchProcessorUtil;
@ -30,6 +34,7 @@ import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.business.utils.MinioUtil;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.api.RemoteLabelPostService;
import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo;
@ -65,6 +70,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
private final BusinessAlertMapper baseMapper;
@Autowired
private BusinessAlertConstructInfoMapper businessAlertConstructInfoMapper;
@DubboReference(timeout = 30000)
RemoteWorkflowService remoteWorkflowService;
@ -151,22 +159,38 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
* @return
*/
@Override
public Boolean batchAddBusinessAlert(List<RemoteBusinessAlertVo> alertVoList) {
public Boolean batchAddBusinessAlert(List<RemoteBusinessAlertVo> alertVoList, String activeProfile) {
List<BusinessAlert> businessAlerts = alertVoList.stream().map(alert -> {
BusinessAlert businessAlert = new BusinessAlert();
alert.setCreateTime(new Date());
alert.setHandleType(BusinessStatusEnum.VERIFY.getStatus());
RemoteBusinessAlertConstructInfo remoteAlertConstructInfo = alert.getRemoteAlertConstructInfo();
BusinessAlertConstructInfoVo alertConstructInfoVo = new BusinessAlertConstructInfoVo();
BeanUtils.copyProperties(alert.getRemoteAlertConstructInfo(), alertConstructInfoVo);
businessAlert.setAlertConstructInfoVo(alertConstructInfoVo);
BeanUtils.copyProperties(alert, businessAlert);
if(!StrUtil.equals("default", activeProfile)){
businessAlert.setBusinessType(2);
}
//查询历史预警
List<BusinessAlert> businessAlertList = this.listHandleHistory(alert.getLng(), alert.getLat(), DateUtils.parseDateToStr(FormatsType.YYYY_MM_DD_HH_MM_SS, alert.getCreateTime()));
businessAlert.setHandleNum(businessAlertList.size());
return businessAlert;
}).toList();
return this.baseMapper.insertBatch(businessAlerts);
boolean b = this.baseMapper.insertBatch(businessAlerts);
/*List<BusinessAlertConstructInfo> alertConstructInfoList = businessAlerts.stream().map(alert -> {
BusinessAlertConstructInfoVo alertConstructInfoVo = alert.getAlertConstructInfoVo();
BusinessAlertConstructInfo businessAlertConstructInfo = new BusinessAlertConstructInfo();
BeanUtils.copyProperties(alertConstructInfoVo, businessAlertConstructInfo);
businessAlertConstructInfo.setBusinessAlertId(alert.getId());
return businessAlertConstructInfo;
}).collect(Collectors.toList());
businessAlertConstructInfoMapper.insertBatch(alertConstructInfoList);*/
return b;
}
/**
@ -252,7 +276,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
Page<BusinessAlert> page = this.baseMapper.pageBusinessAlert(pageQuery.build(), wrapper, ptPrefix);
try {
try {//预警管理查询图片
page.getRecords().forEach(businessAlertVo->{
if (businessAlertVo.getBusinessType() == 2){
businessAlertVo.setImages(MinioUntil.getObjectUrlOne(MinIOConstants.BUCKET_DKCY, businessAlertVo.getImages(), 3600).toString());
@ -871,6 +895,16 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService {
LambdaUpdateWrapper<BusinessAlert> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(BusinessAlert::getId, alertId);
wrapper.set(BusinessAlert::getDelFlag,1);
BusinessAlert businessAlert = this.baseMapper.selectById(alertId);
//删除minio多余数据
try {
MinioUtil.deleteFile(businessAlert.getImages(), MinIOConstants.BUCKET_DKCY);
MinioUtil.deleteFile(businessAlert.getImages(), MinIOConstants.BUCKET_ALERT);
} catch (Exception e) {
throw new RuntimeException(e);
}
return this.baseMapper.update(wrapper) > 0;
}

183
dk-modules/business/src/main/java/org/dromara/business/utils/MinioUtil.java

@ -0,0 +1,183 @@
package org.dromara.business.utils;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import io.minio.*;
import io.minio.http.Method;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.InputStream;
import java.util.HashMap;
@Component
public class MinioUtil {
// 指定MinIO服务的访问地址(包括协议、域名或IP以及端口)
private static String endpoint;
// MinIO的访问密钥(Access Key),用于身份验证
private static String accessKey;
// MinIO的秘密密钥(Secret Key),与访问密钥配对使用,也是认证的一部分。
private static String secretKey;
// 指定默认的存储桶(Bucket)名称,MinIO中用于组织和存储对象(文件)的基本容器。
private static String bucket;
@Value("${minio.endpoint:http://114.235.183.147:9090}")
public void setEndpoint(String endpoint) {
MinioUtil.endpoint = endpoint;
}
@Value("${minio.accessKey:wuyuan@yf}")
public void setAccessKey(String accessKey) {
MinioUtil.accessKey = accessKey;
}
@Value("${minio.secretKey:wuyuan@yf}")
public void setSecretKey(String secretKey) {
MinioUtil.secretKey = secretKey;
}
@Value("${minio.bucket:dkcy}")
public void setBucket(String bucket) {
MinioUtil.bucket = bucket;
}
/**
* 创建并返回一个配置好的MinioClient实例
* 用于与MinIO服务器交互,上传文件下载文件删除文件
*
* @return 配置
*/
public static MinioClient getMinioClient() {
return MinioClient.builder()
.endpoint(endpoint)
.credentials(accessKey, secretKey)
.build();
}
/**
* 上传将一个输入流中的文件上传到MinIO服务器上指定的存储桶bucket
*
* @param objectName .object(objectName)指定了上传后对象的名称
* @param inputStream 转换为
* @param size 文件大小
* @param contentType 内容类型
* @throws Exception 异常
*/
public static void uploadFile(String objectName, InputStream inputStream, long size, String contentType,String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient minioClient = getMinioClient();
minioClient.putObject(
// .bucket(bucket) 指定了目标存储桶的名称。.object(objectName)指定了上传后对象的名称。
PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(inputStream, size, -1)
// .contentType(contentType)指定了上传文件的内容类型。
.contentType(contentType)
.build());
}
/**
* 下载从MinIO服务器下载指定存储桶bucket中的文件
*
* @param objectName 指定要从MinIO下载的文件对象名称即文件路径和文件名
* @return 对象
* @throws Exception 异常
*/
public static InputStream downloadFile(String objectName,String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient minioClient = getMinioClient();
return minioClient.getObject(
GetObjectArgs.builder()
// .bucket(bucket)指定了文件所在的存储桶名称。
.bucket(bucketName)
// .object(objectName)指定了要下载的对象名称。
.object(objectName)
.build());
}
/**
* 预览生成一个预签名的URL允许用户通过浏览器或其他HTTP客户端以GET方法访问MinIO存储桶中指定对象文件的临时链接
*
* @param objectName 指定需要获取预览链接的文件对象名称包括路径
* @return 对象
* @throws Exception .method(Method.GET)指定了请求的方法为GET这是预览文件时的标准HTTP方法
* .bucket(bucket)指定了存储桶的名称
* .object(objectName)指定了对象文件的名称
*/
public static String getPreviewUrl(String objectName,String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient minioClient = getMinioClient();
return minioClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.GET)
.bucket(bucketName)
.object(objectName)
.build());
}
/**
* 删除从MinIO服务器上的指定存储桶中删除一个文件
*
* @param objectName 指定要删除的文件对象名称包括路径和文件名
* @throws Exception
*/
public static void deleteFile(String objectName,String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient minioClient = getMinioClient();
minioClient.removeObject(
RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build());
}
//查询文件信息
public static HashMap<String,Object> getFileAsMultipart(String objectName, String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient client = getMinioClient();
// 获取对象
InputStream is = client.getObject(GetObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.build());
// 获取文件元信息(如 contentType)
StatObjectResponse stat = client.statObject(StatObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.build());
String contentType = stat.contentType();
// 将流读为 byte[] 以生成 MockMultipartFile
byte[] bytes = IoUtil.readBytes(is); // Hutool 工具类
HashMap<String, Object> map = new HashMap<>();
map.put("objectName",objectName);
map.put("contentType",contentType);
map.put("bytes",bytes);
return map;
}
//文件复制
public static void copyFile(String sourceObjectName, String targetObjectName, String sourceBucket, String targetBucket) throws Exception {
MinioClient client = getMinioClient();
// 使用服务器端复制,无需下载上传
client.copyObject(CopyObjectArgs.builder()
.bucket(targetBucket) // 目标桶
.object(targetObjectName) // 目标对象
.source(CopySource.builder()
.bucket(sourceBucket)
.object(sourceObjectName)
.build())
.build());
}
}

7
dk-modules/business/src/main/resources/mapper/business/BusinessAlertConstructInfoMapper.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.business.mapper.BusinessAlertConstructInfoMapper">
</mapper>

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

@ -86,4 +86,6 @@ public interface IFileService {
* @param fileType 图片类型 "jpeg,mp4"
* */
List<MediaFileDTO> getMediaFileDTO( String jobId,String fileType);
String copyFile(String sourceBucket, String originFileUrl, String targetBucket);
}

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

@ -22,6 +22,7 @@ import org.dromara.sample.media.mapper.IFileMapper;
import org.dromara.sample.media.model.MediaFileDTO;
import org.dromara.sample.media.model.MediaFileEntity;
import org.dromara.sample.media.service.IFileService;
import org.dromara.sample.utils.MinioUtil;
import org.dromara.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -178,6 +179,22 @@ public class FileServiceImpl implements IFileService {
}
//文件从 mediafile 复制到 alert库,文件保持相同目录
@Override
public String copyFile(String sourceBucket, String originFileUrl, String targetBucket) {
String fileUrl = "";
try {
// String originalfileName = FileUtil.getName(originFileUrl);
MinioUtil.copyFile(originFileUrl,originFileUrl,sourceBucket,targetBucket);//列表图片
MinioUtil.copyFile(originFileUrl,originFileUrl,sourceBucket,MinIOConstants.BUCKET_ALERT);//预览图片
} catch (Exception e) {
throw new RuntimeException(e);
}
return fileUrl;
}
/**
* Convert the received file object into a database entity object.
* @param file

183
dk-modules/sample/src/main/java/org/dromara/sample/utils/MinioUtil.java

@ -0,0 +1,183 @@
package org.dromara.sample.utils;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
import io.minio.*;
import io.minio.http.Method;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.InputStream;
import java.util.HashMap;
@Component
public class MinioUtil {
// 指定MinIO服务的访问地址(包括协议、域名或IP以及端口)
private static String endpoint;
// MinIO的访问密钥(Access Key),用于身份验证
private static String accessKey;
// MinIO的秘密密钥(Secret Key),与访问密钥配对使用,也是认证的一部分。
private static String secretKey;
// 指定默认的存储桶(Bucket)名称,MinIO中用于组织和存储对象(文件)的基本容器。
private static String bucket;
@Value("${minio.endpoint:http://114.235.183.147:9090}")
public void setEndpoint(String endpoint) {
MinioUtil.endpoint = endpoint;
}
@Value("${minio.accessKey:wuyuan@yf}")
public void setAccessKey(String accessKey) {
MinioUtil.accessKey = accessKey;
}
@Value("${minio.secretKey:wuyuan@yf}")
public void setSecretKey(String secretKey) {
MinioUtil.secretKey = secretKey;
}
@Value("${minio.bucket:dkcy}")
public void setBucket(String bucket) {
MinioUtil.bucket = bucket;
}
/**
* 创建并返回一个配置好的MinioClient实例
* 用于与MinIO服务器交互,上传文件下载文件删除文件
*
* @return 配置
*/
public static MinioClient getMinioClient() {
return MinioClient.builder()
.endpoint(endpoint)
.credentials(accessKey, secretKey)
.build();
}
/**
* 上传将一个输入流中的文件上传到MinIO服务器上指定的存储桶bucket
*
* @param objectName .object(objectName)指定了上传后对象的名称
* @param inputStream 转换为
* @param size 文件大小
* @param contentType 内容类型
* @throws Exception 异常
*/
public static void uploadFile(String objectName, InputStream inputStream, long size, String contentType,String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient minioClient = getMinioClient();
minioClient.putObject(
// .bucket(bucket) 指定了目标存储桶的名称。.object(objectName)指定了上传后对象的名称。
PutObjectArgs.builder().bucket(bucketName).object(objectName).stream(inputStream, size, -1)
// .contentType(contentType)指定了上传文件的内容类型。
.contentType(contentType)
.build());
}
/**
* 下载从MinIO服务器下载指定存储桶bucket中的文件
*
* @param objectName 指定要从MinIO下载的文件对象名称即文件路径和文件名
* @return 对象
* @throws Exception 异常
*/
public static InputStream downloadFile(String objectName,String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient minioClient = getMinioClient();
return minioClient.getObject(
GetObjectArgs.builder()
// .bucket(bucket)指定了文件所在的存储桶名称。
.bucket(bucketName)
// .object(objectName)指定了要下载的对象名称。
.object(objectName)
.build());
}
/**
* 预览生成一个预签名的URL允许用户通过浏览器或其他HTTP客户端以GET方法访问MinIO存储桶中指定对象文件的临时链接
*
* @param objectName 指定需要获取预览链接的文件对象名称包括路径
* @return 对象
* @throws Exception .method(Method.GET)指定了请求的方法为GET这是预览文件时的标准HTTP方法
* .bucket(bucket)指定了存储桶的名称
* .object(objectName)指定了对象文件的名称
*/
public static String getPreviewUrl(String objectName,String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient minioClient = getMinioClient();
return minioClient.getPresignedObjectUrl(
GetPresignedObjectUrlArgs.builder()
.method(Method.GET)
.bucket(bucketName)
.object(objectName)
.build());
}
/**
* 删除从MinIO服务器上的指定存储桶中删除一个文件
*
* @param objectName 指定要删除的文件对象名称包括路径和文件名
* @throws Exception
*/
public static void deleteFile(String objectName,String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient minioClient = getMinioClient();
minioClient.removeObject(
RemoveObjectArgs.builder().bucket(bucketName).object(objectName).build());
}
//查询文件信息
public static HashMap<String,Object> getFileAsMultipart(String objectName, String newBucket) throws Exception {
String bucketName = StrUtil.isEmpty(newBucket) ? bucket : newBucket;
MinioClient client = getMinioClient();
// 获取对象
InputStream is = client.getObject(GetObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.build());
// 获取文件元信息(如 contentType)
StatObjectResponse stat = client.statObject(StatObjectArgs.builder()
.bucket(bucketName)
.object(objectName)
.build());
String contentType = stat.contentType();
// 将流读为 byte[] 以生成 MockMultipartFile
byte[] bytes = IoUtil.readBytes(is); // Hutool 工具类
HashMap<String, Object> map = new HashMap<>();
map.put("objectName",objectName);
map.put("contentType",contentType);
map.put("bytes",bytes);
return map;
}
//文件复制
public static void copyFile(String sourceObjectName, String targetObjectName, String sourceBucket, String targetBucket) throws Exception {
MinioClient client = getMinioClient();
// 使用服务器端复制,无需下载上传
client.copyObject(CopyObjectArgs.builder()
.bucket(targetBucket) // 目标桶
.object(targetObjectName) // 目标对象
.source(CopySource.builder()
.bucket(sourceBucket)
.object(sourceObjectName)
.build())
.build());
}
}

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

@ -1,25 +1,26 @@
package org.dromara.sample.wayline.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.minio.MinioClient;
import io.minio.StatObjectArgs;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.ibatis.executor.BatchResult;
import org.dromara.business.api.RemoteBusinessAlertService;
import org.dromara.business.api.domain.bo.RemoteBusinessAlertBo;
import org.dromara.business.api.domain.vo.RemoteBusinessAlertConstructInfo;
import org.dromara.business.api.domain.vo.RemoteBusinessAlertVo;
import org.dromara.common.core.constant.AiCompareStatusConstants;
import org.dromara.common.core.constant.BusinessConstants;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@ -28,10 +29,7 @@ import org.dromara.common.sdk.mqtt.CommonTopicRequest;
import org.dromara.common.sdk.mqtt.MqttGatewayPublish;
import org.dromara.common.sdk.mqtt.TopicConst;
import org.dromara.sample.media.constant.MinIOConstants;
import org.dromara.sample.media.mapper.IFileMapper;
import org.dromara.sample.media.model.MediaFileEntity;
import org.dromara.sample.media.service.IFileService;
import org.dromara.sample.media.service.IMediaService;
import org.dromara.sample.wayline.mapper.IAiCompareMapper;
import org.dromara.sample.wayline.mapper.IAiComparePlateMapper;
import org.dromara.sample.wayline.mapper.IWaylineJobMapper;
@ -45,13 +43,11 @@ import org.dromara.sample.wayline.service.IAiCompareService;
import org.dromara.system.api.model.LoginUser;
import org.dromara.workflow.api.RemoteWorkflowService;
import org.dromara.workflow.api.domain.RemoteStartProcess;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -206,21 +202,116 @@ public class AiCompareServiceImpl implements IAiCompareService {
AiCompareEntity aiCompareEntity = aiCompareMapper.selectById(id);
return listMediaFile(aiCompareEntity.getJobId(),aiCompareEntity.getId(),3600,true);
}
// @Value("${spring.profiles.active}")
// private String activeProfile;
@Override
public Boolean pictureFrame(Map<String,Object>objectMap) {
public Boolean pictureFrame(Map<String,Object> objectMap) {
FrameDTO frameDTO = Convert.convert(FrameDTO.class, objectMap);
AiCompareEntity aiCompareEntity = aiCompareMapper.selectById(frameDTO.getCompareId());
aiCompareEntity.setStatus(AiCompareStatusConstants.COMPARE_STATUS_3);
aiCompareEntity.setId(frameDTO.getCompareId());
aiCompareMapper.updateById(aiCompareEntity);
frameDTO.setJobName(aiCompareEntity.getJobName());
frameDTO.setFileUrl(fileService.getObjectUrlOne(MinIOConstants.BUCKET_MEDIAFILE,frameDTO.getFileUrl(),3600).toString());
frameDTO.setMateFileUrl(fileService.getObjectUrlOne(MinIOConstants.BUCKET_MEDIAFILE,frameDTO.getMateFileUrl(),3600).toString());
String originFileUrl = frameDTO.getFileUrl();
String fileUrl = fileService.getObjectUrlOne(MinIOConstants.BUCKET_MEDIAFILE, originFileUrl, 3600).toString();
frameDTO.setFileUrl(fileUrl);
String originMateFileUrl = frameDTO.getMateFileUrl();
String mateFileUrl = fileService.getObjectUrlOne(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, 3600).toString();
frameDTO.setMateFileUrl(mateFileUrl);
String topic = TopicConst.IMAGE +TopicConst.FRAME;
mqttGatewayPublish.publish(topic,new CommonTopicRequest().setData(frameDTO),1);
// if(StrUtil.equals(activeProfile,"w_fengxianranqi"))
// activeProfile="w_fengxianranqi"
String activeProfile = MapUtil.getStr(objectMap, "activeProfile", "default");
if (StrUtil.equals("default", activeProfile)) {
//发送mqtt给算法,处理完
mqttGatewayPublish.publish(topic, new CommonTopicRequest().setData(frameDTO), 1);
} else {
//图片处理
// fileService.get(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, 3600);
//复制原图到指定bucket
String copyFileUrl = fileService.copyFile(MinIOConstants.BUCKET_MEDIAFILE, originMateFileUrl, MinIOConstants.BUCKET_DKCY);
// String copyFileUrl = fileService.copyFile(MinIOConstants.BUCKET_MEDIAFILE, originFileUrl, MinIOConstants.BUCKET_ALERT);
ArrayList<RemoteBusinessAlertVo> alertVoList = new ArrayList<>();
//手动简化逻辑,上传图片
int frameCount =0;
for (Map<String, Object> alertMap : frameDTO.getFrameList()) {
if(frameCount >= 1 ){continue;} //暂时只保存一个文件
//businessAlert数据
RemoteBusinessAlertVo remoteBusinessAlertVo = new RemoteBusinessAlertVo();
// remoteBusinessAlertVo.setAlertType("1"); //1:图片比对预警 2:AI实时预警
remoteBusinessAlertVo.setJobId(aiCompareEntity.getJobId());
remoteBusinessAlertVo.setJobName(aiCompareEntity.getJobName());
remoteBusinessAlertVo.setAssign(false);
remoteBusinessAlertVo.setImages(originMateFileUrl);//fileUrl
remoteBusinessAlertVo.setMaxImages(originMateFileUrl);//mateFileUrl
remoteBusinessAlertVo.setMateSourceImgUrl(originFileUrl);//mateFileUrl
remoteBusinessAlertVo.setLat("34.20912175973148");
remoteBusinessAlertVo.setLng("117.2260332850499");
remoteBusinessAlertVo.setLabelCn(MapUtil.getStr(alertMap,"labelCn",""));
remoteBusinessAlertVo.setLabelEn(MapUtil.getStr(alertMap,"labelEn",""));
remoteBusinessAlertVo.setTaskContent("");
//面积计算
setupArea(alertMap, remoteBusinessAlertVo);
remoteBusinessAlertVo.setHandleType("waiting");
remoteBusinessAlertVo.setDeptId(aiCompareEntity.getCreateDept()+"");
remoteBusinessAlertVo.setDeptName(aiCompareEntity.getDeptName());
remoteBusinessAlertVo.setHandleNum(0);
//businessAlertConstructInfo数据
RemoteBusinessAlertConstructInfo acInfo = new RemoteBusinessAlertConstructInfo();
acInfo.setBusinessType(2l);
acInfo.setJobId(aiCompareEntity.getJobId());
acInfo.setJobName(aiCompareEntity.getJobName());
acInfo.setConstructName(MapUtil.getStr(alertMap,"constructName",""));
acInfo.setConstructDept(MapUtil.getStr(alertMap,"constructDept",""));
acInfo.setConstructLeader(MapUtil.getStr(alertMap,"constructLeader",""));
acInfo.setPhonenumber(MapUtil.getStr(alertMap,"phonenumber",""));
acInfo.setAddress(MapUtil.getStr(alertMap,"address",""));
acInfo.setPipeline(MapUtil.getStr(alertMap,"pipeline",""));
acInfo.setRemark(MapUtil.getStr(alertMap,"remark",""));
remoteBusinessAlertVo.setRemoteAlertConstructInfo(acInfo);
alertVoList.add(remoteBusinessAlertVo);
frameCount +=1;
}
businessAlertService.saveBusinessAlert(alertVoList,activeProfile);
}
return true;
}
private static void setupArea(Map<String, Object> alertMap, RemoteBusinessAlertVo remoteBusinessAlertVo) {
double lx = MapUtil.getInt(alertMap,"lx",0);
double ly = MapUtil.getInt(alertMap,"ly",0);
double rx = MapUtil.getInt(alertMap,"rx",0);
double ry = MapUtil.getInt(alertMap,"ry",0);
double areaw = Math.abs(rx - lx);
double areal = Math.abs(ry - ly);
double area = areaw * areal;
remoteBusinessAlertVo.setArea((long)area);
remoteBusinessAlertVo.setAreaL((long)areal);
remoteBusinessAlertVo.setAreaW((long)areaw);
JSONObject entries = new JSONObject();
entries.set("lef_x", lx);
entries.set("lef_y", ly);
entries.set("right_x", rx);
entries.set("right_y", ry);
remoteBusinessAlertVo.setPixelCoordinate(entries.toString());
}
@Override
public Boolean expose(List<Map<String,Object>> mapList) {
if(!mapList.isEmpty()){
@ -246,7 +337,7 @@ public class AiCompareServiceImpl implements IAiCompareService {
AiCompareAlertDTO compareAlertDTO = Convert.convert(AiCompareAlertDTO.class,map);
aiComparePlateMapper.update(new LambdaUpdateWrapper<AiComparePlateEntity>().eq(AiComparePlateEntity::getFileId,compareAlertDTO.getFileId()).set(AiComparePlateEntity::getPatternName,compareAlertDTO.getDiscernImgUrl()));
List<RemoteBusinessAlertVo> handleList = compareAlertDTO.getHandleList();
return businessAlertService.saveBusinessAlert(handleList);
return businessAlertService.saveBusinessAlert(handleList,"default");
}
@Override

Loading…
Cancel
Save