图片增加来源

This commit is contained in:
高雄 2025-07-07 16:44:58 +08:00
parent 14ba8266fa
commit 4373fb4374
6 changed files with 30 additions and 7 deletions

View File

@ -75,4 +75,8 @@ public class ImageCollectEntity extends AuditableEntity implements Serializable
@ApiModelProperty("采集员姓名")
@TableField("collector_name")
private String collectorName;
@ApiModelProperty("来源")
@TableField("image_source")
private String imageSource;
}

View File

@ -47,4 +47,10 @@ public class ImageCollectInfo implements Serializable {
@ApiModelProperty("采集员姓名")
private String collectorName;
@ApiModelProperty("来源")
private String imageSource;
@ApiModelProperty("来源描述")
private String imageSourceLabel;
}

View File

@ -60,6 +60,9 @@ public class ImageCollectReq implements Serializable {
@ApiModelProperty("采集员姓名")
private String collectorName;
@ApiModelProperty("来源")
private String imageSource;
@ApiModelProperty("图像信息")
private List<ImageReq> imageList;
}

View File

@ -83,6 +83,12 @@ public class ImageListResp implements Serializable {
@ApiModelProperty("采集员姓名")
private String collectorName;
@ApiModelProperty("来源,枚举ImageSourceEnum")
private String imageSource;
@ApiModelProperty("来源描述")
private String imageSourceLabel;
@ApiModelProperty("影像类型,枚举ImageTypeEnum")
private String imageType;

View File

@ -69,18 +69,19 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
@Override
public List<ImageListResp> list(ImageListReq req) {
List<ImageListResp> partList= this.baseMapper.queryImageList(req);
if (CollUtil.isNotEmpty(partList)) {
Map<String, List<AudioFileInfoResp>> audioMap = audioFileInfoService.selectByImageIds(partList.stream().map(ImageListResp::getImageId).collect(Collectors.toList()))
List<ImageListResp> list = this.baseMapper.queryImageList(req);
if (CollUtil.isNotEmpty(list)) {
Map<String, List<AudioFileInfoResp>> audioMap = audioFileInfoService.selectByImageIds(list.stream().map(ImageListResp::getImageId).collect(Collectors.toList()))
.stream().collect(Collectors.groupingBy(AudioFileInfoResp::getImageId));
partList.forEach(resp -> {
list.forEach(resp -> {
resp.setAudioList(BeanUtil.copyToList(audioMap.get(resp.getImageId()), AudioFileInfoResp.class));
resp.setWeatherLabel(WeatherEnum.getDescByCode(resp.getWeather()));
resp.setShootingMethodLabel(ShootingMethodEnum.getDescByCode(resp.getShootingMethod()));
resp.setImageTypeLabel(ImageTypeEnum.getDescByCode(resp.getImageType()));
resp.setImageSourceLabel(ImageSourceEnum.getDescByCode(resp.getImageSource()));
});
}
return partList;
return list;
}
@Override
@ -124,6 +125,7 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
if (null != imageResp.getImageCollectInfo()) {
imageResp.getImageCollectInfo().setWeatherLabel(WeatherEnum.getDescByCode(imageResp.getImageCollectInfo().getWeather()));
imageResp.getImageCollectInfo().setShootingMethodLabel(ShootingMethodEnum.getDescByCode(imageResp.getImageCollectInfo().getShootingMethodLabel()));
imageResp.getImageCollectInfo().setImageSourceLabel(ImageSourceEnum.getDescByCode(imageResp.getImageCollectInfo().getImageSource()));
}
}
return imageResp;
@ -150,6 +152,7 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
String temPathPrefix = FilePathEnum.IMAGE_TEMP.getFileAbsolutePathPrefix().concat(imageSource).concat(FileUtil.FILE_SEPARATOR).concat(partId).concat(FileUtil.FILE_SEPARATOR);
ImageCollectEntity imageCollect = Optional.ofNullable(BeanUtil.copyProperties(collectReq, ImageCollectEntity.class)).orElse(new ImageCollectEntity());
imageCollect.setCollectId(IdUtil.simpleUUID());
imageCollect.setImageSource(imageSource);
List<ImageEntity> imageList = new ArrayList<>();
for (MultipartFile file : files) {
ImageEntity imageEntity = new ImageEntity();

View File

@ -5,7 +5,7 @@
SELECT
i.image_id, i.image_name, i.part_id, p.part_name, i.image_resolution, i.focal_distance, i.shooting_time, i.camera_manufacturer,
i.camera_model, i.GPS, ic.weather, ic.humidness, CONCAT(ic.temperature_min, '℃', '~',temperature_max, '℃') AS temperature, ic.wind_level,
ic.shooting_method, ic.shooting_distance,ic.collector_name, i.image_type, i.image_path
ic.shooting_method, ic.shooting_distance,ic.collector_name, i.image_type, i.image_path, ic.image_source
FROM image i
LEFT JOIN image_collect ic ON i.collect_id = ic.collect_id
LEFT JOIN part p ON i.part_id = p.part_id
@ -56,6 +56,7 @@
<result property="shootingMethod" column="shooting_method"></result>
<result property="shootingDistance" column="shooting_distance"></result>
<result property="collectorName" column="collector_name"></result>
<result property="imageSource" column="image_source"></result>
</association>
</resultMap>
@ -63,7 +64,7 @@
SELECT i.image_id, i.image_name, i.image_path, i.image_height, i.image_resolution, i.image_width, i.image_height, i.focal_distance,
i.focal_distance35, i.x_resolution, i.y_resolution, i.resolution_units, i.shooting_time, i.camera_manufacturer, i.camera_model,
i.latitude, i.latitude, i.altitude, ic.collect_id, ic.weather, CONCAT(ic.temperature_min, '℃', '~',temperature_max, '℃') AS temperature,
ic.wind_level, ic.shooting_method, ic.shooting_distance, ic.collector_name
ic.wind_level, ic.shooting_method, ic.shooting_distance, ic.collector_name, ic.image_source
FROM image i
LEFT JOIN image_collect ic ON i.collect_id = ic.collect_id
WHERE i.image_id = #{imageId}