Commit 9b11bd9b authored by 刘基明's avatar 刘基明

图片审核失败图片

parent 0f994b09
......@@ -8,7 +8,7 @@ public enum FileChechStatusEnum {
INIT(0,"初始化"),
PASS(1,"审核通过"),
NOT_PASS(2,"审核不通过");
FAILED(2,"审核不通过");
public static final HashSet<String> ossTypeSet = SetUtils.hashSet("jpg", "jpeg", "png", "txt");
......
......@@ -3,7 +3,6 @@ package com.tanpu.community.dao.entity.community;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tanpu.community.api.enums.FileChechStatusEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -64,10 +63,6 @@ public class FileRecordEntity implements Serializable {
private String checkTaskId;
public String getUrl(){
if (FileChechStatusEnum.NOT_PASS.getCode().equals(checkStatus)){
// 审核不通过,返回默认图片
return "https://tamp-sit.oss-cn-shanghai.aliyuncs.com/community/pic/default/not_exist.jpg";
}
return getPreviewUrl().substring(0,getPreviewUrl().indexOf("?"));
}
......
......@@ -18,6 +18,7 @@ import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.api.beans.vo.feign.product.FundInfoBaseResp;
import com.tanpu.community.api.beans.vo.feign.product.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.zhibo.ZhiboListResp;
import com.tanpu.community.api.enums.FileChechStatusEnum;
import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.feign.course.FeignClientForCourse;
......@@ -180,7 +181,10 @@ public class BatchFeignCallService {
curriculumIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.SINGLE_IMG.type)) {
imageIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.NEW_COURSE_SECTION_AUDIO.type) ||
}else if (c.getType().equals(RelTypeEnum.MULTIPLE_IMAGE.type)) {
c.getImgList().forEach(img->imageIds.add(img.getRelId()));
}
else if (c.getType().equals(RelTypeEnum.NEW_COURSE_SECTION_AUDIO.type) ||
c.getType().equals(RelTypeEnum.NEW_COURSE_SECTION_VIDEO.type)) {
courseIds.add(c.getValue());
}
......@@ -436,6 +440,13 @@ public class BatchFeignCallService {
//压缩图片
.resizeUrl(imgEntity.getUrl() + CommunityConstant.OSS_RESIZE_RATIO)
.build();
// 图片审核屏蔽
if (FileChechStatusEnum.FAILED.getCode().equals(imgEntity.getCheckStatus())){
imagesDTO.setRemark("https://tamp-sit.oss-cn-shanghai.aliyuncs.com/community/pic/default/check_fail.png");
imagesDTO.setResizeUrl("https://tamp-sit.oss-cn-shanghai.aliyuncs.com/community/pic/default/check_fail.png?x-oss-process=image/resize,p_50");
imagesDTO.setImgWidth(1035);
imagesDTO.setImgHeight(1115);
}
themeContent.setImgList(Collections.singletonList(imagesDTO));
}
}
......@@ -446,15 +457,21 @@ public class BatchFeignCallService {
if (imgUrlMap.containsKey(imagesDTO.getRelId())) {
FileRecordEntity imgEntity = imgUrlMap.get(imagesDTO.getRelId());
// 处理屏蔽图片
imagesDTO.setRemark(imgEntity.getUrl());
//压缩图片地址
imagesDTO.setResizeUrl(imgEntity.getUrl() + CommunityConstant.OSS_RESIZE_RATIO);
String extInfo = imgEntity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)) {
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
imagesDTO.setImgHeight((Integer) extMap.get("height"));
imagesDTO.setImgWidth((Integer) extMap.get("width"));
// 图片审核不通过,替换为默认图片
if (FileChechStatusEnum.FAILED.getCode().equals(imgEntity.getCheckStatus())){
imagesDTO.setRemark("https://tamp-sit.oss-cn-shanghai.aliyuncs.com/community/pic/default/check_fail.png");
imagesDTO.setResizeUrl("https://tamp-sit.oss-cn-shanghai.aliyuncs.com/community/pic/default/check_fail.png?x-oss-process=image/resize,p_50");
imagesDTO.setImgWidth(1035);
imagesDTO.setImgHeight(1115);
}else {
imagesDTO.setRemark(imgEntity.getUrl());
imagesDTO.setResizeUrl(imgEntity.getUrl() + CommunityConstant.OSS_RESIZE_RATIO);
String extInfo = imgEntity.getExtInfo();
if (!StringUtils.isEmpty(extInfo)) {
Map<String, Object> extMap = JsonUtil.toMap(extInfo);
imagesDTO.setImgHeight((Integer) extMap.get("height"));
imagesDTO.setImgWidth((Integer) extMap.get("width"));
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment