图像管理 todo

This commit is contained in:
高雄 2025-04-24 17:58:44 +08:00
parent 546750e754
commit 6dfb965631
11 changed files with 180 additions and 264 deletions

View File

@ -134,6 +134,12 @@
<artifactId>fastjson</artifactId>
<version>1.2.83</version>
</dependency>
<!--读取照片EXIF信息-->
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.15.0</version>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -1,77 +1,71 @@
package com.dite.znpt.domain.entity;
import java.time.LocalDateTime;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dite.znpt.domain.AuditableEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.alibaba.excel.annotation.ExcelProperty;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author huise23
* @date 2025/04/24 13:44
* @Description: 图像信息表实体类
* @author Bear.G
* @date 2025/4/24/周四 13:15
* @description
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("image")
@ApiModel(value="ImageEntity对象", description="图像信息表")
public class ImageEntity extends AuditableEntity implements Serializable {
public class ImageEntity extends AuditableEntity implements Serializable {
private static final long serialVersionUID = -60463872766900490L;
@Serial
private static final long serialVersionUID = -7702927820673158420L;
@ExcelProperty("图像id")
@ApiModelProperty("图像id")
@TableId(value = "image_id", type = IdType.ASSIGN_UUID)
private Long imageId;
@TableId(value = "part_id", type = IdType.ASSIGN_UUID)
private String imageId;
@ExcelProperty("部件id")
@ApiModelProperty("部件id")
@TableField("part_id")
private Long partId;
private String partId;
@ApiModelProperty("项目id")
@TableField("project_id")
private String projectId;
@ExcelProperty("机组id")
@ApiModelProperty("机组id")
@TableField("turbine_id")
private Long turbineId;
private String turbineId;
@ExcelProperty("项目id")
@ApiModelProperty("项目id")
@TableField("project")
private Long project;
@ExcelProperty("图像名称")
@ApiModelProperty("图像名称")
@TableField("image_name")
private String imageName;
@ExcelProperty("图像尺寸")
@ApiModelProperty("图像尺寸")
@TableField("image_size")
private String imageSize;
@ExcelProperty("焦距")
@ApiModelProperty("焦距")
@TableField("focal_distance")
private String focalDistance;
@ExcelProperty("拍摄时间")
@ApiModelProperty("拍摄时间")
@TableField("shooting_time")
private LocalDateTime shootingTime;
@ExcelProperty("相机制造商")
@ApiModelProperty("相机制造商")
@TableField("camera_manufacturer")
private String cameraManufacturer;
@ExcelProperty("相机型号")
@ApiModelProperty("相机型号")
@TableField("camera_model")
private String cameraModel;
}
}

View File

@ -1,55 +1,19 @@
package com.dite.znpt.domain.vo;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* @author huise23
* @date 2025/04/24 13:44
* @Description: 图像信息请求实体
* @author Bear.G
* @date 2025/4/24/周四 14:18
* @description
*/
@Data
@ApiModel("图像信息列表请求实体")
@ApiModel("图像信息列表查询实体")
public class ImageListReq implements Serializable {
private static final long serialVersionUID = 734848078850759056L;
@ApiModelProperty("查询关键字")
private String keyword;
@ApiModelProperty("图像信息Id")
private Long imageId;
@ApiModelProperty("部件id")
private Long partId;
@ApiModelProperty("机组id")
private Long turbineId;
@ApiModelProperty("项目id")
private Long project;
@ApiModelProperty("图像名称")
private String imageName;
@ApiModelProperty("图像尺寸")
private String imageSize;
@ApiModelProperty("焦距")
private String focalDistance;
@ApiModelProperty("拍摄时间")
private LocalDateTime shootingTime;
@ApiModelProperty("相机制造商")
private String cameraManufacturer;
@ApiModelProperty("相机型号")
private String cameraModel;
@Serial
private static final long serialVersionUID = 671014582625089979L;
}

View File

@ -1,19 +1,19 @@
package com.dite.znpt.domain.vo;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.dite.znpt.domain.entity.ImageEntity;
import java.io.Serial;
import java.io.Serializable;
/**
* @author huise23
* @date 2025/04/24 13:44
* @Description: 图像信息响应实体
* @author Bear.G
* @date 2025/4/24/周四 14:16
* @description
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("图像信息响应实体")
public class ImageResp extends ImageEntity {
public class ImageResp implements Serializable {
@Serial
private static final long serialVersionUID = -5215414858454232077L;
}

View File

@ -4,16 +4,16 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dite.znpt.domain.entity.ImageEntity;
import com.dite.znpt.domain.vo.ImageListReq;
import com.dite.znpt.domain.vo.ImageResp;
import org.apache.ibatis.annotations.Param;
import com.dite.znpt.domain.vo.PartListReq;
import com.dite.znpt.domain.vo.PartResp;
import java.util.List;
/**
* @author huise23
* @date 2025/04/24 13:44
* @Description: 图像信息表数据库访问层
* @author Bear.G
* @date 2025/4/24/周四 13:17
* @description
*/
public interface ImageMapper extends BaseMapper<ImageEntity> {
List<ImageResp> queryBySelective(ImageListReq imageReq);
List<ImageResp> queryBySelective(ImageListReq req);
}

