ssk 1 mês atrás
pai
commit
2e286d9c81

+ 2 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserViolationVo.java

@@ -27,4 +27,6 @@ public class LifeUserViolationVo extends LifeUserViolation {
     private String phone;
 
     private String nickName;
+
+    private String image;
 }

+ 44 - 35
alien-entity/src/main/java/shop/alien/mapper/LifeUserViolationMapper.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.LifeUserViolation;
+import shop.alien.entity.store.dto.LifeUserViolationDto;
 import shop.alien.entity.store.vo.LifeUserViolationVo;
 
 import java.util.List;
@@ -20,53 +21,61 @@ import java.util.List;
  * @since 2025-04-29
  */
 public interface LifeUserViolationMapper extends BaseMapper<LifeUserViolation> {
-    
+
     /**
      * 分页查询用户举报信息
-     * 
-     * @param page 分页对象
+     *
+     * @param page         分页对象
      * @param queryWrapper 查询条件包装器
      * @return 分页结果
      */
     @Select("<script>" +
-            "WITH userInfo AS (" +
-            "    SELECT " +
-            "        su.phone, " +
-            "        su.id, " +
-            "        CASE su.delete_flag " +
-            "            WHEN 1 THEN CONCAT(su.nick_name, '(账号已注销)') " +
-            "            ELSE su.nick_name " +
-            "        END AS nick_name, " +
-            "        '1' AS type " +
-            "    FROM store_user su " +
-            "    UNION ALL " +
-            "    SELECT " +
-            "        lu.user_phone AS phone, " +
-            "        lu.id, " +
-            "        CASE lu.delete_flag " +
-            "            WHEN 1 THEN CONCAT(lu.user_name, '(账号已注销)') " +
-            "            ELSE lu.user_name " +
-            "        END AS nick_name, " +
-            "        '2' AS type " +
-            "    FROM life_user lu " +
-            ") " +
-            "SELECT " +
-            "    luv.*, " +
-            "    ui.nick_name AS nickname, " +
-            "    ui.phone " +
-            "FROM life_user_violation luv " +
-            "LEFT JOIN userInfo ui ON ui.type = luv.reporting_user_type " +
-            "    AND ui.id = luv.reporting_user_id " +
-            "    ${ew.customSqlSegment}" +
+            " WITH userInfo AS ( " +
+            " SELECT " +
+            " su.phone, " +
+            " su.id, " +
+            " CASE su.delete_flag " +
+            " WHEN 1 THEN CONCAT(su.nick_name, '(账号已注销)') " +
+            " ELSE su.nick_name " +
+            " END AS nick_name, " +
+            " '1' AS type " +
+            " FROM store_user su " +
+            " UNION ALL " +
+            " SELECT " +
+            " lu.user_phone AS phone, " +
+            " lu.id, " +
+            " CASE lu.delete_flag " +
+            " WHEN 1 THEN CONCAT(lu.user_name, '(账号已注销)') " +
+            " ELSE lu.user_name " +
+            " END AS nick_name, " +
+            " '2' AS type " +
+            " FROM life_user lu " +
+            " ) " +
+            " SELECT " +
+            " luv.*, " +
+            " ui.nick_name AS nickname, " +
+            " ui.phone, " +
+            " img.img_url image" +
+            " FROM life_user_violation luv " +
+            " LEFT JOIN userInfo ui ON ui.type = luv.reporting_user_type " +
+            " AND ui.id = luv.reporting_user_id " +
+            " left join store_img img on luv.id = img.store_id and img.delete_flag = 0 " +
+            " ${ew.customSqlSegment}" +
             "</script>")
     IPage<LifeUserViolationVo> getViolationPage(
-            IPage<LifeUserViolationVo> page, 
+            IPage<LifeUserViolationVo> page,
             @Param(Constants.WRAPPER) QueryWrapper<LifeUserViolationVo> queryWrapper
     );
-    
+
+    @Select("select luv.*, img.img_url image " +
+            "FROM life_user_violation luv " +
+            "left join store_img img on luv.id = img.store_id and img.delete_flag = 0 " +
+            "${ew.customSqlSegment}")
+    LifeUserViolationDto getDetailById(@Param(Constants.WRAPPER) QueryWrapper<LifeUserViolationDto> queryWrapper);
+
     /**
      * 查询用户举报信息列表
-     * 
+     *
      * @param queryWrapper 查询条件包装器
      * @return 举报信息列表
      */

+ 7 - 10
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserViolationServiceImpl.java

@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.google.common.collect.Lists;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -18,7 +17,6 @@ import org.springframework.util.CollectionUtils;
 import shop.alien.entity.second.SecondGoodsRecord;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.dto.LifeUserViolationDto;
-import shop.alien.entity.store.excelVo.LifeUserOrderExcelVo;
 import shop.alien.entity.store.excelVo.LifeUserViolationExcelVO;
 import shop.alien.entity.store.excelVo.util.ExcelGenerator;
 import shop.alien.entity.store.vo.LifeUserViolationVo;
@@ -30,20 +28,16 @@ import shop.alien.store.service.*;
 import shop.alien.store.util.FunctionMagic;
 import shop.alien.util.ali.AliOSSUtil;
 import shop.alien.util.common.EnumUtil;
-import shop.alien.util.common.JwtUtil;
 
 import java.io.File;
 import java.io.IOException;
 import java.text.SimpleDateFormat;
-import java.time.Instant;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
-import static shop.alien.util.common.constant.Constant.*;
-
 
 /**
  * <p>
@@ -85,6 +79,7 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
     private final StoreCommentMapper storeCommentMapper;
 
     private final SecondGoodsRecordMapper secondGoodsRecordMapper;
+    private final StoreImgService storeImgService;
 
     @Value("${spring.web.resources.excel-path}")
     private String excelPath;
@@ -527,10 +522,12 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
         if (entity == null) return null;
         LifeUserViolationDto dto = new LifeUserViolationDto();
         BeanUtils.copyProperties(entity, dto);
-        if (Objects.nonNull(entity.getReportEvidenceImg())) {
-            List<String> list = Arrays.stream(entity.getReportEvidenceImg().split(",")).map(String::trim).collect(Collectors.toList());
-            dto.setImageList(list);
-        }
+        LambdaQueryWrapper<StoreImg> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(StoreImg::getStoreId, entity.getId());
+        queryWrapper.in(StoreImg::getImgType, 19);
+        List<StoreImg> storeImgList = storeImgService.list(queryWrapper);
+        List<String> collect = storeImgList.stream().map(StoreImg::getImgUrl).collect(Collectors.toList());
+        dto.setImageList(collect);
         // 处理举报人信息
         FunctionMagic.handleUserInfo(dto.getReportingUserType(), dto.getReportingUserId(), storeId -> storeUserService.getOne(FunctionMagic.idQueryWrapper(storeId)), lifeId -> lifeUserService.getOne(FunctionMagic.idQueryWrapper(lifeId)), user -> {
             if (user instanceof StoreUser) {