فهرست منبع

Merge remote-tracking branch 'origin/sit-plantform' into sit-plantform

lyx 5 روز پیش
والد
کامیت
cf98c4c073

+ 16 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondUserViolationDetailVo.java

@@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import shop.alien.entity.store.LifeComment;
+import shop.alien.entity.store.LifeUserDynamics;
 
 import java.util.List;
 import java.util.Map;
@@ -24,6 +26,20 @@ public class SecondUserViolationDetailVo extends SecondUserViolationVo{
     // 商品信息
     private SecondGoodsVo secondGoods;
 
+    // 动态图片
+    @ApiModelProperty(value = "动态图片")
+    private List<String> dynamicsImg;
 
+    // 评论图片
+    @ApiModelProperty(value = "评论图片")
+    private List<String> commentImg;
+
+    // 动态信息
+    @ApiModelProperty(value = "动态信息")
+    List<LifeUserDynamics> dynamicsList;
+
+    // 评论信息
+    @ApiModelProperty(value = "评论信息")
+    List<LifeComment> commentList;
 
 }

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondUserViolationVo.java

@@ -52,7 +52,7 @@ public class SecondUserViolationVo extends LifeUserViolation {
     @ApiModelProperty(value = "举报状态")
     private String processingContext;
 
-    @ApiModelProperty(value = "商品图片")
+    @ApiModelProperty(value = "图片")
     private List<String> imgUrl;
 
 }

+ 3 - 0
alien-entity/src/main/java/shop/alien/mapper/second/SecondUserViolationMapper.java

@@ -17,4 +17,7 @@ public interface SecondUserViolationMapper extends BaseMapper<SecondUserViolatio
                                                         @Param("reportContextType") String reportContextType);
 
     SecondUserViolationDetailVo getUserViolationInfo(@Param("id") Integer id);
+
+
+    SecondUserViolationDetailVo getUserViolationDetailInfo(@Param("id") Integer id);
 }

+ 33 - 0
alien-entity/src/main/resources/mapper/second/SecondUserViolationMapper.xml

@@ -92,4 +92,37 @@
         </if>
     </select>
 
+
+    <!-- 分页查询举报信息 -->
+    <select id="getUserViolationDetailInfo" resultType="shop.alien.entity.second.vo.SecondUserViolationDetailVo">
+        select
+            v.id,
+            case when reported_user_type = 1 then s.nick_name else u.user_name end reported_user_name,
+            case when reported_user_type = 1 then s.phone else u.user_phone end reported_user_phone,
+            case when reporting_user_type = 1 then su.nick_name else lu.user_name end reporting_user_name,
+            case when reporting_user_type = 1 then su.phone else lu.user_phone end reporting_user_phone,
+            v.created_time,
+            case when v.processing_status = 0 then '待处理' when v.processing_status = 1 then '已通过' else '已驳回' end processing_status,
+            case when v.violation_type = 1 then '用户违规' when v.violation_type = 2 then '色情低俗' when v.violation_type = 3 then '违法违规' when v.violation_type = 4 then '谩骂嘲讽、煽动对立' when v.violation_type = 5 then '涉嫌诈骗'
+            when v.violation_type = 6 then '人身攻击' when v.violation_type = 7 then '种族歧视' when v.violation_type = 8 then '政治敏感' when v.violation_type = 9 then '虚假、不实内容'
+            when v.violation_type = 10 then '违反公德秩序' when v.violation_type = 11 then '危害人身安全' when v.violation_type = 12 then '网络暴力' else '其他原因' end dict_detail,
+            v.business_id,
+            v.report_context_type,
+            v.processing_status,
+            v.other_reason_content,
+            v.report_evidence_img,
+            v.processing_time,
+            v.report_result,
+            v.video_first_frame
+        from
+            life_user_violation v
+            left join life_user u on v.reported_user_id = u.id
+            left join store_user s on v.reported_user_id = s.id
+            left join life_user lu on v.reporting_user_id = lu.id
+            left join store_user su on v.reporting_user_id = su.id
+        <if test="id != null and id != ''">
+            where v.id = #{id}
+        </if>
+    </select>
+
 </mapper>

+ 19 - 5
alien-store/src/main/java/shop/alien/store/controller/UserViolationController.java

@@ -8,6 +8,7 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
+import shop.alien.entity.second.vo.SecondUserViolationDetailVo;
 import shop.alien.entity.store.LifeNotice;
 import shop.alien.entity.store.LifeUserViolation;
 import shop.alien.entity.store.UserLoginInfo;
@@ -96,11 +97,11 @@ public class UserViolationController {
     public R<IPage<LifeUserViolationDto>> getAllViolationPage(
             @RequestParam(defaultValue = "1") int pageNum,
             @RequestParam(defaultValue = "10") int pageSize,
-            @RequestParam(required = false) String nickname,
-            @RequestParam(required = false) String phone,
-            @RequestParam(required = false) String processingStatus,
-            @RequestParam(required = false) String startTime,
-            @RequestParam(required = false) String endTime) {
+            @RequestParam(value = "nickname", required = false) String nickname,
+            @RequestParam(value = "phone", required = false) String phone,
+            @RequestParam(value = "processingStatus", required = false) String processingStatus,
+            @RequestParam(value = "startTime", required = false) String startTime,
+            @RequestParam(value = "endTime", required = false) String endTime ) {
         log.info("UserViolationController.getAllViolationPage?pageNum={},pageSize={},nickName={},phone={},processingStatus={},startTime={},endTime={}", 
                 pageNum, pageSize, nickname, phone, processingStatus, startTime, endTime);
         return R.data(lifeUserViolationService.getAllViolationPage(pageNum, pageSize, nickname, phone, processingStatus, startTime, endTime));
@@ -160,4 +161,17 @@ public class UserViolationController {
     public R<String> level(@ApiIgnore @TokenInfo UserLoginInfo userLoginInfo) {
         return R.data(lifeUserViolationService.level(userLoginInfo));
     }
+
+
+    @ApiOperation("中台举报详情")
+    @ApiOperationSupport(order = 9)
+    @GetMapping("/queryViolationDetail")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query")
+    })
+    public R<SecondUserViolationDetailVo> queryViolationDetail(
+            @RequestParam(value = "id", required = false) Integer id) {
+        log.info("UserViolationController.queryViolationDetail?id={}", id);
+        return R.data(lifeUserViolationService.queryViolationDetail(id));
+    }
 }

