|
@@ -0,0 +1,126 @@
|
|
|
|
|
+package shop.alien.second.service.impl;
|
|
|
|
|
+
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import shop.alien.entity.second.SecondGoods;
|
|
|
|
|
+import shop.alien.entity.second.vo.SecondGoodsVo;
|
|
|
|
|
+import shop.alien.entity.second.vo.SecondUserViolationDetailVo;
|
|
|
|
|
+import shop.alien.entity.second.vo.SecondUserViolationVo;
|
|
|
|
|
+import shop.alien.entity.store.LifeUserViolation;
|
|
|
|
|
+import shop.alien.entity.store.StoreImg;
|
|
|
|
|
+import shop.alien.mapper.LifeUserViolationMapper;
|
|
|
|
|
+import shop.alien.mapper.StoreImgMapper;
|
|
|
|
|
+import shop.alien.mapper.second.SecondGoodsMapper;
|
|
|
|
|
+import shop.alien.mapper.second.SecondUserViolationMapper;
|
|
|
|
|
+import shop.alien.second.service.PlatformUserViolationService;
|
|
|
|
|
+import shop.alien.second.service.SecondGoodsService;
|
|
|
|
|
+
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.time.ZoneId;
|
|
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@Service
|
|
|
|
|
+public class PlatformUserViolationServiceImpl extends ServiceImpl<SecondUserViolationMapper, SecondUserViolationVo> implements PlatformUserViolationService {
|
|
|
|
|
+
|
|
|
|
|
+ List<String> videoFileType = Arrays.asList("mp4", "avi", "flv", "mkv", "rmvb", "wmv", "3gp", "mov");
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SecondUserViolationMapper mapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private LifeUserViolationMapper lifeUserViolationMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SecondGoodsMapper secondGoodsMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private StoreImgMapper storeImgMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Lazy
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private SecondGoodsService secondGoodsService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<SecondUserViolationVo> getUserViolationByPage(IPage<SecondUserViolationVo> page, String reportingUserName,
|
|
|
|
|
+ String reportingDate, String processingStatus, Integer reportContextType) throws Exception {
|
|
|
|
|
+ try {
|
|
|
|
|
+ return mapper.getUserViolationByPage(page, reportingUserName, reportingDate, processingStatus, reportContextType);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("PlatformUserViolationServiceImpl.getUserViolationByPage Error Mgs={}", e.getMessage());
|
|
|
|
|
+ throw new Exception(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public SecondUserViolationDetailVo getUserViolationDetail(Integer id) throws Exception {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 查询举报信息
|
|
|
|
|
+ SecondUserViolationDetailVo item =mapper.getUserViolationInfo(id);
|
|
|
|
|
+
|
|
|
|
|
+ // 商品的时候查询商品信息
|
|
|
|
|
+ if (item.getReportContextType() == 4) {
|
|
|
|
|
+ SecondGoodsVo secondGoods = secondGoodsService.dealSecondGoodsRecordInfo(item.getBusinessId());
|
|
|
|
|
+ item.setSecondGoods(secondGoods);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 拆分举报图片信息
|
|
|
|
|
+ List<String> urlList = Arrays.asList(item.getReportEvidenceImg().split(","));
|
|
|
|
|
+ // 存放已存在文件list
|
|
|
|
|
+ List<String> videoList = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < urlList.size(); i++) {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 查找最后一个点的位置
|
|
|
|
|
+ int lastDotIndex = urlList.get(i).lastIndexOf('.');
|
|
|
|
|
+
|
|
|
|
|
+ String fileType = urlList.get(i).substring(urlList.get(i).lastIndexOf(".") + 1);;
|
|
|
|
|
+ String contains = null;
|
|
|
|
|
+ if (lastDotIndex != -1) { // 确保存在
|
|
|
|
|
+ contains = urlList.get(i).substring(0, lastDotIndex);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ 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));
|
|
|
|
|
+ }
|
|
|
|
|
+ list.add(map);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ item.setImgList(list);
|
|
|
|
|
+ return item;
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("PlatformUserViolationServiceImpl.getUserViolationByPage Error Mgs={}", e.getMessage());
|
|
|
|
|
+ throw new Exception(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static boolean isVideoUrl(String url) {
|
|
|
|
|
+ if (url == null) return false;
|
|
|
|
|
+ url = url.toLowerCase();
|
|
|
|
|
+ return url.endsWith(".mp4") ||
|
|
|
|
|
+ url.endsWith(".avi") ||
|
|
|
|
|
+ url.endsWith(".mov") ||
|
|
|
|
|
+ url.endsWith(".flv") ||
|
|
|
|
|
+ url.endsWith(".wmv") ||
|
|
|
|
|
+ url.endsWith(".mkv");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|