drone-ops-api/drone-resource-api/src/main/java/org/sxkj/resource/entity/Attach.java
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -12,10 +11,8 @@ import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tool.utils.StringUtil; import org.springframework.util.StringUtils; import org.sxkj.common.constant.CommonConstant; import org.sxkj.common.utils.file.FileNameHarsher; import java.time.LocalDateTime; import java.util.List; import java.util.Objects; import java.util.stream.Stream; @@ -80,10 +77,9 @@ @ApiModelProperty(value = "附件大小") private Long attachSize; @ApiModelProperty(value = "任务id") @TableField(value = "wayline_job_id") private String wayLineJobId; @ApiModelProperty(value = "巡查任务id") @TableField(value = "patrol_task_id") private String patrolTaskId; @ApiModelProperty(value = "附件类型: 1=巡查类文档,2=巡检类文档,3=安保类文档,4=文旅类文档,5=采集数据类文档") private Integer resultType; @@ -103,26 +99,13 @@ @ApiModelProperty(value = "文件昵称") private String nickName; //区域 @TableField(exist = false) private String areaCode; @TableField(exist = false) private List<String> wayLineJobIds; /** * 是否缩略图 0=原图 1=缩略图 */ @TableField(value = "is_thumbnail") private Boolean thumbnail; /** * 最末尾文件名称hash算法 */ @TableField("md5") private String md5; private Double longitude; private Double latitude; /** * 是否生成过ai 图 0 =未生成过 1=已生成过 */ @@ -130,19 +113,12 @@ @TableField("is_deleted") private Integer isDeleted; @ApiModelProperty(value = "媒体类型:0 可见光 1 红外") @TableField("media_category") private Integer mediaCategory; //区域 @TableField(exist = false) private String areaCode; @ApiModelProperty(value = "媒体创建时间") @TableField("media_create_time") @JsonFormat(pattern = CommonConstant.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8") private LocalDateTime mediaCreateTime; @ApiModelProperty(value = "变化监测标识(0:否,1:是)") @TableField("is_change_monitor") private Integer isChangeMonitor; @TableField(exist = false) private List<String> wayLineJobIds; public String getMd5() { String link = this.link; drone-ops/drone-resource/src/main/java/org/sxkj/resource/service/IAttachService.java
@@ -117,13 +117,6 @@ */ public TreeVo mapAttachEvents(AttachQueryParam dto) ; /** * 图片分析对比 * * @param id * @return */ List<AnalysisAttachVo> contrastiveAnalysis(Long id); int updateFileName(Long id, String nickName); drone-ops/drone-resource/src/main/java/org/sxkj/resource/service/impl/AttachServiceImpl.java
@@ -439,36 +439,6 @@ @Override public List<AnalysisAttachVo> contrastiveAnalysis(Long id) { Attach attach = getById(id); ValidUtil.assertNull(attach, "数据不能为空!"); ValidUtil.assertNull(attach.getMetadata(), "媒体数据不存在经纬度!"); FileMetadataDTO metadata = JSON.parseObject(attach.getMetadata().toString(), FileMetadataDTO.class); PositionDTO shootPosition = metadata.getShootPosition(); ValidUtil.assertNull(shootPosition, "媒体数据不存在经纬度!"); Double lat = attach.getLatitude() != null && attach.getLatitude() > 0 ? attach.getLatitude() : shootPosition.getLat(); Double lng = attach.getLongitude() != null && attach.getLongitude() > 0 ? attach.getLongitude() : shootPosition.getLng(); Date createTime = attach.getCreateTime(); // 转换为 LocalDateTime(保留时间部分) LocalDateTime ldt = createTime.toInstant() .atZone(ZoneId.systemDefault()) .toLocalDateTime(); // 计算前后两个月 LocalDateTime twoMonthsBefore = ldt.minusMonths(2); // 前2个月 LocalDateTime twoMonthsAfter = ldt.plusMonths(2); // 后2个月 // 如果需要转回 Date 类型 Date beforeDate = Date.from(twoMonthsBefore.atZone(ZoneId.systemDefault()).toInstant()); Date afterDate = Date.from(twoMonthsAfter.atZone(ZoneId.systemDefault()).toInstant()); List<AnalysisAttachVo> pointAttachList = baseMapper.findPointAttach(lat, lng, beforeDate, afterDate, id); return Streams.toList(pointAttachList, entity -> { entity.setIsCheck(entity.getId().equals(id)); return entity; }); } @Override public AttachInfoVO getAttachInfo(Long id) { AttachInfoVO attachVO = baseMapper.getAttachInfo(id); if (attachVO != null) { @@ -478,16 +448,8 @@ PositionDTO shootPosition = metadata.getShootPosition(); ValidUtil.assertNull(shootPosition, "媒体数据不存在经纬度!"); Double lat = shootPosition.getLat(); attachVO.setLatitude(lat); Double lng = shootPosition.getLng(); attachVO.setLongitude(lng); } // 文件类型,通过文件名称有_T,则是红外,包含_W|_V 则是可见光 // if (attachVO.getName().contains("_T")) { // attachVO.setPhotoType("ir"); // } else if (attachVO.getName().contains("_W") || attachVO.getName().contains("_V")) { // attachVO.setPhotoType("visible"); // } } return attachVO; } @@ -501,19 +463,8 @@ FileMetadataDTO metadata = JSON.parseObject(item.getMetadata().toString(), FileMetadataDTO.class); PositionDTO shootPosition = metadata.getShootPosition(); Double lat = shootPosition.getLat(); item.setLatitude(lat); Double lng = shootPosition.getLng(); item.setLongitude(lng); } }); // 把result_type=0和把result_type=2数据进行用经度和纬度对比,如果有相同的,则把result_type=0的数据删除 boolean removed = attachVO.removeIf(item -> { return item.getResultType() == 0 && attachVO.stream().anyMatch( item1 -> item1.getResultType() == 2 && item1.getLatitude().equals(item.getLatitude()) && item1.getLongitude().equals(item.getLongitude()) ); }); return attachVO; } drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/service/impl/GdPatrolTaskServiceImpl.java
@@ -517,6 +517,7 @@ attach.setAttachSize(reportFile.length()); attach.setExtension(FileUtil.getFileExtension(reportFile.getName())); attach.setResultType(resultType); attach.setPatrolTaskId(String.valueOf(taskEntity != null ? taskEntity.getId() : null)); Long createUser = taskEntity != null ? taskEntity.getCreateUser() : null; Long updateUser = taskEntity != null ? taskEntity.getUpdateUser() : null; Long createDept = taskEntity != null ? taskEntity.getCreateDept() : null;