+ 3 - 0
alien-store/src/main/java/shop/alien/store/service/LifeUserViolationService.java

@@ -2,6 +2,7 @@ package shop.alien.store.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import shop.alien.entity.second.vo.SecondUserViolationDetailVo;
 import shop.alien.entity.store.LifeUserViolation;
 import shop.alien.entity.store.UserLoginInfo;
 import shop.alien.entity.store.dto.LifeUserViolationDto;
@@ -38,4 +39,6 @@ public interface LifeUserViolationService extends IService<LifeUserViolation> {
     String exportExcel(String nickName, String phone, String processingStatus) throws IOException;
 
     String level(UserLoginInfo userLoginInfo);
+
+    SecondUserViolationDetailVo queryViolationDetail(Integer id);
 }

+ 67 - 1
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserViolationServiceImpl.java

@@ -12,10 +12,12 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import shop.alien.entity.second.SecondGoodsRecord;
+import shop.alien.entity.second.vo.SecondUserViolationDetailVo;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.dto.LifeUserViolationDto;
 import shop.alien.entity.store.excelVo.LifeUserOrderExcelVo;
@@ -25,6 +27,7 @@ import shop.alien.entity.store.vo.LifeUserViolationVo;
 import shop.alien.entity.store.vo.WebSocketVo;
 import shop.alien.mapper.*;
 import shop.alien.mapper.second.SecondGoodsRecordMapper;
+import shop.alien.mapper.second.SecondUserViolationMapper;
 import shop.alien.store.config.WebSocketProcess;
 import shop.alien.store.service.*;
 import shop.alien.store.util.AiUserViolationUtils;
@@ -90,6 +93,9 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
 
     private final AiUserViolationUtils aiUserViolationUtils;
 
+    @Autowired
+    private SecondUserViolationMapper mapper;
+
     @Value("${spring.web.resources.excel-path}")
     private String excelPath;
 
@@ -744,7 +750,7 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
         }
         queryWrapper.orderByDesc("updated_time");
 
-        IPage<LifeUserViolationVo> resultPage = lifeUserViolationMapper.getViolationPage(pageRequest, queryWrapper);
+        IPage<LifeUserViolationVo> resultPage = lifeUserViolationMapper.getAllViolationPage(pageRequest, queryWrapper);
 
         return resultPage.convert(e -> {
             LifeUserViolationDto dto = new LifeUserViolationDto();
@@ -752,4 +758,64 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
             return dto;
         });
     }
+
+
+    @Override
+    public SecondUserViolationDetailVo queryViolationDetail(Integer id) {
+        // 查询举报信息
+        SecondUserViolationDetailVo item = mapper.getUserViolationDetailInfo(id);
+
+        // 视频文件类型
+        List<String> videoFileType = Arrays.asList("mp4", "avi", "mov", "wmv", "flv", "mkv");
+
+        if ("2".equals(item.getReportContextType())) {
+            LifeUserDynamics dynamicsList = lifeUserDynamicsMapper.selectById(id);
+            // 将逗号分隔的图片路径拆分成 List<String>
+            if (dynamicsList != null && StringUtils.isNotEmpty(dynamicsList.getImagePath())) {
+                List<String> imagePathList = Arrays.stream(dynamicsList.getImagePath().split(","))
+                        .map(String::trim)
+                        .filter(StringUtils::isNotEmpty)
+                        .collect(Collectors.toList());
+                item.setDynamicsImg(imagePathList);
+            }
+        }
+
+        if ("3".equals(item.getReportContextType())) {
+            // TODO: 处理评论类型
+            LifeComment commentList = lifeCommentMapper.selectById(id);
+            // 将逗号分隔的图片路径拆分成 List<String>
+            if (commentList != null && StringUtils.isNotEmpty(commentList.getImagePath())) {
+                List<String> imagePathList = Arrays.stream(commentList.getImagePath().split(","))
+                        .map(String::trim)
+                        .filter(StringUtils::isNotEmpty)
+                        .collect(Collectors.toList());
+                item.setCommentImg(imagePathList);
+            }
+        }
+
+        List<Map<String, Object>> list = new ArrayList<>();
+        // 将逗号分隔的图片路径拆分成 List<String>
+        if (item != null && StringUtils.isNotEmpty(item.getReportEvidenceImg())) {
+            List<String> imagePathList = Arrays.stream(item.getReportEvidenceImg().split(","))
+                    .map(String::trim)
+                    .filter(StringUtils::isNotEmpty)
+                    .collect(Collectors.toList());
+
+            for (String imgUrl : imagePathList) {
+                Map<String, Object> map = new HashMap<>();
+                String fileType = imgUrl.substring(imgUrl.lastIndexOf(".") + 1);
+                if (videoFileType.contains(fileType.toLowerCase())) {
+                    map.put("type", "video");
+                } else {
+                    map.put("type", "image");
+                }
+                map.put("imgUrl", imgUrl);
+                list.add(map);
+            }
+
+            item.setImgList(list);
+        }
+
+        return item;
+    }
 }