|
|
@@ -311,24 +311,23 @@ public class TechnicianMomentServiceImpl extends ServiceImpl<TechnicianMomentMap
|
|
|
throw new ServiceException("动态内容不能为空");
|
|
|
}
|
|
|
// 校验媒体类型和媒体文件
|
|
|
- if (dto.getMediaType() == null) {
|
|
|
- throw new ServiceException("媒体类型不能为空");
|
|
|
- }
|
|
|
- if (dto.getMediaType() == 1) {
|
|
|
- // 图片类型
|
|
|
- if (dto.getImageUrls() == null || dto.getImageUrls().isEmpty()) {
|
|
|
- throw new ServiceException("图片不能为空");
|
|
|
- }
|
|
|
- if (dto.getImageUrls().size() > 9) {
|
|
|
- throw new ServiceException("最多只能上传9张图片");
|
|
|
- }
|
|
|
- } else if (dto.getMediaType() == 2) {
|
|
|
- // 视频类型
|
|
|
- if (StringUtils.isBlank(dto.getVideoUrl())) {
|
|
|
- throw new ServiceException("视频不能为空");
|
|
|
+ if (dto.getMediaType() != null) {
|
|
|
+ if (dto.getMediaType() == 1) {
|
|
|
+ // 图片类型
|
|
|
+ if (dto.getImageUrls() == null || dto.getImageUrls().isEmpty()) {
|
|
|
+ throw new ServiceException("图片不能为空");
|
|
|
+ }
|
|
|
+ if (dto.getImageUrls().size() > 9) {
|
|
|
+ throw new ServiceException("最多只能上传9张图片");
|
|
|
+ }
|
|
|
+ } else if (dto.getMediaType() == 2) {
|
|
|
+ // 视频类型
|
|
|
+ if (StringUtils.isBlank(dto.getVideoUrl())) {
|
|
|
+ throw new ServiceException("视频不能为空");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new ServiceException("媒体类型不正确");
|
|
|
}
|
|
|
- } else {
|
|
|
- throw new ServiceException("媒体类型不正确");
|
|
|
}
|
|
|
}
|
|
|
|