|
|
@@ -4,15 +4,12 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import shop.alien.entity.second.SecondGoods;
|
|
|
import shop.alien.entity.second.SecondGoodsRecord;
|
|
|
-import shop.alien.entity.second.vo.SecondGoodsVo;
|
|
|
import shop.alien.entity.second.vo.SecondReportingVo;
|
|
|
import shop.alien.entity.second.vo.SecondUserViolationVo;
|
|
|
import shop.alien.entity.store.*;
|
|
|
@@ -24,7 +21,6 @@ import shop.alien.second.service.SecondGoodsReportingService;
|
|
|
import shop.alien.second.util.AiUserViolationUtils;
|
|
|
import shop.alien.second.util.JsonUtils;
|
|
|
import shop.alien.util.common.Constants;
|
|
|
-import shop.alien.util.common.EnumUtil;
|
|
|
import shop.alien.util.common.JwtUtil;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
@@ -32,7 +28,6 @@ import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 二手商品服务实现类
|
|
|
@@ -127,32 +122,43 @@ public class SecondGoodsReportingServiceImpl implements SecondGoodsReportingServ
|
|
|
List<String> videoList = new ArrayList<>();
|
|
|
|
|
|
if (lifeUserViolation.getReportContextType().equals("1") || lifeUserViolation.getReportContextType().equals("2") || lifeUserViolation.getReportContextType().equals("3")) {
|
|
|
- List<String> urlList = Arrays.asList(lifeUserViolation.getReportEvidenceImg().split(","));
|
|
|
- for (int i = 0; i < urlList.size(); i++) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
+ if (StringUtils.isNotBlank(lifeUserViolation.getReportEvidenceImg())) {
|
|
|
+ List<String> urlList = Arrays.asList(lifeUserViolation.getReportEvidenceImg().split(","));
|
|
|
+ for (int i = 0; i < urlList.size(); i++) {
|
|
|
+ String url = urlList.get(i);
|
|
|
+ // 过滤掉空的URL
|
|
|
+ if (StringUtils.isBlank(url)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- // 查找最后一个点的位置
|
|
|
- int lastDotIndex = urlList.get(i).lastIndexOf('.');
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
- String fileType = urlList.get(i).substring(urlList.get(i).lastIndexOf(".") + 1);
|
|
|
- String contains = null;
|
|
|
- if (lastDotIndex != -1) { // 确保存在
|
|
|
- contains = urlList.get(i).substring(0, lastDotIndex);
|
|
|
- }
|
|
|
+ // 查找最后一个点的位置
|
|
|
+ int lastDotIndex = url.lastIndexOf('.');
|
|
|
|
|
|
- if (!videoList.contains(contains)) {
|
|
|
- videoList.add(contains);
|
|
|
- if (videoFileType.contains(fileType.toLowerCase())) {
|
|
|
- map.put("type", "video");
|
|
|
- map.put("imgUrl", urlList.get(i + 1));
|
|
|
- map.put("videoUrl", urlList.get(i));
|
|
|
- } else {
|
|
|
- map.put("type", "image");
|
|
|
- map.put("imgUrl", urlList.get(i));
|
|
|
+ String fileType = url.substring(url.lastIndexOf(".") + 1);
|
|
|
+ String contains = null;
|
|
|
+ if (lastDotIndex != -1) { // 确保存在
|
|
|
+ contains = url.substring(0, lastDotIndex);
|
|
|
}
|
|
|
- list.add(map);
|
|
|
- }
|
|
|
|
|
|
+ if (!videoList.contains(contains)) {
|
|
|
+ videoList.add(contains);
|
|
|
+ if (videoFileType.contains(fileType.toLowerCase())) {
|
|
|
+ map.put("type", "video");
|
|
|
+ if (i + 1 < urlList.size() && StringUtils.isNotBlank(urlList.get(i + 1))) {
|
|
|
+ map.put("imgUrl", urlList.get(i + 1));
|
|
|
+ map.put("videoUrl", url);
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ map.put("type", "image");
|
|
|
+ map.put("imgUrl", url);
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
LambdaQueryWrapper<StoreImg> wrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -160,16 +166,22 @@ public class SecondGoodsReportingServiceImpl implements SecondGoodsReportingServ
|
|
|
wrapper.eq(StoreImg::getImgType, Constants.ImageType.SECOND_HAND_REPORT);
|
|
|
List<StoreImg> imgList = storeImgMapper.selectList(wrapper);
|
|
|
for (int i = 0; i < imgList.size(); i++) {
|
|
|
+ StoreImg storeImg = imgList.get(i);
|
|
|
+ // 过滤掉imgUrl为空或null的记录
|
|
|
+ if (storeImg == null || StringUtils.isBlank(storeImg.getImgUrl())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
- String fileType = imgList.get(i).getImgUrl().substring(imgList.get(i).getImgUrl().lastIndexOf(".") + 1);
|
|
|
+ String fileType = storeImg.getImgUrl().substring(storeImg.getImgUrl().lastIndexOf(".") + 1);
|
|
|
|
|
|
if (videoFileType.contains(fileType.toLowerCase())) {
|
|
|
map.put("type", "video");
|
|
|
} else {
|
|
|
map.put("type", "image");
|
|
|
}
|
|
|
- map.put("imgUrl", imgList.get(i).getImgUrl());
|
|
|
+ map.put("imgUrl", storeImg.getImgUrl());
|
|
|
list.add(map);
|
|
|
}
|
|
|
secondReportingVo.setVideoFirstFrame(lifeUserViolation.getVideoFirstFrame());
|