View File

@ -8,57 +8,11 @@ import com.dite.znpt.domain.vo.ImageResp;
import java.util.List;
/**
* @author huise23
* @date 2025/04/24 13:44
* @Description: 图像信息表服务接口
* @author Bear.G
* @date 2025/4/24/周四 13:14
* @description
*/
public interface ImageService extends IService<ImageEntity> {
/**
* 功能描述查询图像信息列表
*
* @param imageReq 图像信息
* @return {@link List }<{@link ImageEntity }>
* @author huise23
* @date 2025/04/24 13:44
**/
List<ImageResp> selectList(ImageListReq imageReq);
/**
* 功能描述查询单条图像信息
*
* @param imageId 图像信息Id
* @return {@link ImageResp }
* @author huise23
* @date 2025/04/24 13:44
**/
ImageResp selectById(Long imageId);
/**
* 功能描述新增图像信息
*
* @param image 图像信息
* @author huise23
* @date 2025/04/24 13:44
**/
void saveData(ImageEntity image);
/**
* 功能描述更新图像信息
*
* @param image 图像信息
* @author huise23
* @date 2025/04/24 13:44
**/
void updateData(ImageEntity image);
/**
* 功能描述删除图像信息
*
* @param imageId 图像信息Id
* @author huise23
* @date 2025/04/24 13:44
**/
void deleteById(Long imageId);
List<ImageResp> selectList(ImageListReq req);
}

View File

@ -4,96 +4,25 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dite.znpt.domain.entity.ImageEntity;
import com.dite.znpt.domain.vo.ImageListReq;
import com.dite.znpt.domain.vo.ImageResp;
import com.dite.znpt.service.ImageService;
import com.dite.znpt.mapper.ImageMapper;
import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollUtil;
import lombok.RequiredArgsConstructor;
import com.dite.znpt.service.ImageService;
import com.dite.znpt.util.PageUtil;
import java.util.List;
/**
* @author huise23
* @date 2025/04/24 13:44
* @Description: 图像信息表服务实现类
* @author Bear.G
* @date 2025/4/24/周四 13:23
* @description
*/
@Service
@RequiredArgsConstructor
public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> implements ImageService {
/**
* 功能描述查询图像信息列表
*
* @param imageReq 图像信息信息
* @return {@link List }<{@link ImageResp }>
* @author huise23
* @date 2025/04/24 13:44
**/
@Override
public List<ImageResp> selectList(ImageListReq imageReq) {
public List<ImageResp> selectList(ImageListReq req) {
PageUtil.startPage();
List<ImageResp> imageList= this.baseMapper.queryBySelective(imageReq);
List<ImageResp> imageList= this.baseMapper.queryBySelective(req);
imageList.forEach(resp -> {
});
return imageList;
}
/**
* 功能描述查询单条图像信息
*
* @param imageId 图像信息Id
* @return {@link ImageResp }
* @author huise23
* @date 2025/04/24 13:44
**/
@Override
public ImageResp selectById(Long imageId) {
ImageListReq imageReq = new ImageListReq();
imageReq.setImageId(imageId);
List<ImageResp> list = selectList(imageReq);
return list.isEmpty() ? CollUtil.getFirst(list) : new ImageResp();
}
/**
* 功能描述新增图像信息
*
* @param image 图像信息
* @author huise23
* @date 2025/04/24 13:44
**/
@Override
public void saveData(ImageEntity image) {
// todo 校验
save(image);
}
/**
* 功能描述更新图像信息
*
* @param image 图像信息
* @author huise23
* @date 2025/04/24 13:44
**/
@Override
public void updateData(ImageEntity image) {
// todo 校验
updateById(image);
}
/**
* 功能描述删除图像信息
*
* @param imageId 图像信息Id
* @author huise23
* @date 2025/04/24 13:44
**/
@Override
public void deleteById(Long imageId) {
// todo 校验
removeById(imageId);
}
}

View File

@ -0,0 +1,69 @@
package com.dite.znpt.util;
import cn.hutool.json.JSONObject;
import com.drew.imaging.ImageMetadataReader;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;
import java.io.File;
/**
* @author Bear.G
* @date 2025/4/24/周四 14:10
* @description
*/
public class EXIFUtil {
public static void main(String[] args) throws Exception {
File file = new File("C:\\Users\\Administrator\\Desktop\\水杯.jpg");
printImageTags(file);
}
/**
* 读取照片里面的信息
*/
public static JSONObject printImageTags(File file) throws Exception {
Metadata metadata = ImageMetadataReader.readMetadata(file);
JSONObject jsonObject = new JSONObject();
String lat = "";
String log = "";
for (Directory directory : metadata.getDirectories()) {
for (Tag tag : directory.getTags()) {
// 标签名
String tagName = tag.getTagName();
// 标签信息
String desc = tag.getDescription();
System.out.println(tagName + "=" + desc);
switch (tagName) {
// 经度
case "GPS Longitude":
lat = pointToLatlong(desc);
jsonObject.put(tagName, lat);
break;
// 纬度
case "GPS Latitude":
log = pointToLatlong(desc);
jsonObject.put(tagName, log);
break;
default:
jsonObject.put(tagName, desc);
break;
}
}
}
System.out.println("**********" + jsonObject.toString());
return jsonObject;
}
/***
* 经纬度坐标格式转换* °转十进制格式
* @param point
*/
public static String pointToLatlong(String point) {
Double du = Double.parseDouble(point.substring(0, point.indexOf("°")).trim());
Double fen = Double.parseDouble(point.substring(point.indexOf("°") + 1, point.indexOf("'")).trim());
Double miao = Double.parseDouble(point.substring(point.indexOf("'") + 1, point.indexOf("\"")).trim());
Double duStr = du + fen / 60 + miao / 60 / 60;
return duStr.toString();
}
}

View File

@ -1,52 +1,18 @@
<?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="com.dite.znpt.mapper.ImageMapper">
<sql id="Base_Column_List">
a.image_id, a.part_id, a.turbine_id, a.project,
a.image_name, a.image_size, a.focal_distance, a.shooting_time,
a.camera_manufacturer, a.camera_model
a.image, a.part_id, a.turbine_id, a.project_id, a.image_name, a.image_size, a.focal_distance, a.shooting_time, a.camera_manufacture, a.camera_model
</sql>
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.ImageResp">
select
<include refid="Base_Column_List"/>
<include refid="Base_Column_List"/>
from image a
<where>
<if test="keyword != null and keyword != ''">
# and (a.TODO like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or a.TODO like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
</if>
<if test="imageId != null">
and a.image_id = #{imageId}
</if>
<if test="partId != null">
and a.part_id = #{partId}
</if>
<if test="turbineId != null">
and a.turbine_id = #{turbineId}
</if>
<if test="project != null">
and a.project = #{project}
</if>
<if test="imageName != null and imageName != ''">
and a.image_name like concat ('%', #{imageName}, '%')
</if>
<if test="imageSize != null and imageSize != ''">
and a.image_size like concat ('%', #{imageSize}, '%')
</if>
<if test="focalDistance != null and focalDistance != ''">
and a.focal_distance like concat ('%', #{focalDistance}, '%')
</if>
<if test="shootingTime != null">
and a.shooting_time = #{shootingTime}
</if>
<if test="cameraManufacturer != null and cameraManufacturer != ''">
and a.camera_manufacturer like concat ('%', #{cameraManufacturer}, '%')
</if>
<if test="cameraModel != null and cameraModel != ''">
and a.camera_model like concat ('%', #{cameraModel}, '%')
and a.image_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%')
</if>
</where>
</select>
</mapper>
</mapper>

View File

@ -0,0 +1,29 @@
package com.dite.znpt.web.controller;
import com.dite.znpt.domain.PageResult;
import com.dite.znpt.domain.vo.ImageListReq;
import com.dite.znpt.domain.vo.ImageResp;
import com.dite.znpt.service.ImageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import javax.annotation.Resource;
/**
* @author Bear.G
* @date 2025/4/24/周四 12:46
* @description
*/
public class ImageController {
@Resource
private ImageService imageService;
@ApiOperation(value = "分页查询图像列表", httpMethod = "GET")
@GetMapping("/page")
public PageResult<ImageResp> list(ImageListReq req) {
return PageResult.ok(imageService.selectList(req));
}
}

View File

@ -1,7 +1,7 @@
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8080
port: 8888
# 数据源配置
spring:
@ -10,7 +10,7 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://39.99.201.243:3306/test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: h67&E98HS8^6
password: BUw8YW6%@^8q
druid:
# 初始连接数
initialSize: 5
@ -59,11 +59,16 @@ spring:
max-wait: 3000
host: 39.99.201.243
port: 6379
password: yfeng@123
password: diTeZn@123
timeout: 3000
# 0 gaea系统3 gaea-dev/gaea-test系统4 znpt开发5 znpt测试 6 znpt生产
database: 4
# mq 配置
rabbitmq:
host: 39.99.201.243
port: 3389
username: dite
password: diTezN@123
## MINIO配置
#minio:
# url: http://10.20.32.11:9000
@ -80,7 +85,7 @@ spring:
sip-config:
name: 信令服务
ip: 10.17.12.203
ip: 192.168.0.207
port: 1074
charset: gb2312
domain: 3402000000
@ -96,17 +101,17 @@ zlm-config:
# 公网ip
publicHost:
# 接口ip
apiHost: 10.17.12.203
apiHost: 192.168.0.207
# 接口端口
apiPort: 30186
apiPort: 8080
# 密钥
secretKey: JvVotkdN01y4qZHlrJsdq4gD7n9rK6wV
secretKey: 6Q76ivvVOQDsnnfOSKbtVzcYpbgy4n1G
# 流id前缀
streamPrefix:
# rtp ip
rtpHost: 10.17.12.203
# rtp 端口
rtpPort: 30186
rtpPort: 8080
# 动态端口起始值
dynamicPortStart: 30150
# 动态端口结束值