新增视频文件信息
This commit is contained in:
parent
af4c318a10
commit
b36cb3d38b
|
@ -35,3 +35,4 @@ build/
|
|||
### VS Code ###
|
||||
.vscode/
|
||||
target/
|
||||
logs/
|
|
@ -1,18 +1,13 @@
|
|||
package com.dite.znpt.config;
|
||||
|
||||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -29,13 +24,17 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
|||
@Value(value = "${upload.perm-path.image}")
|
||||
private String uploadPermPath;
|
||||
|
||||
@Value(value = "${upload.perm-path.video}")
|
||||
private String uploadPermVideoPath;
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
||||
registry.addResourceHandler("/static/image/**").addResourceLocations("file:" + uploadPermPath);
|
||||
registry.addResourceHandler("/static/image/temp/**").addResourceLocations("file:" + uploadTempPath);
|
||||
registry.addResourceHandler(Constants.PERM_IMAGE_PATH + "**").addResourceLocations("file:" + uploadPermPath);
|
||||
registry.addResourceHandler(Constants.PERM_VIDEO_PATH + "**").addResourceLocations("file:" + uploadPermVideoPath);
|
||||
registry.addResourceHandler(Constants.TEMP_IMAGE_PATH + "**").addResourceLocations("file:" + uploadTempPath);
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
|
|
@ -87,4 +87,10 @@ public class Constants {
|
|||
*/
|
||||
public static final String VISIBLE_1 = "1";
|
||||
|
||||
// 持久化图片路径请求前缀
|
||||
public static final String TEMP_IMAGE_PATH = "/static/image/temp/";
|
||||
// 临时图片路径请求前缀
|
||||
public static final String PERM_IMAGE_PATH = "/static/image/";
|
||||
// 持久化视频文件路径请求前缀
|
||||
public static final String PERM_VIDEO_PATH = "/static/video/";
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.dite.znpt.domain;
|
|||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -29,9 +30,11 @@ public class AuditableEntity implements Serializable {
|
|||
@ApiParam(hidden = true)
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间", example = "2022-01-22", notes = "创建时间", hidden = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(hidden = true)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package com.dite.znpt.domain.entity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:44
|
||||
* @Description: 视频文件信息表实体类
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("video_file_info")
|
||||
@ApiModel(value="VideoFileInfoEntity对象", description="视频文件信息表")
|
||||
public class VideoFileInfoEntity extends AuditableEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 306867911204598834L;
|
||||
|
||||
@ExcelProperty("id")
|
||||
@ApiModelProperty("id")
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@ExcelProperty("机组id")
|
||||
@ApiModelProperty(value = "机组id",required = true)
|
||||
@TableField("part_id")
|
||||
private String partId;
|
||||
|
||||
@ExcelProperty("测试点")
|
||||
@ApiModelProperty("测试点")
|
||||
@TableField("test_point")
|
||||
private String testPoint;
|
||||
|
||||
@ExcelProperty("作业人员id")
|
||||
@ApiModelProperty("作业人员id")
|
||||
@TableField("worker_user_id")
|
||||
private String workerUserId;
|
||||
|
||||
@ExcelProperty("拍摄时间")
|
||||
@ApiModelProperty("拍摄时间")
|
||||
@TableField("shooting_time")
|
||||
private LocalDateTime shootingTime;
|
||||
|
||||
@ExcelProperty("拍摄地点")
|
||||
@ApiModelProperty("拍摄地点")
|
||||
@TableField("location")
|
||||
private String location;
|
||||
|
||||
@ExcelProperty("是否合格,默认合格1")
|
||||
@ApiModelProperty("是否合格,默认合格1")
|
||||
@TableField("qualified")
|
||||
private Integer qualified;
|
||||
|
||||
@ExcelProperty("是否已抓帧,默认未抓帧0")
|
||||
@ApiModelProperty("是否已抓帧,默认未抓帧0")
|
||||
@TableField("frame_capture")
|
||||
private Integer frameCapture;
|
||||
|
||||
@ExcelProperty("文件保存路径")
|
||||
@ApiModelProperty("文件保存路径")
|
||||
@TableField("file_path")
|
||||
private String filePath;
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:44
|
||||
* @Description: 视频文件信息请求实体
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("视频文件信息列表请求实体")
|
||||
public class VideoFileInfoListReq implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 499752243735301115L;
|
||||
|
||||
@ApiModelProperty("查询关键字")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("视频文件信息Id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("机组id")
|
||||
private String partId;
|
||||
|
||||
@ApiModelProperty("测试点")
|
||||
private String testPoint;
|
||||
|
||||
@ApiModelProperty("作业人员id")
|
||||
private String workerUserId;
|
||||
|
||||
@ApiModelProperty("拍摄时间")
|
||||
private LocalDateTime shootingTime;
|
||||
|
||||
@ApiModelProperty("拍摄地点")
|
||||
private String location;
|
||||
|
||||
@ApiModelProperty("是否合格,默认合格1")
|
||||
private Integer qualified;
|
||||
|
||||
@ApiModelProperty("是否已抓帧,默认未抓帧0")
|
||||
private Integer frameCapture;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
* @date 2025/5/27/周二 15:25
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("人员资质请求实体")
|
||||
public class VideoFileInfoReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1737569842748352413L;
|
||||
|
||||
@NotBlank(message = "机组id不能为空")
|
||||
@ApiModelProperty(value = "机组id",required = true)
|
||||
private String partId;
|
||||
|
||||
@ApiModelProperty("测试点")
|
||||
private String testPoint;
|
||||
|
||||
@ApiModelProperty("作业人员id")
|
||||
private String workerUserId;
|
||||
|
||||
@ApiModelProperty("拍摄时间")
|
||||
private LocalDateTime shootingTime;
|
||||
|
||||
@ApiModelProperty("拍摄地点")
|
||||
private String location;
|
||||
|
||||
@ApiModelProperty("是否合格,默认合格1")
|
||||
private Integer qualified;
|
||||
}
|
|
@ -0,0 +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.VideoFileInfoEntity;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
* @Description: 视频文件信息响应实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("视频文件信息响应实体")
|
||||
public class VideoFileInfoResp extends VideoFileInfoEntity {
|
||||
}
|
||||
|
|
@ -14,9 +14,9 @@ import java.util.List;
|
|||
@Getter
|
||||
public enum MenuTypeEnum {
|
||||
|
||||
DEFECT("catalog", "目录"),
|
||||
TYPICAL("route", "菜单"),
|
||||
OTHER("button", "按钮");
|
||||
CATALOG("catalog", "目录"),
|
||||
ROUTE("route", "菜单"),
|
||||
BUTTON("button", "按钮");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.VideoFileInfoEntity;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoListReq;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
* @Description: 视频文件信息表数据库访问层
|
||||
*/
|
||||
public interface VideoFileInfoMapper extends BaseMapper<VideoFileInfoEntity> {
|
||||
List<VideoFileInfoResp> queryBySelective(VideoFileInfoListReq videoFileInfoReq);
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.VideoFileInfoEntity;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoListReq;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoReq;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoResp;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
* @Description: 视频文件信息表服务接口
|
||||
*/
|
||||
public interface VideoFileInfoService extends IService<VideoFileInfoEntity> {
|
||||
|
||||
/**
|
||||
* 功能描述:查询视频文件信息列表
|
||||
*
|
||||
* @param videoFileInfoReq 视频文件信息
|
||||
* @return {@link List }<{@link VideoFileInfoEntity }>
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
**/
|
||||
List<VideoFileInfoResp> selectList(VideoFileInfoListReq videoFileInfoReq);
|
||||
|
||||
/**
|
||||
* 功能描述:查询单条视频文件信息
|
||||
*
|
||||
* @param id 视频文件信息Id
|
||||
* @return {@link VideoFileInfoResp }
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
**/
|
||||
VideoFileInfoResp selectById(String id);
|
||||
|
||||
/**
|
||||
* 功能描述:更新视频文件信息
|
||||
*
|
||||
* @param videoFileInfo 视频文件信息
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
**/
|
||||
void updateData(VideoFileInfoEntity videoFileInfo);
|
||||
|
||||
/**
|
||||
* 功能描述:删除视频文件信息
|
||||
*
|
||||
* @param id 视频文件信息Id
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
**/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 功能描述:批量上传
|
||||
*
|
||||
* @param infoReq 视频文件信息实体
|
||||
* @param files 文件
|
||||
* @return
|
||||
* @author cuizhibin
|
||||
* @date 2025/06/09 10:14
|
||||
*/
|
||||
List<String> batchUpload(VideoFileInfoReq infoReq, MultipartFile[] files);
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ public class CombinedDictServiceImpl extends ServiceImpl<CombinedDictMapper, Com
|
|||
combinedDictReq.setDictId(dictId);
|
||||
|
||||
List<CombinedDictResp> list = selectList(combinedDictReq);
|
||||
return list.isEmpty() ? CollUtil.getFirst(list) : new CombinedDictResp();
|
||||
return CollUtil.isNotEmpty(list) ? CollUtil.getFirst(list) : new CombinedDictResp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfoEnt
|
|||
fileInfoReq.setFileId(fileId);
|
||||
|
||||
List<FileInfoResp> list = selectList(fileInfoReq);
|
||||
return list.isEmpty() ? CollUtil.getFirst(list) : new FileInfoResp();
|
||||
return CollUtil.isNotEmpty(list) ? CollUtil.getFirst(list) : new FileInfoResp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.dite.znpt.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.file.PathUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
|
@ -9,6 +10,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.domain.bo.PartFullInfoBo;
|
||||
import com.dite.znpt.domain.entity.ImageCollectEntity;
|
||||
|
@ -272,9 +274,10 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
* @date 2025/06/06 09:07
|
||||
**/
|
||||
public static String getImageDownPath(String relativePath) {
|
||||
String url = StrUtil.SLASH.concat("static").concat(StrUtil.SLASH).concat("image").concat(StrUtil.SLASH).concat(relativePath);
|
||||
String url = Constants.PERM_IMAGE_PATH.concat(relativePath);
|
||||
return StrUtil.replace(url, FileUtil.FILE_SEPARATOR, StrUtil.SLASH);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:获取tmp图像下载路径
|
||||
*
|
||||
|
@ -284,7 +287,7 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
* @date 2025/06/06 09:07
|
||||
**/
|
||||
public static String getTmpImageDownPath(String relativePath) {
|
||||
String url = StrUtil.SLASH.concat("static").concat(StrUtil.SLASH).concat("image").concat(StrUtil.SLASH).concat("temp").concat(StrUtil.SLASH).concat(relativePath);
|
||||
String url = Constants.TEMP_IMAGE_PATH.concat(StrUtil.SLASH).concat(relativePath);
|
||||
return StrUtil.replace(url, FileUtil.FILE_SEPARATOR, StrUtil.SLASH);
|
||||
}
|
||||
|
||||
|
@ -296,7 +299,13 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) {
|
||||
if (path.toFile().isFile()) {
|
||||
String relativePath = StrUtil.removePrefix(path.toFile().getAbsolutePath(), permPath);
|
||||
filePaths.add(getImageDownPath(relativePath));
|
||||
String imageDownPath = getImageDownPath(relativePath);
|
||||
List<String> split = StrUtil.split(imageDownPath, StrUtil.SLASH, true, true);
|
||||
// /static/image/source/date
|
||||
try {
|
||||
DateUtil.parseDate(split.get(4));
|
||||
filePaths.add(imageDownPath);
|
||||
} catch (Exception ignore) {}
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class TConstructionServiceImpl extends ServiceImpl<TConstructionMapper, T
|
|||
tConstructionReq.setConstructionId(constructionId);
|
||||
|
||||
List<TConstructionResp> list = selectList(tConstructionReq);
|
||||
return list.isEmpty() ? CollUtil.getFirst(list) : new TConstructionResp();
|
||||
return CollUtil.isNotEmpty(list) ? CollUtil.getFirst(list) : new TConstructionResp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Constants;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.domain.entity.VideoFileInfoEntity;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoListReq;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoReq;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoResp;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.service.PartService;
|
||||
import com.dite.znpt.service.VideoFileInfoService;
|
||||
import com.dite.znpt.mapper.VideoFileInfoMapper;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
* @Description: 视频文件信息表服务实现类
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class VideoFileInfoServiceImpl extends ServiceImpl<VideoFileInfoMapper, VideoFileInfoEntity> implements VideoFileInfoService {
|
||||
|
||||
private final PartService partService;
|
||||
@Value(value = "${upload.perm-path.video}")
|
||||
private String uploadPermVideoPath;
|
||||
|
||||
/**
|
||||
* 功能描述:查询视频文件信息列表
|
||||
*
|
||||
* @param videoFileInfoReq 视频文件信息信息
|
||||
* @return {@link List }<{@link VideoFileInfoResp }>
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
**/
|
||||
@Override
|
||||
public List<VideoFileInfoResp> selectList(VideoFileInfoListReq videoFileInfoReq) {
|
||||
PageUtil.startPage();
|
||||
List<VideoFileInfoResp> videoFileInfoList = this.baseMapper.queryBySelective(videoFileInfoReq);
|
||||
videoFileInfoList.forEach(resp -> {
|
||||
|
||||
});
|
||||
return videoFileInfoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:查询单条视频文件信息
|
||||
*
|
||||
* @param id 视频文件信息Id
|
||||
* @return {@link VideoFileInfoResp }
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
**/
|
||||
@Override
|
||||
public VideoFileInfoResp selectById(String id) {
|
||||
VideoFileInfoListReq videoFileInfoReq = new VideoFileInfoListReq();
|
||||
videoFileInfoReq.setId(id);
|
||||
|
||||
List<VideoFileInfoResp> list = selectList(videoFileInfoReq);
|
||||
return CollUtil.isNotEmpty(list) ? CollUtil.getFirst(list) : new VideoFileInfoResp();
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:更新视频文件信息
|
||||
*
|
||||
* @param videoFileInfo 视频文件信息
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
**/
|
||||
@Override
|
||||
public void updateData(VideoFileInfoEntity videoFileInfo) {
|
||||
updateById(videoFileInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:删除视频文件信息
|
||||
*
|
||||
* @param id 视频文件信息Id
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:45
|
||||
**/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:批量上传
|
||||
*
|
||||
* @param infoReq 视频文件信息实体
|
||||
* @param files 文件
|
||||
* @return
|
||||
* @author cuizhibin
|
||||
* @date 2025/06/09 10:14
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<String> batchUpload(VideoFileInfoReq infoReq, MultipartFile[] files) {
|
||||
if (null == partService.getById(infoReq.getPartId())) {
|
||||
throw new ServiceException(Message.PART_ID_IS_NOT_EXIST);
|
||||
}
|
||||
if (null == files || files.length == 0) {
|
||||
throw new ServiceException(Message.IMAGE_IS_EMPTY);
|
||||
}
|
||||
String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
String path_prefix = uploadPermVideoPath.concat(dateStr).concat(FileUtil.FILE_SEPARATOR);
|
||||
if (!FileUtil.exist(path_prefix)) {
|
||||
FileUtil.mkdir(path_prefix);
|
||||
}
|
||||
List<VideoFileInfoEntity> result = new ArrayList<>(files.length);
|
||||
for (MultipartFile multipartFile : files) {
|
||||
VideoFileInfoEntity info = BeanUtil.copyProperties(infoReq, VideoFileInfoEntity.class);
|
||||
String path = path_prefix + multipartFile.getOriginalFilename();
|
||||
FileUtil.writeBytes(multipartFile.getBytes(), path);
|
||||
info.setFilePath(Constants.PERM_VIDEO_PATH + StrUtil.removePrefix(path, uploadPermVideoPath).replace(FileUtil.FILE_SEPARATOR, StrUtil.SLASH));
|
||||
result.add(info);
|
||||
}
|
||||
baseMapper.insert(result);
|
||||
return result.stream().map(VideoFileInfoEntity::getFilePath).collect(Collectors.toList());
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ public class WeatherTypeServiceImpl extends ServiceImpl<WeatherTypeMapper, Weath
|
|||
weatherTypeReq.setWeatherCode(weatherCode);
|
||||
|
||||
List<WeatherTypeResp> list = selectList(weatherTypeReq);
|
||||
return list.isEmpty() ? CollUtil.getFirst(list) : new WeatherTypeResp();
|
||||
return CollUtil.isNotEmpty(list) ? CollUtil.getFirst(list) : new WeatherTypeResp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
<?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.VideoFileInfoMapper">
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
a.id, a.part_id, a.test_point, a.worker_user_id,
|
||||
a.shooting_time, a.location, a.qualified, a.frame_capture,
|
||||
a.file_path, a.update_by, a.create_time, a.create_by,
|
||||
a.update_time
|
||||
</sql>
|
||||
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.VideoFileInfoResp">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from video_file_info a
|
||||
<where>
|
||||
<if test="id != null and id != ''">
|
||||
and a.id like concat ('%', #{id}, '%')
|
||||
</if>
|
||||
<if test="partId != null and partId != ''">
|
||||
and a.part_id like concat ('%', #{partId}, '%')
|
||||
</if>
|
||||
<if test="testPoint != null and testPoint != ''">
|
||||
and a.test_point like concat ('%', #{testPoint}, '%')
|
||||
</if>
|
||||
<if test="workerUserId != null and workerUserId != ''">
|
||||
and a.worker_user_id like concat ('%', #{workerUserId}, '%')
|
||||
</if>
|
||||
<if test="shootingTime != null">
|
||||
and a.shooting_time = #{shootingTime}
|
||||
</if>
|
||||
<if test="location != null and location != ''">
|
||||
and a.location like concat ('%', #{location}, '%')
|
||||
</if>
|
||||
<if test="qualified != null">
|
||||
and a.qualified = #{qualified}
|
||||
</if>
|
||||
<if test="frameCapture != null">
|
||||
and a.frame_capture = #{frameCapture}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.dite.znpt.web.controller;
|
||||
|
||||
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.entity.VideoFileInfoEntity;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoListReq;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoReq;
|
||||
import com.dite.znpt.domain.vo.VideoFileInfoResp;
|
||||
import com.dite.znpt.service.VideoFileInfoService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/06/09 09:42
|
||||
*/
|
||||
@Api(tags = "视频文件信息")
|
||||
@RestController
|
||||
@RequestMapping("/video-file-info")
|
||||
public class VideoFileInfoController {
|
||||
@Resource
|
||||
private VideoFileInfoService videoFileInfoService;
|
||||
|
||||
@ApiOperation(value = "获取视频文件信息列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public PageResult<VideoFileInfoResp> list(VideoFileInfoListReq videoFileInfoReq) {
|
||||
return PageResult.ok(videoFileInfoService.selectList(videoFileInfoReq));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据视频文件信息Id获取详细信息", httpMethod = "GET")
|
||||
@GetMapping("/{id}")
|
||||
public Result<VideoFileInfoResp> getInfo(@PathVariable String id) {
|
||||
return Result.ok(videoFileInfoService.selectById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量上传视频文件", httpMethod = "POST")
|
||||
@PostMapping("/batch-upload")
|
||||
public Result batchUploadImage(VideoFileInfoReq infoReq,
|
||||
@RequestParam("file") MultipartFile[] files) throws IOException {
|
||||
return Result.ok(videoFileInfoService.batchUpload(infoReq, files));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改视频文件信息", httpMethod = "PUT")
|
||||
@PutMapping
|
||||
public Result<Object> edit(@RequestBody VideoFileInfoEntity videoFileInfo) {
|
||||
videoFileInfoService.updateData(videoFileInfo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除视频文件信息", httpMethod = "DELETE")
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Object> remove(@PathVariable String id) {
|
||||
videoFileInfoService.deleteById(id);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
@ -138,4 +138,5 @@ upload:
|
|||
image: D:\Upload\Image\Temp\
|
||||
perm-path:
|
||||
image: D:\Upload\Image\
|
||||
video: D:\Upload\Video\
|
||||
|
||||
|
|
Loading…
Reference in New Issue